0.9.9 API documenation
type_vec.hpp
Go to the documentation of this file.
1 
4 #pragma once
5 
6 #include "qualifier.hpp"
7 #include "type_int.hpp"
8 #include "compute_vector_relational.hpp"
9 
10 namespace glm{
11 namespace detail
12 {
13  template<typename T, std::size_t size, bool aligned>
14  struct storage
15  {
16  typedef struct type {
17  uint8 data[size];
18  } type;
19  };
20 
21  #define GLM_ALIGNED_STORAGE_TYPE_STRUCT(x) \
22  template<typename T> \
23  struct storage<T, x, true> { \
24  GLM_ALIGNED_STRUCT(x) type { \
25  uint8 data[x]; \
26  }; \
27  };
28 
29  GLM_ALIGNED_STORAGE_TYPE_STRUCT(1)
30  GLM_ALIGNED_STORAGE_TYPE_STRUCT(2)
31  GLM_ALIGNED_STORAGE_TYPE_STRUCT(4)
32  GLM_ALIGNED_STORAGE_TYPE_STRUCT(8)
33  GLM_ALIGNED_STORAGE_TYPE_STRUCT(16)
34  GLM_ALIGNED_STORAGE_TYPE_STRUCT(32)
35  GLM_ALIGNED_STORAGE_TYPE_STRUCT(64)
36 
37 # if GLM_ARCH & GLM_ARCH_SSE2_BIT
38  template<>
39  struct storage<float, 16, true>
40  {
41  typedef glm_vec4 type;
42  };
43 
44  template<>
45  struct storage<int, 16, true>
46  {
47  typedef glm_ivec4 type;
48  };
49 
50  template<>
51  struct storage<unsigned int, 16, true>
52  {
53  typedef glm_uvec4 type;
54  };
55 /*
56 # else
57  typedef union __declspec(align(16)) glm_128
58  {
59  unsigned __int8 data[16];
60  } glm_128;
61 
62  template<>
63  struct storage<float, 16, true>
64  {
65  typedef glm_128 type;
66  };
67 
68  template<>
69  struct storage<int, 16, true>
70  {
71  typedef glm_128 type;
72  };
73 
74  template<>
75  struct storage<unsigned int, 16, true>
76  {
77  typedef glm_128 type;
78  };
79 */
80 # endif
81 
82 # if (GLM_ARCH & GLM_ARCH_AVX_BIT)
83  template<>
84  struct storage<double, 32, true>
85  {
86  typedef glm_dvec4 type;
87  };
88 # endif
89 
90 # if (GLM_ARCH & GLM_ARCH_AVX2_BIT)
91  template<>
92  struct storage<int64, 32, true>
93  {
94  typedef glm_i64vec4 type;
95  };
96 
97  template<>
98  struct storage<uint64, 32, true>
99  {
100  typedef glm_u64vec4 type;
101  };
102 # endif
103 }//namespace detail
104 
105 #if GLM_HAS_TEMPLATE_ALIASES
106  template <typename T, qualifier Q = defaultp> using tvec2 = vec<2, T, Q>;
107  template <typename T, qualifier Q = defaultp> using tvec3 = vec<3, T, Q>;
108  template <typename T, qualifier Q = defaultp> using tvec4 = vec<4, T, Q>;
109 #endif//GLM_HAS_TEMPLATE_ALIASES
110 
113 
119  typedef vec<2, float, highp> highp_vec2;
120 
126  typedef vec<2, float, mediump> mediump_vec2;
127 
133  typedef vec<2, float, lowp> lowp_vec2;
134 
140  typedef vec<2, double, highp> highp_dvec2;
141 
147  typedef vec<2, double, mediump> mediump_dvec2;
148 
154  typedef vec<2, double, lowp> lowp_dvec2;
155 
161  typedef vec<2, int, highp> highp_ivec2;
162 
168  typedef vec<2, int, mediump> mediump_ivec2;
169 
175  typedef vec<2, int, lowp> lowp_ivec2;
176 
182  typedef vec<2, uint, highp> highp_uvec2;
183 
189  typedef vec<2, uint, mediump> mediump_uvec2;
190 
196  typedef vec<2, uint, lowp> lowp_uvec2;
197 
203  typedef vec<2, bool, highp> highp_bvec2;
204 
210  typedef vec<2, bool, mediump> mediump_bvec2;
211 
217  typedef vec<2, bool, lowp> lowp_bvec2;
218 
220 
223 
229  typedef vec<3, float, highp> highp_vec3;
230 
236  typedef vec<3, float, mediump> mediump_vec3;
237 
243  typedef vec<3, float, lowp> lowp_vec3;
244 
250  typedef vec<3, double, highp> highp_dvec3;
251 
257  typedef vec<3, double, mediump> mediump_dvec3;
258 
264  typedef vec<3, double, lowp> lowp_dvec3;
265 
271  typedef vec<3, int, highp> highp_ivec3;
272 
278  typedef vec<3, int, mediump> mediump_ivec3;
279 
285  typedef vec<3, int, lowp> lowp_ivec3;
286 
292  typedef vec<3, uint, highp> highp_uvec3;
293 
299  typedef vec<3, uint, mediump> mediump_uvec3;
300 
306  typedef vec<3, uint, lowp> lowp_uvec3;
307 
312  typedef vec<3, bool, highp> highp_bvec3;
313 
318  typedef vec<3, bool, mediump> mediump_bvec3;
319 
324  typedef vec<3, bool, lowp> lowp_bvec3;
325 
327 
330 
335  typedef vec<4, float, highp> highp_vec4;
336 
341  typedef vec<4, float, mediump> mediump_vec4;
342 
347  typedef vec<4, float, lowp> lowp_vec4;
348 
353  typedef vec<4, double, highp> highp_dvec4;
354 
359  typedef vec<4, double, mediump> mediump_dvec4;
360 
365  typedef vec<4, double, lowp> lowp_dvec4;
366 
371  typedef vec<4, int, highp> highp_ivec4;
372 
377  typedef vec<4, int, mediump> mediump_ivec4;
378 
383  typedef vec<4, int, lowp> lowp_ivec4;
384 
389  typedef vec<4, uint, highp> highp_uvec4;
390 
395  typedef vec<4, uint, mediump> mediump_uvec4;
396 
401  typedef vec<4, uint, lowp> lowp_uvec4;
402 
407  typedef vec<4, bool, highp> highp_bvec4;
408 
413  typedef vec<4, bool, mediump> mediump_bvec4;
414 
419  typedef vec<4, bool, lowp> lowp_bvec4;
420 
422 
425 
426  // -- Default float definition --
427 
428 #if(defined(GLM_PRECISION_LOWP_FLOAT))
429  typedef lowp_vec2 vec2;
430  typedef lowp_vec3 vec3;
431  typedef lowp_vec4 vec4;
432 #elif(defined(GLM_PRECISION_MEDIUMP_FLOAT))
433  typedef mediump_vec2 vec2;
434  typedef mediump_vec3 vec3;
435  typedef mediump_vec4 vec4;
436 #else //defined(GLM_PRECISION_HIGHP_FLOAT)
437  typedef highp_vec2 vec2;
441 
445  typedef highp_vec3 vec3;
446 
450  typedef highp_vec4 vec4;
451 #endif//GLM_PRECISION
452 
453  // -- Default double definition --
454 
455 #if(defined(GLM_PRECISION_LOWP_DOUBLE))
456  typedef lowp_dvec2 dvec2;
457  typedef lowp_dvec3 dvec3;
458  typedef lowp_dvec4 dvec4;
459 #elif(defined(GLM_PRECISION_MEDIUMP_DOUBLE))
460  typedef mediump_dvec2 dvec2;
461  typedef mediump_dvec3 dvec3;
462  typedef mediump_dvec4 dvec4;
463 #else //defined(GLM_PRECISION_HIGHP_DOUBLE)
464  typedef highp_dvec2 dvec2;
468 
472  typedef highp_dvec3 dvec3;
473 
477  typedef highp_dvec4 dvec4;
478 #endif//GLM_PRECISION
479 
480  // -- Signed integer definition --
481 
482 #if(defined(GLM_PRECISION_LOWP_INT))
483  typedef lowp_ivec2 ivec2;
484  typedef lowp_ivec3 ivec3;
485  typedef lowp_ivec4 ivec4;
486 #elif(defined(GLM_PRECISION_MEDIUMP_INT))
487  typedef mediump_ivec2 ivec2;
488  typedef mediump_ivec3 ivec3;
489  typedef mediump_ivec4 ivec4;
490 #else //defined(GLM_PRECISION_HIGHP_INT)
491  typedef highp_ivec2 ivec2;
495 
499  typedef highp_ivec3 ivec3;
500 
504  typedef highp_ivec4 ivec4;
505 #endif//GLM_PRECISION
506 
507  // -- Unsigned integer definition --
508 
509 #if(defined(GLM_PRECISION_LOWP_UINT))
510  typedef lowp_uvec2 uvec2;
511  typedef lowp_uvec3 uvec3;
512  typedef lowp_uvec4 uvec4;
513 #elif(defined(GLM_PRECISION_MEDIUMP_UINT))
514  typedef mediump_uvec2 uvec2;
515  typedef mediump_uvec3 uvec3;
516  typedef mediump_uvec4 uvec4;
517 #else //defined(GLM_PRECISION_HIGHP_UINT)
518  typedef highp_uvec2 uvec2;
522 
526  typedef highp_uvec3 uvec3;
527 
531  typedef highp_uvec4 uvec4;
532 #endif//GLM_PRECISION
533 
534  // -- Boolean definition --
535 
536 #if(defined(GLM_PRECISION_LOWP_BOOL))
537  typedef lowp_bvec2 bvec2;
538  typedef lowp_bvec3 bvec3;
539  typedef lowp_bvec4 bvec4;
540 #elif(defined(GLM_PRECISION_MEDIUMP_BOOL))
541  typedef mediump_bvec2 bvec2;
542  typedef mediump_bvec3 bvec3;
543  typedef mediump_bvec4 bvec4;
544 #else //defined(GLM_PRECISION_HIGHP_BOOL)
545  typedef highp_bvec2 bvec2;
549 
553  typedef highp_bvec3 bvec3;
554 
558  typedef highp_bvec4 bvec4;
559 #endif//GLM_PRECISION
560 
562 }//namespace glm
vec< 4, bool, lowp > lowp_bvec4
4 components vector of low qualifier bool numbers.
Definition: type_vec.hpp:419
vec< 2, int, highp > highp_ivec2
2 components vector of high qualifier signed integer numbers.
Definition: type_vec.hpp:161
vec< 3, int, highp > highp_ivec3
3 components vector of high qualifier signed integer numbers.
Definition: type_vec.hpp:271
vec< 3, uint, lowp > lowp_uvec3
3 components vector of low qualifier unsigned integer numbers.
Definition: type_vec.hpp:306
highp_ivec3 ivec3
3 components vector of signed integer numbers.
Definition: type_vec.hpp:499
vec< 3, bool, lowp > lowp_bvec3
3 components vector of low qualifier bool numbers.
Definition: type_vec.hpp:324
vec< 2, int, mediump > mediump_ivec2
2 components vector of medium qualifier signed integer numbers.
Definition: type_vec.hpp:168
highp_bvec2 bvec2
2 components vector of boolean.
Definition: type_vec.hpp:548
vec< 4, float, lowp > lowp_vec4
4 components vector of low single-qualifier floating-point numbers.
Definition: type_vec.hpp:347
highp_vec2 vec2
2 components vector of floating-point numbers.
Definition: type_vec.hpp:440
vec< 4, double, highp > highp_dvec4
4 components vector of high double-qualifier floating-point numbers.
Definition: type_vec.hpp:353
vec< 2, double, highp > highp_dvec2
2 components vector of high double-qualifier floating-point numbers.
Definition: type_vec.hpp:140
highp_uvec2 uvec2
2 components vector of unsigned integer numbers.
Definition: type_vec.hpp:521
vec< 2, double, mediump > mediump_dvec2
2 components vector of medium double-qualifier floating-point numbers.
Definition: type_vec.hpp:147
Core features
highp_dvec4 dvec4
4 components vector of double-qualifier floating-point numbers.
Definition: type_vec.hpp:477
vec< 3, int, mediump > mediump_ivec3
3 components vector of medium qualifier signed integer numbers.
Definition: type_vec.hpp:278
vec< 4, float, mediump > mediump_vec4
4 components vector of medium single-qualifier floating-point numbers.
Definition: type_vec.hpp:341
highp_ivec2 ivec2
2 components vector of signed integer numbers.
Definition: type_vec.hpp:494
Definition: common.hpp:20
vec< 4, bool, highp > highp_bvec4
4 components vector of high qualifier bool numbers.
Definition: type_vec.hpp:407
vec< 4, double, lowp > lowp_dvec4
4 components vector of low double-qualifier floating-point numbers.
Definition: type_vec.hpp:365
vec< 2, double, lowp > lowp_dvec2
2 components vector of low double-qualifier floating-point numbers.
Definition: type_vec.hpp:154
vec< 3, bool, mediump > mediump_bvec3
3 components vector of medium qualifier bool numbers.
Definition: type_vec.hpp:318
vec< 4, double, mediump > mediump_dvec4
4 components vector of medium double-qualifier floating-point numbers.
Definition: type_vec.hpp:359
highp_ivec4 ivec4
4 components vector of signed integer numbers.
Definition: type_vec.hpp:504
vec< 2, float, highp > highp_vec2
2 components vector of high single-qualifier floating-point numbers.
Definition: type_vec.hpp:119
vec< 3, uint, mediump > mediump_uvec3
3 components vector of medium qualifier unsigned integer numbers.
Definition: type_vec.hpp:299
highp_vec4 vec4
4 components vector of floating-point numbers.
Definition: type_vec.hpp:450
highp_uvec4 uvec4
4 components vector of unsigned integer numbers.
Definition: type_vec.hpp:531
vec< 2, bool, mediump > mediump_bvec2
2 components vector of medium qualifier bool numbers.
Definition: type_vec.hpp:210
vec< 4, int, lowp > lowp_ivec4
4 components vector of low qualifier signed integer numbers.
Definition: type_vec.hpp:383
vec< 2, bool, lowp > lowp_bvec2
2 components vector of low qualifier bool numbers.
Definition: type_vec.hpp:217
vec< 3, uint, highp > highp_uvec3
3 components vector of high qualifier unsigned integer numbers.
Definition: type_vec.hpp:292
vec< 2, float, mediump > mediump_vec2
2 components vector of medium single-qualifier floating-point numbers.
Definition: type_vec.hpp:126
highp_vec3 vec3
3 components vector of floating-point numbers.
Definition: type_vec.hpp:445
highp_bvec3 bvec3
3 components vector of boolean.
Definition: type_vec.hpp:553
vec< 3, int, lowp > lowp_ivec3
3 components vector of low qualifier signed integer numbers.
Definition: type_vec.hpp:285
vec< 4, uint, highp > highp_uvec4
4 components vector of high qualifier unsigned integer numbers.
Definition: type_vec.hpp:389
vec< 4, uint, lowp > lowp_uvec4
4 components vector of low qualifier unsigned integer numbers.
Definition: type_vec.hpp:401
vec< 4, bool, mediump > mediump_bvec4
4 components vector of medium qualifier bool numbers.
Definition: type_vec.hpp:413
highp_bvec4 bvec4
4 components vector of boolean.
Definition: type_vec.hpp:558
vec< 4, int, mediump > mediump_ivec4
4 components vector of medium qualifier signed integer numbers.
Definition: type_vec.hpp:377
highp_dvec2 dvec2
2 components vector of double-qualifier floating-point numbers.
Definition: type_vec.hpp:467
vec< 4, float, highp > highp_vec4
4 components vector of high single-qualifier floating-point numbers.
Definition: type_vec.hpp:335
vec< 2, uint, mediump > mediump_uvec2
2 components vector of medium qualifier unsigned integer numbers.
Definition: type_vec.hpp:189
vec< 4, uint, mediump > mediump_uvec4
4 components vector of medium qualifier unsigned integer numbers.
Definition: type_vec.hpp:395
vec< 2, bool, highp > highp_bvec2
2 components vector of high qualifier bool numbers.
Definition: type_vec.hpp:203
vec< 3, double, highp > highp_dvec3
3 components vector of high double-qualifier floating-point numbers.
Definition: type_vec.hpp:250
vec< 2, uint, highp > highp_uvec2
2 components vector of high qualifier unsigned integer numbers.
Definition: type_vec.hpp:182
vec< 3, double, mediump > mediump_dvec3
3 components vector of medium double-qualifier floating-point numbers.
Definition: type_vec.hpp:257
vec< 4, int, highp > highp_ivec4
4 components vector of high qualifier signed integer numbers.
Definition: type_vec.hpp:371
highp_uvec3 uvec3
3 components vector of unsigned integer numbers.
Definition: type_vec.hpp:526
vec< 3, bool, highp > highp_bvec3
3 components vector of high qualifier bool numbers.
Definition: type_vec.hpp:312
vec< 2, int, lowp > lowp_ivec2
2 components vector of low qualifier signed integer numbers.
Definition: type_vec.hpp:175
vec< 2, uint, lowp > lowp_uvec2
2 components vector of low qualifier unsigned integer numbers.
Definition: type_vec.hpp:196
vec< 3, double, lowp > lowp_dvec3
3 components vector of low double-qualifier floating-point numbers.
Definition: type_vec.hpp:264
vec< 3, float, mediump > mediump_vec3
3 components vector of medium single-qualifier floating-point numbers.
Definition: type_vec.hpp:236
vec< 3, float, highp > highp_vec3
3 components vector of high single-qualifier floating-point numbers.
Definition: type_vec.hpp:229
vec< 2, float, lowp > lowp_vec2
2 components vector of low single-qualifier floating-point numbers.
Definition: type_vec.hpp:133
vec< 3, float, lowp > lowp_vec3
3 components vector of low single-qualifier floating-point numbers.
Definition: type_vec.hpp:243
Core features
highp_dvec3 dvec3
3 components vector of double-qualifier floating-point numbers.
Definition: type_vec.hpp:472