0.9.8: type_vec.hpp Source File

| 0.9.8

- Main Page
- Modules
- Files

- File List

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<std::size_t N> struct aligned {};
13 template<> GLM_ALIGNED_STRUCT(1) aligned<1>{};
14 template<> GLM_ALIGNED_STRUCT(2) aligned<2>{};
15 template<> GLM_ALIGNED_STRUCT(4) aligned<4>{};
16 template<> GLM_ALIGNED_STRUCT(8) aligned<8>{};
17 template<> GLM_ALIGNED_STRUCT(16) aligned<16>{};
18 template<> GLM_ALIGNED_STRUCT(32) aligned<32>{};
19 template<> GLM_ALIGNED_STRUCT(64) aligned<64>{};
20
21 template <typename T, std::size_t size, bool aligned>
22 struct storage
23 {
24 typedef struct type {
25 uint8 data[size];
26 } type;
27 };
28
29 template <typename T, std::size_t size>
30 struct storage<T, size, true>
31 {
32 struct type : aligned<size>
33 {
34 uint8 data[size];
35 };
36 };
37
38 # if GLM_ARCH & GLM_ARCH_SSE2_BIT
39 template <>
40 struct storage<float, 16, true>
41 {
42 typedef glm_vec4 type;
43 };
44
45 template <>
46 struct storage<int, 16, true>
47 {
48 typedef glm_ivec4 type;
49 };
50
51 template <>
52 struct storage<unsigned int, 16, true>
53 {
54 typedef glm_uvec4 type;
55 };
56 /*
57 # else
58 typedef union __declspec(align(16)) glm_128
59 {
60 unsigned __int8 data[16];
61 } glm_128;
62
63 template <>
64 struct storage<float, 16, true>
65 {
66 typedef glm_128 type;
67 };
68
69 template <>
70 struct storage<int, 16, true>
71 {
72 typedef glm_128 type;
73 };
74
75 template <>
76 struct storage<unsigned int, 16, true>
77 {
78 typedef glm_128 type;
79 };
80 */
81 # endif
82
83 # if (GLM_ARCH & GLM_ARCH_AVX_BIT)
84 template <>
85 struct storage<double, 32, true>
86 {
87 typedef glm_dvec4 type;
88 };
89 # endif
90
91 # if (GLM_ARCH & GLM_ARCH_AVX2_BIT)
92 template <>
93 struct storage<int64, 32, true>
94 {
95 typedef glm_i64vec4 type;
96 };
97
98 template <>
99 struct storage<uint64, 32, true>
100 {
101 typedef glm_u64vec4 type;
102 };
103 # endif
104 }//namespace detail
105
106 template <typename T, precision P> struct tvec1;
107 template <typename T, precision P> struct tvec2;
108 template <typename T, precision P> struct tvec3;
109 template <typename T, precision P> struct tvec4;
110
111 typedef tvec1<float, highp> highp_vec1_t;
112 typedef tvec1<float, mediump> mediump_vec1_t;
113 typedef tvec1<float, lowp> lowp_vec1_t;
114 typedef tvec1<double, highp> highp_dvec1_t;
115 typedef tvec1<double, mediump> mediump_dvec1_t;
116 typedef tvec1<double, lowp> lowp_dvec1_t;
117 typedef tvec1<int, highp> highp_ivec1_t;
118 typedef tvec1<int, mediump> mediump_ivec1_t;
119 typedef tvec1<int, lowp> lowp_ivec1_t;
120 typedef tvec1<uint, highp> highp_uvec1_t;
121 typedef tvec1<uint, mediump> mediump_uvec1_t;
122 typedef tvec1<uint, lowp> lowp_uvec1_t;
123 typedef tvec1<bool, highp> highp_bvec1_t;
124 typedef tvec1<bool, mediump> mediump_bvec1_t;
125 typedef tvec1<bool, lowp> lowp_bvec1_t;
126
129
135 typedef tvec2<float, highp> highp_vec2;
136
142 typedef tvec2<float, mediump> mediump_vec2;
143
149 typedef tvec2<float, lowp> lowp_vec2;
150
156 typedef tvec2<double, highp> highp_dvec2;
157
163 typedef tvec2<double, mediump> mediump_dvec2;
164
170 typedef tvec2<double, lowp> lowp_dvec2;
171
177 typedef tvec2<int, highp> highp_ivec2;
178
184 typedef tvec2<int, mediump> mediump_ivec2;
185
191 typedef tvec2<int, lowp> lowp_ivec2;
192
198 typedef tvec2<uint, highp> highp_uvec2;
199
205 typedef tvec2<uint, mediump> mediump_uvec2;
206
212 typedef tvec2<uint, lowp> lowp_uvec2;
213
219 typedef tvec2<bool, highp> highp_bvec2;
220
226 typedef tvec2<bool, mediump> mediump_bvec2;
227
233 typedef tvec2<bool, lowp> lowp_bvec2;
234
236
239
245 typedef tvec3<float, highp> highp_vec3;
246
252 typedef tvec3<float, mediump> mediump_vec3;
253
259 typedef tvec3<float, lowp> lowp_vec3;
260
266 typedef tvec3<double, highp> highp_dvec3;
267
273 typedef tvec3<double, mediump> mediump_dvec3;
274
280 typedef tvec3<double, lowp> lowp_dvec3;
281
287 typedef tvec3<int, highp> highp_ivec3;
288
294 typedef tvec3<int, mediump> mediump_ivec3;
295
301 typedef tvec3<int, lowp> lowp_ivec3;
302
308 typedef tvec3<uint, highp> highp_uvec3;
309
315 typedef tvec3<uint, mediump> mediump_uvec3;
316
322 typedef tvec3<uint, lowp> lowp_uvec3;
323
328 typedef tvec3<bool, highp> highp_bvec3;
329
334 typedef tvec3<bool, mediump> mediump_bvec3;
335
340 typedef tvec3<bool, lowp> lowp_bvec3;
341
343
346
351 typedef tvec4<float, highp> highp_vec4;
352
357 typedef tvec4<float, mediump> mediump_vec4;
358
363 typedef tvec4<float, lowp> lowp_vec4;
364
369 typedef tvec4<double, highp> highp_dvec4;
370
375 typedef tvec4<double, mediump> mediump_dvec4;
376
381 typedef tvec4<double, lowp> lowp_dvec4;
382
387 typedef tvec4<int, highp> highp_ivec4;
388
393 typedef tvec4<int, mediump> mediump_ivec4;
394
399 typedef tvec4<int, lowp> lowp_ivec4;
400
405 typedef tvec4<uint, highp> highp_uvec4;
406
411 typedef tvec4<uint, mediump> mediump_uvec4;
412
417 typedef tvec4<uint, lowp> lowp_uvec4;
418
423 typedef tvec4<bool, highp> highp_bvec4;
424
429 typedef tvec4<bool, mediump> mediump_bvec4;
430
435 typedef tvec4<bool, lowp> lowp_bvec4;
436
438
441
442 // -- Default float definition --
443
444 #if(defined(GLM_PRECISION_LOWP_FLOAT))
445 typedef lowp_vec2 vec2;
446 typedef lowp_vec3 vec3;
447 typedef lowp_vec4 vec4;
448 #elif(defined(GLM_PRECISION_MEDIUMP_FLOAT))
449 typedef mediump_vec2 vec2;
450 typedef mediump_vec3 vec3;
451 typedef mediump_vec4 vec4;
452 #else //defined(GLM_PRECISION_HIGHP_FLOAT)
453 typedef highp_vec2 vec2;
457
461 typedef highp_vec3 vec3;
462
466 typedef highp_vec4 vec4;
467 #endif//GLM_PRECISION
468
469 // -- Default double definition --
470
471 #if(defined(GLM_PRECISION_LOWP_DOUBLE))
472 typedef lowp_dvec2 dvec2;
473 typedef lowp_dvec3 dvec3;
474 typedef lowp_dvec4 dvec4;
475 #elif(defined(GLM_PRECISION_MEDIUMP_DOUBLE))
476 typedef mediump_dvec2 dvec2;
477 typedef mediump_dvec3 dvec3;
478 typedef mediump_dvec4 dvec4;
479 #else //defined(GLM_PRECISION_HIGHP_DOUBLE)
480 typedef highp_dvec2 dvec2;
484
488 typedef highp_dvec3 dvec3;
489
493 typedef highp_dvec4 dvec4;
494 #endif//GLM_PRECISION
495
496 // -- Signed integer definition --
497
498 #if(defined(GLM_PRECISION_LOWP_INT))
499 typedef lowp_ivec2 ivec2;
500 typedef lowp_ivec3 ivec3;
501 typedef lowp_ivec4 ivec4;
502 #elif(defined(GLM_PRECISION_MEDIUMP_INT))
503 typedef mediump_ivec2 ivec2;
504 typedef mediump_ivec3 ivec3;
505 typedef mediump_ivec4 ivec4;
506 #else //defined(GLM_PRECISION_HIGHP_INT)
507 typedef highp_ivec2 ivec2;
511
515 typedef highp_ivec3 ivec3;
516
520 typedef highp_ivec4 ivec4;
521 #endif//GLM_PRECISION
522
523 // -- Unsigned integer definition --
524
525 #if(defined(GLM_PRECISION_LOWP_UINT))
526 typedef lowp_uvec2 uvec2;
527 typedef lowp_uvec3 uvec3;
528 typedef lowp_uvec4 uvec4;
529 #elif(defined(GLM_PRECISION_MEDIUMP_UINT))
530 typedef mediump_uvec2 uvec2;
531 typedef mediump_uvec3 uvec3;
532 typedef mediump_uvec4 uvec4;
533 #else //defined(GLM_PRECISION_HIGHP_UINT)
534 typedef highp_uvec2 uvec2;
538
542 typedef highp_uvec3 uvec3;
543
547 typedef highp_uvec4 uvec4;
548 #endif//GLM_PRECISION
549
550 // -- Boolean definition --
551
552 #if(defined(GLM_PRECISION_LOWP_BOOL))
553 typedef lowp_bvec2 bvec2;
554 typedef lowp_bvec3 bvec3;
555 typedef lowp_bvec4 bvec4;
556 #elif(defined(GLM_PRECISION_MEDIUMP_BOOL))
557 typedef mediump_bvec2 bvec2;
558 typedef mediump_bvec3 bvec3;
559 typedef mediump_bvec4 bvec4;
560 #else //defined(GLM_PRECISION_HIGHP_BOOL)
561 typedef highp_bvec2 bvec2;
565
569 typedef highp_bvec3 bvec3;
570
574 typedef highp_bvec4 bvec4;
575 #endif//GLM_PRECISION
576
578 }//namespace glm
glm::ivec3
highp_ivec3 ivec3
3 components vector of signed integer numbers.
Definition: type_vec.hpp:515
glm::lowp_ivec4
tvec4< int, lowp > lowp_ivec4
4 components vector of low precision signed integer numbers.
Definition: type_vec.hpp:399
glm::bvec3
highp_bvec3 bvec3
3 components vector of boolean.
Definition: type_vec.hpp:569
glm::highp_ivec4
tvec4< int, highp > highp_ivec4
4 components vector of high precision signed integer numbers.
Definition: type_vec.hpp:387
glm::lowp_vec4
tvec4< float, lowp > lowp_vec4
4 components vector of low single-precision floating-point numbers.
Definition: type_vec.hpp:363
glm::lowp_vec2
tvec2< float, lowp > lowp_vec2
2 components vector of low single-precision floating-point numbers.
Definition: type_vec.hpp:149
glm::highp_vec3
tvec3< float, highp > highp_vec3
3 components vector of high single-precision floating-point numbers.
Definition: type_vec.hpp:245
glm::lowp_dvec3
tvec3< double, lowp > lowp_dvec3
3 components vector of low double-precision floating-point numbers.
Definition: type_vec.hpp:280
glm::bvec4
highp_bvec4 bvec4
4 components vector of boolean.
Definition: type_vec.hpp:574
glm::lowp_ivec2
tvec2< int, lowp > lowp_ivec2
2 components vector of low precision signed integer numbers.
Definition: type_vec.hpp:191
glm::mediump_vec4
tvec4< float, mediump > mediump_vec4
4 components vector of medium single-precision floating-point numbers.
Definition: type_vec.hpp:357
glm::highp_uvec2
tvec2< uint, highp > highp_uvec2
2 components vector of high precision unsigned integer numbers.
Definition: type_vec.hpp:198
glm::vec4
highp_vec4 vec4
4 components vector of floating-point numbers.
Definition: type_vec.hpp:466
glm::highp_dvec3
tvec3< double, highp > highp_dvec3
3 components vector of high double-precision floating-point numbers.
Definition: type_vec.hpp:266
glm::ivec2
highp_ivec2 ivec2
2 components vector of signed integer numbers.
Definition: type_vec.hpp:510
glm::lowp_vec3
tvec3< float, lowp > lowp_vec3
3 components vector of low single-precision floating-point numbers.
Definition: type_vec.hpp:259
glm::mediump_ivec4
tvec4< int, mediump > mediump_ivec4
4 components vector of medium precision signed integer numbers.
Definition: type_vec.hpp:393
glm::mediump_ivec2
tvec2< int, mediump > mediump_ivec2
2 components vector of medium precision signed integer numbers.
Definition: type_vec.hpp:184
glm::lowp_ivec3
tvec3< int, lowp > lowp_ivec3
3 components vector of low precision signed integer numbers.
Definition: type_vec.hpp:301
glm
Definition: _noise.hpp:11
glm::highp_bvec4
tvec4< bool, highp > highp_bvec4
4 components vector of high precision bool numbers.
Definition: type_vec.hpp:423
glm::bvec2
highp_bvec2 bvec2
2 components vector of boolean.
Definition: type_vec.hpp:564
glm::highp_bvec3
tvec3< bool, highp > highp_bvec3
3 components vector of high precision bool numbers.
Definition: type_vec.hpp:328
glm::highp_vec4
tvec4< float, highp > highp_vec4
4 components vector of high single-precision floating-point numbers.
Definition: type_vec.hpp:351
glm::lowp_bvec2
tvec2< bool, lowp > lowp_bvec2
2 components vector of low precision bool numbers.
Definition: type_vec.hpp:233
glm::highp_dvec4
tvec4< double, highp > highp_dvec4
4 components vector of high double-precision floating-point numbers.
Definition: type_vec.hpp:369
glm::lowp_dvec2
tvec2< double, lowp > lowp_dvec2
2 components vector of low double-precision floating-point numbers.
Definition: type_vec.hpp:170
glm::uvec3
highp_uvec3 uvec3
3 components vector of unsigned integer numbers.
Definition: type_vec.hpp:542
glm::mediump_vec3
tvec3< float, mediump > mediump_vec3
3 components vector of medium single-precision floating-point numbers.
Definition: type_vec.hpp:252
glm::mediump_bvec4
tvec4< bool, mediump > mediump_bvec4
4 components vector of medium precision bool numbers.
Definition: type_vec.hpp:429
glm::lowp_bvec4
tvec4< bool, lowp > lowp_bvec4
4 components vector of low precision bool numbers.
Definition: type_vec.hpp:435
glm::mediump_uvec4
tvec4< uint, mediump > mediump_uvec4
4 components vector of medium precision unsigned integer numbers.
Definition: type_vec.hpp:411
glm::highp_uvec4
tvec4< uint, highp > highp_uvec4
4 components vector of high precision unsigned integer numbers.
Definition: type_vec.hpp:405
glm::highp_uvec3
tvec3< uint, highp > highp_uvec3
3 components vector of high precision unsigned integer numbers.
Definition: type_vec.hpp:308
glm::lowp_dvec4
tvec4< double, lowp > lowp_dvec4
4 components vector of low double-precision floating-point numbers.
Definition: type_vec.hpp:381
glm::highp_ivec3
tvec3< int, highp > highp_ivec3
3 components vector of high precision signed integer numbers.
Definition: type_vec.hpp:287
glm::mediump_vec2
tvec2< float, mediump > mediump_vec2
2 components vector of medium single-precision floating-point numbers.
Definition: type_vec.hpp:142
glm::uvec4
highp_uvec4 uvec4
4 components vector of unsigned integer numbers.
Definition: type_vec.hpp:547
glm::mediump_dvec2
tvec2< double, mediump > mediump_dvec2
2 components vector of medium double-precision floating-point numbers.
Definition: type_vec.hpp:163
glm::highp_vec2
tvec2< float, highp > highp_vec2
2 components vector of high single-precision floating-point numbers.
Definition: type_vec.hpp:135
glm::mediump_bvec2
tvec2< bool, mediump > mediump_bvec2
2 components vector of medium precision bool numbers.
Definition: type_vec.hpp:226
glm::mediump_bvec3
tvec3< bool, mediump > mediump_bvec3
3 components vector of medium precision bool numbers.
Definition: type_vec.hpp:334
type_int.hpp
GLM Core
glm::highp_bvec2
tvec2< bool, highp > highp_bvec2
2 components vector of high precision bool numbers.
Definition: type_vec.hpp:219
glm::dvec3
highp_dvec3 dvec3
3 components vector of double-precision floating-point numbers.
Definition: type_vec.hpp:488
glm::mediump_uvec2
tvec2< uint, mediump > mediump_uvec2
2 components vector of medium precision unsigned integer numbers.
Definition: type_vec.hpp:205
glm::uvec2
highp_uvec2 uvec2
2 components vector of unsigned integer numbers.
Definition: type_vec.hpp:537
glm::dvec4
highp_dvec4 dvec4
4 components vector of double-precision floating-point numbers.
Definition: type_vec.hpp:493
glm::mediump_dvec4
tvec4< double, mediump > mediump_dvec4
4 components vector of medium double-precision floating-point numbers.
Definition: type_vec.hpp:375
glm::lowp_uvec3
tvec3< uint, lowp > lowp_uvec3
3 components vector of low precision unsigned integer numbers.
Definition: type_vec.hpp:322
glm::mediump_dvec3
tvec3< double, mediump > mediump_dvec3
3 components vector of medium double-precision floating-point numbers.
Definition: type_vec.hpp:273
glm::lowp_uvec2
tvec2< uint, lowp > lowp_uvec2
2 components vector of low precision unsigned integer numbers.
Definition: type_vec.hpp:212
glm::highp_ivec2
tvec2< int, highp > highp_ivec2
2 components vector of high precision signed integer numbers.
Definition: type_vec.hpp:177
glm::lowp_bvec3
tvec3< bool, lowp > lowp_bvec3
3 components vector of low precision bool numbers.
Definition: type_vec.hpp:340
glm::mediump_ivec3
tvec3< int, mediump > mediump_ivec3
3 components vector of medium precision signed integer numbers.
Definition: type_vec.hpp:294
glm::vec3
highp_vec3 vec3
3 components vector of floating-point numbers.
Definition: type_vec.hpp:461
glm::dvec2
highp_dvec2 dvec2
2 components vector of double-precision floating-point numbers.
Definition: type_vec.hpp:483
glm::highp_dvec2
tvec2< double, highp > highp_dvec2
2 components vector of high double-precision floating-point numbers.
Definition: type_vec.hpp:156
glm::vec2
highp_vec2 vec2
2 components vector of floating-point numbers.
Definition: type_vec.hpp:456
glm::mediump_uvec3
tvec3< uint, mediump > mediump_uvec3
3 components vector of medium precision unsigned integer numbers.
Definition: type_vec.hpp:315
glm::lowp_uvec4
tvec4< uint, lowp > lowp_uvec4
4 components vector of low precision unsigned integer numbers.
Definition: type_vec.hpp:417
precision.hpp
GLM Core
glm::ivec4
highp_ivec4 ivec4
4 components vector of signed integer numbers.
Definition: type_vec.hpp:520