0.9.8 API documenation
type_vec.hpp
Go to the documentation of this file.
1 
4 #pragma once
5 
6 #include "precision.hpp"
7 #include "type_int.hpp"
8 
9 namespace glm{
10 namespace detail
11 {
12  template <typename T, std::size_t size, bool aligned>
13  struct storage
14  {
15  typedef struct type {
16  uint8 data[size];
17  } type;
18  };
19 
20  #define GLM_ALIGNED_STORAGE_TYPE_STRUCT(x) \
21  template <typename T> \
22  struct storage<T, x, true> { \
23  GLM_ALIGNED_STRUCT(x) type { \
24  uint8 data[x]; \
25  }; \
26  };
27 
28  GLM_ALIGNED_STORAGE_TYPE_STRUCT(1)
29  GLM_ALIGNED_STORAGE_TYPE_STRUCT(2)
30  GLM_ALIGNED_STORAGE_TYPE_STRUCT(4)
31  GLM_ALIGNED_STORAGE_TYPE_STRUCT(8)
32  GLM_ALIGNED_STORAGE_TYPE_STRUCT(16)
33  GLM_ALIGNED_STORAGE_TYPE_STRUCT(32)
34  GLM_ALIGNED_STORAGE_TYPE_STRUCT(64)
35 
36 # if GLM_ARCH & GLM_ARCH_SSE2_BIT
37  template <>
38  struct storage<float, 16, true>
39  {
40  typedef glm_vec4 type;
41  };
42 
43  template <>
44  struct storage<int, 16, true>
45  {
46  typedef glm_ivec4 type;
47  };
48 
49  template <>
50  struct storage<unsigned int, 16, true>
51  {
52  typedef glm_uvec4 type;
53  };
54 /*
55 # else
56  typedef union __declspec(align(16)) glm_128
57  {
58  unsigned __int8 data[16];
59  } glm_128;
60 
61  template <>
62  struct storage<float, 16, true>
63  {
64  typedef glm_128 type;
65  };
66 
67  template <>
68  struct storage<int, 16, true>
69  {
70  typedef glm_128 type;
71  };
72 
73  template <>
74  struct storage<unsigned int, 16, true>
75  {
76  typedef glm_128 type;
77  };
78 */
79 # endif
80 
81 # if (GLM_ARCH & GLM_ARCH_AVX_BIT)
82  template <>
83  struct storage<double, 32, true>
84  {
85  typedef glm_dvec4 type;
86  };
87 # endif
88 
89 # if (GLM_ARCH & GLM_ARCH_AVX2_BIT)
90  template <>
91  struct storage<int64, 32, true>
92  {
93  typedef glm_i64vec4 type;
94  };
95 
96  template <>
97  struct storage<uint64, 32, true>
98  {
99  typedef glm_u64vec4 type;
100  };
101 # endif
102 }//namespace detail
103 
104  template <typename T, precision P> struct tvec1;
105  template <typename T, precision P> struct tvec2;
106  template <typename T, precision P> struct tvec3;
107  template <typename T, precision P> struct tvec4;
108 
109  typedef tvec1<float, highp> highp_vec1_t;
110  typedef tvec1<float, mediump> mediump_vec1_t;
111  typedef tvec1<float, lowp> lowp_vec1_t;
112  typedef tvec1<double, highp> highp_dvec1_t;
113  typedef tvec1<double, mediump> mediump_dvec1_t;
114  typedef tvec1<double, lowp> lowp_dvec1_t;
115  typedef tvec1<int, highp> highp_ivec1_t;
116  typedef tvec1<int, mediump> mediump_ivec1_t;
117  typedef tvec1<int, lowp> lowp_ivec1_t;
118  typedef tvec1<uint, highp> highp_uvec1_t;
119  typedef tvec1<uint, mediump> mediump_uvec1_t;
120  typedef tvec1<uint, lowp> lowp_uvec1_t;
121  typedef tvec1<bool, highp> highp_bvec1_t;
122  typedef tvec1<bool, mediump> mediump_bvec1_t;
123  typedef tvec1<bool, lowp> lowp_bvec1_t;
124 
127 
133  typedef tvec2<float, highp> highp_vec2;
134 
140  typedef tvec2<float, mediump> mediump_vec2;
141 
147  typedef tvec2<float, lowp> lowp_vec2;
148 
154  typedef tvec2<double, highp> highp_dvec2;
155 
161  typedef tvec2<double, mediump> mediump_dvec2;
162 
168  typedef tvec2<double, lowp> lowp_dvec2;
169 
175  typedef tvec2<int, highp> highp_ivec2;
176 
182  typedef tvec2<int, mediump> mediump_ivec2;
183 
189  typedef tvec2<int, lowp> lowp_ivec2;
190 
196  typedef tvec2<uint, highp> highp_uvec2;
197 
203  typedef tvec2<uint, mediump> mediump_uvec2;
204 
210  typedef tvec2<uint, lowp> lowp_uvec2;
211 
217  typedef tvec2<bool, highp> highp_bvec2;
218 
224  typedef tvec2<bool, mediump> mediump_bvec2;
225 
231  typedef tvec2<bool, lowp> lowp_bvec2;
232 
234 
237 
243  typedef tvec3<float, highp> highp_vec3;
244 
250  typedef tvec3<float, mediump> mediump_vec3;
251 
257  typedef tvec3<float, lowp> lowp_vec3;
258 
264  typedef tvec3<double, highp> highp_dvec3;
265 
271  typedef tvec3<double, mediump> mediump_dvec3;
272 
278  typedef tvec3<double, lowp> lowp_dvec3;
279 
285  typedef tvec3<int, highp> highp_ivec3;
286 
292  typedef tvec3<int, mediump> mediump_ivec3;
293 
299  typedef tvec3<int, lowp> lowp_ivec3;
300 
306  typedef tvec3<uint, highp> highp_uvec3;
307 
313  typedef tvec3<uint, mediump> mediump_uvec3;
314 
320  typedef tvec3<uint, lowp> lowp_uvec3;
321 
326  typedef tvec3<bool, highp> highp_bvec3;
327 
332  typedef tvec3<bool, mediump> mediump_bvec3;
333 
338  typedef tvec3<bool, lowp> lowp_bvec3;
339 
341 
344 
349  typedef tvec4<float, highp> highp_vec4;
350 
355  typedef tvec4<float, mediump> mediump_vec4;
356 
361  typedef tvec4<float, lowp> lowp_vec4;
362 
367  typedef tvec4<double, highp> highp_dvec4;
368 
373  typedef tvec4<double, mediump> mediump_dvec4;
374 
379  typedef tvec4<double, lowp> lowp_dvec4;
380 
385  typedef tvec4<int, highp> highp_ivec4;
386 
391  typedef tvec4<int, mediump> mediump_ivec4;
392 
397  typedef tvec4<int, lowp> lowp_ivec4;
398 
403  typedef tvec4<uint, highp> highp_uvec4;
404 
409  typedef tvec4<uint, mediump> mediump_uvec4;
410 
415  typedef tvec4<uint, lowp> lowp_uvec4;
416 
421  typedef tvec4<bool, highp> highp_bvec4;
422 
427  typedef tvec4<bool, mediump> mediump_bvec4;
428 
433  typedef tvec4<bool, lowp> lowp_bvec4;
434 
436 
439 
440  // -- Default float definition --
441 
442 #if(defined(GLM_PRECISION_LOWP_FLOAT))
443  typedef lowp_vec2 vec2;
444  typedef lowp_vec3 vec3;
445  typedef lowp_vec4 vec4;
446 #elif(defined(GLM_PRECISION_MEDIUMP_FLOAT))
447  typedef mediump_vec2 vec2;
448  typedef mediump_vec3 vec3;
449  typedef mediump_vec4 vec4;
450 #else //defined(GLM_PRECISION_HIGHP_FLOAT)
451  typedef highp_vec2 vec2;
455 
459  typedef highp_vec3 vec3;
460 
464  typedef highp_vec4 vec4;
465 #endif//GLM_PRECISION
466 
467  // -- Default double definition --
468 
469 #if(defined(GLM_PRECISION_LOWP_DOUBLE))
470  typedef lowp_dvec2 dvec2;
471  typedef lowp_dvec3 dvec3;
472  typedef lowp_dvec4 dvec4;
473 #elif(defined(GLM_PRECISION_MEDIUMP_DOUBLE))
474  typedef mediump_dvec2 dvec2;
475  typedef mediump_dvec3 dvec3;
476  typedef mediump_dvec4 dvec4;
477 #else //defined(GLM_PRECISION_HIGHP_DOUBLE)
478  typedef highp_dvec2 dvec2;
482 
486  typedef highp_dvec3 dvec3;
487 
491  typedef highp_dvec4 dvec4;
492 #endif//GLM_PRECISION
493 
494  // -- Signed integer definition --
495 
496 #if(defined(GLM_PRECISION_LOWP_INT))
497  typedef lowp_ivec2 ivec2;
498  typedef lowp_ivec3 ivec3;
499  typedef lowp_ivec4 ivec4;
500 #elif(defined(GLM_PRECISION_MEDIUMP_INT))
501  typedef mediump_ivec2 ivec2;
502  typedef mediump_ivec3 ivec3;
503  typedef mediump_ivec4 ivec4;
504 #else //defined(GLM_PRECISION_HIGHP_INT)
505  typedef highp_ivec2 ivec2;
509 
513  typedef highp_ivec3 ivec3;
514 
518  typedef highp_ivec4 ivec4;
519 #endif//GLM_PRECISION
520 
521  // -- Unsigned integer definition --
522 
523 #if(defined(GLM_PRECISION_LOWP_UINT))
524  typedef lowp_uvec2 uvec2;
525  typedef lowp_uvec3 uvec3;
526  typedef lowp_uvec4 uvec4;
527 #elif(defined(GLM_PRECISION_MEDIUMP_UINT))
528  typedef mediump_uvec2 uvec2;
529  typedef mediump_uvec3 uvec3;
530  typedef mediump_uvec4 uvec4;
531 #else //defined(GLM_PRECISION_HIGHP_UINT)
532  typedef highp_uvec2 uvec2;
536 
540  typedef highp_uvec3 uvec3;
541 
545  typedef highp_uvec4 uvec4;
546 #endif//GLM_PRECISION
547 
548  // -- Boolean definition --
549 
550 #if(defined(GLM_PRECISION_LOWP_BOOL))
551  typedef lowp_bvec2 bvec2;
552  typedef lowp_bvec3 bvec3;
553  typedef lowp_bvec4 bvec4;
554 #elif(defined(GLM_PRECISION_MEDIUMP_BOOL))
555  typedef mediump_bvec2 bvec2;
556  typedef mediump_bvec3 bvec3;
557  typedef mediump_bvec4 bvec4;
558 #else //defined(GLM_PRECISION_HIGHP_BOOL)
559  typedef highp_bvec2 bvec2;
563 
567  typedef highp_bvec3 bvec3;
568 
572  typedef highp_bvec4 bvec4;
573 #endif//GLM_PRECISION
574 
576 }//namespace glm
tvec2< bool, mediump > mediump_bvec2
2 components vector of medium precision bool numbers.
Definition: type_vec.hpp:224
tvec4< uint, mediump > mediump_uvec4
4 components vector of medium precision unsigned integer numbers.
Definition: type_vec.hpp:409
tvec3< bool, mediump > mediump_bvec3
3 components vector of medium precision bool numbers.
Definition: type_vec.hpp:332
tvec2< uint, mediump > mediump_uvec2
2 components vector of medium precision unsigned integer numbers.
Definition: type_vec.hpp:203
tvec4< int, mediump > mediump_ivec4
4 components vector of medium precision signed integer numbers.
Definition: type_vec.hpp:391
highp_dvec4 dvec4
4 components vector of double-precision floating-point numbers.
Definition: type_vec.hpp:491
tvec2< int, mediump > mediump_ivec2
2 components vector of medium precision signed integer numbers.
Definition: type_vec.hpp:182
tvec2< double, mediump > mediump_dvec2
2 components vector of medium double-precision floating-point numbers.
Definition: type_vec.hpp:161
tvec3< uint, mediump > mediump_uvec3
3 components vector of medium precision unsigned integer numbers.
Definition: type_vec.hpp:313
tvec3< int, lowp > lowp_ivec3
3 components vector of low precision signed integer numbers.
Definition: type_vec.hpp:299
tvec3< float, lowp > lowp_vec3
3 components vector of low single-precision floating-point numbers.
Definition: type_vec.hpp:257
tvec3< uint, highp > highp_uvec3
3 components vector of high precision unsigned integer numbers.
Definition: type_vec.hpp:306
highp_dvec2 dvec2
2 components vector of double-precision floating-point numbers.
Definition: type_vec.hpp:481
tvec3< uint, lowp > lowp_uvec3
3 components vector of low precision unsigned integer numbers.
Definition: type_vec.hpp:320
tvec2< bool, highp > highp_bvec2
2 components vector of high precision bool numbers.
Definition: type_vec.hpp:217
tvec2< float, highp > highp_vec2
2 components vector of high single-precision floating-point numbers.
Definition: type_vec.hpp:133
tvec3< bool, lowp > lowp_bvec3
3 components vector of low precision bool numbers.
Definition: type_vec.hpp:338
tvec3< int, mediump > mediump_ivec3
3 components vector of medium precision signed integer numbers.
Definition: type_vec.hpp:292
tvec4< int, lowp > lowp_ivec4
4 components vector of low precision signed integer numbers.
Definition: type_vec.hpp:397
tvec3< double, mediump > mediump_dvec3
3 components vector of medium double-precision floating-point numbers.
Definition: type_vec.hpp:271
highp_uvec3 uvec3
3 components vector of unsigned integer numbers.
Definition: type_vec.hpp:540
tvec2< uint, lowp > lowp_uvec2
2 components vector of low precision unsigned integer numbers.
Definition: type_vec.hpp:210
tvec2< int, highp > highp_ivec2
2 components vector of high precision signed integer numbers.
Definition: type_vec.hpp:175
highp_ivec4 ivec4
4 components vector of signed integer numbers.
Definition: type_vec.hpp:518
highp_ivec3 ivec3
3 components vector of signed integer numbers.
Definition: type_vec.hpp:513
highp_bvec4 bvec4
4 components vector of boolean.
Definition: type_vec.hpp:572
tvec2< uint, highp > highp_uvec2
2 components vector of high precision unsigned integer numbers.
Definition: type_vec.hpp:196
tvec4< uint, lowp > lowp_uvec4
4 components vector of low precision unsigned integer numbers.
Definition: type_vec.hpp:415
highp_dvec3 dvec3
3 components vector of double-precision floating-point numbers.
Definition: type_vec.hpp:486
highp_uvec2 uvec2
2 components vector of unsigned integer numbers.
Definition: type_vec.hpp:535
tvec4< double, mediump > mediump_dvec4
4 components vector of medium double-precision floating-point numbers.
Definition: type_vec.hpp:373
tvec2< double, highp > highp_dvec2
2 components vector of high double-precision floating-point numbers.
Definition: type_vec.hpp:154
tvec3< float, highp > highp_vec3
3 components vector of high single-precision floating-point numbers.
Definition: type_vec.hpp:243
tvec4< float, lowp > lowp_vec4
4 components vector of low single-precision floating-point numbers.
Definition: type_vec.hpp:361
highp_vec3 vec3
3 components vector of floating-point numbers.
Definition: type_vec.hpp:459
tvec2< float, lowp > lowp_vec2
2 components vector of low single-precision floating-point numbers.
Definition: type_vec.hpp:147
tvec4< bool, highp > highp_bvec4
4 components vector of high precision bool numbers.
Definition: type_vec.hpp:421
tvec3< double, lowp > lowp_dvec3
3 components vector of low double-precision floating-point numbers.
Definition: type_vec.hpp:278
highp_vec2 vec2
2 components vector of floating-point numbers.
Definition: type_vec.hpp:454
tvec3< float, mediump > mediump_vec3
3 components vector of medium single-precision floating-point numbers.
Definition: type_vec.hpp:250
Definition: _noise.hpp:11
GLM Core
tvec4< bool, mediump > mediump_bvec4
4 components vector of medium precision bool numbers.
Definition: type_vec.hpp:427
GLM Core
tvec4< double, highp > highp_dvec4
4 components vector of high double-precision floating-point numbers.
Definition: type_vec.hpp:367
tvec4< double, lowp > lowp_dvec4
4 components vector of low double-precision floating-point numbers.
Definition: type_vec.hpp:379
highp_bvec2 bvec2
2 components vector of boolean.
Definition: type_vec.hpp:562
tvec2< double, lowp > lowp_dvec2
2 components vector of low double-precision floating-point numbers.
Definition: type_vec.hpp:168
highp_bvec3 bvec3
3 components vector of boolean.
Definition: type_vec.hpp:567
tvec2< int, lowp > lowp_ivec2
2 components vector of low precision signed integer numbers.
Definition: type_vec.hpp:189
tvec3< int, highp > highp_ivec3
3 components vector of high precision signed integer numbers.
Definition: type_vec.hpp:285
highp_vec4 vec4
4 components vector of floating-point numbers.
Definition: type_vec.hpp:464
tvec4< float, highp > highp_vec4
4 components vector of high single-precision floating-point numbers.
Definition: type_vec.hpp:349
tvec2< float, mediump > mediump_vec2
2 components vector of medium single-precision floating-point numbers.
Definition: type_vec.hpp:140
tvec4< int, highp > highp_ivec4
4 components vector of high precision signed integer numbers.
Definition: type_vec.hpp:385
highp_ivec2 ivec2
2 components vector of signed integer numbers.
Definition: type_vec.hpp:508
tvec2< bool, lowp > lowp_bvec2
2 components vector of low precision bool numbers.
Definition: type_vec.hpp:231
tvec4< bool, lowp > lowp_bvec4
4 components vector of low precision bool numbers.
Definition: type_vec.hpp:433
tvec4< float, mediump > mediump_vec4
4 components vector of medium single-precision floating-point numbers.
Definition: type_vec.hpp:355
tvec4< uint, highp > highp_uvec4
4 components vector of high precision unsigned integer numbers.
Definition: type_vec.hpp:403
tvec3< bool, highp > highp_bvec3
3 components vector of high precision bool numbers.
Definition: type_vec.hpp:326
tvec3< double, highp > highp_dvec3
3 components vector of high double-precision floating-point numbers.
Definition: type_vec.hpp:264
highp_uvec4 uvec4
4 components vector of unsigned integer numbers.
Definition: type_vec.hpp:545