7 #if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
8 # if GLM_HAS_UNRESTRICTED_UNIONS
13 #endif //GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
18 template<
typename T, qualifier P>
25 typedef vec<3, bool, P> bool_type;
29 # if GLM_HAS_ONLY_XYZW
32 # elif GLM_HAS_ALIGNED_TYPE
33 # if GLM_COMPILER & GLM_COMPILER_GCC
34 # pragma GCC diagnostic push
35 # pragma GCC diagnostic ignored "-Wpedantic"
37 # if GLM_COMPILER & GLM_COMPILER_CLANG
38 # pragma clang diagnostic push
39 # pragma clang diagnostic ignored "-Wgnu-anonymous-struct"
40 # pragma clang diagnostic ignored "-Wnested-anon-types"
49 # if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
50 GLM_SWIZZLE3_2_MEMBERS(T, P, x, y, z)
51 GLM_SWIZZLE3_2_MEMBERS(T, P, r, g, b)
52 GLM_SWIZZLE3_2_MEMBERS(T, P, s, t, p)
53 GLM_SWIZZLE3_3_MEMBERS(T, P, x, y, z)
54 GLM_SWIZZLE3_3_MEMBERS(T, P, r, g, b)
55 GLM_SWIZZLE3_3_MEMBERS(T, P, s, t, p)
56 GLM_SWIZZLE3_4_MEMBERS(T, P, x, y, z)
57 GLM_SWIZZLE3_4_MEMBERS(T, P, r, g, b)
58 GLM_SWIZZLE3_4_MEMBERS(T, P, s, t, p)
62 # if GLM_COMPILER & GLM_COMPILER_CLANG
63 # pragma clang diagnostic pop
65 # if GLM_COMPILER & GLM_COMPILER_GCC
66 # pragma GCC diagnostic pop
73 # if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED
74 GLM_SWIZZLE_GEN_VEC_FROM_VEC3(T, P)
81 typedef length_t length_type;
82 GLM_FUNC_DECL
static GLM_CONSTEXPR length_type
length(){
return 3;}
84 GLM_FUNC_DECL T & operator[](length_type i);
85 GLM_FUNC_DECL T
const & operator[](length_type i)
const;
89 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec() GLM_DEFAULT;
90 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec const & v) GLM_DEFAULT;
92 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<3, T, Q> const & v);
96 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit vec(T scalar);
97 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(T a, T b, T c);
102 template<typename X, typename Y, typename Z>
103 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(X x, Y y, Z z);
104 template<typename X, typename Y, typename Z>
105 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<1, X, P> const& _x, vec<1, Y, P> const& _y, vec<1, Z, P> const& _z);
110 template<typename A, typename B, qualifier Q>
111 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<2, A, Q> const& _xy, B _z);
113 template<typename A, typename B, qualifier Q>
114 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<2, A, Q> const& _xy, vec<1, B, Q> const& _z);
116 template<typename A, typename B, qualifier Q>
117 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(A _x, vec<2, B, Q> const& _yz);
119 template<typename A, typename B, qualifier Q>
120 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<1, A, Q> const& _x, vec<2, B, Q> const& _yz);
122 template<typename U, qualifier Q>
123 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR GLM_EXPLICIT vec(vec<4, U, Q> const& v);
126 template<typename U, qualifier Q>
127 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR GLM_EXPLICIT vec(vec<3, U, Q> const& v);
130 # if GLM_HAS_UNRESTRICTED_UNIONS && (GLM_SWIZZLE == GLM_SWIZZLE_ENABLED)
131 template<
int E0,
int E1,
int E2>
132 GLM_FUNC_DECL vec(detail::_swizzle<3, T, P, E0, E1, E2, -1>
const & that)
137 template<
int E0,
int E1>
138 GLM_FUNC_DECL vec(detail::_swizzle<2, T, P, E0, E1, -1, -2>
const & v, T
const & scalar)
140 *
this = vec(v(), scalar);
143 template<
int E0,
int E1>
144 GLM_FUNC_DECL vec(T
const & scalar, detail::_swizzle<2, T, P, E0, E1, -1, -2>
const & v)
146 *
this = vec(scalar, v());
148 # endif// GLM_HAS_UNRESTRICTED_UNIONS && (GLM_SWIZZLE == GLM_SWIZZLE_ENABLED)
152 GLM_FUNC_DECL vec & operator=(vec
const & v) GLM_DEFAULT;
155 GLM_FUNC_DECL vec & operator=(vec<3, U, P>
const & v);
157 GLM_FUNC_DECL vec & operator+=(U scalar);
159 GLM_FUNC_DECL vec & operator+=(vec<1, U, P>
const & v);
161 GLM_FUNC_DECL vec & operator+=(vec<3, U, P>
const & v);
163 GLM_FUNC_DECL vec & operator-=(U scalar);
165 GLM_FUNC_DECL vec & operator-=(vec<1, U, P>
const & v);
167 GLM_FUNC_DECL vec & operator-=(vec<3, U, P>
const & v);
169 GLM_FUNC_DECL vec & operator*=(U scalar);
171 GLM_FUNC_DECL vec & operator*=(vec<1, U, P>
const & v);
173 GLM_FUNC_DECL vec & operator*=(vec<3, U, P>
const & v);
175 GLM_FUNC_DECL vec & operator/=(U scalar);
177 GLM_FUNC_DECL vec & operator/=(vec<1, U, P>
const & v);
179 GLM_FUNC_DECL vec & operator/=(vec<3, U, P>
const & v);
183 GLM_FUNC_DECL vec & operator++();
184 GLM_FUNC_DECL vec & operator--();
185 GLM_FUNC_DECL vec operator++(
int);
186 GLM_FUNC_DECL vec operator--(
int);
191 GLM_FUNC_DECL vec & operator%=(U scalar);
193 GLM_FUNC_DECL vec & operator%=(vec<1, U, P>
const & v);
195 GLM_FUNC_DECL vec & operator%=(vec<3, U, P>
const & v);
197 GLM_FUNC_DECL vec & operator&=(U scalar);
199 GLM_FUNC_DECL vec & operator&=(vec<1, U, P>
const & v);
201 GLM_FUNC_DECL vec & operator&=(vec<3, U, P>
const & v);
203 GLM_FUNC_DECL vec & operator|=(U scalar);
205 GLM_FUNC_DECL vec & operator|=(vec<1, U, P>
const & v);
207 GLM_FUNC_DECL vec & operator|=(vec<3, U, P>
const & v);
209 GLM_FUNC_DECL vec & operator^=(U scalar);
211 GLM_FUNC_DECL vec & operator^=(vec<1, U, P>
const & v);
213 GLM_FUNC_DECL vec & operator^=(vec<3, U, P>
const & v);
215 GLM_FUNC_DECL vec & operator<<=(U scalar);
217 GLM_FUNC_DECL vec & operator<<=(vec<1, U, P>
const & v);
219 GLM_FUNC_DECL vec & operator<<=(vec<3, U, P>
const & v);
221 GLM_FUNC_DECL vec & operator>>=(U scalar);
223 GLM_FUNC_DECL vec & operator>>=(vec<1, U, P>
const & v);
225 GLM_FUNC_DECL vec & operator>>=(vec<3, U, P>
const & v);
230 template<
typename T, qualifier P>
231 GLM_FUNC_DECL vec<3, T, P> operator+(vec<3, T, P>
const & v);
233 template<
typename T, qualifier P>
234 GLM_FUNC_DECL vec<3, T, P> operator-(vec<3, T, P>
const & v);
238 template<
typename T, qualifier P>
239 GLM_FUNC_DECL vec<3, T, P> operator+(vec<3, T, P>
const & v, T scalar);
241 template<
typename T, qualifier P>
242 GLM_FUNC_DECL vec<3, T, P> operator+(vec<3, T, P>
const & v, vec<1, T, P>
const & scalar);
244 template<
typename T, qualifier P>
245 GLM_FUNC_DECL vec<3, T, P> operator+(T scalar, vec<3, T, P>
const & v);
247 template<
typename T, qualifier P>
248 GLM_FUNC_DECL vec<3, T, P> operator+(vec<1, T, P>
const & v1, vec<3, T, P>
const & v2);
250 template<
typename T, qualifier P>
251 GLM_FUNC_DECL vec<3, T, P> operator+(vec<3, T, P>
const & v1, vec<3, T, P>
const & v2);
253 template<
typename T, qualifier P>
254 GLM_FUNC_DECL vec<3, T, P> operator-(vec<3, T, P>
const & v, T scalar);
256 template<
typename T, qualifier P>
257 GLM_FUNC_DECL vec<3, T, P> operator-(vec<3, T, P>
const & v1, vec<1, T, P>
const & v2);
259 template<
typename T, qualifier P>
260 GLM_FUNC_DECL vec<3, T, P> operator-(T scalar, vec<3, T, P>
const & v);
262 template<
typename T, qualifier P>
263 GLM_FUNC_DECL vec<3, T, P> operator-(vec<1, T, P>
const & v1, vec<3, T, P>
const & v2);
265 template<
typename T, qualifier P>
266 GLM_FUNC_DECL vec<3, T, P> operator-(vec<3, T, P>
const & v1, vec<3, T, P>
const & v2);
268 template<
typename T, qualifier P>
269 GLM_FUNC_DECL vec<3, T, P> operator*(vec<3, T, P>
const & v, T scalar);
271 template<
typename T, qualifier P>
272 GLM_FUNC_DECL vec<3, T, P> operator*(vec<3, T, P>
const & v1, vec<1, T, P>
const & v2);
274 template<
typename T, qualifier P>
275 GLM_FUNC_DECL vec<3, T, P> operator*(T scalar, vec<3, T, P>
const & v);
277 template<
typename T, qualifier P>
278 GLM_FUNC_DECL vec<3, T, P> operator*(vec<1, T, P>
const & v1, vec<3, T, P>
const & v2);
280 template<
typename T, qualifier P>
281 GLM_FUNC_DECL vec<3, T, P> operator*(vec<3, T, P>
const & v1, vec<3, T, P>
const & v2);
283 template<
typename T, qualifier P>
284 GLM_FUNC_DECL vec<3, T, P> operator/(vec<3, T, P>
const & v, T scalar);
286 template<
typename T, qualifier P>
287 GLM_FUNC_DECL vec<3, T, P> operator/(vec<3, T, P>
const & v1, vec<1, T, P>
const & v2);
289 template<
typename T, qualifier P>
290 GLM_FUNC_DECL vec<3, T, P> operator/(T scalar, vec<3, T, P>
const & v);
292 template<
typename T, qualifier P>
293 GLM_FUNC_DECL vec<3, T, P> operator/(vec<1, T, P>
const & v1, vec<3, T, P>
const & v2);
295 template<
typename T, qualifier P>
296 GLM_FUNC_DECL vec<3, T, P> operator/(vec<3, T, P>
const & v1, vec<3, T, P>
const & v2);
298 template<
typename T, qualifier P>
299 GLM_FUNC_DECL vec<3, T, P> operator%(vec<3, T, P>
const & v, T scalar);
301 template<
typename T, qualifier P>
302 GLM_FUNC_DECL vec<3, T, P> operator%(vec<3, T, P>
const & v1, vec<1, T, P>
const & v2);
304 template<
typename T, qualifier P>
305 GLM_FUNC_DECL vec<3, T, P> operator%(T
const & scalar, vec<3, T, P>
const & v);
307 template<
typename T, qualifier P>
308 GLM_FUNC_DECL vec<3, T, P> operator%(vec<1, T, P>
const & v1, vec<3, T, P>
const & v2);
310 template<
typename T, qualifier P>
311 GLM_FUNC_DECL vec<3, T, P> operator%(vec<3, T, P>
const & v1, vec<3, T, P>
const & v2);
313 template<
typename T, qualifier P>
314 GLM_FUNC_DECL vec<3, T, P> operator&(vec<3, T, P>
const & v1, T scalar);
316 template<
typename T, qualifier P>
317 GLM_FUNC_DECL vec<3, T, P> operator&(vec<3, T, P>
const & v1, vec<1, T, P>
const & v2);
319 template<
typename T, qualifier P>
320 GLM_FUNC_DECL vec<3, T, P> operator&(T scalar, vec<3, T, P>
const & v);
322 template<
typename T, qualifier P>
323 GLM_FUNC_DECL vec<3, T, P> operator&(vec<1, T, P>
const & v1, vec<3, T, P>
const & v2);
325 template<
typename T, qualifier P>
326 GLM_FUNC_DECL vec<3, T, P> operator&(vec<3, T, P>
const & v1, vec<3, T, P>
const & v2);
328 template<
typename T, qualifier P>
329 GLM_FUNC_DECL vec<3, T, P> operator|(vec<3, T, P>
const & v, T scalar);
331 template<
typename T, qualifier P>
332 GLM_FUNC_DECL vec<3, T, P> operator|(vec<3, T, P>
const & v1, vec<1, T, P>
const & v2);
334 template<
typename T, qualifier P>
335 GLM_FUNC_DECL vec<3, T, P> operator|(T scalar, vec<3, T, P>
const & v);
337 template<
typename T, qualifier P>
338 GLM_FUNC_DECL vec<3, T, P> operator|(vec<1, T, P>
const & v1, vec<3, T, P>
const & v2);
340 template<
typename T, qualifier P>
341 GLM_FUNC_DECL vec<3, T, P> operator|(vec<3, T, P>
const & v1, vec<3, T, P>
const & v2);
343 template<
typename T, qualifier P>
344 GLM_FUNC_DECL vec<3, T, P> operator^(vec<3, T, P>
const & v, T scalar);
346 template<
typename T, qualifier P>
347 GLM_FUNC_DECL vec<3, T, P> operator^(vec<3, T, P>
const & v1, vec<1, T, P>
const & v2);
349 template<
typename T, qualifier P>
350 GLM_FUNC_DECL vec<3, T, P> operator^(T scalar, vec<3, T, P>
const & v);
352 template<
typename T, qualifier P>
353 GLM_FUNC_DECL vec<3, T, P> operator^(vec<1, T, P>
const & v1, vec<3, T, P>
const & v2);
355 template<
typename T, qualifier P>
356 GLM_FUNC_DECL vec<3, T, P> operator^(vec<3, T, P>
const & v1, vec<3, T, P>
const & v2);
358 template<
typename T, qualifier P>
359 GLM_FUNC_DECL vec<3, T, P> operator<<(vec<3, T, P>
const & v, T scalar);
361 template<
typename T, qualifier P>
362 GLM_FUNC_DECL vec<3, T, P> operator<<(vec<3, T, P>
const & v1, vec<1, T, P>
const & v2);
364 template<
typename T, qualifier P>
365 GLM_FUNC_DECL vec<3, T, P> operator<<(T scalar, vec<3, T, P>
const & v);
367 template<
typename T, qualifier P>
368 GLM_FUNC_DECL vec<3, T, P> operator<<(vec<1, T, P>
const & v1, vec<3, T, P>
const & v2);
370 template<
typename T, qualifier P>
371 GLM_FUNC_DECL vec<3, T, P> operator<<(vec<3, T, P>
const & v1, vec<3, T, P>
const & v2);
373 template<
typename T, qualifier P>
374 GLM_FUNC_DECL vec<3, T, P> operator>>(vec<3, T, P>
const & v, T scalar);
376 template<
typename T, qualifier P>
377 GLM_FUNC_DECL vec<3, T, P> operator>>(vec<3, T, P>
const & v1, vec<1, T, P>
const & v2);
379 template<
typename T, qualifier P>
380 GLM_FUNC_DECL vec<3, T, P> operator>>(T scalar, vec<3, T, P>
const & v);
382 template<
typename T, qualifier P>
383 GLM_FUNC_DECL vec<3, T, P> operator>>(vec<1, T, P>
const & v1, vec<3, T, P>
const & v2);
385 template<
typename T, qualifier P>
386 GLM_FUNC_DECL vec<3, T, P> operator>>(vec<3, T, P>
const & v1, vec<3, T, P>
const & v2);
388 template<
typename T, qualifier P>
389 GLM_FUNC_DECL vec<3, T, P> operator~(vec<3, T, P>
const & v);
393 template<
typename T, qualifier P>
394 GLM_FUNC_DECL
bool operator==(vec<3, T, P>
const & v1, vec<3, T, P>
const & v2);
396 template<
typename T, qualifier P>
397 GLM_FUNC_DECL
bool operator!=(vec<3, T, P>
const & v1, vec<3, T, P>
const & v2);
399 template<qualifier P>
400 GLM_FUNC_DECL vec<3, bool, P> operator&&(vec<3, bool, P>
const & v1, vec<3, bool, P>
const & v2);
402 template<qualifier P>
403 GLM_FUNC_DECL vec<3, bool, P> operator||(vec<3, bool, P>
const & v1, vec<3, bool, P>
const & v2);
406 #ifndef GLM_EXTERNAL_TEMPLATE
407 #include "type_vec3.inl"
408 #endif//GLM_EXTERNAL_TEMPLATE
GLM_FUNC_DECL T length(vec< L, T, P > const &x)
Returns the length of x, i.e., sqrt(x * x).