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 P = defaultp> using tvec1 = vec<1, T, P>;
107  template <typename T, qualifier P = defaultp> using tvec2 = vec<2, T, P>;
108  template <typename T, qualifier P = defaultp> using tvec3 = vec<3, T, P>;
109  template <typename T, qualifier P = defaultp> using tvec4 = vec<4, T, P>;
110 #endif//GLM_HAS_TEMPLATE_ALIASES
111 
112  typedef vec<1, float, highp> highp_vec1_t;
113  typedef vec<1, float, mediump> mediump_vec1_t;
114  typedef vec<1, float, lowp> lowp_vec1_t;
115  typedef vec<1, double, highp> highp_dvec1_t;
116  typedef vec<1, double, mediump> mediump_dvec1_t;
117  typedef vec<1, double, lowp> lowp_dvec1_t;
118  typedef vec<1, int, highp> highp_ivec1_t;
119  typedef vec<1, int, mediump> mediump_ivec1_t;
120  typedef vec<1, int, lowp> lowp_ivec1_t;
121  typedef vec<1, uint, highp> highp_uvec1_t;
122  typedef vec<1, uint, mediump> mediump_uvec1_t;
123  typedef vec<1, uint, lowp> lowp_uvec1_t;
124  typedef vec<1, bool, highp> highp_bvec1_t;
125  typedef vec<1, bool, mediump> mediump_bvec1_t;
126  typedef vec<1, bool, lowp> lowp_bvec1_t;
127 
130 
136  typedef vec<2, float, highp> highp_vec2;
137 
143  typedef vec<2, float, mediump> mediump_vec2;
144 
150  typedef vec<2, float, lowp> lowp_vec2;
151 
157  typedef vec<2, double, highp> highp_dvec2;
158 
164  typedef vec<2, double, mediump> mediump_dvec2;
165 
171  typedef vec<2, double, lowp> lowp_dvec2;
172 
178  typedef vec<2, int, highp> highp_ivec2;
179 
185  typedef vec<2, int, mediump> mediump_ivec2;
186 
192  typedef vec<2, int, lowp> lowp_ivec2;
193 
199  typedef vec<2, uint, highp> highp_uvec2;
200 
206  typedef vec<2, uint, mediump> mediump_uvec2;
207 
213  typedef vec<2, uint, lowp> lowp_uvec2;
214 
220  typedef vec<2, bool, highp> highp_bvec2;
221 
227  typedef vec<2, bool, mediump> mediump_bvec2;
228 
234  typedef vec<2, bool, lowp> lowp_bvec2;
235 
237 
240 
246  typedef vec<3, float, highp> highp_vec3;
247 
253  typedef vec<3, float, mediump> mediump_vec3;
254 
260  typedef vec<3, float, lowp> lowp_vec3;
261 
267  typedef vec<3, double, highp> highp_dvec3;
268 
274  typedef vec<3, double, mediump> mediump_dvec3;
275 
281  typedef vec<3, double, lowp> lowp_dvec3;
282 
288  typedef vec<3, int, highp> highp_ivec3;
289 
295  typedef vec<3, int, mediump> mediump_ivec3;
296 
302  typedef vec<3, int, lowp> lowp_ivec3;
303 
309  typedef vec<3, uint, highp> highp_uvec3;
310 
316  typedef vec<3, uint, mediump> mediump_uvec3;
317 
323  typedef vec<3, uint, lowp> lowp_uvec3;
324 
329  typedef vec<3, bool, highp> highp_bvec3;
330 
335  typedef vec<3, bool, mediump> mediump_bvec3;
336 
341  typedef vec<3, bool, lowp> lowp_bvec3;
342 
344 
347 
352  typedef vec<4, float, highp> highp_vec4;
353 
358  typedef vec<4, float, mediump> mediump_vec4;
359 
364  typedef vec<4, float, lowp> lowp_vec4;
365 
370  typedef vec<4, double, highp> highp_dvec4;
371 
376  typedef vec<4, double, mediump> mediump_dvec4;
377 
382  typedef vec<4, double, lowp> lowp_dvec4;
383 
388  typedef vec<4, int, highp> highp_ivec4;
389 
394  typedef vec<4, int, mediump> mediump_ivec4;
395 
400  typedef vec<4, int, lowp> lowp_ivec4;
401 
406  typedef vec<4, uint, highp> highp_uvec4;
407 
412  typedef vec<4, uint, mediump> mediump_uvec4;
413 
418  typedef vec<4, uint, lowp> lowp_uvec4;
419 
424  typedef vec<4, bool, highp> highp_bvec4;
425 
430  typedef vec<4, bool, mediump> mediump_bvec4;
431 
436  typedef vec<4, bool, lowp> lowp_bvec4;
437 
439 
442 
443  // -- Default float definition --
444 
445 #if(defined(GLM_PRECISION_LOWP_FLOAT))
446  typedef lowp_vec2 vec2;
447  typedef lowp_vec3 vec3;
448  typedef lowp_vec4 vec4;
449 #elif(defined(GLM_PRECISION_MEDIUMP_FLOAT))
450  typedef mediump_vec2 vec2;
451  typedef mediump_vec3 vec3;
452  typedef mediump_vec4 vec4;
453 #else //defined(GLM_PRECISION_HIGHP_FLOAT)
454  typedef highp_vec2 vec2;
458 
462  typedef highp_vec3 vec3;
463 
467  typedef highp_vec4 vec4;
468 #endif//GLM_PRECISION
469 
470  // -- Default double definition --
471 
472 #if(defined(GLM_PRECISION_LOWP_DOUBLE))
473  typedef lowp_dvec2 dvec2;
474  typedef lowp_dvec3 dvec3;
475  typedef lowp_dvec4 dvec4;
476 #elif(defined(GLM_PRECISION_MEDIUMP_DOUBLE))
477  typedef mediump_dvec2 dvec2;
478  typedef mediump_dvec3 dvec3;
479  typedef mediump_dvec4 dvec4;
480 #else //defined(GLM_PRECISION_HIGHP_DOUBLE)
481  typedef highp_dvec2 dvec2;
485 
489  typedef highp_dvec3 dvec3;
490 
494  typedef highp_dvec4 dvec4;
495 #endif//GLM_PRECISION
496 
497  // -- Signed integer definition --
498 
499 #if(defined(GLM_PRECISION_LOWP_INT))
500  typedef lowp_ivec2 ivec2;
501  typedef lowp_ivec3 ivec3;
502  typedef lowp_ivec4 ivec4;
503 #elif(defined(GLM_PRECISION_MEDIUMP_INT))
504  typedef mediump_ivec2 ivec2;
505  typedef mediump_ivec3 ivec3;
506  typedef mediump_ivec4 ivec4;
507 #else //defined(GLM_PRECISION_HIGHP_INT)
508  typedef highp_ivec2 ivec2;
512 
516  typedef highp_ivec3 ivec3;
517 
521  typedef highp_ivec4 ivec4;
522 #endif//GLM_PRECISION
523 
524  // -- Unsigned integer definition --
525 
526 #if(defined(GLM_PRECISION_LOWP_UINT))
527  typedef lowp_uvec2 uvec2;
528  typedef lowp_uvec3 uvec3;
529  typedef lowp_uvec4 uvec4;
530 #elif(defined(GLM_PRECISION_MEDIUMP_UINT))
531  typedef mediump_uvec2 uvec2;
532  typedef mediump_uvec3 uvec3;
533  typedef mediump_uvec4 uvec4;
534 #else //defined(GLM_PRECISION_HIGHP_UINT)
535  typedef highp_uvec2 uvec2;
539 
543  typedef highp_uvec3 uvec3;
544 
548  typedef highp_uvec4 uvec4;
549 #endif//GLM_PRECISION
550 
551  // -- Boolean definition --
552 
553 #if(defined(GLM_PRECISION_LOWP_BOOL))
554  typedef lowp_bvec2 bvec2;
555  typedef lowp_bvec3 bvec3;
556  typedef lowp_bvec4 bvec4;
557 #elif(defined(GLM_PRECISION_MEDIUMP_BOOL))
558  typedef mediump_bvec2 bvec2;
559  typedef mediump_bvec3 bvec3;
560  typedef mediump_bvec4 bvec4;
561 #else //defined(GLM_PRECISION_HIGHP_BOOL)
562  typedef highp_bvec2 bvec2;
566 
570  typedef highp_bvec3 bvec3;
571 
575  typedef highp_bvec4 bvec4;
576 #endif//GLM_PRECISION
577 
579 }//namespace glm
highp_vec2 vec2
2 components vector of floating-point numbers.
Definition: type_vec.hpp:457
highp_bvec4 bvec4
4 components vector of boolean.
Definition: type_vec.hpp:575
vec< 4, float, highp > highp_vec4
4 components vector of high single-qualifier floating-point numbers.
Definition: type_vec.hpp:352
vec< 2, uint, mediump > mediump_uvec2
2 components vector of medium qualifier unsigned integer numbers.
Definition: type_vec.hpp:206
vec< 2, bool, highp > highp_bvec2
2 components vector of high qualifier bool numbers.
Definition: type_vec.hpp:220
vec< 2, double, mediump > mediump_dvec2
2 components vector of medium double-qualifier floating-point numbers.
Definition: type_vec.hpp:164
vec< 2, uint, highp > highp_uvec2
2 components vector of high qualifier unsigned integer numbers.
Definition: type_vec.hpp:199
vec< 3, double, mediump > mediump_dvec3
3 components vector of medium double-qualifier floating-point numbers.
Definition: type_vec.hpp:274
vec< 4, int, highp > highp_ivec4
4 components vector of high qualifier signed integer numbers.
Definition: type_vec.hpp:388
highp_ivec2 ivec2
2 components vector of signed integer numbers.
Definition: type_vec.hpp:511
vec< 3, uint, mediump > mediump_uvec3
3 components vector of medium qualifier unsigned integer numbers.
Definition: type_vec.hpp:316
vec< 4, bool, lowp > lowp_bvec4
4 components vector of low qualifier bool numbers.
Definition: type_vec.hpp:436
vec< 3, int, highp > highp_ivec3
3 components vector of high qualifier signed integer numbers.
Definition: type_vec.hpp:288
vec< 4, bool, mediump > mediump_bvec4
4 components vector of medium qualifier bool numbers.
Definition: type_vec.hpp:430
highp_vec4 vec4
4 components vector of floating-point numbers.
Definition: type_vec.hpp:467
vec< 3, float, lowp > lowp_vec3
3 components vector of low single-qualifier floating-point numbers.
Definition: type_vec.hpp:260
vec< 4, int, lowp > lowp_ivec4
4 components vector of low qualifier signed integer numbers.
Definition: type_vec.hpp:400
vec< 4, int, mediump > mediump_ivec4
4 components vector of medium qualifier signed integer numbers.
Definition: type_vec.hpp:394
Definition: _noise.hpp:11
vec< 2, bool, lowp > lowp_bvec2
2 components vector of low qualifier bool numbers.
Definition: type_vec.hpp:234
vec< 2, int, mediump > mediump_ivec2
2 components vector of medium qualifier signed integer numbers.
Definition: type_vec.hpp:185
vec< 4, uint, mediump > mediump_uvec4
4 components vector of medium qualifier unsigned integer numbers.
Definition: type_vec.hpp:412
vec< 3, int, lowp > lowp_ivec3
3 components vector of low qualifier signed integer numbers.
Definition: type_vec.hpp:302
vec< 2, int, highp > highp_ivec2
2 components vector of high qualifier signed integer numbers.
Definition: type_vec.hpp:178
vec< 3, double, highp > highp_dvec3
3 components vector of high double-qualifier floating-point numbers.
Definition: type_vec.hpp:267
GLM Core
highp_uvec3 uvec3
3 components vector of unsigned integer numbers.
Definition: type_vec.hpp:543
vec< 2, double, highp > highp_dvec2
2 components vector of high double-qualifier floating-point numbers.
Definition: type_vec.hpp:157
GLM Core
highp_bvec2 bvec2
2 components vector of boolean.
Definition: type_vec.hpp:565
vec< 4, float, lowp > lowp_vec4
4 components vector of low single-qualifier floating-point numbers.
Definition: type_vec.hpp:364
vec< 3, float, mediump > mediump_vec3
3 components vector of medium single-qualifier floating-point numbers.
Definition: type_vec.hpp:253
vec< 3, int, mediump > mediump_ivec3
3 components vector of medium qualifier signed integer numbers.
Definition: type_vec.hpp:295
vec< 4, float, mediump > mediump_vec4
4 components vector of medium single-qualifier floating-point numbers.
Definition: type_vec.hpp:358
vec< 3, bool, highp > highp_bvec3
3 components vector of high qualifier bool numbers.
Definition: type_vec.hpp:329
vec< 2, int, lowp > lowp_ivec2
2 components vector of low qualifier signed integer numbers.
Definition: type_vec.hpp:192
vec< 2, uint, lowp > lowp_uvec2
2 components vector of low qualifier unsigned integer numbers.
Definition: type_vec.hpp:213
vec< 3, double, lowp > lowp_dvec3
3 components vector of low double-qualifier floating-point numbers.
Definition: type_vec.hpp:281
highp_dvec3 dvec3
3 components vector of double-qualifier floating-point numbers.
Definition: type_vec.hpp:489
vec< 3, float, highp > highp_vec3
3 components vector of high single-qualifier floating-point numbers.
Definition: type_vec.hpp:246
vec< 4, double, mediump > mediump_dvec4
4 components vector of medium double-qualifier floating-point numbers.
Definition: type_vec.hpp:376
highp_dvec4 dvec4
4 components vector of double-qualifier floating-point numbers.
Definition: type_vec.hpp:494
highp_uvec4 uvec4
4 components vector of unsigned integer numbers.
Definition: type_vec.hpp:548
vec< 2, float, lowp > lowp_vec2
2 components vector of low single-qualifier floating-point numbers.
Definition: type_vec.hpp:150
vec< 3, uint, lowp > lowp_uvec3
3 components vector of low qualifier unsigned integer numbers.
Definition: type_vec.hpp:323
vec< 3, bool, lowp > lowp_bvec3
3 components vector of low qualifier bool numbers.
Definition: type_vec.hpp:341
vec< 2, bool, mediump > mediump_bvec2
2 components vector of medium qualifier bool numbers.
Definition: type_vec.hpp:227
vec< 3, uint, highp > highp_uvec3
3 components vector of high qualifier unsigned integer numbers.
Definition: type_vec.hpp:309
highp_vec3 vec3
3 components vector of floating-point numbers.
Definition: type_vec.hpp:462
highp_dvec2 dvec2
2 components vector of double-qualifier floating-point numbers.
Definition: type_vec.hpp:484
vec< 4, bool, highp > highp_bvec4
4 components vector of high qualifier bool numbers.
Definition: type_vec.hpp:424
vec< 4, double, lowp > lowp_dvec4
4 components vector of low double-qualifier floating-point numbers.
Definition: type_vec.hpp:382
vec< 2, double, lowp > lowp_dvec2
2 components vector of low double-qualifier floating-point numbers.
Definition: type_vec.hpp:171
vec< 3, bool, mediump > mediump_bvec3
3 components vector of medium qualifier bool numbers.
Definition: type_vec.hpp:335
vec< 4, uint, lowp > lowp_uvec4
4 components vector of low qualifier unsigned integer numbers.
Definition: type_vec.hpp:418
vec< 2, float, highp > highp_vec2
2 components vector of high single-qualifier floating-point numbers.
Definition: type_vec.hpp:136
highp_ivec4 ivec4
4 components vector of signed integer numbers.
Definition: type_vec.hpp:521
vec< 4, double, highp > highp_dvec4
4 components vector of high double-qualifier floating-point numbers.
Definition: type_vec.hpp:370
highp_uvec2 uvec2
2 components vector of unsigned integer numbers.
Definition: type_vec.hpp:538
highp_ivec3 ivec3
3 components vector of signed integer numbers.
Definition: type_vec.hpp:516
vec< 2, float, mediump > mediump_vec2
2 components vector of medium single-qualifier floating-point numbers.
Definition: type_vec.hpp:143
highp_bvec3 bvec3
3 components vector of boolean.
Definition: type_vec.hpp:570
vec< 4, uint, highp > highp_uvec4
4 components vector of high qualifier unsigned integer numbers.
Definition: type_vec.hpp:406