39 # if GLM_HAS_ANONYMOUS_UNION
56 # define GLM_NOT_BUGGY_VC32BITS !(GLM_MODEL == GLM_MODEL_32 && GLM_COMPILER & GLM_COMPILER_VC && GLM_COMPILER < GLM_COMPILER_VC2013)
58 # if GLM_ARCH & GLM_ARCH_SSE2 && GLM_NOT_BUGGY_VC32BITS
72 struct simd<unsigned int>
78 # if GLM_ARCH & GLM_ARCH_AVX && GLM_NOT_BUGGY_VC32BITS
86 # if GLM_ARCH & GLM_ARCH_AVX2 && GLM_NOT_BUGGY_VC32BITS
102 template <
typename T, precision P = defaultp>
108 typedef tvec4<T, P> type;
109 typedef tvec4<bool, P> bool_type;
110 typedef T value_type;
115 # if GLM_HAS_ANONYMOUS_UNION
118 typename detail::simd<T>::type data;
119 struct { T r, g, b, a; };
120 struct { T s, t, p, q; };
121 struct { T x, y, z, w;};
124 _GLM_SWIZZLE4_2_MEMBERS(T, P, tvec2, x, y, z, w)
125 _GLM_SWIZZLE4_2_MEMBERS(T, P, tvec2, r, g, b, a)
126 _GLM_SWIZZLE4_2_MEMBERS(T, P, tvec2, s, t, p, q)
127 _GLM_SWIZZLE4_3_MEMBERS(T, P, tvec3, x, y, z, w)
128 _GLM_SWIZZLE4_3_MEMBERS(T, P, tvec3, r, g, b, a)
129 _GLM_SWIZZLE4_3_MEMBERS(T, P, tvec3, s, t, p, q)
130 _GLM_SWIZZLE4_4_MEMBERS(T, P, tvec4, x, y, z, w)
131 _GLM_SWIZZLE4_4_MEMBERS(T, P, tvec4, r, g, b, a)
132 _GLM_SWIZZLE4_4_MEMBERS(T, P, tvec4, s, t, p, q)
136 union { T x, r, s; };
137 union { T y, g, t; };
138 union { T z, b, p; };
139 union { T w, a, q; };
142 GLM_SWIZZLE_GEN_VEC_FROM_VEC4(T, P, tvec4, tvec2, tvec3, tvec4)
149 # ifdef GLM_FORCE_SIZE_FUNC
150 typedef size_t size_type;
152 GLM_FUNC_DECL GLM_CONSTEXPR size_type size()
const;
154 GLM_FUNC_DECL T & operator[](size_type i);
155 GLM_FUNC_DECL T
const & operator[](size_type i)
const;
157 typedef length_t length_type;
159 GLM_FUNC_DECL GLM_CONSTEXPR length_type
length()
const;
161 GLM_FUNC_DECL T & operator[](length_type i);
162 GLM_FUNC_DECL T
const & operator[](length_type i)
const;
163 # endif//GLM_FORCE_SIZE_FUNC
168 GLM_FUNC_DECL tvec4();
169 template <precision Q>
170 GLM_FUNC_DECL tvec4(tvec4<T, Q>
const & v);
175 GLM_FUNC_DECL
explicit tvec4(ctor);
176 GLM_FUNC_DECL
explicit tvec4(T s);
177 GLM_FUNC_DECL tvec4(T a, T b, T c, T d);
178 GLM_FUNC_DECL ~tvec4(){}
184 template <
typename A,
typename B,
typename C,
typename D>
185 GLM_FUNC_DECL tvec4(A a, B b, C c, D d);
186 template <
typename A,
typename B,
typename C,
typename D>
187 GLM_FUNC_DECL tvec4(tvec1<A, P>
const & a, tvec1<B, P>
const & b, tvec1<C, P>
const & c, tvec1<D, P>
const & d);
193 template <
typename A,
typename B,
typename C, precision Q>
194 GLM_FUNC_DECL
explicit tvec4(tvec2<A, Q>
const & a, B b, C c);
196 template <
typename A,
typename B,
typename C, precision Q>
197 GLM_FUNC_DECL
explicit tvec4(tvec2<A, Q>
const & a, tvec1<B, Q>
const & b, tvec1<C, Q>
const & c);
199 template <
typename A,
typename B,
typename C, precision Q>
200 GLM_FUNC_DECL
explicit tvec4(A a, tvec2<B, Q>
const & b, C c);
202 template <
typename A,
typename B,
typename C, precision Q>
203 GLM_FUNC_DECL
explicit tvec4(tvec1<A, Q>
const & a, tvec2<B, Q>
const & b, tvec1<C, Q>
const & c);
205 template <
typename A,
typename B,
typename C, precision Q>
206 GLM_FUNC_DECL
explicit tvec4(A a, B b, tvec2<C, Q>
const & c);
208 template <
typename A,
typename B,
typename C, precision Q>
209 GLM_FUNC_DECL
explicit tvec4(tvec1<A, Q>
const & a, tvec1<B, Q>
const & b, tvec2<C, Q>
const & c);
211 template <
typename A,
typename B, precision Q>
212 GLM_FUNC_DECL
explicit tvec4(tvec3<A, Q>
const & a, B b);
214 template <
typename A,
typename B, precision Q>
215 GLM_FUNC_DECL
explicit tvec4(tvec3<A, Q>
const & a, tvec1<B, Q>
const & b);
217 template <
typename A,
typename B, precision Q>
218 GLM_FUNC_DECL
explicit tvec4(A a, tvec3<B, Q>
const & b);
220 template <
typename A,
typename B, precision Q>
221 GLM_FUNC_DECL
explicit tvec4(tvec1<A, Q>
const & a, tvec3<B, Q>
const & b);
223 template <
typename A,
typename B, precision Q>
224 GLM_FUNC_DECL
explicit tvec4(tvec2<A, Q>
const & a, tvec2<B, Q>
const & b);
226 # ifdef GLM_FORCE_EXPLICIT_CTOR
227 template <
typename U, precision Q>
229 GLM_FUNC_DECL
explicit tvec4(tvec4<U, Q>
const & v);
231 template <
typename U, precision Q>
233 GLM_FUNC_DECL tvec4(tvec4<U, Q>
const & v);
239 # if GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE)
240 template <
int E0,
int E1,
int E2,
int E3>
241 GLM_FUNC_DECL tvec4(detail::_swizzle<4, T, P, tvec4<T, P>, E0, E1, E2, E3>
const & that)
246 template <
int E0,
int E1,
int F0,
int F1>
247 GLM_FUNC_DECL tvec4(detail::_swizzle<2, T, P, tvec2<T, P>, E0, E1, -1, -2>
const & v, detail::_swizzle<2, T, P, tvec2<T, P>, F0, F1, -1, -2>
const & u)
249 *
this = tvec4<T, P>(v(), u());
252 template <
int E0,
int E1>
253 GLM_FUNC_DECL tvec4(T
const & x, T
const & y, detail::_swizzle<2, T, P, tvec2<T, P>, E0, E1, -1, -2>
const & v)
255 *
this = tvec4<T, P>(x, y, v());
258 template <
int E0,
int E1>
259 GLM_FUNC_DECL tvec4(T
const & x, detail::_swizzle<2, T, P, tvec2<T, P>, E0, E1, -1, -2>
const & v, T
const & w)
261 *
this = tvec4<T, P>(x, v(), w);
264 template <
int E0,
int E1>
265 GLM_FUNC_DECL tvec4(detail::_swizzle<2, T, P, tvec2<T, P>, E0, E1, -1, -2>
const & v, T
const & z, T
const & w)
267 *
this = tvec4<T, P>(v(), z, w);
270 template <
int E0,
int E1,
int E2>
271 GLM_FUNC_DECL tvec4(detail::_swizzle<3, T, P, tvec3<T, P>, E0, E1, E2, -1>
const & v, T
const & w)
273 *
this = tvec4<T, P>(v(), w);
276 template <
int E0,
int E1,
int E2>
277 GLM_FUNC_DECL tvec4(T
const & x, detail::_swizzle<3, T, P, tvec3<T, P>, E0, E1, E2, -1>
const & v)
279 *
this = tvec4<T, P>(x, v());
281 # endif// GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE)
286 template <
typename U>
287 GLM_FUNC_DECL tvec4<T, P> & operator=(tvec4<U, P>
const & v);
288 template <
typename U>
289 GLM_FUNC_DECL tvec4<T, P> & operator+=(U scalar);
290 template <
typename U>
291 GLM_FUNC_DECL tvec4<T, P> & operator+=(tvec1<U, P>
const & v);
292 template <
typename U>
293 GLM_FUNC_DECL tvec4<T, P> & operator+=(tvec4<U, P>
const & v);
294 template <
typename U>
295 GLM_FUNC_DECL tvec4<T, P> & operator-=(U scalar);
296 template <
typename U>
297 GLM_FUNC_DECL tvec4<T, P> & operator-=(tvec1<U, P>
const & v);
298 template <
typename U>
299 GLM_FUNC_DECL tvec4<T, P> & operator-=(tvec4<U, P>
const & v);
300 template <
typename U>
301 GLM_FUNC_DECL tvec4<T, P> & operator*=(U scalar);
302 template <
typename U>
303 GLM_FUNC_DECL tvec4<T, P> & operator*=(tvec1<U, P>
const & v);
304 template <
typename U>
305 GLM_FUNC_DECL tvec4<T, P> & operator*=(tvec4<U, P>
const & v);
306 template <
typename U>
307 GLM_FUNC_DECL tvec4<T, P> & operator/=(U scalar);
308 template <
typename U>
309 GLM_FUNC_DECL tvec4<T, P> & operator/=(tvec1<U, P>
const & v);
310 template <
typename U>
311 GLM_FUNC_DECL tvec4<T, P> & operator/=(tvec4<U, P>
const & v);
316 GLM_FUNC_DECL tvec4<T, P> & operator++();
317 GLM_FUNC_DECL tvec4<T, P> & operator--();
318 GLM_FUNC_DECL tvec4<T, P> operator++(
int);
319 GLM_FUNC_DECL tvec4<T, P> operator--(
int);
324 template <
typename U>
325 GLM_FUNC_DECL tvec4<T, P> & operator%=(U scalar);
326 template <
typename U>
327 GLM_FUNC_DECL tvec4<T, P> & operator%=(tvec1<U, P>
const & v);
328 template <
typename U>
329 GLM_FUNC_DECL tvec4<T, P> & operator%=(tvec4<U, P>
const & v);
330 template <
typename U>
331 GLM_FUNC_DECL tvec4<T, P> & operator&=(U scalar);
332 template <
typename U>
333 GLM_FUNC_DECL tvec4<T, P> & operator&=(tvec1<U, P>
const & v);
334 template <
typename U>
335 GLM_FUNC_DECL tvec4<T, P> & operator&=(tvec4<U, P>
const & v);
336 template <
typename U>
337 GLM_FUNC_DECL tvec4<T, P> & operator|=(U scalar);
338 template <
typename U>
339 GLM_FUNC_DECL tvec4<T, P> & operator|=(tvec1<U, P>
const & v);
340 template <
typename U>
341 GLM_FUNC_DECL tvec4<T, P> & operator|=(tvec4<U, P>
const & v);
342 template <
typename U>
343 GLM_FUNC_DECL tvec4<T, P> & operator^=(U scalar);
344 template <
typename U>
345 GLM_FUNC_DECL tvec4<T, P> & operator^=(tvec1<U, P>
const & v);
346 template <
typename U>
347 GLM_FUNC_DECL tvec4<T, P> & operator^=(tvec4<U, P>
const & v);
348 template <
typename U>
349 GLM_FUNC_DECL tvec4<T, P> & operator<<=(U scalar);
350 template <
typename U>
351 GLM_FUNC_DECL tvec4<T, P> & operator<<=(tvec1<U, P>
const & v);
352 template <
typename U>
353 GLM_FUNC_DECL tvec4<T, P> & operator<<=(tvec4<U, P>
const & v);
354 template <
typename U>
355 GLM_FUNC_DECL tvec4<T, P> & operator>>=(U scalar);
356 template <
typename U>
357 GLM_FUNC_DECL tvec4<T, P> & operator>>=(tvec1<U, P>
const & v);
358 template <
typename U>
359 GLM_FUNC_DECL tvec4<T, P> & operator>>=(tvec4<U, P>
const & v);
362 template <
typename T, precision P>
363 GLM_FUNC_DECL tvec4<T, P> operator+(tvec4<T, P>
const & v, T scalar);
365 template <
typename T, precision P>
366 GLM_FUNC_DECL tvec4<T, P> operator+(tvec4<T, P>
const & v, tvec1<T, P>
const & s);
368 template <
typename T, precision P>
369 GLM_FUNC_DECL tvec4<T, P> operator+(T scalar, tvec4<T, P>
const & v);
371 template <
typename T, precision P>
372 GLM_FUNC_DECL tvec4<T, P> operator+(tvec1<T, P>
const & s, tvec4<T, P>
const & v);
374 template <
typename T, precision P>
375 GLM_FUNC_DECL tvec4<T, P> operator+(tvec4<T, P>
const & v1, tvec4<T, P>
const & v2);
377 template <
typename T, precision P>
378 GLM_FUNC_DECL tvec4<T, P> operator-(tvec4<T, P>
const & v, T scalar);
380 template <
typename T, precision P>
381 GLM_FUNC_DECL tvec4<T, P> operator-(tvec4<T, P>
const & v, tvec1<T, P>
const & s);
383 template <
typename T, precision P>
384 GLM_FUNC_DECL tvec4<T, P> operator-(T scalar, tvec4<T, P>
const & v);
386 template <
typename T, precision P>
387 GLM_FUNC_DECL tvec4<T, P> operator-(tvec1<T, P>
const & s, tvec4<T, P>
const & v);
389 template <
typename T, precision P>
390 GLM_FUNC_DECL tvec4<T, P> operator-(tvec4<T, P>
const & v1, tvec4<T, P>
const & v2);
392 template <
typename T, precision P>
393 GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P>
const & v, T scalar);
395 template <
typename T, precision P>
396 GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P>
const & v, tvec1<T, P>
const & s);
398 template <
typename T, precision P>
399 GLM_FUNC_DECL tvec4<T, P> operator*(T scalar, tvec4<T, P>
const & v);
401 template <
typename T, precision P>
402 GLM_FUNC_DECL tvec4<T, P> operator*(tvec1<T, P>
const & s, tvec4<T, P>
const & v);
404 template <
typename T, precision P>
405 GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P>
const & v1, tvec4<T, P>
const & v2);
407 template <
typename T, precision P>
408 GLM_FUNC_DECL tvec4<T, P> operator/(tvec4<T, P>
const & v, T scalar);
410 template <
typename T, precision P>
411 GLM_FUNC_DECL tvec4<T, P> operator/(tvec4<T, P>
const & v, tvec1<T, P>
const & s);
413 template <
typename T, precision P>
414 GLM_FUNC_DECL tvec4<T, P> operator/(T scalar, tvec4<T, P>
const & v);
416 template <
typename T, precision P>
417 GLM_FUNC_DECL tvec4<T, P> operator/(tvec1<T, P>
const & s, tvec4<T, P>
const & v);
419 template <
typename T, precision P>
420 GLM_FUNC_DECL tvec4<T, P> operator/(tvec4<T, P>
const & v1, tvec4<T, P>
const & v2);
422 template <
typename T, precision P>
423 GLM_FUNC_DECL tvec4<T, P> operator-(tvec4<T, P>
const & v);
425 template <
typename T, precision P>
426 GLM_FUNC_DECL
bool operator==(tvec4<T, P>
const & v1, tvec4<T, P>
const & v2);
428 template <
typename T, precision P>
429 GLM_FUNC_DECL
bool operator!=(tvec4<T, P>
const & v1, tvec4<T, P>
const & v2);
431 template <
typename T, precision P>
432 GLM_FUNC_DECL tvec4<T, P> operator%(tvec4<T, P>
const & v, T scalar);
434 template <
typename T, precision P>
435 GLM_FUNC_DECL tvec4<T, P> operator%(tvec4<T, P>
const & v, tvec1<T, P>
const & s);
437 template <
typename T, precision P>
438 GLM_FUNC_DECL tvec4<T, P> operator%(T scalar, tvec4<T, P>
const & v);
440 template <
typename T, precision P>
441 GLM_FUNC_DECL tvec4<T, P> operator%(tvec1<T, P>
const & s, tvec4<T, P>
const & v);
443 template <
typename T, precision P>
444 GLM_FUNC_DECL tvec4<T, P> operator%(tvec4<T, P>
const & v1, tvec4<T, P>
const & v2);
446 template <
typename T, precision P>
447 GLM_FUNC_DECL tvec4<T, P> operator&(tvec4<T, P>
const & v, T scalar);
449 template <
typename T, precision P>
450 GLM_FUNC_DECL tvec4<T, P> operator&(tvec4<T, P>
const & v, tvec1<T, P>
const & s);
452 template <
typename T, precision P>
453 GLM_FUNC_DECL tvec4<T, P> operator&(T scalar, tvec4<T, P>
const & v);
455 template <
typename T, precision P>
456 GLM_FUNC_DECL tvec4<T, P> operator&(tvec1<T, P>
const & s, tvec4<T, P>
const & v);
458 template <
typename T, precision P>
459 GLM_FUNC_DECL tvec4<T, P> operator&(tvec4<T, P>
const & v1, tvec4<T, P>
const & v2);
461 template <
typename T, precision P>
462 GLM_FUNC_DECL tvec4<T, P> operator|(tvec4<T, P>
const & v, T scalar);
464 template <
typename T, precision P>
465 GLM_FUNC_DECL tvec4<T, P> operator|(tvec4<T, P>
const & v, tvec1<T, P>
const & s);
467 template <
typename T, precision P>
468 GLM_FUNC_DECL tvec4<T, P> operator|(T scalar, tvec4<T, P>
const & v);
470 template <
typename T, precision P>
471 GLM_FUNC_DECL tvec4<T, P> operator|(tvec1<T, P>
const & s, tvec4<T, P>
const & v);
473 template <
typename T, precision P>
474 GLM_FUNC_DECL tvec4<T, P> operator|(tvec4<T, P>
const & v1, tvec4<T, P>
const & v2);
476 template <
typename T, precision P>
477 GLM_FUNC_DECL tvec4<T, P> operator^(tvec4<T, P>
const & v, T scalar);
479 template <
typename T, precision P>
480 GLM_FUNC_DECL tvec4<T, P> operator^(tvec4<T, P>
const & v, tvec1<T, P>
const & s);
482 template <
typename T, precision P>
483 GLM_FUNC_DECL tvec4<T, P> operator^(T scalar, tvec4<T, P>
const & v);
485 template <
typename T, precision P>
486 GLM_FUNC_DECL tvec4<T, P> operator^(tvec1<T, P>
const & s, tvec4<T, P>
const & v);
488 template <
typename T, precision P>
489 GLM_FUNC_DECL tvec4<T, P> operator^(tvec4<T, P>
const & v1, tvec4<T, P>
const & v2);
491 template <
typename T, precision P>
492 GLM_FUNC_DECL tvec4<T, P> operator<<(tvec4<T, P>
const & v, T scalar);
494 template <
typename T, precision P>
495 GLM_FUNC_DECL tvec4<T, P> operator<<(tvec4<T, P>
const & v, tvec1<T, P>
const & s);
497 template <
typename T, precision P>
498 GLM_FUNC_DECL tvec4<T, P> operator<<(T scalar, tvec4<T, P>
const & v);
500 template <
typename T, precision P>
501 GLM_FUNC_DECL tvec4<T, P> operator<<(tvec1<T, P>
const & s, tvec4<T, P>
const & v);
503 template <
typename T, precision P>
504 GLM_FUNC_DECL tvec4<T, P> operator<<(tvec4<T, P>
const & v1, tvec4<T, P>
const & v2);
506 template <
typename T, precision P>
507 GLM_FUNC_DECL tvec4<T, P> operator>>(tvec4<T, P>
const & v, T scalar);
509 template <
typename T, precision P>
510 GLM_FUNC_DECL tvec4<T, P> operator>>(tvec4<T, P>
const & v, tvec1<T, P>
const & s);
512 template <
typename T, precision P>
513 GLM_FUNC_DECL tvec4<T, P> operator>>(T scalar, tvec4<T, P>
const & v);
515 template <
typename T, precision P>
516 GLM_FUNC_DECL tvec4<T, P> operator>>(tvec1<T, P>
const & s, tvec4<T, P>
const & v);
518 template <
typename T, precision P>
519 GLM_FUNC_DECL tvec4<T, P> operator>>(tvec4<T, P>
const & v1, tvec4<T, P>
const & v2);
521 template <
typename T, precision P>
522 GLM_FUNC_DECL tvec4<T, P> operator~(tvec4<T, P>
const & v);
525 #ifndef GLM_EXTERNAL_TEMPLATE
526 #include "type_vec4.inl"
527 #endif//GLM_EXTERNAL_TEMPLATE
OpenGL Mathematics (glm.g-truc.net)
GLM_FUNC_DECL T length(vecType< T, P > const &x)
Returns the length of x, i.e., sqrt(x * x).
OpenGL Mathematics (glm.g-truc.net)
OpenGL Mathematics (glm.g-truc.net)
OpenGL Mathematics (glm.g-truc.net)