LinzhouLi commited on
Commit
7d8cb51
·
verified ·
1 Parent(s): 8448f43

Update RealDenseFace image reconstruction demo (part 2)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. cuda_extensions/third_party/glm/glm/ext.hpp +255 -0
  2. cuda_extensions/third_party/glm/glm/ext/vector_int3_sized.hpp +49 -0
  3. cuda_extensions/third_party/glm/glm/ext/vector_int4.hpp +18 -0
  4. cuda_extensions/third_party/glm/glm/ext/vector_int4_sized.hpp +49 -0
  5. cuda_extensions/third_party/glm/glm/ext/vector_integer.hpp +149 -0
  6. cuda_extensions/third_party/glm/glm/ext/vector_integer.inl +85 -0
  7. cuda_extensions/third_party/glm/glm/ext/vector_packing.hpp +32 -0
  8. cuda_extensions/third_party/glm/glm/ext/vector_packing.inl +0 -0
  9. cuda_extensions/third_party/glm/glm/ext/vector_reciprocal.hpp +135 -0
  10. cuda_extensions/third_party/glm/glm/ext/vector_reciprocal.inl +105 -0
  11. cuda_extensions/third_party/glm/glm/ext/vector_relational.hpp +107 -0
  12. cuda_extensions/third_party/glm/glm/ext/vector_relational.inl +75 -0
  13. cuda_extensions/third_party/glm/glm/ext/vector_uint1.hpp +32 -0
  14. cuda_extensions/third_party/glm/glm/ext/vector_uint1_sized.hpp +49 -0
  15. cuda_extensions/third_party/glm/glm/ext/vector_uint2.hpp +18 -0
  16. cuda_extensions/third_party/glm/glm/ext/vector_uint2_sized.hpp +49 -0
  17. cuda_extensions/third_party/glm/glm/ext/vector_uint3.hpp +18 -0
  18. cuda_extensions/third_party/glm/glm/ext/vector_uint3_sized.hpp +49 -0
  19. cuda_extensions/third_party/glm/glm/ext/vector_uint4.hpp +18 -0
  20. cuda_extensions/third_party/glm/glm/ext/vector_uint4_sized.hpp +49 -0
  21. cuda_extensions/third_party/glm/glm/ext/vector_ulp.hpp +112 -0
  22. cuda_extensions/third_party/glm/glm/ext/vector_ulp.inl +74 -0
  23. cuda_extensions/third_party/glm/glm/fwd.hpp +1233 -0
  24. cuda_extensions/third_party/glm/glm/geometric.hpp +116 -0
  25. cuda_extensions/third_party/glm/glm/glm.hpp +137 -0
  26. cuda_extensions/third_party/glm/glm/gtc/bitfield.hpp +266 -0
  27. cuda_extensions/third_party/glm/glm/gtc/bitfield.inl +626 -0
  28. cuda_extensions/third_party/glm/glm/gtc/color_space.hpp +56 -0
  29. cuda_extensions/third_party/glm/glm/gtc/color_space.inl +84 -0
  30. cuda_extensions/third_party/glm/glm/gtc/constants.hpp +165 -0
  31. cuda_extensions/third_party/glm/glm/gtc/constants.inl +167 -0
  32. cuda_extensions/third_party/glm/glm/gtc/epsilon.hpp +60 -0
  33. cuda_extensions/third_party/glm/glm/gtc/epsilon.inl +80 -0
  34. cuda_extensions/third_party/glm/glm/gtc/integer.hpp +43 -0
  35. cuda_extensions/third_party/glm/glm/gtc/integer.inl +33 -0
  36. cuda_extensions/third_party/glm/glm/gtc/matrix_access.hpp +60 -0
  37. cuda_extensions/third_party/glm/glm/gtc/matrix_access.inl +62 -0
  38. cuda_extensions/third_party/glm/glm/gtc/matrix_integer.hpp +433 -0
  39. cuda_extensions/third_party/glm/glm/gtc/matrix_inverse.hpp +50 -0
  40. cuda_extensions/third_party/glm/glm/gtc/matrix_inverse.inl +118 -0
  41. cuda_extensions/third_party/glm/glm/gtc/matrix_transform.hpp +36 -0
  42. cuda_extensions/third_party/glm/glm/gtc/matrix_transform.inl +3 -0
  43. cuda_extensions/third_party/glm/glm/gtc/noise.hpp +61 -0
  44. cuda_extensions/third_party/glm/glm/gtc/noise.inl +807 -0
  45. cuda_extensions/third_party/glm/glm/gtc/packing.hpp +728 -0
  46. cuda_extensions/third_party/glm/glm/gtc/packing.inl +938 -0
  47. cuda_extensions/third_party/glm/glm/gtc/quaternion.hpp +173 -0
  48. cuda_extensions/third_party/glm/glm/gtc/quaternion.inl +208 -0
  49. cuda_extensions/third_party/glm/glm/gtc/quaternion_simd.inl +0 -0
  50. cuda_extensions/third_party/glm/glm/gtc/random.hpp +82 -0
cuda_extensions/third_party/glm/glm/ext.hpp ADDED
@@ -0,0 +1,255 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @file glm/ext.hpp
2
+ ///
3
+ /// @ref core (Dependence)
4
+
5
+ #include "detail/setup.hpp"
6
+
7
+ #pragma once
8
+
9
+ #include "glm.hpp"
10
+
11
+ #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_MESSAGE_EXT_INCLUDED_DISPLAYED)
12
+ # define GLM_MESSAGE_EXT_INCLUDED_DISPLAYED
13
+ # pragma message("GLM: All extensions included (not recommended)")
14
+ #endif//GLM_MESSAGES
15
+
16
+ #include "./ext/matrix_clip_space.hpp"
17
+ #include "./ext/matrix_common.hpp"
18
+
19
+ #include "./ext/matrix_double2x2.hpp"
20
+ #include "./ext/matrix_double2x2_precision.hpp"
21
+ #include "./ext/matrix_double2x3.hpp"
22
+ #include "./ext/matrix_double2x3_precision.hpp"
23
+ #include "./ext/matrix_double2x4.hpp"
24
+ #include "./ext/matrix_double2x4_precision.hpp"
25
+ #include "./ext/matrix_double3x2.hpp"
26
+ #include "./ext/matrix_double3x2_precision.hpp"
27
+ #include "./ext/matrix_double3x3.hpp"
28
+ #include "./ext/matrix_double3x3_precision.hpp"
29
+ #include "./ext/matrix_double3x4.hpp"
30
+ #include "./ext/matrix_double3x4_precision.hpp"
31
+ #include "./ext/matrix_double4x2.hpp"
32
+ #include "./ext/matrix_double4x2_precision.hpp"
33
+ #include "./ext/matrix_double4x3.hpp"
34
+ #include "./ext/matrix_double4x3_precision.hpp"
35
+ #include "./ext/matrix_double4x4.hpp"
36
+ #include "./ext/matrix_double4x4_precision.hpp"
37
+
38
+ #include "./ext/matrix_float2x2.hpp"
39
+ #include "./ext/matrix_float2x2_precision.hpp"
40
+ #include "./ext/matrix_float2x3.hpp"
41
+ #include "./ext/matrix_float2x3_precision.hpp"
42
+ #include "./ext/matrix_float2x4.hpp"
43
+ #include "./ext/matrix_float2x4_precision.hpp"
44
+ #include "./ext/matrix_float3x2.hpp"
45
+ #include "./ext/matrix_float3x2_precision.hpp"
46
+ #include "./ext/matrix_float3x3.hpp"
47
+ #include "./ext/matrix_float3x3_precision.hpp"
48
+ #include "./ext/matrix_float3x4.hpp"
49
+ #include "./ext/matrix_float3x4_precision.hpp"
50
+ #include "./ext/matrix_float4x2.hpp"
51
+ #include "./ext/matrix_float4x2_precision.hpp"
52
+ #include "./ext/matrix_float4x3.hpp"
53
+ #include "./ext/matrix_float4x3_precision.hpp"
54
+ #include "./ext/matrix_float4x4.hpp"
55
+ #include "./ext/matrix_float4x4_precision.hpp"
56
+
57
+ #include "./ext/matrix_int2x2.hpp"
58
+ #include "./ext/matrix_int2x2_sized.hpp"
59
+ #include "./ext/matrix_int2x3.hpp"
60
+ #include "./ext/matrix_int2x3_sized.hpp"
61
+ #include "./ext/matrix_int2x4.hpp"
62
+ #include "./ext/matrix_int2x4_sized.hpp"
63
+ #include "./ext/matrix_int3x2.hpp"
64
+ #include "./ext/matrix_int3x2_sized.hpp"
65
+ #include "./ext/matrix_int3x3.hpp"
66
+ #include "./ext/matrix_int3x3_sized.hpp"
67
+ #include "./ext/matrix_int3x4.hpp"
68
+ #include "./ext/matrix_int3x4_sized.hpp"
69
+ #include "./ext/matrix_int4x2.hpp"
70
+ #include "./ext/matrix_int4x2_sized.hpp"
71
+ #include "./ext/matrix_int4x3.hpp"
72
+ #include "./ext/matrix_int4x3_sized.hpp"
73
+ #include "./ext/matrix_int4x4.hpp"
74
+ #include "./ext/matrix_int4x4_sized.hpp"
75
+
76
+ #include "./ext/matrix_uint2x2.hpp"
77
+ #include "./ext/matrix_uint2x2_sized.hpp"
78
+ #include "./ext/matrix_uint2x3.hpp"
79
+ #include "./ext/matrix_uint2x3_sized.hpp"
80
+ #include "./ext/matrix_uint2x4.hpp"
81
+ #include "./ext/matrix_uint2x4_sized.hpp"
82
+ #include "./ext/matrix_uint3x2.hpp"
83
+ #include "./ext/matrix_uint3x2_sized.hpp"
84
+ #include "./ext/matrix_uint3x3.hpp"
85
+ #include "./ext/matrix_uint3x3_sized.hpp"
86
+ #include "./ext/matrix_uint3x4.hpp"
87
+ #include "./ext/matrix_uint3x4_sized.hpp"
88
+ #include "./ext/matrix_uint4x2.hpp"
89
+ #include "./ext/matrix_uint4x2_sized.hpp"
90
+ #include "./ext/matrix_uint4x3.hpp"
91
+ #include "./ext/matrix_uint4x3_sized.hpp"
92
+ #include "./ext/matrix_uint4x4.hpp"
93
+ #include "./ext/matrix_uint4x4_sized.hpp"
94
+
95
+ #include "./ext/matrix_projection.hpp"
96
+ #include "./ext/matrix_relational.hpp"
97
+ #include "./ext/matrix_transform.hpp"
98
+
99
+ #include "./ext/quaternion_common.hpp"
100
+ #include "./ext/quaternion_double.hpp"
101
+ #include "./ext/quaternion_double_precision.hpp"
102
+ #include "./ext/quaternion_float.hpp"
103
+ #include "./ext/quaternion_float_precision.hpp"
104
+ #include "./ext/quaternion_exponential.hpp"
105
+ #include "./ext/quaternion_geometric.hpp"
106
+ #include "./ext/quaternion_relational.hpp"
107
+ #include "./ext/quaternion_transform.hpp"
108
+ #include "./ext/quaternion_trigonometric.hpp"
109
+
110
+ #include "./ext/scalar_common.hpp"
111
+ #include "./ext/scalar_constants.hpp"
112
+ #include "./ext/scalar_integer.hpp"
113
+ #include "./ext/scalar_packing.hpp"
114
+ #include "./ext/scalar_reciprocal.hpp"
115
+ #include "./ext/scalar_relational.hpp"
116
+ #include "./ext/scalar_ulp.hpp"
117
+
118
+ #include "./ext/scalar_int_sized.hpp"
119
+ #include "./ext/scalar_uint_sized.hpp"
120
+
121
+ #include "./ext/vector_common.hpp"
122
+ #include "./ext/vector_integer.hpp"
123
+ #include "./ext/vector_packing.hpp"
124
+ #include "./ext/vector_reciprocal.hpp"
125
+ #include "./ext/vector_relational.hpp"
126
+ #include "./ext/vector_ulp.hpp"
127
+
128
+ #include "./ext/vector_bool1.hpp"
129
+ #include "./ext/vector_bool1_precision.hpp"
130
+ #include "./ext/vector_bool2.hpp"
131
+ #include "./ext/vector_bool2_precision.hpp"
132
+ #include "./ext/vector_bool3.hpp"
133
+ #include "./ext/vector_bool3_precision.hpp"
134
+ #include "./ext/vector_bool4.hpp"
135
+ #include "./ext/vector_bool4_precision.hpp"
136
+
137
+ #include "./ext/vector_double1.hpp"
138
+ #include "./ext/vector_double1_precision.hpp"
139
+ #include "./ext/vector_double2.hpp"
140
+ #include "./ext/vector_double2_precision.hpp"
141
+ #include "./ext/vector_double3.hpp"
142
+ #include "./ext/vector_double3_precision.hpp"
143
+ #include "./ext/vector_double4.hpp"
144
+ #include "./ext/vector_double4_precision.hpp"
145
+
146
+ #include "./ext/vector_float1.hpp"
147
+ #include "./ext/vector_float1_precision.hpp"
148
+ #include "./ext/vector_float2.hpp"
149
+ #include "./ext/vector_float2_precision.hpp"
150
+ #include "./ext/vector_float3.hpp"
151
+ #include "./ext/vector_float3_precision.hpp"
152
+ #include "./ext/vector_float4.hpp"
153
+ #include "./ext/vector_float4_precision.hpp"
154
+
155
+ #include "./ext/vector_int1.hpp"
156
+ #include "./ext/vector_int1_sized.hpp"
157
+ #include "./ext/vector_int2.hpp"
158
+ #include "./ext/vector_int2_sized.hpp"
159
+ #include "./ext/vector_int3.hpp"
160
+ #include "./ext/vector_int3_sized.hpp"
161
+ #include "./ext/vector_int4.hpp"
162
+ #include "./ext/vector_int4_sized.hpp"
163
+
164
+ #include "./ext/vector_uint1.hpp"
165
+ #include "./ext/vector_uint1_sized.hpp"
166
+ #include "./ext/vector_uint2.hpp"
167
+ #include "./ext/vector_uint2_sized.hpp"
168
+ #include "./ext/vector_uint3.hpp"
169
+ #include "./ext/vector_uint3_sized.hpp"
170
+ #include "./ext/vector_uint4.hpp"
171
+ #include "./ext/vector_uint4_sized.hpp"
172
+
173
+ #include "./gtc/bitfield.hpp"
174
+ #include "./gtc/color_space.hpp"
175
+ #include "./gtc/constants.hpp"
176
+ #include "./gtc/epsilon.hpp"
177
+ #include "./gtc/integer.hpp"
178
+ #include "./gtc/matrix_access.hpp"
179
+ #include "./gtc/matrix_integer.hpp"
180
+ #include "./gtc/matrix_inverse.hpp"
181
+ #include "./gtc/matrix_transform.hpp"
182
+ #include "./gtc/noise.hpp"
183
+ #include "./gtc/packing.hpp"
184
+ #include "./gtc/quaternion.hpp"
185
+ #include "./gtc/random.hpp"
186
+ #include "./gtc/reciprocal.hpp"
187
+ #include "./gtc/round.hpp"
188
+ #include "./gtc/type_precision.hpp"
189
+ #include "./gtc/type_ptr.hpp"
190
+ #include "./gtc/ulp.hpp"
191
+ #include "./gtc/vec1.hpp"
192
+ #if GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE
193
+ # include "./gtc/type_aligned.hpp"
194
+ #endif
195
+
196
+ #ifdef GLM_ENABLE_EXPERIMENTAL
197
+ #include "./gtx/associated_min_max.hpp"
198
+ #include "./gtx/bit.hpp"
199
+ #include "./gtx/closest_point.hpp"
200
+ #include "./gtx/color_encoding.hpp"
201
+ #include "./gtx/color_space.hpp"
202
+ #include "./gtx/color_space_YCoCg.hpp"
203
+ #include "./gtx/compatibility.hpp"
204
+ #include "./gtx/component_wise.hpp"
205
+ #include "./gtx/dual_quaternion.hpp"
206
+ #include "./gtx/euler_angles.hpp"
207
+ #include "./gtx/extend.hpp"
208
+ #include "./gtx/extended_min_max.hpp"
209
+ #include "./gtx/fast_exponential.hpp"
210
+ #include "./gtx/fast_square_root.hpp"
211
+ #include "./gtx/fast_trigonometry.hpp"
212
+ #include "./gtx/functions.hpp"
213
+ #include "./gtx/gradient_paint.hpp"
214
+ #include "./gtx/handed_coordinate_space.hpp"
215
+ #include "./gtx/integer.hpp"
216
+ #include "./gtx/intersect.hpp"
217
+ #include "./gtx/log_base.hpp"
218
+ #include "./gtx/matrix_cross_product.hpp"
219
+ #include "./gtx/matrix_interpolation.hpp"
220
+ #include "./gtx/matrix_major_storage.hpp"
221
+ #include "./gtx/matrix_operation.hpp"
222
+ #include "./gtx/matrix_query.hpp"
223
+ #include "./gtx/mixed_product.hpp"
224
+ #include "./gtx/norm.hpp"
225
+ #include "./gtx/normal.hpp"
226
+ #include "./gtx/normalize_dot.hpp"
227
+ #include "./gtx/number_precision.hpp"
228
+ #include "./gtx/optimum_pow.hpp"
229
+ #include "./gtx/orthonormalize.hpp"
230
+ #include "./gtx/perpendicular.hpp"
231
+ #include "./gtx/polar_coordinates.hpp"
232
+ #include "./gtx/projection.hpp"
233
+ #include "./gtx/quaternion.hpp"
234
+ #include "./gtx/raw_data.hpp"
235
+ #include "./gtx/rotate_vector.hpp"
236
+ #include "./gtx/spline.hpp"
237
+ #include "./gtx/std_based_type.hpp"
238
+ #if !((GLM_COMPILER & GLM_COMPILER_CUDA) || (GLM_COMPILER & GLM_COMPILER_HIP))
239
+ # include "./gtx/string_cast.hpp"
240
+ #endif
241
+ #include "./gtx/transform.hpp"
242
+ #include "./gtx/transform2.hpp"
243
+ #include "./gtx/vec_swizzle.hpp"
244
+ #include "./gtx/vector_angle.hpp"
245
+ #include "./gtx/vector_query.hpp"
246
+ #include "./gtx/wrap.hpp"
247
+
248
+ #if GLM_HAS_TEMPLATE_ALIASES
249
+ # include "./gtx/scalar_multiplication.hpp"
250
+ #endif
251
+
252
+ #if GLM_HAS_RANGE_FOR
253
+ # include "./gtx/range.hpp"
254
+ #endif
255
+ #endif//GLM_ENABLE_EXPERIMENTAL
cuda_extensions/third_party/glm/glm/ext/vector_int3_sized.hpp ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref ext_vector_int3_sized
2
+ /// @file glm/ext/vector_int3_sized.hpp
3
+ ///
4
+ /// @defgroup ext_vector_int3_sized GLM_EXT_vector_int3_sized
5
+ /// @ingroup ext
6
+ ///
7
+ /// Exposes sized signed integer vector of 3 components type.
8
+ ///
9
+ /// Include <glm/ext/vector_int3_sized.hpp> to use the features of this extension.
10
+ ///
11
+ /// @see ext_scalar_int_sized
12
+ /// @see ext_vector_uint3_sized
13
+
14
+ #pragma once
15
+
16
+ #include "../ext/vector_int3.hpp"
17
+ #include "../ext/scalar_int_sized.hpp"
18
+
19
+ #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
20
+ # pragma message("GLM: GLM_EXT_vector_int3_sized extension included")
21
+ #endif
22
+
23
+ namespace glm
24
+ {
25
+ /// @addtogroup ext_vector_int3_sized
26
+ /// @{
27
+
28
+ /// 8 bit signed integer vector of 3 components type.
29
+ ///
30
+ /// @see ext_vector_int3_sized
31
+ typedef vec<3, int8, defaultp> i8vec3;
32
+
33
+ /// 16 bit signed integer vector of 3 components type.
34
+ ///
35
+ /// @see ext_vector_int3_sized
36
+ typedef vec<3, int16, defaultp> i16vec3;
37
+
38
+ /// 32 bit signed integer vector of 3 components type.
39
+ ///
40
+ /// @see ext_vector_int3_sized
41
+ typedef vec<3, int32, defaultp> i32vec3;
42
+
43
+ /// 64 bit signed integer vector of 3 components type.
44
+ ///
45
+ /// @see ext_vector_int3_sized
46
+ typedef vec<3, int64, defaultp> i64vec3;
47
+
48
+ /// @}
49
+ }//namespace glm
cuda_extensions/third_party/glm/glm/ext/vector_int4.hpp ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref core
2
+ /// @file glm/ext/vector_int4.hpp
3
+
4
+ #pragma once
5
+ #include "../detail/type_vec4.hpp"
6
+
7
+ namespace glm
8
+ {
9
+ /// @addtogroup core_vector
10
+ /// @{
11
+
12
+ /// 4 components vector of signed integer numbers.
13
+ ///
14
+ /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
15
+ typedef vec<4, int, defaultp> ivec4;
16
+
17
+ /// @}
18
+ }//namespace glm
cuda_extensions/third_party/glm/glm/ext/vector_int4_sized.hpp ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref ext_vector_int4_sized
2
+ /// @file glm/ext/vector_int4_sized.hpp
3
+ ///
4
+ /// @defgroup ext_vector_int4_sized GLM_EXT_vector_int4_sized
5
+ /// @ingroup ext
6
+ ///
7
+ /// Exposes sized signed integer vector of 4 components type.
8
+ ///
9
+ /// Include <glm/ext/vector_int4_sized.hpp> to use the features of this extension.
10
+ ///
11
+ /// @see ext_scalar_int_sized
12
+ /// @see ext_vector_uint4_sized
13
+
14
+ #pragma once
15
+
16
+ #include "../ext/vector_int4.hpp"
17
+ #include "../ext/scalar_int_sized.hpp"
18
+
19
+ #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
20
+ # pragma message("GLM: GLM_EXT_vector_int4_sized extension included")
21
+ #endif
22
+
23
+ namespace glm
24
+ {
25
+ /// @addtogroup ext_vector_int4_sized
26
+ /// @{
27
+
28
+ /// 8 bit signed integer vector of 4 components type.
29
+ ///
30
+ /// @see ext_vector_int4_sized
31
+ typedef vec<4, int8, defaultp> i8vec4;
32
+
33
+ /// 16 bit signed integer vector of 4 components type.
34
+ ///
35
+ /// @see ext_vector_int4_sized
36
+ typedef vec<4, int16, defaultp> i16vec4;
37
+
38
+ /// 32 bit signed integer vector of 4 components type.
39
+ ///
40
+ /// @see ext_vector_int4_sized
41
+ typedef vec<4, int32, defaultp> i32vec4;
42
+
43
+ /// 64 bit signed integer vector of 4 components type.
44
+ ///
45
+ /// @see ext_vector_int4_sized
46
+ typedef vec<4, int64, defaultp> i64vec4;
47
+
48
+ /// @}
49
+ }//namespace glm
cuda_extensions/third_party/glm/glm/ext/vector_integer.hpp ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref ext_vector_integer
2
+ /// @file glm/ext/vector_integer.hpp
3
+ ///
4
+ /// @see core (dependence)
5
+ /// @see ext_vector_integer (dependence)
6
+ ///
7
+ /// @defgroup ext_vector_integer GLM_EXT_vector_integer
8
+ /// @ingroup ext
9
+ ///
10
+ /// Include <glm/ext/vector_integer.hpp> to use the features of this extension.
11
+
12
+ #pragma once
13
+
14
+ // Dependencies
15
+ #include "../detail/setup.hpp"
16
+ #include "../detail/qualifier.hpp"
17
+ #include "../detail/_vectorize.hpp"
18
+ #include "../vector_relational.hpp"
19
+ #include "../common.hpp"
20
+ #include <limits>
21
+
22
+ #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
23
+ # pragma message("GLM: GLM_EXT_vector_integer extension included")
24
+ #endif
25
+
26
+ namespace glm
27
+ {
28
+ /// @addtogroup ext_vector_integer
29
+ /// @{
30
+
31
+ /// Return true if the value is a power of two number.
32
+ ///
33
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
34
+ /// @tparam T Signed or unsigned integer scalar types.
35
+ /// @tparam Q Value from qualifier enum
36
+ ///
37
+ /// @see ext_vector_integer
38
+ template<length_t L, typename T, qualifier Q>
39
+ GLM_FUNC_DECL vec<L, bool, Q> isPowerOfTwo(vec<L, T, Q> const& v);
40
+
41
+ /// Return the power of two number which value is just higher the input value,
42
+ /// round up to a power of two.
43
+ ///
44
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
45
+ /// @tparam T Signed or unsigned integer scalar types.
46
+ /// @tparam Q Value from qualifier enum
47
+ ///
48
+ /// @see ext_vector_integer
49
+ template<length_t L, typename T, qualifier Q>
50
+ GLM_FUNC_DECL vec<L, T, Q> nextPowerOfTwo(vec<L, T, Q> const& v);
51
+
52
+ /// Return the power of two number which value is just lower the input value,
53
+ /// round down to a power of two.
54
+ ///
55
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
56
+ /// @tparam T Signed or unsigned integer scalar types.
57
+ /// @tparam Q Value from qualifier enum
58
+ ///
59
+ /// @see ext_vector_integer
60
+ template<length_t L, typename T, qualifier Q>
61
+ GLM_FUNC_DECL vec<L, T, Q> prevPowerOfTwo(vec<L, T, Q> const& v);
62
+
63
+ /// Return true if the 'Value' is a multiple of 'Multiple'.
64
+ ///
65
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
66
+ /// @tparam T Signed or unsigned integer scalar types.
67
+ /// @tparam Q Value from qualifier enum
68
+ ///
69
+ /// @see ext_vector_integer
70
+ template<length_t L, typename T, qualifier Q>
71
+ GLM_FUNC_DECL vec<L, bool, Q> isMultiple(vec<L, T, Q> const& v, T Multiple);
72
+
73
+ /// Return true if the 'Value' is a multiple of 'Multiple'.
74
+ ///
75
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
76
+ /// @tparam T Signed or unsigned integer scalar types.
77
+ /// @tparam Q Value from qualifier enum
78
+ ///
79
+ /// @see ext_vector_integer
80
+ template<length_t L, typename T, qualifier Q>
81
+ GLM_FUNC_DECL vec<L, bool, Q> isMultiple(vec<L, T, Q> const& v, vec<L, T, Q> const& Multiple);
82
+
83
+ /// Higher multiple number of Source.
84
+ ///
85
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
86
+ /// @tparam T Signed or unsigned integer scalar types.
87
+ /// @tparam Q Value from qualifier enum
88
+ ///
89
+ /// @param v Source values to which is applied the function
90
+ /// @param Multiple Must be a null or positive value
91
+ ///
92
+ /// @see ext_vector_integer
93
+ template<length_t L, typename T, qualifier Q>
94
+ GLM_FUNC_DECL vec<L, T, Q> nextMultiple(vec<L, T, Q> const& v, T Multiple);
95
+
96
+ /// Higher multiple number of Source.
97
+ ///
98
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
99
+ /// @tparam T Signed or unsigned integer scalar types.
100
+ /// @tparam Q Value from qualifier enum
101
+ ///
102
+ /// @param v Source values to which is applied the function
103
+ /// @param Multiple Must be a null or positive value
104
+ ///
105
+ /// @see ext_vector_integer
106
+ template<length_t L, typename T, qualifier Q>
107
+ GLM_FUNC_DECL vec<L, T, Q> nextMultiple(vec<L, T, Q> const& v, vec<L, T, Q> const& Multiple);
108
+
109
+ /// Lower multiple number of Source.
110
+ ///
111
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
112
+ /// @tparam T Signed or unsigned integer scalar types.
113
+ /// @tparam Q Value from qualifier enum
114
+ ///
115
+ /// @param v Source values to which is applied the function
116
+ /// @param Multiple Must be a null or positive value
117
+ ///
118
+ /// @see ext_vector_integer
119
+ template<length_t L, typename T, qualifier Q>
120
+ GLM_FUNC_DECL vec<L, T, Q> prevMultiple(vec<L, T, Q> const& v, T Multiple);
121
+
122
+ /// Lower multiple number of Source.
123
+ ///
124
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
125
+ /// @tparam T Signed or unsigned integer scalar types.
126
+ /// @tparam Q Value from qualifier enum
127
+ ///
128
+ /// @param v Source values to which is applied the function
129
+ /// @param Multiple Must be a null or positive value
130
+ ///
131
+ /// @see ext_vector_integer
132
+ template<length_t L, typename T, qualifier Q>
133
+ GLM_FUNC_DECL vec<L, T, Q> prevMultiple(vec<L, T, Q> const& v, vec<L, T, Q> const& Multiple);
134
+
135
+ /// Returns the bit number of the Nth significant bit set to
136
+ /// 1 in the binary representation of value.
137
+ /// If value bitcount is less than the Nth significant bit, -1 will be returned.
138
+ ///
139
+ /// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
140
+ /// @tparam T Signed or unsigned integer scalar types.
141
+ ///
142
+ /// @see ext_vector_integer
143
+ template<length_t L, typename T, qualifier Q>
144
+ GLM_FUNC_DECL vec<L, int, Q> findNSB(vec<L, T, Q> const& Source, vec<L, int, Q> SignificantBitCount);
145
+
146
+ /// @}
147
+ } //namespace glm
148
+
149
+ #include "vector_integer.inl"
cuda_extensions/third_party/glm/glm/ext/vector_integer.inl ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include "scalar_integer.hpp"
2
+
3
+ namespace glm
4
+ {
5
+ template<length_t L, typename T, qualifier Q>
6
+ GLM_FUNC_QUALIFIER vec<L, bool, Q> isPowerOfTwo(vec<L, T, Q> const& Value)
7
+ {
8
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'isPowerOfTwo' only accept integer inputs");
9
+
10
+ vec<L, T, Q> const Result(abs(Value));
11
+ return equal(Result & (Result - vec<L, T, Q>(1)), vec<L, T, Q>(0));
12
+ }
13
+
14
+ template<length_t L, typename T, qualifier Q>
15
+ GLM_FUNC_QUALIFIER vec<L, T, Q> nextPowerOfTwo(vec<L, T, Q> const& v)
16
+ {
17
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'nextPowerOfTwo' only accept integer inputs");
18
+
19
+ return detail::compute_ceilPowerOfTwo<L, T, Q, std::numeric_limits<T>::is_signed>::call(v);
20
+ }
21
+
22
+ template<length_t L, typename T, qualifier Q>
23
+ GLM_FUNC_QUALIFIER vec<L, T, Q> prevPowerOfTwo(vec<L, T, Q> const& v)
24
+ {
25
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'prevPowerOfTwo' only accept integer inputs");
26
+
27
+ return detail::functor1<vec, L, T, T, Q>::call(prevPowerOfTwo, v);
28
+ }
29
+
30
+ template<length_t L, typename T, qualifier Q>
31
+ GLM_FUNC_QUALIFIER vec<L, bool, Q> isMultiple(vec<L, T, Q> const& Value, T Multiple)
32
+ {
33
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'isMultiple' only accept integer inputs");
34
+
35
+ return equal(Value % Multiple, vec<L, T, Q>(0));
36
+ }
37
+
38
+ template<length_t L, typename T, qualifier Q>
39
+ GLM_FUNC_QUALIFIER vec<L, bool, Q> isMultiple(vec<L, T, Q> const& Value, vec<L, T, Q> const& Multiple)
40
+ {
41
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'isMultiple' only accept integer inputs");
42
+
43
+ return equal(Value % Multiple, vec<L, T, Q>(0));
44
+ }
45
+
46
+ template<length_t L, typename T, qualifier Q>
47
+ GLM_FUNC_QUALIFIER vec<L, T, Q> nextMultiple(vec<L, T, Q> const& Source, T Multiple)
48
+ {
49
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'nextMultiple' only accept integer inputs");
50
+
51
+ return detail::functor2<vec, L, T, Q>::call(nextMultiple, Source, vec<L, T, Q>(Multiple));
52
+ }
53
+
54
+ template<length_t L, typename T, qualifier Q>
55
+ GLM_FUNC_QUALIFIER vec<L, T, Q> nextMultiple(vec<L, T, Q> const& Source, vec<L, T, Q> const& Multiple)
56
+ {
57
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'nextMultiple' only accept integer inputs");
58
+
59
+ return detail::functor2<vec, L, T, Q>::call(nextMultiple, Source, Multiple);
60
+ }
61
+
62
+ template<length_t L, typename T, qualifier Q>
63
+ GLM_FUNC_QUALIFIER vec<L, T, Q> prevMultiple(vec<L, T, Q> const& Source, T Multiple)
64
+ {
65
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'prevMultiple' only accept integer inputs");
66
+
67
+ return detail::functor2<vec, L, T, Q>::call(prevMultiple, Source, vec<L, T, Q>(Multiple));
68
+ }
69
+
70
+ template<length_t L, typename T, qualifier Q>
71
+ GLM_FUNC_QUALIFIER vec<L, T, Q> prevMultiple(vec<L, T, Q> const& Source, vec<L, T, Q> const& Multiple)
72
+ {
73
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'prevMultiple' only accept integer inputs");
74
+
75
+ return detail::functor2<vec, L, T, Q>::call(prevMultiple, Source, Multiple);
76
+ }
77
+
78
+ template<length_t L, typename T, qualifier Q>
79
+ GLM_FUNC_QUALIFIER vec<L, int, Q> findNSB(vec<L, T, Q> const& Source, vec<L, int, Q> SignificantBitCount)
80
+ {
81
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'findNSB' only accept integer inputs");
82
+
83
+ return detail::functor2_vec_int<L, T, Q>::call(findNSB, Source, SignificantBitCount);
84
+ }
85
+ }//namespace glm
cuda_extensions/third_party/glm/glm/ext/vector_packing.hpp ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref ext_vector_packing
2
+ /// @file glm/ext/vector_packing.hpp
3
+ ///
4
+ /// @see core (dependence)
5
+ ///
6
+ /// @defgroup ext_vector_packing GLM_EXT_vector_packing
7
+ /// @ingroup ext
8
+ ///
9
+ /// Include <glm/ext/vector_packing.hpp> to use the features of this extension.
10
+ ///
11
+ /// This extension provides a set of function to convert vectors to packed
12
+ /// formats.
13
+
14
+ #pragma once
15
+
16
+ // Dependency:
17
+ #include "../detail/qualifier.hpp"
18
+
19
+ #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
20
+ # pragma message("GLM: GLM_EXT_vector_packing extension included")
21
+ #endif
22
+
23
+ namespace glm
24
+ {
25
+ /// @addtogroup ext_vector_packing
26
+ /// @{
27
+
28
+
29
+ /// @}
30
+ }// namespace glm
31
+
32
+ #include "vector_packing.inl"
cuda_extensions/third_party/glm/glm/ext/vector_packing.inl ADDED
File without changes
cuda_extensions/third_party/glm/glm/ext/vector_reciprocal.hpp ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref ext_vector_reciprocal
2
+ /// @file glm/ext/vector_reciprocal.hpp
3
+ ///
4
+ /// @see core (dependence)
5
+ ///
6
+ /// @defgroup ext_vector_reciprocal GLM_EXT_vector_reciprocal
7
+ /// @ingroup ext
8
+ ///
9
+ /// Include <glm/ext/vector_reciprocal.hpp> to use the features of this extension.
10
+ ///
11
+ /// Define secant, cosecant and cotangent functions.
12
+
13
+ #pragma once
14
+
15
+ // Dependencies
16
+ #include "../detail/setup.hpp"
17
+
18
+ #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
19
+ # pragma message("GLM: GLM_EXT_vector_reciprocal extension included")
20
+ #endif
21
+
22
+ namespace glm
23
+ {
24
+ /// @addtogroup ext_vector_reciprocal
25
+ /// @{
26
+
27
+ /// Secant function.
28
+ /// hypotenuse / adjacent or 1 / cos(x)
29
+ ///
30
+ /// @tparam genType Floating-point scalar or vector types.
31
+ ///
32
+ /// @see ext_vector_reciprocal
33
+ template<typename genType>
34
+ GLM_FUNC_DECL genType sec(genType angle);
35
+
36
+ /// Cosecant function.
37
+ /// hypotenuse / opposite or 1 / sin(x)
38
+ ///
39
+ /// @tparam genType Floating-point scalar or vector types.
40
+ ///
41
+ /// @see ext_vector_reciprocal
42
+ template<typename genType>
43
+ GLM_FUNC_DECL genType csc(genType angle);
44
+
45
+ /// Cotangent function.
46
+ /// adjacent / opposite or 1 / tan(x)
47
+ ///
48
+ /// @tparam genType Floating-point scalar or vector types.
49
+ ///
50
+ /// @see ext_vector_reciprocal
51
+ template<typename genType>
52
+ GLM_FUNC_DECL genType cot(genType angle);
53
+
54
+ /// Inverse secant function.
55
+ ///
56
+ /// @return Return an angle expressed in radians.
57
+ /// @tparam genType Floating-point scalar or vector types.
58
+ ///
59
+ /// @see ext_vector_reciprocal
60
+ template<typename genType>
61
+ GLM_FUNC_DECL genType asec(genType x);
62
+
63
+ /// Inverse cosecant function.
64
+ ///
65
+ /// @return Return an angle expressed in radians.
66
+ /// @tparam genType Floating-point scalar or vector types.
67
+ ///
68
+ /// @see ext_vector_reciprocal
69
+ template<typename genType>
70
+ GLM_FUNC_DECL genType acsc(genType x);
71
+
72
+ /// Inverse cotangent function.
73
+ ///
74
+ /// @return Return an angle expressed in radians.
75
+ /// @tparam genType Floating-point scalar or vector types.
76
+ ///
77
+ /// @see ext_vector_reciprocal
78
+ template<typename genType>
79
+ GLM_FUNC_DECL genType acot(genType x);
80
+
81
+ /// Secant hyperbolic function.
82
+ ///
83
+ /// @tparam genType Floating-point scalar or vector types.
84
+ ///
85
+ /// @see ext_vector_reciprocal
86
+ template<typename genType>
87
+ GLM_FUNC_DECL genType sech(genType angle);
88
+
89
+ /// Cosecant hyperbolic function.
90
+ ///
91
+ /// @tparam genType Floating-point scalar or vector types.
92
+ ///
93
+ /// @see ext_vector_reciprocal
94
+ template<typename genType>
95
+ GLM_FUNC_DECL genType csch(genType angle);
96
+
97
+ /// Cotangent hyperbolic function.
98
+ ///
99
+ /// @tparam genType Floating-point scalar or vector types.
100
+ ///
101
+ /// @see ext_vector_reciprocal
102
+ template<typename genType>
103
+ GLM_FUNC_DECL genType coth(genType angle);
104
+
105
+ /// Inverse secant hyperbolic function.
106
+ ///
107
+ /// @return Return an angle expressed in radians.
108
+ /// @tparam genType Floating-point scalar or vector types.
109
+ ///
110
+ /// @see ext_vector_reciprocal
111
+ template<typename genType>
112
+ GLM_FUNC_DECL genType asech(genType x);
113
+
114
+ /// Inverse cosecant hyperbolic function.
115
+ ///
116
+ /// @return Return an angle expressed in radians.
117
+ /// @tparam genType Floating-point scalar or vector types.
118
+ ///
119
+ /// @see ext_vector_reciprocal
120
+ template<typename genType>
121
+ GLM_FUNC_DECL genType acsch(genType x);
122
+
123
+ /// Inverse cotangent hyperbolic function.
124
+ ///
125
+ /// @return Return an angle expressed in radians.
126
+ /// @tparam genType Floating-point scalar or vector types.
127
+ ///
128
+ /// @see ext_vector_reciprocal
129
+ template<typename genType>
130
+ GLM_FUNC_DECL genType acoth(genType x);
131
+
132
+ /// @}
133
+ }//namespace glm
134
+
135
+ #include "vector_reciprocal.inl"
cuda_extensions/third_party/glm/glm/ext/vector_reciprocal.inl ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref ext_vector_reciprocal
2
+
3
+ #include "../trigonometric.hpp"
4
+ #include <limits>
5
+
6
+ namespace glm
7
+ {
8
+ // sec
9
+ template<length_t L, typename T, qualifier Q>
10
+ GLM_FUNC_QUALIFIER vec<L, T, Q> sec(vec<L, T, Q> const& x)
11
+ {
12
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'sec' only accept floating-point inputs");
13
+ return static_cast<T>(1) / detail::functor1<vec, L, T, T, Q>::call(cos, x);
14
+ }
15
+
16
+ // csc
17
+ template<length_t L, typename T, qualifier Q>
18
+ GLM_FUNC_QUALIFIER vec<L, T, Q> csc(vec<L, T, Q> const& x)
19
+ {
20
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'csc' only accept floating-point inputs");
21
+ return static_cast<T>(1) / detail::functor1<vec, L, T, T, Q>::call(sin, x);
22
+ }
23
+
24
+ // cot
25
+ template<length_t L, typename T, qualifier Q>
26
+ GLM_FUNC_QUALIFIER vec<L, T, Q> cot(vec<L, T, Q> const& x)
27
+ {
28
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'cot' only accept floating-point inputs");
29
+ T const pi_over_2 = static_cast<T>(3.1415926535897932384626433832795 / 2.0);
30
+ return detail::functor1<vec, L, T, T, Q>::call(tan, pi_over_2 - x);
31
+ }
32
+
33
+ // asec
34
+ template<length_t L, typename T, qualifier Q>
35
+ GLM_FUNC_QUALIFIER vec<L, T, Q> asec(vec<L, T, Q> const& x)
36
+ {
37
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'asec' only accept floating-point inputs");
38
+ return detail::functor1<vec, L, T, T, Q>::call(acos, static_cast<T>(1) / x);
39
+ }
40
+
41
+ // acsc
42
+ template<length_t L, typename T, qualifier Q>
43
+ GLM_FUNC_QUALIFIER vec<L, T, Q> acsc(vec<L, T, Q> const& x)
44
+ {
45
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acsc' only accept floating-point inputs");
46
+ return detail::functor1<vec, L, T, T, Q>::call(asin, static_cast<T>(1) / x);
47
+ }
48
+
49
+ // acot
50
+ template<length_t L, typename T, qualifier Q>
51
+ GLM_FUNC_QUALIFIER vec<L, T, Q> acot(vec<L, T, Q> const& x)
52
+ {
53
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acot' only accept floating-point inputs");
54
+ T const pi_over_2 = static_cast<T>(3.1415926535897932384626433832795 / 2.0);
55
+ return pi_over_2 - detail::functor1<vec, L, T, T, Q>::call(atan, x);
56
+ }
57
+
58
+ // sech
59
+ template<length_t L, typename T, qualifier Q>
60
+ GLM_FUNC_QUALIFIER vec<L, T, Q> sech(vec<L, T, Q> const& x)
61
+ {
62
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'sech' only accept floating-point inputs");
63
+ return static_cast<T>(1) / detail::functor1<vec, L, T, T, Q>::call(cosh, x);
64
+ }
65
+
66
+ // csch
67
+ template<length_t L, typename T, qualifier Q>
68
+ GLM_FUNC_QUALIFIER vec<L, T, Q> csch(vec<L, T, Q> const& x)
69
+ {
70
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'csch' only accept floating-point inputs");
71
+ return static_cast<T>(1) / detail::functor1<vec, L, T, T, Q>::call(sinh, x);
72
+ }
73
+
74
+ // coth
75
+ template<length_t L, typename T, qualifier Q>
76
+ GLM_FUNC_QUALIFIER vec<L, T, Q> coth(vec<L, T, Q> const& x)
77
+ {
78
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'coth' only accept floating-point inputs");
79
+ return glm::cosh(x) / glm::sinh(x);
80
+ }
81
+
82
+ // asech
83
+ template<length_t L, typename T, qualifier Q>
84
+ GLM_FUNC_QUALIFIER vec<L, T, Q> asech(vec<L, T, Q> const& x)
85
+ {
86
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'asech' only accept floating-point inputs");
87
+ return detail::functor1<vec, L, T, T, Q>::call(acosh, static_cast<T>(1) / x);
88
+ }
89
+
90
+ // acsch
91
+ template<length_t L, typename T, qualifier Q>
92
+ GLM_FUNC_QUALIFIER vec<L, T, Q> acsch(vec<L, T, Q> const& x)
93
+ {
94
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acsch' only accept floating-point inputs");
95
+ return detail::functor1<vec, L, T, T, Q>::call(asinh, static_cast<T>(1) / x);
96
+ }
97
+
98
+ // acoth
99
+ template<length_t L, typename T, qualifier Q>
100
+ GLM_FUNC_QUALIFIER vec<L, T, Q> acoth(vec<L, T, Q> const& x)
101
+ {
102
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acoth' only accept floating-point inputs");
103
+ return detail::functor1<vec, L, T, T, Q>::call(atanh, static_cast<T>(1) / x);
104
+ }
105
+ }//namespace glm
cuda_extensions/third_party/glm/glm/ext/vector_relational.hpp ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref ext_vector_relational
2
+ /// @file glm/ext/vector_relational.hpp
3
+ ///
4
+ /// @see core (dependence)
5
+ /// @see ext_scalar_integer (dependence)
6
+ ///
7
+ /// @defgroup ext_vector_relational GLM_EXT_vector_relational
8
+ /// @ingroup ext
9
+ ///
10
+ /// Exposes comparison functions for vector types that take a user defined epsilon values.
11
+ ///
12
+ /// Include <glm/ext/vector_relational.hpp> to use the features of this extension.
13
+ ///
14
+ /// @see core_vector_relational
15
+ /// @see ext_scalar_relational
16
+ /// @see ext_matrix_relational
17
+
18
+ #pragma once
19
+
20
+ // Dependencies
21
+ #include "../detail/qualifier.hpp"
22
+
23
+ #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
24
+ # pragma message("GLM: GLM_EXT_vector_relational extension included")
25
+ #endif
26
+
27
+ namespace glm
28
+ {
29
+ /// @addtogroup ext_vector_relational
30
+ /// @{
31
+
32
+ /// Returns the component-wise comparison of |x - y| < epsilon.
33
+ /// True if this expression is satisfied.
34
+ ///
35
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
36
+ /// @tparam T Floating-point or integer scalar types
37
+ /// @tparam Q Value from qualifier enum
38
+ template<length_t L, typename T, qualifier Q>
39
+ GLM_FUNC_DECL GLM_CONSTEXPR vec<L, bool, Q> equal(vec<L, T, Q> const& x, vec<L, T, Q> const& y, T epsilon);
40
+
41
+ /// Returns the component-wise comparison of |x - y| < epsilon.
42
+ /// True if this expression is satisfied.
43
+ ///
44
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
45
+ /// @tparam T Floating-point or integer scalar types
46
+ /// @tparam Q Value from qualifier enum
47
+ template<length_t L, typename T, qualifier Q>
48
+ GLM_FUNC_DECL GLM_CONSTEXPR vec<L, bool, Q> equal(vec<L, T, Q> const& x, vec<L, T, Q> const& y, vec<L, T, Q> const& epsilon);
49
+
50
+ /// Returns the component-wise comparison of |x - y| >= epsilon.
51
+ /// True if this expression is not satisfied.
52
+ ///
53
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
54
+ /// @tparam T Floating-point or integer scalar types
55
+ /// @tparam Q Value from qualifier enum
56
+ template<length_t L, typename T, qualifier Q>
57
+ GLM_FUNC_DECL GLM_CONSTEXPR vec<L, bool, Q> notEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y, T epsilon);
58
+
59
+ /// Returns the component-wise comparison of |x - y| >= epsilon.
60
+ /// True if this expression is not satisfied.
61
+ ///
62
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
63
+ /// @tparam T Floating-point or integer scalar types
64
+ /// @tparam Q Value from qualifier enum
65
+ template<length_t L, typename T, qualifier Q>
66
+ GLM_FUNC_DECL GLM_CONSTEXPR vec<L, bool, Q> notEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y, vec<L, T, Q> const& epsilon);
67
+
68
+ /// Returns the component-wise comparison between two vectors in term of ULPs.
69
+ /// True if this expression is satisfied.
70
+ ///
71
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
72
+ /// @tparam T Floating-point
73
+ /// @tparam Q Value from qualifier enum
74
+ template<length_t L, typename T, qualifier Q>
75
+ GLM_FUNC_DECL GLM_CONSTEXPR vec<L, bool, Q> equal(vec<L, T, Q> const& x, vec<L, T, Q> const& y, int ULPs);
76
+
77
+ /// Returns the component-wise comparison between two vectors in term of ULPs.
78
+ /// True if this expression is satisfied.
79
+ ///
80
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
81
+ /// @tparam T Floating-point
82
+ /// @tparam Q Value from qualifier enum
83
+ template<length_t L, typename T, qualifier Q>
84
+ GLM_FUNC_DECL GLM_CONSTEXPR vec<L, bool, Q> equal(vec<L, T, Q> const& x, vec<L, T, Q> const& y, vec<L, int, Q> const& ULPs);
85
+
86
+ /// Returns the component-wise comparison between two vectors in term of ULPs.
87
+ /// True if this expression is not satisfied.
88
+ ///
89
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
90
+ /// @tparam T Floating-point
91
+ /// @tparam Q Value from qualifier enum
92
+ template<length_t L, typename T, qualifier Q>
93
+ GLM_FUNC_DECL GLM_CONSTEXPR vec<L, bool, Q> notEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y, int ULPs);
94
+
95
+ /// Returns the component-wise comparison between two vectors in term of ULPs.
96
+ /// True if this expression is not satisfied.
97
+ ///
98
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
99
+ /// @tparam T Floating-point
100
+ /// @tparam Q Value from qualifier enum
101
+ template<length_t L, typename T, qualifier Q>
102
+ GLM_FUNC_DECL GLM_CONSTEXPR vec<L, bool, Q> notEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y, vec<L, int, Q> const& ULPs);
103
+
104
+ /// @}
105
+ }//namespace glm
106
+
107
+ #include "vector_relational.inl"
cuda_extensions/third_party/glm/glm/ext/vector_relational.inl ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include "../vector_relational.hpp"
2
+ #include "../common.hpp"
3
+ #include "../detail/qualifier.hpp"
4
+ #include "../detail/type_float.hpp"
5
+
6
+ namespace glm
7
+ {
8
+ template<length_t L, typename T, qualifier Q>
9
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, bool, Q> equal(vec<L, T, Q> const& x, vec<L, T, Q> const& y, T Epsilon)
10
+ {
11
+ return equal(x, y, vec<L, T, Q>(Epsilon));
12
+ }
13
+
14
+ template<length_t L, typename T, qualifier Q>
15
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, bool, Q> equal(vec<L, T, Q> const& x, vec<L, T, Q> const& y, vec<L, T, Q> const& Epsilon)
16
+ {
17
+ return lessThanEqual(abs(x - y), Epsilon);
18
+ }
19
+
20
+ template<length_t L, typename T, qualifier Q>
21
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, bool, Q> notEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y, T Epsilon)
22
+ {
23
+ return notEqual(x, y, vec<L, T, Q>(Epsilon));
24
+ }
25
+
26
+ template<length_t L, typename T, qualifier Q>
27
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, bool, Q> notEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y, vec<L, T, Q> const& Epsilon)
28
+ {
29
+ return greaterThan(abs(x - y), Epsilon);
30
+ }
31
+
32
+
33
+ template<length_t L, typename T, qualifier Q>
34
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, bool, Q> equal(vec<L, T, Q> const& x, vec<L, T, Q> const& y, int MaxULPs)
35
+ {
36
+ return equal(x, y, vec<L, int, Q>(MaxULPs));
37
+ }
38
+
39
+ template<length_t L, typename T, qualifier Q>
40
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, bool, Q> equal(vec<L, T, Q> const& x, vec<L, T, Q> const& y, vec<L, int, Q> const& MaxULPs)
41
+ {
42
+ vec<L, bool, Q> Result(false);
43
+ for(length_t i = 0; i < L; ++i)
44
+ {
45
+ detail::float_t<T> const a(x[i]);
46
+ detail::float_t<T> const b(y[i]);
47
+
48
+ // Different signs means they do not match.
49
+ if(a.negative() != b.negative())
50
+ {
51
+ // Check for equality to make sure +0==-0
52
+ Result[i] = a.mantissa() == b.mantissa() && a.exponent() == b.exponent();
53
+ }
54
+ else
55
+ {
56
+ // Find the difference in ULPs.
57
+ typename detail::float_t<T>::int_type const DiffULPs = abs(a.i - b.i);
58
+ Result[i] = DiffULPs <= MaxULPs[i];
59
+ }
60
+ }
61
+ return Result;
62
+ }
63
+
64
+ template<length_t L, typename T, qualifier Q>
65
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, bool, Q> notEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y, int MaxULPs)
66
+ {
67
+ return notEqual(x, y, vec<L, int, Q>(MaxULPs));
68
+ }
69
+
70
+ template<length_t L, typename T, qualifier Q>
71
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<L, bool, Q> notEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y, vec<L, int, Q> const& MaxULPs)
72
+ {
73
+ return not_(equal(x, y, MaxULPs));
74
+ }
75
+ }//namespace glm
cuda_extensions/third_party/glm/glm/ext/vector_uint1.hpp ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref ext_vector_uint1
2
+ /// @file glm/ext/vector_uint1.hpp
3
+ ///
4
+ /// @defgroup ext_vector_uint1 GLM_EXT_vector_uint1
5
+ /// @ingroup ext
6
+ ///
7
+ /// Exposes uvec1 vector type.
8
+ ///
9
+ /// Include <glm/ext/vector_uvec1.hpp> to use the features of this extension.
10
+ ///
11
+ /// @see ext_vector_int1 extension.
12
+ /// @see ext_vector_uint1_precision extension.
13
+
14
+ #pragma once
15
+
16
+ #include "../detail/type_vec1.hpp"
17
+
18
+ #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
19
+ # pragma message("GLM: GLM_EXT_vector_uint1 extension included")
20
+ #endif
21
+
22
+ namespace glm
23
+ {
24
+ /// @addtogroup ext_vector_uint1
25
+ /// @{
26
+
27
+ /// 1 component vector of unsigned integer numbers.
28
+ typedef vec<1, unsigned int, defaultp> uvec1;
29
+
30
+ /// @}
31
+ }//namespace glm
32
+
cuda_extensions/third_party/glm/glm/ext/vector_uint1_sized.hpp ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref ext_vector_uint1_sized
2
+ /// @file glm/ext/vector_uint1_sized.hpp
3
+ ///
4
+ /// @defgroup ext_vector_uint1_sized GLM_EXT_vector_uint1_sized
5
+ /// @ingroup ext
6
+ ///
7
+ /// Exposes sized unsigned integer vector types.
8
+ ///
9
+ /// Include <glm/ext/vector_uint1_sized.hpp> to use the features of this extension.
10
+ ///
11
+ /// @see ext_scalar_uint_sized
12
+ /// @see ext_vector_int1_sized
13
+
14
+ #pragma once
15
+
16
+ #include "../ext/vector_uint1.hpp"
17
+ #include "../ext/scalar_uint_sized.hpp"
18
+
19
+ #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
20
+ # pragma message("GLM: GLM_EXT_vector_uint1_sized extension included")
21
+ #endif
22
+
23
+ namespace glm
24
+ {
25
+ /// @addtogroup ext_vector_uint1_sized
26
+ /// @{
27
+
28
+ /// 8 bit unsigned integer vector of 1 component type.
29
+ ///
30
+ /// @see ext_vector_uint1_sized
31
+ typedef vec<1, uint8, defaultp> u8vec1;
32
+
33
+ /// 16 bit unsigned integer vector of 1 component type.
34
+ ///
35
+ /// @see ext_vector_uint1_sized
36
+ typedef vec<1, uint16, defaultp> u16vec1;
37
+
38
+ /// 32 bit unsigned integer vector of 1 component type.
39
+ ///
40
+ /// @see ext_vector_uint1_sized
41
+ typedef vec<1, uint32, defaultp> u32vec1;
42
+
43
+ /// 64 bit unsigned integer vector of 1 component type.
44
+ ///
45
+ /// @see ext_vector_uint1_sized
46
+ typedef vec<1, uint64, defaultp> u64vec1;
47
+
48
+ /// @}
49
+ }//namespace glm
cuda_extensions/third_party/glm/glm/ext/vector_uint2.hpp ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref core
2
+ /// @file glm/ext/vector_uint2.hpp
3
+
4
+ #pragma once
5
+ #include "../detail/type_vec2.hpp"
6
+
7
+ namespace glm
8
+ {
9
+ /// @addtogroup core_vector
10
+ /// @{
11
+
12
+ /// 2 components vector of unsigned integer numbers.
13
+ ///
14
+ /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
15
+ typedef vec<2, unsigned int, defaultp> uvec2;
16
+
17
+ /// @}
18
+ }//namespace glm
cuda_extensions/third_party/glm/glm/ext/vector_uint2_sized.hpp ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref ext_vector_uint2_sized
2
+ /// @file glm/ext/vector_uint2_sized.hpp
3
+ ///
4
+ /// @defgroup ext_vector_uint2_sized GLM_EXT_vector_uint2_sized
5
+ /// @ingroup ext
6
+ ///
7
+ /// Exposes sized unsigned integer vector of 2 components type.
8
+ ///
9
+ /// Include <glm/ext/vector_uint2_sized.hpp> to use the features of this extension.
10
+ ///
11
+ /// @see ext_scalar_uint_sized
12
+ /// @see ext_vector_int2_sized
13
+
14
+ #pragma once
15
+
16
+ #include "../ext/vector_uint2.hpp"
17
+ #include "../ext/scalar_uint_sized.hpp"
18
+
19
+ #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
20
+ # pragma message("GLM: GLM_EXT_vector_uint2_sized extension included")
21
+ #endif
22
+
23
+ namespace glm
24
+ {
25
+ /// @addtogroup ext_vector_uint2_sized
26
+ /// @{
27
+
28
+ /// 8 bit unsigned integer vector of 2 components type.
29
+ ///
30
+ /// @see ext_vector_uint2_sized
31
+ typedef vec<2, uint8, defaultp> u8vec2;
32
+
33
+ /// 16 bit unsigned integer vector of 2 components type.
34
+ ///
35
+ /// @see ext_vector_uint2_sized
36
+ typedef vec<2, uint16, defaultp> u16vec2;
37
+
38
+ /// 32 bit unsigned integer vector of 2 components type.
39
+ ///
40
+ /// @see ext_vector_uint2_sized
41
+ typedef vec<2, uint32, defaultp> u32vec2;
42
+
43
+ /// 64 bit unsigned integer vector of 2 components type.
44
+ ///
45
+ /// @see ext_vector_uint2_sized
46
+ typedef vec<2, uint64, defaultp> u64vec2;
47
+
48
+ /// @}
49
+ }//namespace glm
cuda_extensions/third_party/glm/glm/ext/vector_uint3.hpp ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref core
2
+ /// @file glm/ext/vector_uint3.hpp
3
+
4
+ #pragma once
5
+ #include "../detail/type_vec3.hpp"
6
+
7
+ namespace glm
8
+ {
9
+ /// @addtogroup core_vector
10
+ /// @{
11
+
12
+ /// 3 components vector of unsigned integer numbers.
13
+ ///
14
+ /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
15
+ typedef vec<3, unsigned int, defaultp> uvec3;
16
+
17
+ /// @}
18
+ }//namespace glm
cuda_extensions/third_party/glm/glm/ext/vector_uint3_sized.hpp ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref ext_vector_uint3_sized
2
+ /// @file glm/ext/vector_uint3_sized.hpp
3
+ ///
4
+ /// @defgroup ext_vector_uint3_sized GLM_EXT_vector_uint3_sized
5
+ /// @ingroup ext
6
+ ///
7
+ /// Exposes sized unsigned integer vector of 3 components type.
8
+ ///
9
+ /// Include <glm/ext/vector_uint3_sized.hpp> to use the features of this extension.
10
+ ///
11
+ /// @see ext_scalar_uint_sized
12
+ /// @see ext_vector_int3_sized
13
+
14
+ #pragma once
15
+
16
+ #include "../ext/vector_uint3.hpp"
17
+ #include "../ext/scalar_uint_sized.hpp"
18
+
19
+ #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
20
+ # pragma message("GLM: GLM_EXT_vector_uint3_sized extension included")
21
+ #endif
22
+
23
+ namespace glm
24
+ {
25
+ /// @addtogroup ext_vector_uint3_sized
26
+ /// @{
27
+
28
+ /// 8 bit unsigned integer vector of 3 components type.
29
+ ///
30
+ /// @see ext_vector_uint3_sized
31
+ typedef vec<3, uint8, defaultp> u8vec3;
32
+
33
+ /// 16 bit unsigned integer vector of 3 components type.
34
+ ///
35
+ /// @see ext_vector_uint3_sized
36
+ typedef vec<3, uint16, defaultp> u16vec3;
37
+
38
+ /// 32 bit unsigned integer vector of 3 components type.
39
+ ///
40
+ /// @see ext_vector_uint3_sized
41
+ typedef vec<3, uint32, defaultp> u32vec3;
42
+
43
+ /// 64 bit unsigned integer vector of 3 components type.
44
+ ///
45
+ /// @see ext_vector_uint3_sized
46
+ typedef vec<3, uint64, defaultp> u64vec3;
47
+
48
+ /// @}
49
+ }//namespace glm
cuda_extensions/third_party/glm/glm/ext/vector_uint4.hpp ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref core
2
+ /// @file glm/ext/vector_uint4.hpp
3
+
4
+ #pragma once
5
+ #include "../detail/type_vec4.hpp"
6
+
7
+ namespace glm
8
+ {
9
+ /// @addtogroup core_vector
10
+ /// @{
11
+
12
+ /// 4 components vector of unsigned integer numbers.
13
+ ///
14
+ /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
15
+ typedef vec<4, unsigned int, defaultp> uvec4;
16
+
17
+ /// @}
18
+ }//namespace glm
cuda_extensions/third_party/glm/glm/ext/vector_uint4_sized.hpp ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref ext_vector_uint4_sized
2
+ /// @file glm/ext/vector_uint4_sized.hpp
3
+ ///
4
+ /// @defgroup ext_vector_uint4_sized GLM_EXT_vector_uint4_sized
5
+ /// @ingroup ext
6
+ ///
7
+ /// Exposes sized unsigned integer vector of 4 components type.
8
+ ///
9
+ /// Include <glm/ext/vector_uint4_sized.hpp> to use the features of this extension.
10
+ ///
11
+ /// @see ext_scalar_uint_sized
12
+ /// @see ext_vector_int4_sized
13
+
14
+ #pragma once
15
+
16
+ #include "../ext/vector_uint4.hpp"
17
+ #include "../ext/scalar_uint_sized.hpp"
18
+
19
+ #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
20
+ # pragma message("GLM: GLM_EXT_vector_uint4_sized extension included")
21
+ #endif
22
+
23
+ namespace glm
24
+ {
25
+ /// @addtogroup ext_vector_uint4_sized
26
+ /// @{
27
+
28
+ /// 8 bit unsigned integer vector of 4 components type.
29
+ ///
30
+ /// @see ext_vector_uint4_sized
31
+ typedef vec<4, uint8, defaultp> u8vec4;
32
+
33
+ /// 16 bit unsigned integer vector of 4 components type.
34
+ ///
35
+ /// @see ext_vector_uint4_sized
36
+ typedef vec<4, uint16, defaultp> u16vec4;
37
+
38
+ /// 32 bit unsigned integer vector of 4 components type.
39
+ ///
40
+ /// @see ext_vector_uint4_sized
41
+ typedef vec<4, uint32, defaultp> u32vec4;
42
+
43
+ /// 64 bit unsigned integer vector of 4 components type.
44
+ ///
45
+ /// @see ext_vector_uint4_sized
46
+ typedef vec<4, uint64, defaultp> u64vec4;
47
+
48
+ /// @}
49
+ }//namespace glm
cuda_extensions/third_party/glm/glm/ext/vector_ulp.hpp ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref ext_vector_ulp
2
+ /// @file glm/ext/vector_ulp.hpp
3
+ ///
4
+ /// @defgroup ext_vector_ulp GLM_EXT_vector_ulp
5
+ /// @ingroup ext
6
+ ///
7
+ /// Allow the measurement of the accuracy of a function against a reference
8
+ /// implementation. This extension works on floating-point data and provide results
9
+ /// in ULP.
10
+ ///
11
+ /// Include <glm/ext/vector_ulp.hpp> to use the features of this extension.
12
+ ///
13
+ /// @see ext_scalar_ulp
14
+ /// @see ext_scalar_relational
15
+ /// @see ext_vector_relational
16
+
17
+ #pragma once
18
+
19
+ // Dependencies
20
+ #include "../ext/scalar_ulp.hpp"
21
+
22
+ #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
23
+ # pragma message("GLM: GLM_EXT_vector_ulp extension included")
24
+ #endif
25
+
26
+ namespace glm
27
+ {
28
+ /// @addtogroup ext_vector_ulp
29
+ /// @{
30
+
31
+ /// Return the next ULP value(s) after the input value(s).
32
+ ///
33
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
34
+ /// @tparam T Floating-point
35
+ /// @tparam Q Value from qualifier enum
36
+ ///
37
+ /// @see ext_scalar_ulp
38
+ template<length_t L, typename T, qualifier Q>
39
+ GLM_FUNC_DECL vec<L, T, Q> nextFloat(vec<L, T, Q> const& x);
40
+
41
+ /// Return the value(s) ULP distance after the input value(s).
42
+ ///
43
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
44
+ /// @tparam T Floating-point
45
+ /// @tparam Q Value from qualifier enum
46
+ ///
47
+ /// @see ext_scalar_ulp
48
+ template<length_t L, typename T, qualifier Q>
49
+ GLM_FUNC_DECL vec<L, T, Q> nextFloat(vec<L, T, Q> const& x, int ULPs);
50
+
51
+ /// Return the value(s) ULP distance after the input value(s).
52
+ ///
53
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
54
+ /// @tparam T Floating-point
55
+ /// @tparam Q Value from qualifier enum
56
+ ///
57
+ /// @see ext_scalar_ulp
58
+ template<length_t L, typename T, qualifier Q>
59
+ GLM_FUNC_DECL vec<L, T, Q> nextFloat(vec<L, T, Q> const& x, vec<L, int, Q> const& ULPs);
60
+
61
+ /// Return the previous ULP value(s) before the input value(s).
62
+ ///
63
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
64
+ /// @tparam T Floating-point
65
+ /// @tparam Q Value from qualifier enum
66
+ ///
67
+ /// @see ext_scalar_ulp
68
+ template<length_t L, typename T, qualifier Q>
69
+ GLM_FUNC_DECL vec<L, T, Q> prevFloat(vec<L, T, Q> const& x);
70
+
71
+ /// Return the value(s) ULP distance before the input value(s).
72
+ ///
73
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
74
+ /// @tparam T Floating-point
75
+ /// @tparam Q Value from qualifier enum
76
+ ///
77
+ /// @see ext_scalar_ulp
78
+ template<length_t L, typename T, qualifier Q>
79
+ GLM_FUNC_DECL vec<L, T, Q> prevFloat(vec<L, T, Q> const& x, int ULPs);
80
+
81
+ /// Return the value(s) ULP distance before the input value(s).
82
+ ///
83
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
84
+ /// @tparam T Floating-point
85
+ /// @tparam Q Value from qualifier enum
86
+ ///
87
+ /// @see ext_scalar_ulp
88
+ template<length_t L, typename T, qualifier Q>
89
+ GLM_FUNC_DECL vec<L, T, Q> prevFloat(vec<L, T, Q> const& x, vec<L, int, Q> const& ULPs);
90
+
91
+ /// Return the distance in the number of ULP between 2 single-precision floating-point scalars.
92
+ ///
93
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
94
+ /// @tparam Q Value from qualifier enum
95
+ ///
96
+ /// @see ext_scalar_ulp
97
+ template<length_t L, typename T, qualifier Q>
98
+ GLM_FUNC_DECL vec<L, int, Q> floatDistance(vec<L, float, Q> const& x, vec<L, float, Q> const& y);
99
+
100
+ /// Return the distance in the number of ULP between 2 double-precision floating-point scalars.
101
+ ///
102
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
103
+ /// @tparam Q Value from qualifier enum
104
+ ///
105
+ /// @see ext_scalar_ulp
106
+ template<length_t L, typename T, qualifier Q>
107
+ GLM_FUNC_DECL vec<L, int64, Q> floatDistance(vec<L, double, Q> const& x, vec<L, double, Q> const& y);
108
+
109
+ /// @}
110
+ }//namespace glm
111
+
112
+ #include "vector_ulp.inl"
cuda_extensions/third_party/glm/glm/ext/vector_ulp.inl ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ namespace glm
2
+ {
3
+ template<length_t L, typename T, qualifier Q>
4
+ GLM_FUNC_QUALIFIER vec<L, T, Q> nextFloat(vec<L, T, Q> const& x)
5
+ {
6
+ vec<L, T, Q> Result;
7
+ for(length_t i = 0, n = Result.length(); i < n; ++i)
8
+ Result[i] = nextFloat(x[i]);
9
+ return Result;
10
+ }
11
+
12
+ template<length_t L, typename T, qualifier Q>
13
+ GLM_FUNC_QUALIFIER vec<L, T, Q> nextFloat(vec<L, T, Q> const& x, int ULPs)
14
+ {
15
+ vec<L, T, Q> Result;
16
+ for(length_t i = 0, n = Result.length(); i < n; ++i)
17
+ Result[i] = nextFloat(x[i], ULPs);
18
+ return Result;
19
+ }
20
+
21
+ template<length_t L, typename T, qualifier Q>
22
+ GLM_FUNC_QUALIFIER vec<L, T, Q> nextFloat(vec<L, T, Q> const& x, vec<L, int, Q> const& ULPs)
23
+ {
24
+ vec<L, T, Q> Result;
25
+ for(length_t i = 0, n = Result.length(); i < n; ++i)
26
+ Result[i] = nextFloat(x[i], ULPs[i]);
27
+ return Result;
28
+ }
29
+
30
+ template<length_t L, typename T, qualifier Q>
31
+ GLM_FUNC_QUALIFIER vec<L, T, Q> prevFloat(vec<L, T, Q> const& x)
32
+ {
33
+ vec<L, T, Q> Result;
34
+ for(length_t i = 0, n = Result.length(); i < n; ++i)
35
+ Result[i] = prevFloat(x[i]);
36
+ return Result;
37
+ }
38
+
39
+ template<length_t L, typename T, qualifier Q>
40
+ GLM_FUNC_QUALIFIER vec<L, T, Q> prevFloat(vec<L, T, Q> const& x, int ULPs)
41
+ {
42
+ vec<L, T, Q> Result;
43
+ for(length_t i = 0, n = Result.length(); i < n; ++i)
44
+ Result[i] = prevFloat(x[i], ULPs);
45
+ return Result;
46
+ }
47
+
48
+ template<length_t L, typename T, qualifier Q>
49
+ GLM_FUNC_QUALIFIER vec<L, T, Q> prevFloat(vec<L, T, Q> const& x, vec<L, int, Q> const& ULPs)
50
+ {
51
+ vec<L, T, Q> Result;
52
+ for(length_t i = 0, n = Result.length(); i < n; ++i)
53
+ Result[i] = prevFloat(x[i], ULPs[i]);
54
+ return Result;
55
+ }
56
+
57
+ template<length_t L, qualifier Q>
58
+ GLM_FUNC_QUALIFIER vec<L, int, Q> floatDistance(vec<L, float, Q> const& x, vec<L, float, Q> const& y)
59
+ {
60
+ vec<L, int, Q> Result;
61
+ for(length_t i = 0, n = Result.length(); i < n; ++i)
62
+ Result[i] = floatDistance(x[i], y[i]);
63
+ return Result;
64
+ }
65
+
66
+ template<length_t L, qualifier Q>
67
+ GLM_FUNC_QUALIFIER vec<L, int64, Q> floatDistance(vec<L, double, Q> const& x, vec<L, double, Q> const& y)
68
+ {
69
+ vec<L, int64, Q> Result;
70
+ for(length_t i = 0, n = Result.length(); i < n; ++i)
71
+ Result[i] = floatDistance(x[i], y[i]);
72
+ return Result;
73
+ }
74
+ }//namespace glm
cuda_extensions/third_party/glm/glm/fwd.hpp ADDED
@@ -0,0 +1,1233 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ #include "detail/qualifier.hpp"
4
+
5
+ namespace glm
6
+ {
7
+ #if GLM_HAS_EXTENDED_INTEGER_TYPE
8
+ typedef std::int8_t int8;
9
+ typedef std::int16_t int16;
10
+ typedef std::int32_t int32;
11
+ typedef std::int64_t int64;
12
+
13
+ typedef std::uint8_t uint8;
14
+ typedef std::uint16_t uint16;
15
+ typedef std::uint32_t uint32;
16
+ typedef std::uint64_t uint64;
17
+ #else
18
+ typedef signed char int8;
19
+ typedef signed short int16;
20
+ typedef signed int int32;
21
+ typedef detail::int64 int64;
22
+
23
+ typedef unsigned char uint8;
24
+ typedef unsigned short uint16;
25
+ typedef unsigned int uint32;
26
+ typedef detail::uint64 uint64;
27
+ #endif
28
+
29
+ // Scalar int
30
+
31
+ typedef int8 lowp_i8;
32
+ typedef int8 mediump_i8;
33
+ typedef int8 highp_i8;
34
+ typedef int8 i8;
35
+
36
+ typedef int8 lowp_int8;
37
+ typedef int8 mediump_int8;
38
+ typedef int8 highp_int8;
39
+
40
+ typedef int8 lowp_int8_t;
41
+ typedef int8 mediump_int8_t;
42
+ typedef int8 highp_int8_t;
43
+ typedef int8 int8_t;
44
+
45
+ typedef int16 lowp_i16;
46
+ typedef int16 mediump_i16;
47
+ typedef int16 highp_i16;
48
+ typedef int16 i16;
49
+
50
+ typedef int16 lowp_int16;
51
+ typedef int16 mediump_int16;
52
+ typedef int16 highp_int16;
53
+
54
+ typedef int16 lowp_int16_t;
55
+ typedef int16 mediump_int16_t;
56
+ typedef int16 highp_int16_t;
57
+ typedef int16 int16_t;
58
+
59
+ typedef int32 lowp_i32;
60
+ typedef int32 mediump_i32;
61
+ typedef int32 highp_i32;
62
+ typedef int32 i32;
63
+
64
+ typedef int32 lowp_int32;
65
+ typedef int32 mediump_int32;
66
+ typedef int32 highp_int32;
67
+
68
+ typedef int32 lowp_int32_t;
69
+ typedef int32 mediump_int32_t;
70
+ typedef int32 highp_int32_t;
71
+ typedef int32 int32_t;
72
+
73
+ typedef int64 lowp_i64;
74
+ typedef int64 mediump_i64;
75
+ typedef int64 highp_i64;
76
+ typedef int64 i64;
77
+
78
+ typedef int64 lowp_int64;
79
+ typedef int64 mediump_int64;
80
+ typedef int64 highp_int64;
81
+
82
+ typedef int64 lowp_int64_t;
83
+ typedef int64 mediump_int64_t;
84
+ typedef int64 highp_int64_t;
85
+ typedef int64 int64_t;
86
+
87
+ // Scalar uint
88
+
89
+ typedef unsigned int uint;
90
+
91
+ typedef uint8 lowp_u8;
92
+ typedef uint8 mediump_u8;
93
+ typedef uint8 highp_u8;
94
+ typedef uint8 u8;
95
+
96
+ typedef uint8 lowp_uint8;
97
+ typedef uint8 mediump_uint8;
98
+ typedef uint8 highp_uint8;
99
+
100
+ typedef uint8 lowp_uint8_t;
101
+ typedef uint8 mediump_uint8_t;
102
+ typedef uint8 highp_uint8_t;
103
+ typedef uint8 uint8_t;
104
+
105
+ typedef uint16 lowp_u16;
106
+ typedef uint16 mediump_u16;
107
+ typedef uint16 highp_u16;
108
+ typedef uint16 u16;
109
+
110
+ typedef uint16 lowp_uint16;
111
+ typedef uint16 mediump_uint16;
112
+ typedef uint16 highp_uint16;
113
+
114
+ typedef uint16 lowp_uint16_t;
115
+ typedef uint16 mediump_uint16_t;
116
+ typedef uint16 highp_uint16_t;
117
+ typedef uint16 uint16_t;
118
+
119
+ typedef uint32 lowp_u32;
120
+ typedef uint32 mediump_u32;
121
+ typedef uint32 highp_u32;
122
+ typedef uint32 u32;
123
+
124
+ typedef uint32 lowp_uint32;
125
+ typedef uint32 mediump_uint32;
126
+ typedef uint32 highp_uint32;
127
+
128
+ typedef uint32 lowp_uint32_t;
129
+ typedef uint32 mediump_uint32_t;
130
+ typedef uint32 highp_uint32_t;
131
+ typedef uint32 uint32_t;
132
+
133
+ typedef uint64 lowp_u64;
134
+ typedef uint64 mediump_u64;
135
+ typedef uint64 highp_u64;
136
+ typedef uint64 u64;
137
+
138
+ typedef uint64 lowp_uint64;
139
+ typedef uint64 mediump_uint64;
140
+ typedef uint64 highp_uint64;
141
+
142
+ typedef uint64 lowp_uint64_t;
143
+ typedef uint64 mediump_uint64_t;
144
+ typedef uint64 highp_uint64_t;
145
+ typedef uint64 uint64_t;
146
+
147
+ // Scalar float
148
+
149
+ typedef float lowp_f32;
150
+ typedef float mediump_f32;
151
+ typedef float highp_f32;
152
+ typedef float f32;
153
+
154
+ typedef float lowp_float32;
155
+ typedef float mediump_float32;
156
+ typedef float highp_float32;
157
+ typedef float float32;
158
+
159
+ typedef float lowp_float32_t;
160
+ typedef float mediump_float32_t;
161
+ typedef float highp_float32_t;
162
+ typedef float float32_t;
163
+
164
+
165
+ typedef double lowp_f64;
166
+ typedef double mediump_f64;
167
+ typedef double highp_f64;
168
+ typedef double f64;
169
+
170
+ typedef double lowp_float64;
171
+ typedef double mediump_float64;
172
+ typedef double highp_float64;
173
+ typedef double float64;
174
+
175
+ typedef double lowp_float64_t;
176
+ typedef double mediump_float64_t;
177
+ typedef double highp_float64_t;
178
+ typedef double float64_t;
179
+
180
+ // Vector bool
181
+
182
+ typedef vec<1, bool, lowp> lowp_bvec1;
183
+ typedef vec<2, bool, lowp> lowp_bvec2;
184
+ typedef vec<3, bool, lowp> lowp_bvec3;
185
+ typedef vec<4, bool, lowp> lowp_bvec4;
186
+
187
+ typedef vec<1, bool, mediump> mediump_bvec1;
188
+ typedef vec<2, bool, mediump> mediump_bvec2;
189
+ typedef vec<3, bool, mediump> mediump_bvec3;
190
+ typedef vec<4, bool, mediump> mediump_bvec4;
191
+
192
+ typedef vec<1, bool, highp> highp_bvec1;
193
+ typedef vec<2, bool, highp> highp_bvec2;
194
+ typedef vec<3, bool, highp> highp_bvec3;
195
+ typedef vec<4, bool, highp> highp_bvec4;
196
+
197
+ typedef vec<1, bool, defaultp> bvec1;
198
+ typedef vec<2, bool, defaultp> bvec2;
199
+ typedef vec<3, bool, defaultp> bvec3;
200
+ typedef vec<4, bool, defaultp> bvec4;
201
+
202
+ // Vector int
203
+
204
+ typedef vec<1, int, lowp> lowp_ivec1;
205
+ typedef vec<2, int, lowp> lowp_ivec2;
206
+ typedef vec<3, int, lowp> lowp_ivec3;
207
+ typedef vec<4, int, lowp> lowp_ivec4;
208
+
209
+ typedef vec<1, int, mediump> mediump_ivec1;
210
+ typedef vec<2, int, mediump> mediump_ivec2;
211
+ typedef vec<3, int, mediump> mediump_ivec3;
212
+ typedef vec<4, int, mediump> mediump_ivec4;
213
+
214
+ typedef vec<1, int, highp> highp_ivec1;
215
+ typedef vec<2, int, highp> highp_ivec2;
216
+ typedef vec<3, int, highp> highp_ivec3;
217
+ typedef vec<4, int, highp> highp_ivec4;
218
+
219
+ typedef vec<1, int, defaultp> ivec1;
220
+ typedef vec<2, int, defaultp> ivec2;
221
+ typedef vec<3, int, defaultp> ivec3;
222
+ typedef vec<4, int, defaultp> ivec4;
223
+
224
+ typedef vec<1, i8, lowp> lowp_i8vec1;
225
+ typedef vec<2, i8, lowp> lowp_i8vec2;
226
+ typedef vec<3, i8, lowp> lowp_i8vec3;
227
+ typedef vec<4, i8, lowp> lowp_i8vec4;
228
+
229
+ typedef vec<1, i8, mediump> mediump_i8vec1;
230
+ typedef vec<2, i8, mediump> mediump_i8vec2;
231
+ typedef vec<3, i8, mediump> mediump_i8vec3;
232
+ typedef vec<4, i8, mediump> mediump_i8vec4;
233
+
234
+ typedef vec<1, i8, highp> highp_i8vec1;
235
+ typedef vec<2, i8, highp> highp_i8vec2;
236
+ typedef vec<3, i8, highp> highp_i8vec3;
237
+ typedef vec<4, i8, highp> highp_i8vec4;
238
+
239
+ typedef vec<1, i8, defaultp> i8vec1;
240
+ typedef vec<2, i8, defaultp> i8vec2;
241
+ typedef vec<3, i8, defaultp> i8vec3;
242
+ typedef vec<4, i8, defaultp> i8vec4;
243
+
244
+ typedef vec<1, i16, lowp> lowp_i16vec1;
245
+ typedef vec<2, i16, lowp> lowp_i16vec2;
246
+ typedef vec<3, i16, lowp> lowp_i16vec3;
247
+ typedef vec<4, i16, lowp> lowp_i16vec4;
248
+
249
+ typedef vec<1, i16, mediump> mediump_i16vec1;
250
+ typedef vec<2, i16, mediump> mediump_i16vec2;
251
+ typedef vec<3, i16, mediump> mediump_i16vec3;
252
+ typedef vec<4, i16, mediump> mediump_i16vec4;
253
+
254
+ typedef vec<1, i16, highp> highp_i16vec1;
255
+ typedef vec<2, i16, highp> highp_i16vec2;
256
+ typedef vec<3, i16, highp> highp_i16vec3;
257
+ typedef vec<4, i16, highp> highp_i16vec4;
258
+
259
+ typedef vec<1, i16, defaultp> i16vec1;
260
+ typedef vec<2, i16, defaultp> i16vec2;
261
+ typedef vec<3, i16, defaultp> i16vec3;
262
+ typedef vec<4, i16, defaultp> i16vec4;
263
+
264
+ typedef vec<1, i32, lowp> lowp_i32vec1;
265
+ typedef vec<2, i32, lowp> lowp_i32vec2;
266
+ typedef vec<3, i32, lowp> lowp_i32vec3;
267
+ typedef vec<4, i32, lowp> lowp_i32vec4;
268
+
269
+ typedef vec<1, i32, mediump> mediump_i32vec1;
270
+ typedef vec<2, i32, mediump> mediump_i32vec2;
271
+ typedef vec<3, i32, mediump> mediump_i32vec3;
272
+ typedef vec<4, i32, mediump> mediump_i32vec4;
273
+
274
+ typedef vec<1, i32, highp> highp_i32vec1;
275
+ typedef vec<2, i32, highp> highp_i32vec2;
276
+ typedef vec<3, i32, highp> highp_i32vec3;
277
+ typedef vec<4, i32, highp> highp_i32vec4;
278
+
279
+ typedef vec<1, i32, defaultp> i32vec1;
280
+ typedef vec<2, i32, defaultp> i32vec2;
281
+ typedef vec<3, i32, defaultp> i32vec3;
282
+ typedef vec<4, i32, defaultp> i32vec4;
283
+
284
+ typedef vec<1, i64, lowp> lowp_i64vec1;
285
+ typedef vec<2, i64, lowp> lowp_i64vec2;
286
+ typedef vec<3, i64, lowp> lowp_i64vec3;
287
+ typedef vec<4, i64, lowp> lowp_i64vec4;
288
+
289
+ typedef vec<1, i64, mediump> mediump_i64vec1;
290
+ typedef vec<2, i64, mediump> mediump_i64vec2;
291
+ typedef vec<3, i64, mediump> mediump_i64vec3;
292
+ typedef vec<4, i64, mediump> mediump_i64vec4;
293
+
294
+ typedef vec<1, i64, highp> highp_i64vec1;
295
+ typedef vec<2, i64, highp> highp_i64vec2;
296
+ typedef vec<3, i64, highp> highp_i64vec3;
297
+ typedef vec<4, i64, highp> highp_i64vec4;
298
+
299
+ typedef vec<1, i64, defaultp> i64vec1;
300
+ typedef vec<2, i64, defaultp> i64vec2;
301
+ typedef vec<3, i64, defaultp> i64vec3;
302
+ typedef vec<4, i64, defaultp> i64vec4;
303
+
304
+ // Vector uint
305
+
306
+ typedef vec<1, uint, lowp> lowp_uvec1;
307
+ typedef vec<2, uint, lowp> lowp_uvec2;
308
+ typedef vec<3, uint, lowp> lowp_uvec3;
309
+ typedef vec<4, uint, lowp> lowp_uvec4;
310
+
311
+ typedef vec<1, uint, mediump> mediump_uvec1;
312
+ typedef vec<2, uint, mediump> mediump_uvec2;
313
+ typedef vec<3, uint, mediump> mediump_uvec3;
314
+ typedef vec<4, uint, mediump> mediump_uvec4;
315
+
316
+ typedef vec<1, uint, highp> highp_uvec1;
317
+ typedef vec<2, uint, highp> highp_uvec2;
318
+ typedef vec<3, uint, highp> highp_uvec3;
319
+ typedef vec<4, uint, highp> highp_uvec4;
320
+
321
+ typedef vec<1, uint, defaultp> uvec1;
322
+ typedef vec<2, uint, defaultp> uvec2;
323
+ typedef vec<3, uint, defaultp> uvec3;
324
+ typedef vec<4, uint, defaultp> uvec4;
325
+
326
+ typedef vec<1, u8, lowp> lowp_u8vec1;
327
+ typedef vec<2, u8, lowp> lowp_u8vec2;
328
+ typedef vec<3, u8, lowp> lowp_u8vec3;
329
+ typedef vec<4, u8, lowp> lowp_u8vec4;
330
+
331
+ typedef vec<1, u8, mediump> mediump_u8vec1;
332
+ typedef vec<2, u8, mediump> mediump_u8vec2;
333
+ typedef vec<3, u8, mediump> mediump_u8vec3;
334
+ typedef vec<4, u8, mediump> mediump_u8vec4;
335
+
336
+ typedef vec<1, u8, highp> highp_u8vec1;
337
+ typedef vec<2, u8, highp> highp_u8vec2;
338
+ typedef vec<3, u8, highp> highp_u8vec3;
339
+ typedef vec<4, u8, highp> highp_u8vec4;
340
+
341
+ typedef vec<1, u8, defaultp> u8vec1;
342
+ typedef vec<2, u8, defaultp> u8vec2;
343
+ typedef vec<3, u8, defaultp> u8vec3;
344
+ typedef vec<4, u8, defaultp> u8vec4;
345
+
346
+ typedef vec<1, u16, lowp> lowp_u16vec1;
347
+ typedef vec<2, u16, lowp> lowp_u16vec2;
348
+ typedef vec<3, u16, lowp> lowp_u16vec3;
349
+ typedef vec<4, u16, lowp> lowp_u16vec4;
350
+
351
+ typedef vec<1, u16, mediump> mediump_u16vec1;
352
+ typedef vec<2, u16, mediump> mediump_u16vec2;
353
+ typedef vec<3, u16, mediump> mediump_u16vec3;
354
+ typedef vec<4, u16, mediump> mediump_u16vec4;
355
+
356
+ typedef vec<1, u16, highp> highp_u16vec1;
357
+ typedef vec<2, u16, highp> highp_u16vec2;
358
+ typedef vec<3, u16, highp> highp_u16vec3;
359
+ typedef vec<4, u16, highp> highp_u16vec4;
360
+
361
+ typedef vec<1, u16, defaultp> u16vec1;
362
+ typedef vec<2, u16, defaultp> u16vec2;
363
+ typedef vec<3, u16, defaultp> u16vec3;
364
+ typedef vec<4, u16, defaultp> u16vec4;
365
+
366
+ typedef vec<1, u32, lowp> lowp_u32vec1;
367
+ typedef vec<2, u32, lowp> lowp_u32vec2;
368
+ typedef vec<3, u32, lowp> lowp_u32vec3;
369
+ typedef vec<4, u32, lowp> lowp_u32vec4;
370
+
371
+ typedef vec<1, u32, mediump> mediump_u32vec1;
372
+ typedef vec<2, u32, mediump> mediump_u32vec2;
373
+ typedef vec<3, u32, mediump> mediump_u32vec3;
374
+ typedef vec<4, u32, mediump> mediump_u32vec4;
375
+
376
+ typedef vec<1, u32, highp> highp_u32vec1;
377
+ typedef vec<2, u32, highp> highp_u32vec2;
378
+ typedef vec<3, u32, highp> highp_u32vec3;
379
+ typedef vec<4, u32, highp> highp_u32vec4;
380
+
381
+ typedef vec<1, u32, defaultp> u32vec1;
382
+ typedef vec<2, u32, defaultp> u32vec2;
383
+ typedef vec<3, u32, defaultp> u32vec3;
384
+ typedef vec<4, u32, defaultp> u32vec4;
385
+
386
+ typedef vec<1, u64, lowp> lowp_u64vec1;
387
+ typedef vec<2, u64, lowp> lowp_u64vec2;
388
+ typedef vec<3, u64, lowp> lowp_u64vec3;
389
+ typedef vec<4, u64, lowp> lowp_u64vec4;
390
+
391
+ typedef vec<1, u64, mediump> mediump_u64vec1;
392
+ typedef vec<2, u64, mediump> mediump_u64vec2;
393
+ typedef vec<3, u64, mediump> mediump_u64vec3;
394
+ typedef vec<4, u64, mediump> mediump_u64vec4;
395
+
396
+ typedef vec<1, u64, highp> highp_u64vec1;
397
+ typedef vec<2, u64, highp> highp_u64vec2;
398
+ typedef vec<3, u64, highp> highp_u64vec3;
399
+ typedef vec<4, u64, highp> highp_u64vec4;
400
+
401
+ typedef vec<1, u64, defaultp> u64vec1;
402
+ typedef vec<2, u64, defaultp> u64vec2;
403
+ typedef vec<3, u64, defaultp> u64vec3;
404
+ typedef vec<4, u64, defaultp> u64vec4;
405
+
406
+ // Vector float
407
+
408
+ typedef vec<1, float, lowp> lowp_vec1;
409
+ typedef vec<2, float, lowp> lowp_vec2;
410
+ typedef vec<3, float, lowp> lowp_vec3;
411
+ typedef vec<4, float, lowp> lowp_vec4;
412
+
413
+ typedef vec<1, float, mediump> mediump_vec1;
414
+ typedef vec<2, float, mediump> mediump_vec2;
415
+ typedef vec<3, float, mediump> mediump_vec3;
416
+ typedef vec<4, float, mediump> mediump_vec4;
417
+
418
+ typedef vec<1, float, highp> highp_vec1;
419
+ typedef vec<2, float, highp> highp_vec2;
420
+ typedef vec<3, float, highp> highp_vec3;
421
+ typedef vec<4, float, highp> highp_vec4;
422
+
423
+ typedef vec<1, float, defaultp> vec1;
424
+ typedef vec<2, float, defaultp> vec2;
425
+ typedef vec<3, float, defaultp> vec3;
426
+ typedef vec<4, float, defaultp> vec4;
427
+
428
+ typedef vec<1, float, lowp> lowp_fvec1;
429
+ typedef vec<2, float, lowp> lowp_fvec2;
430
+ typedef vec<3, float, lowp> lowp_fvec3;
431
+ typedef vec<4, float, lowp> lowp_fvec4;
432
+
433
+ typedef vec<1, float, mediump> mediump_fvec1;
434
+ typedef vec<2, float, mediump> mediump_fvec2;
435
+ typedef vec<3, float, mediump> mediump_fvec3;
436
+ typedef vec<4, float, mediump> mediump_fvec4;
437
+
438
+ typedef vec<1, float, highp> highp_fvec1;
439
+ typedef vec<2, float, highp> highp_fvec2;
440
+ typedef vec<3, float, highp> highp_fvec3;
441
+ typedef vec<4, float, highp> highp_fvec4;
442
+
443
+ typedef vec<1, f32, defaultp> fvec1;
444
+ typedef vec<2, f32, defaultp> fvec2;
445
+ typedef vec<3, f32, defaultp> fvec3;
446
+ typedef vec<4, f32, defaultp> fvec4;
447
+
448
+ typedef vec<1, f32, lowp> lowp_f32vec1;
449
+ typedef vec<2, f32, lowp> lowp_f32vec2;
450
+ typedef vec<3, f32, lowp> lowp_f32vec3;
451
+ typedef vec<4, f32, lowp> lowp_f32vec4;
452
+
453
+ typedef vec<1, f32, mediump> mediump_f32vec1;
454
+ typedef vec<2, f32, mediump> mediump_f32vec2;
455
+ typedef vec<3, f32, mediump> mediump_f32vec3;
456
+ typedef vec<4, f32, mediump> mediump_f32vec4;
457
+
458
+ typedef vec<1, f32, highp> highp_f32vec1;
459
+ typedef vec<2, f32, highp> highp_f32vec2;
460
+ typedef vec<3, f32, highp> highp_f32vec3;
461
+ typedef vec<4, f32, highp> highp_f32vec4;
462
+
463
+ typedef vec<1, f32, defaultp> f32vec1;
464
+ typedef vec<2, f32, defaultp> f32vec2;
465
+ typedef vec<3, f32, defaultp> f32vec3;
466
+ typedef vec<4, f32, defaultp> f32vec4;
467
+
468
+ typedef vec<1, f64, lowp> lowp_dvec1;
469
+ typedef vec<2, f64, lowp> lowp_dvec2;
470
+ typedef vec<3, f64, lowp> lowp_dvec3;
471
+ typedef vec<4, f64, lowp> lowp_dvec4;
472
+
473
+ typedef vec<1, f64, mediump> mediump_dvec1;
474
+ typedef vec<2, f64, mediump> mediump_dvec2;
475
+ typedef vec<3, f64, mediump> mediump_dvec3;
476
+ typedef vec<4, f64, mediump> mediump_dvec4;
477
+
478
+ typedef vec<1, f64, highp> highp_dvec1;
479
+ typedef vec<2, f64, highp> highp_dvec2;
480
+ typedef vec<3, f64, highp> highp_dvec3;
481
+ typedef vec<4, f64, highp> highp_dvec4;
482
+
483
+ typedef vec<1, f64, defaultp> dvec1;
484
+ typedef vec<2, f64, defaultp> dvec2;
485
+ typedef vec<3, f64, defaultp> dvec3;
486
+ typedef vec<4, f64, defaultp> dvec4;
487
+
488
+ typedef vec<1, f64, lowp> lowp_f64vec1;
489
+ typedef vec<2, f64, lowp> lowp_f64vec2;
490
+ typedef vec<3, f64, lowp> lowp_f64vec3;
491
+ typedef vec<4, f64, lowp> lowp_f64vec4;
492
+
493
+ typedef vec<1, f64, mediump> mediump_f64vec1;
494
+ typedef vec<2, f64, mediump> mediump_f64vec2;
495
+ typedef vec<3, f64, mediump> mediump_f64vec3;
496
+ typedef vec<4, f64, mediump> mediump_f64vec4;
497
+
498
+ typedef vec<1, f64, highp> highp_f64vec1;
499
+ typedef vec<2, f64, highp> highp_f64vec2;
500
+ typedef vec<3, f64, highp> highp_f64vec3;
501
+ typedef vec<4, f64, highp> highp_f64vec4;
502
+
503
+ typedef vec<1, f64, defaultp> f64vec1;
504
+ typedef vec<2, f64, defaultp> f64vec2;
505
+ typedef vec<3, f64, defaultp> f64vec3;
506
+ typedef vec<4, f64, defaultp> f64vec4;
507
+
508
+ // Matrix NxN
509
+
510
+ typedef mat<2, 2, f32, lowp> lowp_mat2;
511
+ typedef mat<3, 3, f32, lowp> lowp_mat3;
512
+ typedef mat<4, 4, f32, lowp> lowp_mat4;
513
+
514
+ typedef mat<2, 2, f32, mediump> mediump_mat2;
515
+ typedef mat<3, 3, f32, mediump> mediump_mat3;
516
+ typedef mat<4, 4, f32, mediump> mediump_mat4;
517
+
518
+ typedef mat<2, 2, f32, highp> highp_mat2;
519
+ typedef mat<3, 3, f32, highp> highp_mat3;
520
+ typedef mat<4, 4, f32, highp> highp_mat4;
521
+
522
+ typedef mat<2, 2, f32, defaultp> mat2;
523
+ typedef mat<3, 3, f32, defaultp> mat3;
524
+ typedef mat<4, 4, f32, defaultp> mat4;
525
+
526
+ typedef mat<2, 2, f32, lowp> lowp_fmat2;
527
+ typedef mat<3, 3, f32, lowp> lowp_fmat3;
528
+ typedef mat<4, 4, f32, lowp> lowp_fmat4;
529
+
530
+ typedef mat<2, 2, f32, mediump> mediump_fmat2;
531
+ typedef mat<3, 3, f32, mediump> mediump_fmat3;
532
+ typedef mat<4, 4, f32, mediump> mediump_fmat4;
533
+
534
+ typedef mat<2, 2, f32, highp> highp_fmat2;
535
+ typedef mat<3, 3, f32, highp> highp_fmat3;
536
+ typedef mat<4, 4, f32, highp> highp_fmat4;
537
+
538
+ typedef mat<2, 2, f32, defaultp> fmat2;
539
+ typedef mat<3, 3, f32, defaultp> fmat3;
540
+ typedef mat<4, 4, f32, defaultp> fmat4;
541
+
542
+ typedef mat<2, 2, f32, lowp> lowp_f32mat2;
543
+ typedef mat<3, 3, f32, lowp> lowp_f32mat3;
544
+ typedef mat<4, 4, f32, lowp> lowp_f32mat4;
545
+
546
+ typedef mat<2, 2, f32, mediump> mediump_f32mat2;
547
+ typedef mat<3, 3, f32, mediump> mediump_f32mat3;
548
+ typedef mat<4, 4, f32, mediump> mediump_f32mat4;
549
+
550
+ typedef mat<2, 2, f32, highp> highp_f32mat2;
551
+ typedef mat<3, 3, f32, highp> highp_f32mat3;
552
+ typedef mat<4, 4, f32, highp> highp_f32mat4;
553
+
554
+ typedef mat<2, 2, f32, defaultp> f32mat2;
555
+ typedef mat<3, 3, f32, defaultp> f32mat3;
556
+ typedef mat<4, 4, f32, defaultp> f32mat4;
557
+
558
+ typedef mat<2, 2, f64, lowp> lowp_dmat2;
559
+ typedef mat<3, 3, f64, lowp> lowp_dmat3;
560
+ typedef mat<4, 4, f64, lowp> lowp_dmat4;
561
+
562
+ typedef mat<2, 2, f64, mediump> mediump_dmat2;
563
+ typedef mat<3, 3, f64, mediump> mediump_dmat3;
564
+ typedef mat<4, 4, f64, mediump> mediump_dmat4;
565
+
566
+ typedef mat<2, 2, f64, highp> highp_dmat2;
567
+ typedef mat<3, 3, f64, highp> highp_dmat3;
568
+ typedef mat<4, 4, f64, highp> highp_dmat4;
569
+
570
+ typedef mat<2, 2, f64, defaultp> dmat2;
571
+ typedef mat<3, 3, f64, defaultp> dmat3;
572
+ typedef mat<4, 4, f64, defaultp> dmat4;
573
+
574
+ typedef mat<2, 2, f64, lowp> lowp_f64mat2;
575
+ typedef mat<3, 3, f64, lowp> lowp_f64mat3;
576
+ typedef mat<4, 4, f64, lowp> lowp_f64mat4;
577
+
578
+ typedef mat<2, 2, f64, mediump> mediump_f64mat2;
579
+ typedef mat<3, 3, f64, mediump> mediump_f64mat3;
580
+ typedef mat<4, 4, f64, mediump> mediump_f64mat4;
581
+
582
+ typedef mat<2, 2, f64, highp> highp_f64mat2;
583
+ typedef mat<3, 3, f64, highp> highp_f64mat3;
584
+ typedef mat<4, 4, f64, highp> highp_f64mat4;
585
+
586
+ typedef mat<2, 2, f64, defaultp> f64mat2;
587
+ typedef mat<3, 3, f64, defaultp> f64mat3;
588
+ typedef mat<4, 4, f64, defaultp> f64mat4;
589
+
590
+ // Matrix MxN
591
+
592
+ typedef mat<2, 2, f32, lowp> lowp_mat2x2;
593
+ typedef mat<2, 3, f32, lowp> lowp_mat2x3;
594
+ typedef mat<2, 4, f32, lowp> lowp_mat2x4;
595
+ typedef mat<3, 2, f32, lowp> lowp_mat3x2;
596
+ typedef mat<3, 3, f32, lowp> lowp_mat3x3;
597
+ typedef mat<3, 4, f32, lowp> lowp_mat3x4;
598
+ typedef mat<4, 2, f32, lowp> lowp_mat4x2;
599
+ typedef mat<4, 3, f32, lowp> lowp_mat4x3;
600
+ typedef mat<4, 4, f32, lowp> lowp_mat4x4;
601
+
602
+ typedef mat<2, 2, f32, mediump> mediump_mat2x2;
603
+ typedef mat<2, 3, f32, mediump> mediump_mat2x3;
604
+ typedef mat<2, 4, f32, mediump> mediump_mat2x4;
605
+ typedef mat<3, 2, f32, mediump> mediump_mat3x2;
606
+ typedef mat<3, 3, f32, mediump> mediump_mat3x3;
607
+ typedef mat<3, 4, f32, mediump> mediump_mat3x4;
608
+ typedef mat<4, 2, f32, mediump> mediump_mat4x2;
609
+ typedef mat<4, 3, f32, mediump> mediump_mat4x3;
610
+ typedef mat<4, 4, f32, mediump> mediump_mat4x4;
611
+
612
+ typedef mat<2, 2, f32, highp> highp_mat2x2;
613
+ typedef mat<2, 3, f32, highp> highp_mat2x3;
614
+ typedef mat<2, 4, f32, highp> highp_mat2x4;
615
+ typedef mat<3, 2, f32, highp> highp_mat3x2;
616
+ typedef mat<3, 3, f32, highp> highp_mat3x3;
617
+ typedef mat<3, 4, f32, highp> highp_mat3x4;
618
+ typedef mat<4, 2, f32, highp> highp_mat4x2;
619
+ typedef mat<4, 3, f32, highp> highp_mat4x3;
620
+ typedef mat<4, 4, f32, highp> highp_mat4x4;
621
+
622
+ typedef mat<2, 2, f32, defaultp> mat2x2;
623
+ typedef mat<2, 3, f32, defaultp> mat2x3;
624
+ typedef mat<2, 4, f32, defaultp> mat2x4;
625
+ typedef mat<3, 2, f32, defaultp> mat3x2;
626
+ typedef mat<3, 3, f32, defaultp> mat3x3;
627
+ typedef mat<3, 4, f32, defaultp> mat3x4;
628
+ typedef mat<4, 2, f32, defaultp> mat4x2;
629
+ typedef mat<4, 3, f32, defaultp> mat4x3;
630
+ typedef mat<4, 4, f32, defaultp> mat4x4;
631
+
632
+ typedef mat<2, 2, f32, lowp> lowp_fmat2x2;
633
+ typedef mat<2, 3, f32, lowp> lowp_fmat2x3;
634
+ typedef mat<2, 4, f32, lowp> lowp_fmat2x4;
635
+ typedef mat<3, 2, f32, lowp> lowp_fmat3x2;
636
+ typedef mat<3, 3, f32, lowp> lowp_fmat3x3;
637
+ typedef mat<3, 4, f32, lowp> lowp_fmat3x4;
638
+ typedef mat<4, 2, f32, lowp> lowp_fmat4x2;
639
+ typedef mat<4, 3, f32, lowp> lowp_fmat4x3;
640
+ typedef mat<4, 4, f32, lowp> lowp_fmat4x4;
641
+
642
+ typedef mat<2, 2, f32, mediump> mediump_fmat2x2;
643
+ typedef mat<2, 3, f32, mediump> mediump_fmat2x3;
644
+ typedef mat<2, 4, f32, mediump> mediump_fmat2x4;
645
+ typedef mat<3, 2, f32, mediump> mediump_fmat3x2;
646
+ typedef mat<3, 3, f32, mediump> mediump_fmat3x3;
647
+ typedef mat<3, 4, f32, mediump> mediump_fmat3x4;
648
+ typedef mat<4, 2, f32, mediump> mediump_fmat4x2;
649
+ typedef mat<4, 3, f32, mediump> mediump_fmat4x3;
650
+ typedef mat<4, 4, f32, mediump> mediump_fmat4x4;
651
+
652
+ typedef mat<2, 2, f32, highp> highp_fmat2x2;
653
+ typedef mat<2, 3, f32, highp> highp_fmat2x3;
654
+ typedef mat<2, 4, f32, highp> highp_fmat2x4;
655
+ typedef mat<3, 2, f32, highp> highp_fmat3x2;
656
+ typedef mat<3, 3, f32, highp> highp_fmat3x3;
657
+ typedef mat<3, 4, f32, highp> highp_fmat3x4;
658
+ typedef mat<4, 2, f32, highp> highp_fmat4x2;
659
+ typedef mat<4, 3, f32, highp> highp_fmat4x3;
660
+ typedef mat<4, 4, f32, highp> highp_fmat4x4;
661
+
662
+ typedef mat<2, 2, f32, defaultp> fmat2x2;
663
+ typedef mat<2, 3, f32, defaultp> fmat2x3;
664
+ typedef mat<2, 4, f32, defaultp> fmat2x4;
665
+ typedef mat<3, 2, f32, defaultp> fmat3x2;
666
+ typedef mat<3, 3, f32, defaultp> fmat3x3;
667
+ typedef mat<3, 4, f32, defaultp> fmat3x4;
668
+ typedef mat<4, 2, f32, defaultp> fmat4x2;
669
+ typedef mat<4, 3, f32, defaultp> fmat4x3;
670
+ typedef mat<4, 4, f32, defaultp> fmat4x4;
671
+
672
+ typedef mat<2, 2, f32, lowp> lowp_f32mat2x2;
673
+ typedef mat<2, 3, f32, lowp> lowp_f32mat2x3;
674
+ typedef mat<2, 4, f32, lowp> lowp_f32mat2x4;
675
+ typedef mat<3, 2, f32, lowp> lowp_f32mat3x2;
676
+ typedef mat<3, 3, f32, lowp> lowp_f32mat3x3;
677
+ typedef mat<3, 4, f32, lowp> lowp_f32mat3x4;
678
+ typedef mat<4, 2, f32, lowp> lowp_f32mat4x2;
679
+ typedef mat<4, 3, f32, lowp> lowp_f32mat4x3;
680
+ typedef mat<4, 4, f32, lowp> lowp_f32mat4x4;
681
+
682
+ typedef mat<2, 2, f32, mediump> mediump_f32mat2x2;
683
+ typedef mat<2, 3, f32, mediump> mediump_f32mat2x3;
684
+ typedef mat<2, 4, f32, mediump> mediump_f32mat2x4;
685
+ typedef mat<3, 2, f32, mediump> mediump_f32mat3x2;
686
+ typedef mat<3, 3, f32, mediump> mediump_f32mat3x3;
687
+ typedef mat<3, 4, f32, mediump> mediump_f32mat3x4;
688
+ typedef mat<4, 2, f32, mediump> mediump_f32mat4x2;
689
+ typedef mat<4, 3, f32, mediump> mediump_f32mat4x3;
690
+ typedef mat<4, 4, f32, mediump> mediump_f32mat4x4;
691
+
692
+ typedef mat<2, 2, f32, highp> highp_f32mat2x2;
693
+ typedef mat<2, 3, f32, highp> highp_f32mat2x3;
694
+ typedef mat<2, 4, f32, highp> highp_f32mat2x4;
695
+ typedef mat<3, 2, f32, highp> highp_f32mat3x2;
696
+ typedef mat<3, 3, f32, highp> highp_f32mat3x3;
697
+ typedef mat<3, 4, f32, highp> highp_f32mat3x4;
698
+ typedef mat<4, 2, f32, highp> highp_f32mat4x2;
699
+ typedef mat<4, 3, f32, highp> highp_f32mat4x3;
700
+ typedef mat<4, 4, f32, highp> highp_f32mat4x4;
701
+
702
+ typedef mat<2, 2, f32, defaultp> f32mat2x2;
703
+ typedef mat<2, 3, f32, defaultp> f32mat2x3;
704
+ typedef mat<2, 4, f32, defaultp> f32mat2x4;
705
+ typedef mat<3, 2, f32, defaultp> f32mat3x2;
706
+ typedef mat<3, 3, f32, defaultp> f32mat3x3;
707
+ typedef mat<3, 4, f32, defaultp> f32mat3x4;
708
+ typedef mat<4, 2, f32, defaultp> f32mat4x2;
709
+ typedef mat<4, 3, f32, defaultp> f32mat4x3;
710
+ typedef mat<4, 4, f32, defaultp> f32mat4x4;
711
+
712
+ typedef mat<2, 2, double, lowp> lowp_dmat2x2;
713
+ typedef mat<2, 3, double, lowp> lowp_dmat2x3;
714
+ typedef mat<2, 4, double, lowp> lowp_dmat2x4;
715
+ typedef mat<3, 2, double, lowp> lowp_dmat3x2;
716
+ typedef mat<3, 3, double, lowp> lowp_dmat3x3;
717
+ typedef mat<3, 4, double, lowp> lowp_dmat3x4;
718
+ typedef mat<4, 2, double, lowp> lowp_dmat4x2;
719
+ typedef mat<4, 3, double, lowp> lowp_dmat4x3;
720
+ typedef mat<4, 4, double, lowp> lowp_dmat4x4;
721
+
722
+ typedef mat<2, 2, double, mediump> mediump_dmat2x2;
723
+ typedef mat<2, 3, double, mediump> mediump_dmat2x3;
724
+ typedef mat<2, 4, double, mediump> mediump_dmat2x4;
725
+ typedef mat<3, 2, double, mediump> mediump_dmat3x2;
726
+ typedef mat<3, 3, double, mediump> mediump_dmat3x3;
727
+ typedef mat<3, 4, double, mediump> mediump_dmat3x4;
728
+ typedef mat<4, 2, double, mediump> mediump_dmat4x2;
729
+ typedef mat<4, 3, double, mediump> mediump_dmat4x3;
730
+ typedef mat<4, 4, double, mediump> mediump_dmat4x4;
731
+
732
+ typedef mat<2, 2, double, highp> highp_dmat2x2;
733
+ typedef mat<2, 3, double, highp> highp_dmat2x3;
734
+ typedef mat<2, 4, double, highp> highp_dmat2x4;
735
+ typedef mat<3, 2, double, highp> highp_dmat3x2;
736
+ typedef mat<3, 3, double, highp> highp_dmat3x3;
737
+ typedef mat<3, 4, double, highp> highp_dmat3x4;
738
+ typedef mat<4, 2, double, highp> highp_dmat4x2;
739
+ typedef mat<4, 3, double, highp> highp_dmat4x3;
740
+ typedef mat<4, 4, double, highp> highp_dmat4x4;
741
+
742
+ typedef mat<2, 2, double, defaultp> dmat2x2;
743
+ typedef mat<2, 3, double, defaultp> dmat2x3;
744
+ typedef mat<2, 4, double, defaultp> dmat2x4;
745
+ typedef mat<3, 2, double, defaultp> dmat3x2;
746
+ typedef mat<3, 3, double, defaultp> dmat3x3;
747
+ typedef mat<3, 4, double, defaultp> dmat3x4;
748
+ typedef mat<4, 2, double, defaultp> dmat4x2;
749
+ typedef mat<4, 3, double, defaultp> dmat4x3;
750
+ typedef mat<4, 4, double, defaultp> dmat4x4;
751
+
752
+ typedef mat<2, 2, f64, lowp> lowp_f64mat2x2;
753
+ typedef mat<2, 3, f64, lowp> lowp_f64mat2x3;
754
+ typedef mat<2, 4, f64, lowp> lowp_f64mat2x4;
755
+ typedef mat<3, 2, f64, lowp> lowp_f64mat3x2;
756
+ typedef mat<3, 3, f64, lowp> lowp_f64mat3x3;
757
+ typedef mat<3, 4, f64, lowp> lowp_f64mat3x4;
758
+ typedef mat<4, 2, f64, lowp> lowp_f64mat4x2;
759
+ typedef mat<4, 3, f64, lowp> lowp_f64mat4x3;
760
+ typedef mat<4, 4, f64, lowp> lowp_f64mat4x4;
761
+
762
+ typedef mat<2, 2, f64, mediump> mediump_f64mat2x2;
763
+ typedef mat<2, 3, f64, mediump> mediump_f64mat2x3;
764
+ typedef mat<2, 4, f64, mediump> mediump_f64mat2x4;
765
+ typedef mat<3, 2, f64, mediump> mediump_f64mat3x2;
766
+ typedef mat<3, 3, f64, mediump> mediump_f64mat3x3;
767
+ typedef mat<3, 4, f64, mediump> mediump_f64mat3x4;
768
+ typedef mat<4, 2, f64, mediump> mediump_f64mat4x2;
769
+ typedef mat<4, 3, f64, mediump> mediump_f64mat4x3;
770
+ typedef mat<4, 4, f64, mediump> mediump_f64mat4x4;
771
+
772
+ typedef mat<2, 2, f64, highp> highp_f64mat2x2;
773
+ typedef mat<2, 3, f64, highp> highp_f64mat2x3;
774
+ typedef mat<2, 4, f64, highp> highp_f64mat2x4;
775
+ typedef mat<3, 2, f64, highp> highp_f64mat3x2;
776
+ typedef mat<3, 3, f64, highp> highp_f64mat3x3;
777
+ typedef mat<3, 4, f64, highp> highp_f64mat3x4;
778
+ typedef mat<4, 2, f64, highp> highp_f64mat4x2;
779
+ typedef mat<4, 3, f64, highp> highp_f64mat4x3;
780
+ typedef mat<4, 4, f64, highp> highp_f64mat4x4;
781
+
782
+ typedef mat<2, 2, f64, defaultp> f64mat2x2;
783
+ typedef mat<2, 3, f64, defaultp> f64mat2x3;
784
+ typedef mat<2, 4, f64, defaultp> f64mat2x4;
785
+ typedef mat<3, 2, f64, defaultp> f64mat3x2;
786
+ typedef mat<3, 3, f64, defaultp> f64mat3x3;
787
+ typedef mat<3, 4, f64, defaultp> f64mat3x4;
788
+ typedef mat<4, 2, f64, defaultp> f64mat4x2;
789
+ typedef mat<4, 3, f64, defaultp> f64mat4x3;
790
+ typedef mat<4, 4, f64, defaultp> f64mat4x4;
791
+
792
+ // Signed integer matrix MxN
793
+
794
+ typedef mat<2, 2, int, lowp> lowp_imat2x2;
795
+ typedef mat<2, 3, int, lowp> lowp_imat2x3;
796
+ typedef mat<2, 4, int, lowp> lowp_imat2x4;
797
+ typedef mat<3, 2, int, lowp> lowp_imat3x2;
798
+ typedef mat<3, 3, int, lowp> lowp_imat3x3;
799
+ typedef mat<3, 4, int, lowp> lowp_imat3x4;
800
+ typedef mat<4, 2, int, lowp> lowp_imat4x2;
801
+ typedef mat<4, 3, int, lowp> lowp_imat4x3;
802
+ typedef mat<4, 4, int, lowp> lowp_imat4x4;
803
+
804
+ typedef mat<2, 2, int, mediump> mediump_imat2x2;
805
+ typedef mat<2, 3, int, mediump> mediump_imat2x3;
806
+ typedef mat<2, 4, int, mediump> mediump_imat2x4;
807
+ typedef mat<3, 2, int, mediump> mediump_imat3x2;
808
+ typedef mat<3, 3, int, mediump> mediump_imat3x3;
809
+ typedef mat<3, 4, int, mediump> mediump_imat3x4;
810
+ typedef mat<4, 2, int, mediump> mediump_imat4x2;
811
+ typedef mat<4, 3, int, mediump> mediump_imat4x3;
812
+ typedef mat<4, 4, int, mediump> mediump_imat4x4;
813
+
814
+ typedef mat<2, 2, int, highp> highp_imat2x2;
815
+ typedef mat<2, 3, int, highp> highp_imat2x3;
816
+ typedef mat<2, 4, int, highp> highp_imat2x4;
817
+ typedef mat<3, 2, int, highp> highp_imat3x2;
818
+ typedef mat<3, 3, int, highp> highp_imat3x3;
819
+ typedef mat<3, 4, int, highp> highp_imat3x4;
820
+ typedef mat<4, 2, int, highp> highp_imat4x2;
821
+ typedef mat<4, 3, int, highp> highp_imat4x3;
822
+ typedef mat<4, 4, int, highp> highp_imat4x4;
823
+
824
+ typedef mat<2, 2, int, defaultp> imat2x2;
825
+ typedef mat<2, 3, int, defaultp> imat2x3;
826
+ typedef mat<2, 4, int, defaultp> imat2x4;
827
+ typedef mat<3, 2, int, defaultp> imat3x2;
828
+ typedef mat<3, 3, int, defaultp> imat3x3;
829
+ typedef mat<3, 4, int, defaultp> imat3x4;
830
+ typedef mat<4, 2, int, defaultp> imat4x2;
831
+ typedef mat<4, 3, int, defaultp> imat4x3;
832
+ typedef mat<4, 4, int, defaultp> imat4x4;
833
+
834
+
835
+ typedef mat<2, 2, int8, lowp> lowp_i8mat2x2;
836
+ typedef mat<2, 3, int8, lowp> lowp_i8mat2x3;
837
+ typedef mat<2, 4, int8, lowp> lowp_i8mat2x4;
838
+ typedef mat<3, 2, int8, lowp> lowp_i8mat3x2;
839
+ typedef mat<3, 3, int8, lowp> lowp_i8mat3x3;
840
+ typedef mat<3, 4, int8, lowp> lowp_i8mat3x4;
841
+ typedef mat<4, 2, int8, lowp> lowp_i8mat4x2;
842
+ typedef mat<4, 3, int8, lowp> lowp_i8mat4x3;
843
+ typedef mat<4, 4, int8, lowp> lowp_i8mat4x4;
844
+
845
+ typedef mat<2, 2, int8, mediump> mediump_i8mat2x2;
846
+ typedef mat<2, 3, int8, mediump> mediump_i8mat2x3;
847
+ typedef mat<2, 4, int8, mediump> mediump_i8mat2x4;
848
+ typedef mat<3, 2, int8, mediump> mediump_i8mat3x2;
849
+ typedef mat<3, 3, int8, mediump> mediump_i8mat3x3;
850
+ typedef mat<3, 4, int8, mediump> mediump_i8mat3x4;
851
+ typedef mat<4, 2, int8, mediump> mediump_i8mat4x2;
852
+ typedef mat<4, 3, int8, mediump> mediump_i8mat4x3;
853
+ typedef mat<4, 4, int8, mediump> mediump_i8mat4x4;
854
+
855
+ typedef mat<2, 2, int8, highp> highp_i8mat2x2;
856
+ typedef mat<2, 3, int8, highp> highp_i8mat2x3;
857
+ typedef mat<2, 4, int8, highp> highp_i8mat2x4;
858
+ typedef mat<3, 2, int8, highp> highp_i8mat3x2;
859
+ typedef mat<3, 3, int8, highp> highp_i8mat3x3;
860
+ typedef mat<3, 4, int8, highp> highp_i8mat3x4;
861
+ typedef mat<4, 2, int8, highp> highp_i8mat4x2;
862
+ typedef mat<4, 3, int8, highp> highp_i8mat4x3;
863
+ typedef mat<4, 4, int8, highp> highp_i8mat4x4;
864
+
865
+ typedef mat<2, 2, int8, defaultp> i8mat2x2;
866
+ typedef mat<2, 3, int8, defaultp> i8mat2x3;
867
+ typedef mat<2, 4, int8, defaultp> i8mat2x4;
868
+ typedef mat<3, 2, int8, defaultp> i8mat3x2;
869
+ typedef mat<3, 3, int8, defaultp> i8mat3x3;
870
+ typedef mat<3, 4, int8, defaultp> i8mat3x4;
871
+ typedef mat<4, 2, int8, defaultp> i8mat4x2;
872
+ typedef mat<4, 3, int8, defaultp> i8mat4x3;
873
+ typedef mat<4, 4, int8, defaultp> i8mat4x4;
874
+
875
+
876
+ typedef mat<2, 2, int16, lowp> lowp_i16mat2x2;
877
+ typedef mat<2, 3, int16, lowp> lowp_i16mat2x3;
878
+ typedef mat<2, 4, int16, lowp> lowp_i16mat2x4;
879
+ typedef mat<3, 2, int16, lowp> lowp_i16mat3x2;
880
+ typedef mat<3, 3, int16, lowp> lowp_i16mat3x3;
881
+ typedef mat<3, 4, int16, lowp> lowp_i16mat3x4;
882
+ typedef mat<4, 2, int16, lowp> lowp_i16mat4x2;
883
+ typedef mat<4, 3, int16, lowp> lowp_i16mat4x3;
884
+ typedef mat<4, 4, int16, lowp> lowp_i16mat4x4;
885
+
886
+ typedef mat<2, 2, int16, mediump> mediump_i16mat2x2;
887
+ typedef mat<2, 3, int16, mediump> mediump_i16mat2x3;
888
+ typedef mat<2, 4, int16, mediump> mediump_i16mat2x4;
889
+ typedef mat<3, 2, int16, mediump> mediump_i16mat3x2;
890
+ typedef mat<3, 3, int16, mediump> mediump_i16mat3x3;
891
+ typedef mat<3, 4, int16, mediump> mediump_i16mat3x4;
892
+ typedef mat<4, 2, int16, mediump> mediump_i16mat4x2;
893
+ typedef mat<4, 3, int16, mediump> mediump_i16mat4x3;
894
+ typedef mat<4, 4, int16, mediump> mediump_i16mat4x4;
895
+
896
+ typedef mat<2, 2, int16, highp> highp_i16mat2x2;
897
+ typedef mat<2, 3, int16, highp> highp_i16mat2x3;
898
+ typedef mat<2, 4, int16, highp> highp_i16mat2x4;
899
+ typedef mat<3, 2, int16, highp> highp_i16mat3x2;
900
+ typedef mat<3, 3, int16, highp> highp_i16mat3x3;
901
+ typedef mat<3, 4, int16, highp> highp_i16mat3x4;
902
+ typedef mat<4, 2, int16, highp> highp_i16mat4x2;
903
+ typedef mat<4, 3, int16, highp> highp_i16mat4x3;
904
+ typedef mat<4, 4, int16, highp> highp_i16mat4x4;
905
+
906
+ typedef mat<2, 2, int16, defaultp> i16mat2x2;
907
+ typedef mat<2, 3, int16, defaultp> i16mat2x3;
908
+ typedef mat<2, 4, int16, defaultp> i16mat2x4;
909
+ typedef mat<3, 2, int16, defaultp> i16mat3x2;
910
+ typedef mat<3, 3, int16, defaultp> i16mat3x3;
911
+ typedef mat<3, 4, int16, defaultp> i16mat3x4;
912
+ typedef mat<4, 2, int16, defaultp> i16mat4x2;
913
+ typedef mat<4, 3, int16, defaultp> i16mat4x3;
914
+ typedef mat<4, 4, int16, defaultp> i16mat4x4;
915
+
916
+
917
+ typedef mat<2, 2, int32, lowp> lowp_i32mat2x2;
918
+ typedef mat<2, 3, int32, lowp> lowp_i32mat2x3;
919
+ typedef mat<2, 4, int32, lowp> lowp_i32mat2x4;
920
+ typedef mat<3, 2, int32, lowp> lowp_i32mat3x2;
921
+ typedef mat<3, 3, int32, lowp> lowp_i32mat3x3;
922
+ typedef mat<3, 4, int32, lowp> lowp_i32mat3x4;
923
+ typedef mat<4, 2, int32, lowp> lowp_i32mat4x2;
924
+ typedef mat<4, 3, int32, lowp> lowp_i32mat4x3;
925
+ typedef mat<4, 4, int32, lowp> lowp_i32mat4x4;
926
+
927
+ typedef mat<2, 2, int32, mediump> mediump_i32mat2x2;
928
+ typedef mat<2, 3, int32, mediump> mediump_i32mat2x3;
929
+ typedef mat<2, 4, int32, mediump> mediump_i32mat2x4;
930
+ typedef mat<3, 2, int32, mediump> mediump_i32mat3x2;
931
+ typedef mat<3, 3, int32, mediump> mediump_i32mat3x3;
932
+ typedef mat<3, 4, int32, mediump> mediump_i32mat3x4;
933
+ typedef mat<4, 2, int32, mediump> mediump_i32mat4x2;
934
+ typedef mat<4, 3, int32, mediump> mediump_i32mat4x3;
935
+ typedef mat<4, 4, int32, mediump> mediump_i32mat4x4;
936
+
937
+ typedef mat<2, 2, int32, highp> highp_i32mat2x2;
938
+ typedef mat<2, 3, int32, highp> highp_i32mat2x3;
939
+ typedef mat<2, 4, int32, highp> highp_i32mat2x4;
940
+ typedef mat<3, 2, int32, highp> highp_i32mat3x2;
941
+ typedef mat<3, 3, int32, highp> highp_i32mat3x3;
942
+ typedef mat<3, 4, int32, highp> highp_i32mat3x4;
943
+ typedef mat<4, 2, int32, highp> highp_i32mat4x2;
944
+ typedef mat<4, 3, int32, highp> highp_i32mat4x3;
945
+ typedef mat<4, 4, int32, highp> highp_i32mat4x4;
946
+
947
+ typedef mat<2, 2, int32, defaultp> i32mat2x2;
948
+ typedef mat<2, 3, int32, defaultp> i32mat2x3;
949
+ typedef mat<2, 4, int32, defaultp> i32mat2x4;
950
+ typedef mat<3, 2, int32, defaultp> i32mat3x2;
951
+ typedef mat<3, 3, int32, defaultp> i32mat3x3;
952
+ typedef mat<3, 4, int32, defaultp> i32mat3x4;
953
+ typedef mat<4, 2, int32, defaultp> i32mat4x2;
954
+ typedef mat<4, 3, int32, defaultp> i32mat4x3;
955
+ typedef mat<4, 4, int32, defaultp> i32mat4x4;
956
+
957
+
958
+ typedef mat<2, 2, int64, lowp> lowp_i64mat2x2;
959
+ typedef mat<2, 3, int64, lowp> lowp_i64mat2x3;
960
+ typedef mat<2, 4, int64, lowp> lowp_i64mat2x4;
961
+ typedef mat<3, 2, int64, lowp> lowp_i64mat3x2;
962
+ typedef mat<3, 3, int64, lowp> lowp_i64mat3x3;
963
+ typedef mat<3, 4, int64, lowp> lowp_i64mat3x4;
964
+ typedef mat<4, 2, int64, lowp> lowp_i64mat4x2;
965
+ typedef mat<4, 3, int64, lowp> lowp_i64mat4x3;
966
+ typedef mat<4, 4, int64, lowp> lowp_i64mat4x4;
967
+
968
+ typedef mat<2, 2, int64, mediump> mediump_i64mat2x2;
969
+ typedef mat<2, 3, int64, mediump> mediump_i64mat2x3;
970
+ typedef mat<2, 4, int64, mediump> mediump_i64mat2x4;
971
+ typedef mat<3, 2, int64, mediump> mediump_i64mat3x2;
972
+ typedef mat<3, 3, int64, mediump> mediump_i64mat3x3;
973
+ typedef mat<3, 4, int64, mediump> mediump_i64mat3x4;
974
+ typedef mat<4, 2, int64, mediump> mediump_i64mat4x2;
975
+ typedef mat<4, 3, int64, mediump> mediump_i64mat4x3;
976
+ typedef mat<4, 4, int64, mediump> mediump_i64mat4x4;
977
+
978
+ typedef mat<2, 2, int64, highp> highp_i64mat2x2;
979
+ typedef mat<2, 3, int64, highp> highp_i64mat2x3;
980
+ typedef mat<2, 4, int64, highp> highp_i64mat2x4;
981
+ typedef mat<3, 2, int64, highp> highp_i64mat3x2;
982
+ typedef mat<3, 3, int64, highp> highp_i64mat3x3;
983
+ typedef mat<3, 4, int64, highp> highp_i64mat3x4;
984
+ typedef mat<4, 2, int64, highp> highp_i64mat4x2;
985
+ typedef mat<4, 3, int64, highp> highp_i64mat4x3;
986
+ typedef mat<4, 4, int64, highp> highp_i64mat4x4;
987
+
988
+ typedef mat<2, 2, int64, defaultp> i64mat2x2;
989
+ typedef mat<2, 3, int64, defaultp> i64mat2x3;
990
+ typedef mat<2, 4, int64, defaultp> i64mat2x4;
991
+ typedef mat<3, 2, int64, defaultp> i64mat3x2;
992
+ typedef mat<3, 3, int64, defaultp> i64mat3x3;
993
+ typedef mat<3, 4, int64, defaultp> i64mat3x4;
994
+ typedef mat<4, 2, int64, defaultp> i64mat4x2;
995
+ typedef mat<4, 3, int64, defaultp> i64mat4x3;
996
+ typedef mat<4, 4, int64, defaultp> i64mat4x4;
997
+
998
+
999
+ // Unsigned integer matrix MxN
1000
+
1001
+ typedef mat<2, 2, uint, lowp> lowp_umat2x2;
1002
+ typedef mat<2, 3, uint, lowp> lowp_umat2x3;
1003
+ typedef mat<2, 4, uint, lowp> lowp_umat2x4;
1004
+ typedef mat<3, 2, uint, lowp> lowp_umat3x2;
1005
+ typedef mat<3, 3, uint, lowp> lowp_umat3x3;
1006
+ typedef mat<3, 4, uint, lowp> lowp_umat3x4;
1007
+ typedef mat<4, 2, uint, lowp> lowp_umat4x2;
1008
+ typedef mat<4, 3, uint, lowp> lowp_umat4x3;
1009
+ typedef mat<4, 4, uint, lowp> lowp_umat4x4;
1010
+
1011
+ typedef mat<2, 2, uint, mediump> mediump_umat2x2;
1012
+ typedef mat<2, 3, uint, mediump> mediump_umat2x3;
1013
+ typedef mat<2, 4, uint, mediump> mediump_umat2x4;
1014
+ typedef mat<3, 2, uint, mediump> mediump_umat3x2;
1015
+ typedef mat<3, 3, uint, mediump> mediump_umat3x3;
1016
+ typedef mat<3, 4, uint, mediump> mediump_umat3x4;
1017
+ typedef mat<4, 2, uint, mediump> mediump_umat4x2;
1018
+ typedef mat<4, 3, uint, mediump> mediump_umat4x3;
1019
+ typedef mat<4, 4, uint, mediump> mediump_umat4x4;
1020
+
1021
+ typedef mat<2, 2, uint, highp> highp_umat2x2;
1022
+ typedef mat<2, 3, uint, highp> highp_umat2x3;
1023
+ typedef mat<2, 4, uint, highp> highp_umat2x4;
1024
+ typedef mat<3, 2, uint, highp> highp_umat3x2;
1025
+ typedef mat<3, 3, uint, highp> highp_umat3x3;
1026
+ typedef mat<3, 4, uint, highp> highp_umat3x4;
1027
+ typedef mat<4, 2, uint, highp> highp_umat4x2;
1028
+ typedef mat<4, 3, uint, highp> highp_umat4x3;
1029
+ typedef mat<4, 4, uint, highp> highp_umat4x4;
1030
+
1031
+ typedef mat<2, 2, uint, defaultp> umat2x2;
1032
+ typedef mat<2, 3, uint, defaultp> umat2x3;
1033
+ typedef mat<2, 4, uint, defaultp> umat2x4;
1034
+ typedef mat<3, 2, uint, defaultp> umat3x2;
1035
+ typedef mat<3, 3, uint, defaultp> umat3x3;
1036
+ typedef mat<3, 4, uint, defaultp> umat3x4;
1037
+ typedef mat<4, 2, uint, defaultp> umat4x2;
1038
+ typedef mat<4, 3, uint, defaultp> umat4x3;
1039
+ typedef mat<4, 4, uint, defaultp> umat4x4;
1040
+
1041
+
1042
+ typedef mat<2, 2, uint8, lowp> lowp_u8mat2x2;
1043
+ typedef mat<2, 3, uint8, lowp> lowp_u8mat2x3;
1044
+ typedef mat<2, 4, uint8, lowp> lowp_u8mat2x4;
1045
+ typedef mat<3, 2, uint8, lowp> lowp_u8mat3x2;
1046
+ typedef mat<3, 3, uint8, lowp> lowp_u8mat3x3;
1047
+ typedef mat<3, 4, uint8, lowp> lowp_u8mat3x4;
1048
+ typedef mat<4, 2, uint8, lowp> lowp_u8mat4x2;
1049
+ typedef mat<4, 3, uint8, lowp> lowp_u8mat4x3;
1050
+ typedef mat<4, 4, uint8, lowp> lowp_u8mat4x4;
1051
+
1052
+ typedef mat<2, 2, uint8, mediump> mediump_u8mat2x2;
1053
+ typedef mat<2, 3, uint8, mediump> mediump_u8mat2x3;
1054
+ typedef mat<2, 4, uint8, mediump> mediump_u8mat2x4;
1055
+ typedef mat<3, 2, uint8, mediump> mediump_u8mat3x2;
1056
+ typedef mat<3, 3, uint8, mediump> mediump_u8mat3x3;
1057
+ typedef mat<3, 4, uint8, mediump> mediump_u8mat3x4;
1058
+ typedef mat<4, 2, uint8, mediump> mediump_u8mat4x2;
1059
+ typedef mat<4, 3, uint8, mediump> mediump_u8mat4x3;
1060
+ typedef mat<4, 4, uint8, mediump> mediump_u8mat4x4;
1061
+
1062
+ typedef mat<2, 2, uint8, highp> highp_u8mat2x2;
1063
+ typedef mat<2, 3, uint8, highp> highp_u8mat2x3;
1064
+ typedef mat<2, 4, uint8, highp> highp_u8mat2x4;
1065
+ typedef mat<3, 2, uint8, highp> highp_u8mat3x2;
1066
+ typedef mat<3, 3, uint8, highp> highp_u8mat3x3;
1067
+ typedef mat<3, 4, uint8, highp> highp_u8mat3x4;
1068
+ typedef mat<4, 2, uint8, highp> highp_u8mat4x2;
1069
+ typedef mat<4, 3, uint8, highp> highp_u8mat4x3;
1070
+ typedef mat<4, 4, uint8, highp> highp_u8mat4x4;
1071
+
1072
+ typedef mat<2, 2, uint8, defaultp> u8mat2x2;
1073
+ typedef mat<2, 3, uint8, defaultp> u8mat2x3;
1074
+ typedef mat<2, 4, uint8, defaultp> u8mat2x4;
1075
+ typedef mat<3, 2, uint8, defaultp> u8mat3x2;
1076
+ typedef mat<3, 3, uint8, defaultp> u8mat3x3;
1077
+ typedef mat<3, 4, uint8, defaultp> u8mat3x4;
1078
+ typedef mat<4, 2, uint8, defaultp> u8mat4x2;
1079
+ typedef mat<4, 3, uint8, defaultp> u8mat4x3;
1080
+ typedef mat<4, 4, uint8, defaultp> u8mat4x4;
1081
+
1082
+
1083
+ typedef mat<2, 2, uint16, lowp> lowp_u16mat2x2;
1084
+ typedef mat<2, 3, uint16, lowp> lowp_u16mat2x3;
1085
+ typedef mat<2, 4, uint16, lowp> lowp_u16mat2x4;
1086
+ typedef mat<3, 2, uint16, lowp> lowp_u16mat3x2;
1087
+ typedef mat<3, 3, uint16, lowp> lowp_u16mat3x3;
1088
+ typedef mat<3, 4, uint16, lowp> lowp_u16mat3x4;
1089
+ typedef mat<4, 2, uint16, lowp> lowp_u16mat4x2;
1090
+ typedef mat<4, 3, uint16, lowp> lowp_u16mat4x3;
1091
+ typedef mat<4, 4, uint16, lowp> lowp_u16mat4x4;
1092
+
1093
+ typedef mat<2, 2, uint16, mediump> mediump_u16mat2x2;
1094
+ typedef mat<2, 3, uint16, mediump> mediump_u16mat2x3;
1095
+ typedef mat<2, 4, uint16, mediump> mediump_u16mat2x4;
1096
+ typedef mat<3, 2, uint16, mediump> mediump_u16mat3x2;
1097
+ typedef mat<3, 3, uint16, mediump> mediump_u16mat3x3;
1098
+ typedef mat<3, 4, uint16, mediump> mediump_u16mat3x4;
1099
+ typedef mat<4, 2, uint16, mediump> mediump_u16mat4x2;
1100
+ typedef mat<4, 3, uint16, mediump> mediump_u16mat4x3;
1101
+ typedef mat<4, 4, uint16, mediump> mediump_u16mat4x4;
1102
+
1103
+ typedef mat<2, 2, uint16, highp> highp_u16mat2x2;
1104
+ typedef mat<2, 3, uint16, highp> highp_u16mat2x3;
1105
+ typedef mat<2, 4, uint16, highp> highp_u16mat2x4;
1106
+ typedef mat<3, 2, uint16, highp> highp_u16mat3x2;
1107
+ typedef mat<3, 3, uint16, highp> highp_u16mat3x3;
1108
+ typedef mat<3, 4, uint16, highp> highp_u16mat3x4;
1109
+ typedef mat<4, 2, uint16, highp> highp_u16mat4x2;
1110
+ typedef mat<4, 3, uint16, highp> highp_u16mat4x3;
1111
+ typedef mat<4, 4, uint16, highp> highp_u16mat4x4;
1112
+
1113
+ typedef mat<2, 2, uint16, defaultp> u16mat2x2;
1114
+ typedef mat<2, 3, uint16, defaultp> u16mat2x3;
1115
+ typedef mat<2, 4, uint16, defaultp> u16mat2x4;
1116
+ typedef mat<3, 2, uint16, defaultp> u16mat3x2;
1117
+ typedef mat<3, 3, uint16, defaultp> u16mat3x3;
1118
+ typedef mat<3, 4, uint16, defaultp> u16mat3x4;
1119
+ typedef mat<4, 2, uint16, defaultp> u16mat4x2;
1120
+ typedef mat<4, 3, uint16, defaultp> u16mat4x3;
1121
+ typedef mat<4, 4, uint16, defaultp> u16mat4x4;
1122
+
1123
+
1124
+ typedef mat<2, 2, uint32, lowp> lowp_u32mat2x2;
1125
+ typedef mat<2, 3, uint32, lowp> lowp_u32mat2x3;
1126
+ typedef mat<2, 4, uint32, lowp> lowp_u32mat2x4;
1127
+ typedef mat<3, 2, uint32, lowp> lowp_u32mat3x2;
1128
+ typedef mat<3, 3, uint32, lowp> lowp_u32mat3x3;
1129
+ typedef mat<3, 4, uint32, lowp> lowp_u32mat3x4;
1130
+ typedef mat<4, 2, uint32, lowp> lowp_u32mat4x2;
1131
+ typedef mat<4, 3, uint32, lowp> lowp_u32mat4x3;
1132
+ typedef mat<4, 4, uint32, lowp> lowp_u32mat4x4;
1133
+
1134
+ typedef mat<2, 2, uint32, mediump> mediump_u32mat2x2;
1135
+ typedef mat<2, 3, uint32, mediump> mediump_u32mat2x3;
1136
+ typedef mat<2, 4, uint32, mediump> mediump_u32mat2x4;
1137
+ typedef mat<3, 2, uint32, mediump> mediump_u32mat3x2;
1138
+ typedef mat<3, 3, uint32, mediump> mediump_u32mat3x3;
1139
+ typedef mat<3, 4, uint32, mediump> mediump_u32mat3x4;
1140
+ typedef mat<4, 2, uint32, mediump> mediump_u32mat4x2;
1141
+ typedef mat<4, 3, uint32, mediump> mediump_u32mat4x3;
1142
+ typedef mat<4, 4, uint32, mediump> mediump_u32mat4x4;
1143
+
1144
+ typedef mat<2, 2, uint32, highp> highp_u32mat2x2;
1145
+ typedef mat<2, 3, uint32, highp> highp_u32mat2x3;
1146
+ typedef mat<2, 4, uint32, highp> highp_u32mat2x4;
1147
+ typedef mat<3, 2, uint32, highp> highp_u32mat3x2;
1148
+ typedef mat<3, 3, uint32, highp> highp_u32mat3x3;
1149
+ typedef mat<3, 4, uint32, highp> highp_u32mat3x4;
1150
+ typedef mat<4, 2, uint32, highp> highp_u32mat4x2;
1151
+ typedef mat<4, 3, uint32, highp> highp_u32mat4x3;
1152
+ typedef mat<4, 4, uint32, highp> highp_u32mat4x4;
1153
+
1154
+ typedef mat<2, 2, uint32, defaultp> u32mat2x2;
1155
+ typedef mat<2, 3, uint32, defaultp> u32mat2x3;
1156
+ typedef mat<2, 4, uint32, defaultp> u32mat2x4;
1157
+ typedef mat<3, 2, uint32, defaultp> u32mat3x2;
1158
+ typedef mat<3, 3, uint32, defaultp> u32mat3x3;
1159
+ typedef mat<3, 4, uint32, defaultp> u32mat3x4;
1160
+ typedef mat<4, 2, uint32, defaultp> u32mat4x2;
1161
+ typedef mat<4, 3, uint32, defaultp> u32mat4x3;
1162
+ typedef mat<4, 4, uint32, defaultp> u32mat4x4;
1163
+
1164
+
1165
+ typedef mat<2, 2, uint64, lowp> lowp_u64mat2x2;
1166
+ typedef mat<2, 3, uint64, lowp> lowp_u64mat2x3;
1167
+ typedef mat<2, 4, uint64, lowp> lowp_u64mat2x4;
1168
+ typedef mat<3, 2, uint64, lowp> lowp_u64mat3x2;
1169
+ typedef mat<3, 3, uint64, lowp> lowp_u64mat3x3;
1170
+ typedef mat<3, 4, uint64, lowp> lowp_u64mat3x4;
1171
+ typedef mat<4, 2, uint64, lowp> lowp_u64mat4x2;
1172
+ typedef mat<4, 3, uint64, lowp> lowp_u64mat4x3;
1173
+ typedef mat<4, 4, uint64, lowp> lowp_u64mat4x4;
1174
+
1175
+ typedef mat<2, 2, uint64, mediump> mediump_u64mat2x2;
1176
+ typedef mat<2, 3, uint64, mediump> mediump_u64mat2x3;
1177
+ typedef mat<2, 4, uint64, mediump> mediump_u64mat2x4;
1178
+ typedef mat<3, 2, uint64, mediump> mediump_u64mat3x2;
1179
+ typedef mat<3, 3, uint64, mediump> mediump_u64mat3x3;
1180
+ typedef mat<3, 4, uint64, mediump> mediump_u64mat3x4;
1181
+ typedef mat<4, 2, uint64, mediump> mediump_u64mat4x2;
1182
+ typedef mat<4, 3, uint64, mediump> mediump_u64mat4x3;
1183
+ typedef mat<4, 4, uint64, mediump> mediump_u64mat4x4;
1184
+
1185
+ typedef mat<2, 2, uint64, highp> highp_u64mat2x2;
1186
+ typedef mat<2, 3, uint64, highp> highp_u64mat2x3;
1187
+ typedef mat<2, 4, uint64, highp> highp_u64mat2x4;
1188
+ typedef mat<3, 2, uint64, highp> highp_u64mat3x2;
1189
+ typedef mat<3, 3, uint64, highp> highp_u64mat3x3;
1190
+ typedef mat<3, 4, uint64, highp> highp_u64mat3x4;
1191
+ typedef mat<4, 2, uint64, highp> highp_u64mat4x2;
1192
+ typedef mat<4, 3, uint64, highp> highp_u64mat4x3;
1193
+ typedef mat<4, 4, uint64, highp> highp_u64mat4x4;
1194
+
1195
+ typedef mat<2, 2, uint64, defaultp> u64mat2x2;
1196
+ typedef mat<2, 3, uint64, defaultp> u64mat2x3;
1197
+ typedef mat<2, 4, uint64, defaultp> u64mat2x4;
1198
+ typedef mat<3, 2, uint64, defaultp> u64mat3x2;
1199
+ typedef mat<3, 3, uint64, defaultp> u64mat3x3;
1200
+ typedef mat<3, 4, uint64, defaultp> u64mat3x4;
1201
+ typedef mat<4, 2, uint64, defaultp> u64mat4x2;
1202
+ typedef mat<4, 3, uint64, defaultp> u64mat4x3;
1203
+ typedef mat<4, 4, uint64, defaultp> u64mat4x4;
1204
+
1205
+ // Quaternion
1206
+
1207
+ typedef qua<float, lowp> lowp_quat;
1208
+ typedef qua<float, mediump> mediump_quat;
1209
+ typedef qua<float, highp> highp_quat;
1210
+ typedef qua<float, defaultp> quat;
1211
+
1212
+ typedef qua<float, lowp> lowp_fquat;
1213
+ typedef qua<float, mediump> mediump_fquat;
1214
+ typedef qua<float, highp> highp_fquat;
1215
+ typedef qua<float, defaultp> fquat;
1216
+
1217
+ typedef qua<f32, lowp> lowp_f32quat;
1218
+ typedef qua<f32, mediump> mediump_f32quat;
1219
+ typedef qua<f32, highp> highp_f32quat;
1220
+ typedef qua<f32, defaultp> f32quat;
1221
+
1222
+ typedef qua<double, lowp> lowp_dquat;
1223
+ typedef qua<double, mediump> mediump_dquat;
1224
+ typedef qua<double, highp> highp_dquat;
1225
+ typedef qua<double, defaultp> dquat;
1226
+
1227
+ typedef qua<f64, lowp> lowp_f64quat;
1228
+ typedef qua<f64, mediump> mediump_f64quat;
1229
+ typedef qua<f64, highp> highp_f64quat;
1230
+ typedef qua<f64, defaultp> f64quat;
1231
+ }//namespace glm
1232
+
1233
+
cuda_extensions/third_party/glm/glm/geometric.hpp ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref core
2
+ /// @file glm/geometric.hpp
3
+ ///
4
+ /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
5
+ ///
6
+ /// @defgroup core_func_geometric Geometric functions
7
+ /// @ingroup core
8
+ ///
9
+ /// These operate on vectors as vectors, not component-wise.
10
+ ///
11
+ /// Include <glm/geometric.hpp> to use these core features.
12
+
13
+ #pragma once
14
+
15
+ #include "detail/type_vec3.hpp"
16
+
17
+ namespace glm
18
+ {
19
+ /// @addtogroup core_func_geometric
20
+ /// @{
21
+
22
+ /// Returns the length of x, i.e., sqrt(x * x).
23
+ ///
24
+ /// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
25
+ /// @tparam T Floating-point scalar types.
26
+ ///
27
+ /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/length.xml">GLSL length man page</a>
28
+ /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
29
+ template<length_t L, typename T, qualifier Q>
30
+ GLM_FUNC_DECL T length(vec<L, T, Q> const& x);
31
+
32
+ /// Returns the distance between p0 and p1, i.e., length(p0 - p1).
33
+ ///
34
+ /// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
35
+ /// @tparam T Floating-point scalar types.
36
+ ///
37
+ /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/distance.xml">GLSL distance man page</a>
38
+ /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
39
+ template<length_t L, typename T, qualifier Q>
40
+ GLM_FUNC_DECL T distance(vec<L, T, Q> const& p0, vec<L, T, Q> const& p1);
41
+
42
+ /// Returns the dot product of x and y, i.e., result = x * y.
43
+ ///
44
+ /// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
45
+ /// @tparam T Floating-point scalar types.
46
+ ///
47
+ /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/dot.xml">GLSL dot man page</a>
48
+ /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
49
+ template<length_t L, typename T, qualifier Q>
50
+ GLM_FUNC_DECL GLM_CONSTEXPR T dot(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
51
+
52
+ /// Returns the cross product of x and y.
53
+ ///
54
+ /// @tparam T Floating-point scalar types.
55
+ ///
56
+ /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/cross.xml">GLSL cross man page</a>
57
+ /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
58
+ template<typename T, qualifier Q>
59
+ GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> cross(vec<3, T, Q> const& x, vec<3, T, Q> const& y);
60
+
61
+ /// Returns a vector in the same direction as x but with length of 1.
62
+ /// According to issue 10 GLSL 1.10 specification, if length(x) == 0 then result is undefined and generate an error.
63
+ ///
64
+ /// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
65
+ /// @tparam T Floating-point scalar types.
66
+ ///
67
+ /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/normalize.xml">GLSL normalize man page</a>
68
+ /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
69
+ template<length_t L, typename T, qualifier Q>
70
+ GLM_FUNC_DECL vec<L, T, Q> normalize(vec<L, T, Q> const& x);
71
+
72
+ /// If dot(Nref, I) < 0.0, return N, otherwise, return -N.
73
+ ///
74
+ /// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
75
+ /// @tparam T Floating-point scalar types.
76
+ ///
77
+ /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/faceforward.xml">GLSL faceforward man page</a>
78
+ /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
79
+ template<length_t L, typename T, qualifier Q>
80
+ GLM_FUNC_DECL vec<L, T, Q> faceforward(
81
+ vec<L, T, Q> const& N,
82
+ vec<L, T, Q> const& I,
83
+ vec<L, T, Q> const& Nref);
84
+
85
+ /// For the incident vector I and surface orientation N,
86
+ /// returns the reflection direction : result = I - 2.0 * dot(N, I) * N.
87
+ ///
88
+ /// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
89
+ /// @tparam T Floating-point scalar types.
90
+ ///
91
+ /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/reflect.xml">GLSL reflect man page</a>
92
+ /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
93
+ template<length_t L, typename T, qualifier Q>
94
+ GLM_FUNC_DECL vec<L, T, Q> reflect(
95
+ vec<L, T, Q> const& I,
96
+ vec<L, T, Q> const& N);
97
+
98
+ /// For the incident vector I and surface normal N,
99
+ /// and the ratio of indices of refraction eta,
100
+ /// return the refraction vector.
101
+ ///
102
+ /// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
103
+ /// @tparam T Floating-point scalar types.
104
+ ///
105
+ /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/refract.xml">GLSL refract man page</a>
106
+ /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
107
+ template<length_t L, typename T, qualifier Q>
108
+ GLM_FUNC_DECL vec<L, T, Q> refract(
109
+ vec<L, T, Q> const& I,
110
+ vec<L, T, Q> const& N,
111
+ T eta);
112
+
113
+ /// @}
114
+ }//namespace glm
115
+
116
+ #include "detail/func_geometric.inl"
cuda_extensions/third_party/glm/glm/glm.hpp ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref core
2
+ /// @file glm/glm.hpp
3
+ ///
4
+ /// @mainpage OpenGL Mathematics (GLM)
5
+ /// - Website: <a href="https://glm.g-truc.net">glm.g-truc.net</a>
6
+ /// - <a href="modules.html">GLM API documentation</a>
7
+ /// - <a href="https://github.com/g-truc/glm/blob/master/manual.md">GLM Manual</a>
8
+ ///
9
+ /// @defgroup core Core features
10
+ ///
11
+ /// @brief Features that implement in C++ the GLSL specification as closely as possible.
12
+ ///
13
+ /// The GLM core consists of C++ types that mirror GLSL types and
14
+ /// C++ functions that mirror the GLSL functions.
15
+ ///
16
+ /// The best documentation for GLM Core is the current GLSL specification,
17
+ /// <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.clean.pdf">version 4.2
18
+ /// (pdf file)</a>.
19
+ ///
20
+ /// GLM core functionalities require <glm/glm.hpp> to be included to be used.
21
+ ///
22
+ ///
23
+ /// @defgroup core_vector Vector types
24
+ ///
25
+ /// Vector types of two to four components with an exhaustive set of operators.
26
+ ///
27
+ /// @ingroup core
28
+ ///
29
+ ///
30
+ /// @defgroup core_vector_precision Vector types with precision qualifiers
31
+ ///
32
+ /// @brief Vector types with precision qualifiers which may result in various precision in term of ULPs
33
+ ///
34
+ /// GLSL allows defining qualifiers for particular variables.
35
+ /// With OpenGL's GLSL, these qualifiers have no effect; they are there for compatibility,
36
+ /// with OpenGL ES's GLSL, these qualifiers do have an effect.
37
+ ///
38
+ /// C++ has no language equivalent to qualifier qualifiers. So GLM provides the next-best thing:
39
+ /// a number of typedefs that use a particular qualifier.
40
+ ///
41
+ /// None of these types make any guarantees about the actual qualifier used.
42
+ ///
43
+ /// @ingroup core
44
+ ///
45
+ ///
46
+ /// @defgroup core_matrix Matrix types
47
+ ///
48
+ /// Matrix types of with C columns and R rows where C and R are values between 2 to 4 included.
49
+ /// These types have exhaustive sets of operators.
50
+ ///
51
+ /// @ingroup core
52
+ ///
53
+ ///
54
+ /// @defgroup core_matrix_precision Matrix types with precision qualifiers
55
+ ///
56
+ /// @brief Matrix types with precision qualifiers which may result in various precision in term of ULPs
57
+ ///
58
+ /// GLSL allows defining qualifiers for particular variables.
59
+ /// With OpenGL's GLSL, these qualifiers have no effect; they are there for compatibility,
60
+ /// with OpenGL ES's GLSL, these qualifiers do have an effect.
61
+ ///
62
+ /// C++ has no language equivalent to qualifier qualifiers. So GLM provides the next-best thing:
63
+ /// a number of typedefs that use a particular qualifier.
64
+ ///
65
+ /// None of these types make any guarantees about the actual qualifier used.
66
+ ///
67
+ /// @ingroup core
68
+ ///
69
+ ///
70
+ /// @defgroup ext Stable extensions
71
+ ///
72
+ /// @brief Additional features not specified by GLSL specification.
73
+ ///
74
+ /// EXT extensions are fully tested and documented.
75
+ ///
76
+ /// Even if it's highly unrecommended, it's possible to include all the extensions at once by
77
+ /// including <glm/ext.hpp>. Otherwise, each extension needs to be included a specific file.
78
+ ///
79
+ ///
80
+ /// @defgroup gtc Recommended extensions
81
+ ///
82
+ /// @brief Additional features not specified by GLSL specification.
83
+ ///
84
+ /// GTC extensions aim to be stable with tests and documentation.
85
+ ///
86
+ /// Even if it's highly unrecommended, it's possible to include all the extensions at once by
87
+ /// including <glm/ext.hpp>. Otherwise, each extension needs to be included a specific file.
88
+ ///
89
+ ///
90
+ /// @defgroup gtx Experimental extensions
91
+ ///
92
+ /// @brief Experimental features not specified by GLSL specification.
93
+ ///
94
+ /// Experimental extensions are useful functions and types, but the development of
95
+ /// their API and functionality is not necessarily stable. They can change
96
+ /// substantially between versions. Backwards compatibility is not much of an issue
97
+ /// for them.
98
+ ///
99
+ /// Even if it's highly unrecommended, it's possible to include all the extensions
100
+ /// at once by including <glm/ext.hpp>. Otherwise, each extension needs to be
101
+ /// included a specific file.
102
+ ///
103
+
104
+ #include "detail/_fixes.hpp"
105
+
106
+ #include "detail/setup.hpp"
107
+
108
+ #pragma once
109
+
110
+ #include <cmath>
111
+ #include <climits>
112
+ #include <cfloat>
113
+ #include <limits>
114
+ #include <cassert>
115
+ #include "fwd.hpp"
116
+
117
+ #include "vec2.hpp"
118
+ #include "vec3.hpp"
119
+ #include "vec4.hpp"
120
+ #include "mat2x2.hpp"
121
+ #include "mat2x3.hpp"
122
+ #include "mat2x4.hpp"
123
+ #include "mat3x2.hpp"
124
+ #include "mat3x3.hpp"
125
+ #include "mat3x4.hpp"
126
+ #include "mat4x2.hpp"
127
+ #include "mat4x3.hpp"
128
+ #include "mat4x4.hpp"
129
+
130
+ #include "trigonometric.hpp"
131
+ #include "exponential.hpp"
132
+ #include "common.hpp"
133
+ #include "packing.hpp"
134
+ #include "geometric.hpp"
135
+ #include "matrix.hpp"
136
+ #include "vector_relational.hpp"
137
+ #include "integer.hpp"
cuda_extensions/third_party/glm/glm/gtc/bitfield.hpp ADDED
@@ -0,0 +1,266 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref gtc_bitfield
2
+ /// @file glm/gtc/bitfield.hpp
3
+ ///
4
+ /// @see core (dependence)
5
+ /// @see gtc_bitfield (dependence)
6
+ ///
7
+ /// @defgroup gtc_bitfield GLM_GTC_bitfield
8
+ /// @ingroup gtc
9
+ ///
10
+ /// Include <glm/gtc/bitfield.hpp> to use the features of this extension.
11
+ ///
12
+ /// Allow to perform bit operations on integer values
13
+
14
+ #include "../detail/setup.hpp"
15
+
16
+ #pragma once
17
+
18
+ // Dependencies
19
+ #include "../ext/scalar_int_sized.hpp"
20
+ #include "../ext/scalar_uint_sized.hpp"
21
+ #include "../detail/qualifier.hpp"
22
+ #include "../detail/_vectorize.hpp"
23
+ #include "type_precision.hpp"
24
+ #include <limits>
25
+
26
+ #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
27
+ # pragma message("GLM: GLM_GTC_bitfield extension included")
28
+ #endif
29
+
30
+ namespace glm
31
+ {
32
+ /// @addtogroup gtc_bitfield
33
+ /// @{
34
+
35
+ /// Build a mask of 'count' bits
36
+ ///
37
+ /// @see gtc_bitfield
38
+ template<typename genIUType>
39
+ GLM_FUNC_DECL genIUType mask(genIUType Bits);
40
+
41
+ /// Build a mask of 'count' bits
42
+ ///
43
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
44
+ /// @tparam T Signed and unsigned integer scalar types
45
+ /// @tparam Q Value from qualifier enum
46
+ ///
47
+ /// @see gtc_bitfield
48
+ template<length_t L, typename T, qualifier Q>
49
+ GLM_FUNC_DECL vec<L, T, Q> mask(vec<L, T, Q> const& v);
50
+
51
+ /// Rotate all bits to the right. All the bits dropped in the right side are inserted back on the left side.
52
+ ///
53
+ /// @see gtc_bitfield
54
+ template<typename genIUType>
55
+ GLM_FUNC_DECL genIUType bitfieldRotateRight(genIUType In, int Shift);
56
+
57
+ /// Rotate all bits to the right. All the bits dropped in the right side are inserted back on the left side.
58
+ ///
59
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
60
+ /// @tparam T Signed and unsigned integer scalar types
61
+ /// @tparam Q Value from qualifier enum
62
+ ///
63
+ /// @see gtc_bitfield
64
+ template<length_t L, typename T, qualifier Q>
65
+ GLM_FUNC_DECL vec<L, T, Q> bitfieldRotateRight(vec<L, T, Q> const& In, int Shift);
66
+
67
+ /// Rotate all bits to the left. All the bits dropped in the left side are inserted back on the right side.
68
+ ///
69
+ /// @see gtc_bitfield
70
+ template<typename genIUType>
71
+ GLM_FUNC_DECL genIUType bitfieldRotateLeft(genIUType In, int Shift);
72
+
73
+ /// Rotate all bits to the left. All the bits dropped in the left side are inserted back on the right side.
74
+ ///
75
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
76
+ /// @tparam T Signed and unsigned integer scalar types
77
+ /// @tparam Q Value from qualifier enum
78
+ ///
79
+ /// @see gtc_bitfield
80
+ template<length_t L, typename T, qualifier Q>
81
+ GLM_FUNC_DECL vec<L, T, Q> bitfieldRotateLeft(vec<L, T, Q> const& In, int Shift);
82
+
83
+ /// Set to 1 a range of bits.
84
+ ///
85
+ /// @see gtc_bitfield
86
+ template<typename genIUType>
87
+ GLM_FUNC_DECL genIUType bitfieldFillOne(genIUType Value, int FirstBit, int BitCount);
88
+
89
+ /// Set to 1 a range of bits.
90
+ ///
91
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
92
+ /// @tparam T Signed and unsigned integer scalar types
93
+ /// @tparam Q Value from qualifier enum
94
+ ///
95
+ /// @see gtc_bitfield
96
+ template<length_t L, typename T, qualifier Q>
97
+ GLM_FUNC_DECL vec<L, T, Q> bitfieldFillOne(vec<L, T, Q> const& Value, int FirstBit, int BitCount);
98
+
99
+ /// Set to 0 a range of bits.
100
+ ///
101
+ /// @see gtc_bitfield
102
+ template<typename genIUType>
103
+ GLM_FUNC_DECL genIUType bitfieldFillZero(genIUType Value, int FirstBit, int BitCount);
104
+
105
+ /// Set to 0 a range of bits.
106
+ ///
107
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
108
+ /// @tparam T Signed and unsigned integer scalar types
109
+ /// @tparam Q Value from qualifier enum
110
+ ///
111
+ /// @see gtc_bitfield
112
+ template<length_t L, typename T, qualifier Q>
113
+ GLM_FUNC_DECL vec<L, T, Q> bitfieldFillZero(vec<L, T, Q> const& Value, int FirstBit, int BitCount);
114
+
115
+ /// Interleaves the bits of x and y.
116
+ /// The first bit is the first bit of x followed by the first bit of y.
117
+ /// The other bits are interleaved following the previous sequence.
118
+ ///
119
+ /// @see gtc_bitfield
120
+ GLM_FUNC_DECL int16 bitfieldInterleave(int8 x, int8 y);
121
+
122
+ /// Interleaves the bits of x and y.
123
+ /// The first bit is the first bit of x followed by the first bit of y.
124
+ /// The other bits are interleaved following the previous sequence.
125
+ ///
126
+ /// @see gtc_bitfield
127
+ GLM_FUNC_DECL uint16 bitfieldInterleave(uint8 x, uint8 y);
128
+
129
+ /// Interleaves the bits of x and y.
130
+ /// The first bit is the first bit of v.x followed by the first bit of v.y.
131
+ /// The other bits are interleaved following the previous sequence.
132
+ ///
133
+ /// @see gtc_bitfield
134
+ GLM_FUNC_DECL uint16 bitfieldInterleave(u8vec2 const& v);
135
+
136
+ /// Deinterleaves the bits of x.
137
+ ///
138
+ /// @see gtc_bitfield
139
+ GLM_FUNC_DECL glm::u8vec2 bitfieldDeinterleave(glm::uint16 x);
140
+
141
+ /// Interleaves the bits of x and y.
142
+ /// The first bit is the first bit of x followed by the first bit of y.
143
+ /// The other bits are interleaved following the previous sequence.
144
+ ///
145
+ /// @see gtc_bitfield
146
+ GLM_FUNC_DECL int32 bitfieldInterleave(int16 x, int16 y);
147
+
148
+ /// Interleaves the bits of x and y.
149
+ /// The first bit is the first bit of x followed by the first bit of y.
150
+ /// The other bits are interleaved following the previous sequence.
151
+ ///
152
+ /// @see gtc_bitfield
153
+ GLM_FUNC_DECL uint32 bitfieldInterleave(uint16 x, uint16 y);
154
+
155
+ /// Interleaves the bits of x and y.
156
+ /// The first bit is the first bit of v.x followed by the first bit of v.y.
157
+ /// The other bits are interleaved following the previous sequence.
158
+ ///
159
+ /// @see gtc_bitfield
160
+ GLM_FUNC_DECL uint32 bitfieldInterleave(u16vec2 const& v);
161
+
162
+ /// Deinterleaves the bits of x.
163
+ ///
164
+ /// @see gtc_bitfield
165
+ GLM_FUNC_DECL glm::u16vec2 bitfieldDeinterleave(glm::uint32 x);
166
+
167
+ /// Interleaves the bits of x and y.
168
+ /// The first bit is the first bit of x followed by the first bit of y.
169
+ /// The other bits are interleaved following the previous sequence.
170
+ ///
171
+ /// @see gtc_bitfield
172
+ GLM_FUNC_DECL int64 bitfieldInterleave(int32 x, int32 y);
173
+
174
+ /// Interleaves the bits of x and y.
175
+ /// The first bit is the first bit of x followed by the first bit of y.
176
+ /// The other bits are interleaved following the previous sequence.
177
+ ///
178
+ /// @see gtc_bitfield
179
+ GLM_FUNC_DECL uint64 bitfieldInterleave(uint32 x, uint32 y);
180
+
181
+ /// Interleaves the bits of x and y.
182
+ /// The first bit is the first bit of v.x followed by the first bit of v.y.
183
+ /// The other bits are interleaved following the previous sequence.
184
+ ///
185
+ /// @see gtc_bitfield
186
+ GLM_FUNC_DECL uint64 bitfieldInterleave(u32vec2 const& v);
187
+
188
+ /// Deinterleaves the bits of x.
189
+ ///
190
+ /// @see gtc_bitfield
191
+ GLM_FUNC_DECL glm::u32vec2 bitfieldDeinterleave(glm::uint64 x);
192
+
193
+ /// Interleaves the bits of x, y and z.
194
+ /// The first bit is the first bit of x followed by the first bit of y and the first bit of z.
195
+ /// The other bits are interleaved following the previous sequence.
196
+ ///
197
+ /// @see gtc_bitfield
198
+ GLM_FUNC_DECL int32 bitfieldInterleave(int8 x, int8 y, int8 z);
199
+
200
+ /// Interleaves the bits of x, y and z.
201
+ /// The first bit is the first bit of x followed by the first bit of y and the first bit of z.
202
+ /// The other bits are interleaved following the previous sequence.
203
+ ///
204
+ /// @see gtc_bitfield
205
+ GLM_FUNC_DECL uint32 bitfieldInterleave(uint8 x, uint8 y, uint8 z);
206
+
207
+ /// Interleaves the bits of x, y and z.
208
+ /// The first bit is the first bit of x followed by the first bit of y and the first bit of z.
209
+ /// The other bits are interleaved following the previous sequence.
210
+ ///
211
+ /// @see gtc_bitfield
212
+ GLM_FUNC_DECL int64 bitfieldInterleave(int16 x, int16 y, int16 z);
213
+
214
+ /// Interleaves the bits of x, y and z.
215
+ /// The first bit is the first bit of x followed by the first bit of y and the first bit of z.
216
+ /// The other bits are interleaved following the previous sequence.
217
+ ///
218
+ /// @see gtc_bitfield
219
+ GLM_FUNC_DECL uint64 bitfieldInterleave(uint16 x, uint16 y, uint16 z);
220
+
221
+ /// Interleaves the bits of x, y and z.
222
+ /// The first bit is the first bit of x followed by the first bit of y and the first bit of z.
223
+ /// The other bits are interleaved following the previous sequence.
224
+ ///
225
+ /// @see gtc_bitfield
226
+ GLM_FUNC_DECL int64 bitfieldInterleave(int32 x, int32 y, int32 z);
227
+
228
+ /// Interleaves the bits of x, y and z.
229
+ /// The first bit is the first bit of x followed by the first bit of y and the first bit of z.
230
+ /// The other bits are interleaved following the previous sequence.
231
+ ///
232
+ /// @see gtc_bitfield
233
+ GLM_FUNC_DECL uint64 bitfieldInterleave(uint32 x, uint32 y, uint32 z);
234
+
235
+ /// Interleaves the bits of x, y, z and w.
236
+ /// The first bit is the first bit of x followed by the first bit of y, the first bit of z and finally the first bit of w.
237
+ /// The other bits are interleaved following the previous sequence.
238
+ ///
239
+ /// @see gtc_bitfield
240
+ GLM_FUNC_DECL int32 bitfieldInterleave(int8 x, int8 y, int8 z, int8 w);
241
+
242
+ /// Interleaves the bits of x, y, z and w.
243
+ /// The first bit is the first bit of x followed by the first bit of y, the first bit of z and finally the first bit of w.
244
+ /// The other bits are interleaved following the previous sequence.
245
+ ///
246
+ /// @see gtc_bitfield
247
+ GLM_FUNC_DECL uint32 bitfieldInterleave(uint8 x, uint8 y, uint8 z, uint8 w);
248
+
249
+ /// Interleaves the bits of x, y, z and w.
250
+ /// The first bit is the first bit of x followed by the first bit of y, the first bit of z and finally the first bit of w.
251
+ /// The other bits are interleaved following the previous sequence.
252
+ ///
253
+ /// @see gtc_bitfield
254
+ GLM_FUNC_DECL int64 bitfieldInterleave(int16 x, int16 y, int16 z, int16 w);
255
+
256
+ /// Interleaves the bits of x, y, z and w.
257
+ /// The first bit is the first bit of x followed by the first bit of y, the first bit of z and finally the first bit of w.
258
+ /// The other bits are interleaved following the previous sequence.
259
+ ///
260
+ /// @see gtc_bitfield
261
+ GLM_FUNC_DECL uint64 bitfieldInterleave(uint16 x, uint16 y, uint16 z, uint16 w);
262
+
263
+ /// @}
264
+ } //namespace glm
265
+
266
+ #include "bitfield.inl"
cuda_extensions/third_party/glm/glm/gtc/bitfield.inl ADDED
@@ -0,0 +1,626 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref gtc_bitfield
2
+
3
+ #include "../simd/integer.h"
4
+
5
+ namespace glm{
6
+ namespace detail
7
+ {
8
+ template<typename PARAM, typename RET>
9
+ GLM_FUNC_DECL RET bitfieldInterleave(PARAM x, PARAM y);
10
+
11
+ template<typename PARAM, typename RET>
12
+ GLM_FUNC_DECL RET bitfieldInterleave(PARAM x, PARAM y, PARAM z);
13
+
14
+ template<typename PARAM, typename RET>
15
+ GLM_FUNC_DECL RET bitfieldInterleave(PARAM x, PARAM y, PARAM z, PARAM w);
16
+
17
+ template<>
18
+ GLM_FUNC_QUALIFIER glm::uint16 bitfieldInterleave(glm::uint8 x, glm::uint8 y)
19
+ {
20
+ glm::uint16 REG1(x);
21
+ glm::uint16 REG2(y);
22
+
23
+ REG1 = ((REG1 << 4) | REG1) & static_cast<glm::uint16>(0x0F0F);
24
+ REG2 = ((REG2 << 4) | REG2) & static_cast<glm::uint16>(0x0F0F);
25
+
26
+ REG1 = ((REG1 << 2) | REG1) & static_cast<glm::uint16>(0x3333);
27
+ REG2 = ((REG2 << 2) | REG2) & static_cast<glm::uint16>(0x3333);
28
+
29
+ REG1 = ((REG1 << 1) | REG1) & static_cast<glm::uint16>(0x5555);
30
+ REG2 = ((REG2 << 1) | REG2) & static_cast<glm::uint16>(0x5555);
31
+
32
+ return REG1 | static_cast<glm::uint16>(REG2 << 1);
33
+ }
34
+
35
+ template<>
36
+ GLM_FUNC_QUALIFIER glm::uint32 bitfieldInterleave(glm::uint16 x, glm::uint16 y)
37
+ {
38
+ glm::uint32 REG1(x);
39
+ glm::uint32 REG2(y);
40
+
41
+ REG1 = ((REG1 << 8) | REG1) & static_cast<glm::uint32>(0x00FF00FF);
42
+ REG2 = ((REG2 << 8) | REG2) & static_cast<glm::uint32>(0x00FF00FF);
43
+
44
+ REG1 = ((REG1 << 4) | REG1) & static_cast<glm::uint32>(0x0F0F0F0F);
45
+ REG2 = ((REG2 << 4) | REG2) & static_cast<glm::uint32>(0x0F0F0F0F);
46
+
47
+ REG1 = ((REG1 << 2) | REG1) & static_cast<glm::uint32>(0x33333333);
48
+ REG2 = ((REG2 << 2) | REG2) & static_cast<glm::uint32>(0x33333333);
49
+
50
+ REG1 = ((REG1 << 1) | REG1) & static_cast<glm::uint32>(0x55555555);
51
+ REG2 = ((REG2 << 1) | REG2) & static_cast<glm::uint32>(0x55555555);
52
+
53
+ return REG1 | (REG2 << 1);
54
+ }
55
+
56
+ template<>
57
+ GLM_FUNC_QUALIFIER glm::uint64 bitfieldInterleave(glm::uint32 x, glm::uint32 y)
58
+ {
59
+ glm::uint64 REG1(x);
60
+ glm::uint64 REG2(y);
61
+
62
+ REG1 = ((REG1 << 16) | REG1) & static_cast<glm::uint64>(0x0000FFFF0000FFFFull);
63
+ REG2 = ((REG2 << 16) | REG2) & static_cast<glm::uint64>(0x0000FFFF0000FFFFull);
64
+
65
+ REG1 = ((REG1 << 8) | REG1) & static_cast<glm::uint64>(0x00FF00FF00FF00FFull);
66
+ REG2 = ((REG2 << 8) | REG2) & static_cast<glm::uint64>(0x00FF00FF00FF00FFull);
67
+
68
+ REG1 = ((REG1 << 4) | REG1) & static_cast<glm::uint64>(0x0F0F0F0F0F0F0F0Full);
69
+ REG2 = ((REG2 << 4) | REG2) & static_cast<glm::uint64>(0x0F0F0F0F0F0F0F0Full);
70
+
71
+ REG1 = ((REG1 << 2) | REG1) & static_cast<glm::uint64>(0x3333333333333333ull);
72
+ REG2 = ((REG2 << 2) | REG2) & static_cast<glm::uint64>(0x3333333333333333ull);
73
+
74
+ REG1 = ((REG1 << 1) | REG1) & static_cast<glm::uint64>(0x5555555555555555ull);
75
+ REG2 = ((REG2 << 1) | REG2) & static_cast<glm::uint64>(0x5555555555555555ull);
76
+
77
+ return REG1 | (REG2 << 1);
78
+ }
79
+
80
+ template<>
81
+ GLM_FUNC_QUALIFIER glm::uint32 bitfieldInterleave(glm::uint8 x, glm::uint8 y, glm::uint8 z)
82
+ {
83
+ glm::uint32 REG1(x);
84
+ glm::uint32 REG2(y);
85
+ glm::uint32 REG3(z);
86
+
87
+ REG1 = ((REG1 << 16) | REG1) & static_cast<glm::uint32>(0xFF0000FFu);
88
+ REG2 = ((REG2 << 16) | REG2) & static_cast<glm::uint32>(0xFF0000FFu);
89
+ REG3 = ((REG3 << 16) | REG3) & static_cast<glm::uint32>(0xFF0000FFu);
90
+
91
+ REG1 = ((REG1 << 8) | REG1) & static_cast<glm::uint32>(0x0F00F00Fu);
92
+ REG2 = ((REG2 << 8) | REG2) & static_cast<glm::uint32>(0x0F00F00Fu);
93
+ REG3 = ((REG3 << 8) | REG3) & static_cast<glm::uint32>(0x0F00F00Fu);
94
+
95
+ REG1 = ((REG1 << 4) | REG1) & static_cast<glm::uint32>(0xC30C30C3u);
96
+ REG2 = ((REG2 << 4) | REG2) & static_cast<glm::uint32>(0xC30C30C3u);
97
+ REG3 = ((REG3 << 4) | REG3) & static_cast<glm::uint32>(0xC30C30C3u);
98
+
99
+ REG1 = ((REG1 << 2) | REG1) & static_cast<glm::uint32>(0x49249249u);
100
+ REG2 = ((REG2 << 2) | REG2) & static_cast<glm::uint32>(0x49249249u);
101
+ REG3 = ((REG3 << 2) | REG3) & static_cast<glm::uint32>(0x49249249u);
102
+
103
+ return REG1 | (REG2 << 1) | (REG3 << 2);
104
+ }
105
+
106
+ template<>
107
+ GLM_FUNC_QUALIFIER glm::uint64 bitfieldInterleave(glm::uint16 x, glm::uint16 y, glm::uint16 z)
108
+ {
109
+ glm::uint64 REG1(x);
110
+ glm::uint64 REG2(y);
111
+ glm::uint64 REG3(z);
112
+
113
+ REG1 = ((REG1 << 32) | REG1) & static_cast<glm::uint64>(0xFFFF00000000FFFFull);
114
+ REG2 = ((REG2 << 32) | REG2) & static_cast<glm::uint64>(0xFFFF00000000FFFFull);
115
+ REG3 = ((REG3 << 32) | REG3) & static_cast<glm::uint64>(0xFFFF00000000FFFFull);
116
+
117
+ REG1 = ((REG1 << 16) | REG1) & static_cast<glm::uint64>(0x00FF0000FF0000FFull);
118
+ REG2 = ((REG2 << 16) | REG2) & static_cast<glm::uint64>(0x00FF0000FF0000FFull);
119
+ REG3 = ((REG3 << 16) | REG3) & static_cast<glm::uint64>(0x00FF0000FF0000FFull);
120
+
121
+ REG1 = ((REG1 << 8) | REG1) & static_cast<glm::uint64>(0xF00F00F00F00F00Full);
122
+ REG2 = ((REG2 << 8) | REG2) & static_cast<glm::uint64>(0xF00F00F00F00F00Full);
123
+ REG3 = ((REG3 << 8) | REG3) & static_cast<glm::uint64>(0xF00F00F00F00F00Full);
124
+
125
+ REG1 = ((REG1 << 4) | REG1) & static_cast<glm::uint64>(0x30C30C30C30C30C3ull);
126
+ REG2 = ((REG2 << 4) | REG2) & static_cast<glm::uint64>(0x30C30C30C30C30C3ull);
127
+ REG3 = ((REG3 << 4) | REG3) & static_cast<glm::uint64>(0x30C30C30C30C30C3ull);
128
+
129
+ REG1 = ((REG1 << 2) | REG1) & static_cast<glm::uint64>(0x9249249249249249ull);
130
+ REG2 = ((REG2 << 2) | REG2) & static_cast<glm::uint64>(0x9249249249249249ull);
131
+ REG3 = ((REG3 << 2) | REG3) & static_cast<glm::uint64>(0x9249249249249249ull);
132
+
133
+ return REG1 | (REG2 << 1) | (REG3 << 2);
134
+ }
135
+
136
+ template<>
137
+ GLM_FUNC_QUALIFIER glm::uint64 bitfieldInterleave(glm::uint32 x, glm::uint32 y, glm::uint32 z)
138
+ {
139
+ glm::uint64 REG1(x);
140
+ glm::uint64 REG2(y);
141
+ glm::uint64 REG3(z);
142
+
143
+ REG1 = ((REG1 << 32) | REG1) & static_cast<glm::uint64>(0xFFFF00000000FFFFull);
144
+ REG2 = ((REG2 << 32) | REG2) & static_cast<glm::uint64>(0xFFFF00000000FFFFull);
145
+ REG3 = ((REG3 << 32) | REG3) & static_cast<glm::uint64>(0xFFFF00000000FFFFull);
146
+
147
+ REG1 = ((REG1 << 16) | REG1) & static_cast<glm::uint64>(0x00FF0000FF0000FFull);
148
+ REG2 = ((REG2 << 16) | REG2) & static_cast<glm::uint64>(0x00FF0000FF0000FFull);
149
+ REG3 = ((REG3 << 16) | REG3) & static_cast<glm::uint64>(0x00FF0000FF0000FFull);
150
+
151
+ REG1 = ((REG1 << 8) | REG1) & static_cast<glm::uint64>(0xF00F00F00F00F00Full);
152
+ REG2 = ((REG2 << 8) | REG2) & static_cast<glm::uint64>(0xF00F00F00F00F00Full);
153
+ REG3 = ((REG3 << 8) | REG3) & static_cast<glm::uint64>(0xF00F00F00F00F00Full);
154
+
155
+ REG1 = ((REG1 << 4) | REG1) & static_cast<glm::uint64>(0x30C30C30C30C30C3ull);
156
+ REG2 = ((REG2 << 4) | REG2) & static_cast<glm::uint64>(0x30C30C30C30C30C3ull);
157
+ REG3 = ((REG3 << 4) | REG3) & static_cast<glm::uint64>(0x30C30C30C30C30C3ull);
158
+
159
+ REG1 = ((REG1 << 2) | REG1) & static_cast<glm::uint64>(0x9249249249249249ull);
160
+ REG2 = ((REG2 << 2) | REG2) & static_cast<glm::uint64>(0x9249249249249249ull);
161
+ REG3 = ((REG3 << 2) | REG3) & static_cast<glm::uint64>(0x9249249249249249ull);
162
+
163
+ return REG1 | (REG2 << 1) | (REG3 << 2);
164
+ }
165
+
166
+ template<>
167
+ GLM_FUNC_QUALIFIER glm::uint32 bitfieldInterleave(glm::uint8 x, glm::uint8 y, glm::uint8 z, glm::uint8 w)
168
+ {
169
+ glm::uint32 REG1(x);
170
+ glm::uint32 REG2(y);
171
+ glm::uint32 REG3(z);
172
+ glm::uint32 REG4(w);
173
+
174
+ REG1 = ((REG1 << 12) | REG1) & static_cast<glm::uint32>(0x000F000Fu);
175
+ REG2 = ((REG2 << 12) | REG2) & static_cast<glm::uint32>(0x000F000Fu);
176
+ REG3 = ((REG3 << 12) | REG3) & static_cast<glm::uint32>(0x000F000Fu);
177
+ REG4 = ((REG4 << 12) | REG4) & static_cast<glm::uint32>(0x000F000Fu);
178
+
179
+ REG1 = ((REG1 << 6) | REG1) & static_cast<glm::uint32>(0x03030303u);
180
+ REG2 = ((REG2 << 6) | REG2) & static_cast<glm::uint32>(0x03030303u);
181
+ REG3 = ((REG3 << 6) | REG3) & static_cast<glm::uint32>(0x03030303u);
182
+ REG4 = ((REG4 << 6) | REG4) & static_cast<glm::uint32>(0x03030303u);
183
+
184
+ REG1 = ((REG1 << 3) | REG1) & static_cast<glm::uint32>(0x11111111u);
185
+ REG2 = ((REG2 << 3) | REG2) & static_cast<glm::uint32>(0x11111111u);
186
+ REG3 = ((REG3 << 3) | REG3) & static_cast<glm::uint32>(0x11111111u);
187
+ REG4 = ((REG4 << 3) | REG4) & static_cast<glm::uint32>(0x11111111u);
188
+
189
+ return REG1 | (REG2 << 1) | (REG3 << 2) | (REG4 << 3);
190
+ }
191
+
192
+ template<>
193
+ GLM_FUNC_QUALIFIER glm::uint64 bitfieldInterleave(glm::uint16 x, glm::uint16 y, glm::uint16 z, glm::uint16 w)
194
+ {
195
+ glm::uint64 REG1(x);
196
+ glm::uint64 REG2(y);
197
+ glm::uint64 REG3(z);
198
+ glm::uint64 REG4(w);
199
+
200
+ REG1 = ((REG1 << 24) | REG1) & static_cast<glm::uint64>(0x000000FF000000FFull);
201
+ REG2 = ((REG2 << 24) | REG2) & static_cast<glm::uint64>(0x000000FF000000FFull);
202
+ REG3 = ((REG3 << 24) | REG3) & static_cast<glm::uint64>(0x000000FF000000FFull);
203
+ REG4 = ((REG4 << 24) | REG4) & static_cast<glm::uint64>(0x000000FF000000FFull);
204
+
205
+ REG1 = ((REG1 << 12) | REG1) & static_cast<glm::uint64>(0x000F000F000F000Full);
206
+ REG2 = ((REG2 << 12) | REG2) & static_cast<glm::uint64>(0x000F000F000F000Full);
207
+ REG3 = ((REG3 << 12) | REG3) & static_cast<glm::uint64>(0x000F000F000F000Full);
208
+ REG4 = ((REG4 << 12) | REG4) & static_cast<glm::uint64>(0x000F000F000F000Full);
209
+
210
+ REG1 = ((REG1 << 6) | REG1) & static_cast<glm::uint64>(0x0303030303030303ull);
211
+ REG2 = ((REG2 << 6) | REG2) & static_cast<glm::uint64>(0x0303030303030303ull);
212
+ REG3 = ((REG3 << 6) | REG3) & static_cast<glm::uint64>(0x0303030303030303ull);
213
+ REG4 = ((REG4 << 6) | REG4) & static_cast<glm::uint64>(0x0303030303030303ull);
214
+
215
+ REG1 = ((REG1 << 3) | REG1) & static_cast<glm::uint64>(0x1111111111111111ull);
216
+ REG2 = ((REG2 << 3) | REG2) & static_cast<glm::uint64>(0x1111111111111111ull);
217
+ REG3 = ((REG3 << 3) | REG3) & static_cast<glm::uint64>(0x1111111111111111ull);
218
+ REG4 = ((REG4 << 3) | REG4) & static_cast<glm::uint64>(0x1111111111111111ull);
219
+
220
+ return REG1 | (REG2 << 1) | (REG3 << 2) | (REG4 << 3);
221
+ }
222
+ }//namespace detail
223
+
224
+ template<typename genIUType>
225
+ GLM_FUNC_QUALIFIER genIUType mask(genIUType Bits)
226
+ {
227
+ GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::is_integer, "'mask' accepts only integer values");
228
+
229
+ return Bits >= sizeof(genIUType) * 8 ? ~static_cast<genIUType>(0) : (static_cast<genIUType>(1) << Bits) - static_cast<genIUType>(1);
230
+ }
231
+
232
+ template<length_t L, typename T, qualifier Q>
233
+ GLM_FUNC_QUALIFIER vec<L, T, Q> mask(vec<L, T, Q> const& v)
234
+ {
235
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'mask' accepts only integer values");
236
+
237
+ return detail::functor1<vec, L, T, T, Q>::call(mask, v);
238
+ }
239
+
240
+ template<typename genIType>
241
+ GLM_FUNC_QUALIFIER genIType bitfieldRotateRight(genIType In, int Shift)
242
+ {
243
+ GLM_STATIC_ASSERT(std::numeric_limits<genIType>::is_integer, "'bitfieldRotateRight' accepts only integer values");
244
+
245
+ int const BitSize = static_cast<genIType>(sizeof(genIType) * 8);
246
+ return (In << static_cast<genIType>(Shift)) | (In >> static_cast<genIType>(BitSize - Shift));
247
+ }
248
+
249
+ template<length_t L, typename T, qualifier Q>
250
+ GLM_FUNC_QUALIFIER vec<L, T, Q> bitfieldRotateRight(vec<L, T, Q> const& In, int Shift)
251
+ {
252
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'bitfieldRotateRight' accepts only integer values");
253
+
254
+ int const BitSize = static_cast<int>(sizeof(T) * 8);
255
+ return (In << static_cast<T>(Shift)) | (In >> static_cast<T>(BitSize - Shift));
256
+ }
257
+
258
+ template<typename genIType>
259
+ GLM_FUNC_QUALIFIER genIType bitfieldRotateLeft(genIType In, int Shift)
260
+ {
261
+ GLM_STATIC_ASSERT(std::numeric_limits<genIType>::is_integer, "'bitfieldRotateLeft' accepts only integer values");
262
+
263
+ int const BitSize = static_cast<genIType>(sizeof(genIType) * 8);
264
+ return (In >> static_cast<genIType>(Shift)) | (In << static_cast<genIType>(BitSize - Shift));
265
+ }
266
+
267
+ template<length_t L, typename T, qualifier Q>
268
+ GLM_FUNC_QUALIFIER vec<L, T, Q> bitfieldRotateLeft(vec<L, T, Q> const& In, int Shift)
269
+ {
270
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'bitfieldRotateLeft' accepts only integer values");
271
+
272
+ int const BitSize = static_cast<int>(sizeof(T) * 8);
273
+ return (In >> static_cast<T>(Shift)) | (In << static_cast<T>(BitSize - Shift));
274
+ }
275
+
276
+ template<typename genIUType>
277
+ GLM_FUNC_QUALIFIER genIUType bitfieldFillOne(genIUType Value, int FirstBit, int BitCount)
278
+ {
279
+ return Value | static_cast<genIUType>(mask(BitCount) << FirstBit);
280
+ }
281
+
282
+ template<length_t L, typename T, qualifier Q>
283
+ GLM_FUNC_QUALIFIER vec<L, T, Q> bitfieldFillOne(vec<L, T, Q> const& Value, int FirstBit, int BitCount)
284
+ {
285
+ return Value | static_cast<T>(mask(BitCount) << FirstBit);
286
+ }
287
+
288
+ template<typename genIUType>
289
+ GLM_FUNC_QUALIFIER genIUType bitfieldFillZero(genIUType Value, int FirstBit, int BitCount)
290
+ {
291
+ return Value & static_cast<genIUType>(~(mask(BitCount) << FirstBit));
292
+ }
293
+
294
+ template<length_t L, typename T, qualifier Q>
295
+ GLM_FUNC_QUALIFIER vec<L, T, Q> bitfieldFillZero(vec<L, T, Q> const& Value, int FirstBit, int BitCount)
296
+ {
297
+ return Value & static_cast<T>(~(mask(BitCount) << FirstBit));
298
+ }
299
+
300
+ GLM_FUNC_QUALIFIER int16 bitfieldInterleave(int8 x, int8 y)
301
+ {
302
+ union sign8
303
+ {
304
+ int8 i;
305
+ uint8 u;
306
+ } sign_x, sign_y;
307
+
308
+ union sign16
309
+ {
310
+ int16 i;
311
+ uint16 u;
312
+ } result;
313
+
314
+ sign_x.i = x;
315
+ sign_y.i = y;
316
+ result.u = bitfieldInterleave(sign_x.u, sign_y.u);
317
+
318
+ return result.i;
319
+ }
320
+
321
+ GLM_FUNC_QUALIFIER uint16 bitfieldInterleave(uint8 x, uint8 y)
322
+ {
323
+ return detail::bitfieldInterleave<uint8, uint16>(x, y);
324
+ }
325
+
326
+ GLM_FUNC_QUALIFIER uint16 bitfieldInterleave(u8vec2 const& v)
327
+ {
328
+ return detail::bitfieldInterleave<uint8, uint16>(v.x, v.y);
329
+ }
330
+
331
+ GLM_FUNC_QUALIFIER u8vec2 bitfieldDeinterleave(glm::uint16 x)
332
+ {
333
+ uint16 REG1(x);
334
+ uint16 REG2(x >>= 1);
335
+
336
+ REG1 = REG1 & static_cast<uint16>(0x5555);
337
+ REG2 = REG2 & static_cast<uint16>(0x5555);
338
+
339
+ REG1 = ((REG1 >> 1) | REG1) & static_cast<uint16>(0x3333);
340
+ REG2 = ((REG2 >> 1) | REG2) & static_cast<uint16>(0x3333);
341
+
342
+ REG1 = ((REG1 >> 2) | REG1) & static_cast<uint16>(0x0F0F);
343
+ REG2 = ((REG2 >> 2) | REG2) & static_cast<uint16>(0x0F0F);
344
+
345
+ REG1 = ((REG1 >> 4) | REG1) & static_cast<uint16>(0x00FF);
346
+ REG2 = ((REG2 >> 4) | REG2) & static_cast<uint16>(0x00FF);
347
+
348
+ REG1 = ((REG1 >> 8) | REG1) & static_cast<uint16>(0xFFFF);
349
+ REG2 = ((REG2 >> 8) | REG2) & static_cast<uint16>(0xFFFF);
350
+
351
+ return glm::u8vec2(REG1, REG2);
352
+ }
353
+
354
+ GLM_FUNC_QUALIFIER int32 bitfieldInterleave(int16 x, int16 y)
355
+ {
356
+ union sign16
357
+ {
358
+ int16 i;
359
+ uint16 u;
360
+ } sign_x, sign_y;
361
+
362
+ union sign32
363
+ {
364
+ int32 i;
365
+ uint32 u;
366
+ } result;
367
+
368
+ sign_x.i = x;
369
+ sign_y.i = y;
370
+ result.u = bitfieldInterleave(sign_x.u, sign_y.u);
371
+
372
+ return result.i;
373
+ }
374
+
375
+ GLM_FUNC_QUALIFIER uint32 bitfieldInterleave(uint16 x, uint16 y)
376
+ {
377
+ return detail::bitfieldInterleave<uint16, uint32>(x, y);
378
+ }
379
+
380
+ GLM_FUNC_QUALIFIER glm::uint32 bitfieldInterleave(u16vec2 const& v)
381
+ {
382
+ return detail::bitfieldInterleave<uint16, uint32>(v.x, v.y);
383
+ }
384
+
385
+ GLM_FUNC_QUALIFIER glm::u16vec2 bitfieldDeinterleave(glm::uint32 x)
386
+ {
387
+ glm::uint32 REG1(x);
388
+ glm::uint32 REG2(x >>= 1);
389
+
390
+ REG1 = REG1 & static_cast<glm::uint32>(0x55555555);
391
+ REG2 = REG2 & static_cast<glm::uint32>(0x55555555);
392
+
393
+ REG1 = ((REG1 >> 1) | REG1) & static_cast<glm::uint32>(0x33333333);
394
+ REG2 = ((REG2 >> 1) | REG2) & static_cast<glm::uint32>(0x33333333);
395
+
396
+ REG1 = ((REG1 >> 2) | REG1) & static_cast<glm::uint32>(0x0F0F0F0F);
397
+ REG2 = ((REG2 >> 2) | REG2) & static_cast<glm::uint32>(0x0F0F0F0F);
398
+
399
+ REG1 = ((REG1 >> 4) | REG1) & static_cast<glm::uint32>(0x00FF00FF);
400
+ REG2 = ((REG2 >> 4) | REG2) & static_cast<glm::uint32>(0x00FF00FF);
401
+
402
+ REG1 = ((REG1 >> 8) | REG1) & static_cast<glm::uint32>(0x0000FFFF);
403
+ REG2 = ((REG2 >> 8) | REG2) & static_cast<glm::uint32>(0x0000FFFF);
404
+
405
+ return glm::u16vec2(REG1, REG2);
406
+ }
407
+
408
+ GLM_FUNC_QUALIFIER int64 bitfieldInterleave(int32 x, int32 y)
409
+ {
410
+ union sign32
411
+ {
412
+ int32 i;
413
+ uint32 u;
414
+ } sign_x, sign_y;
415
+
416
+ union sign64
417
+ {
418
+ int64 i;
419
+ uint64 u;
420
+ } result;
421
+
422
+ sign_x.i = x;
423
+ sign_y.i = y;
424
+ result.u = bitfieldInterleave(sign_x.u, sign_y.u);
425
+
426
+ return result.i;
427
+ }
428
+
429
+ GLM_FUNC_QUALIFIER uint64 bitfieldInterleave(uint32 x, uint32 y)
430
+ {
431
+ return detail::bitfieldInterleave<uint32, uint64>(x, y);
432
+ }
433
+
434
+ GLM_FUNC_QUALIFIER glm::uint64 bitfieldInterleave(u32vec2 const& v)
435
+ {
436
+ return detail::bitfieldInterleave<uint32, uint64>(v.x, v.y);
437
+ }
438
+
439
+ GLM_FUNC_QUALIFIER glm::u32vec2 bitfieldDeinterleave(glm::uint64 x)
440
+ {
441
+ glm::uint64 REG1(x);
442
+ glm::uint64 REG2(x >>= 1);
443
+
444
+ REG1 = REG1 & static_cast<glm::uint64>(0x5555555555555555ull);
445
+ REG2 = REG2 & static_cast<glm::uint64>(0x5555555555555555ull);
446
+
447
+ REG1 = ((REG1 >> 1) | REG1) & static_cast<glm::uint64>(0x3333333333333333ull);
448
+ REG2 = ((REG2 >> 1) | REG2) & static_cast<glm::uint64>(0x3333333333333333ull);
449
+
450
+ REG1 = ((REG1 >> 2) | REG1) & static_cast<glm::uint64>(0x0F0F0F0F0F0F0F0Full);
451
+ REG2 = ((REG2 >> 2) | REG2) & static_cast<glm::uint64>(0x0F0F0F0F0F0F0F0Full);
452
+
453
+ REG1 = ((REG1 >> 4) | REG1) & static_cast<glm::uint64>(0x00FF00FF00FF00FFull);
454
+ REG2 = ((REG2 >> 4) | REG2) & static_cast<glm::uint64>(0x00FF00FF00FF00FFull);
455
+
456
+ REG1 = ((REG1 >> 8) | REG1) & static_cast<glm::uint64>(0x0000FFFF0000FFFFull);
457
+ REG2 = ((REG2 >> 8) | REG2) & static_cast<glm::uint64>(0x0000FFFF0000FFFFull);
458
+
459
+ REG1 = ((REG1 >> 16) | REG1) & static_cast<glm::uint64>(0x00000000FFFFFFFFull);
460
+ REG2 = ((REG2 >> 16) | REG2) & static_cast<glm::uint64>(0x00000000FFFFFFFFull);
461
+
462
+ return glm::u32vec2(REG1, REG2);
463
+ }
464
+
465
+ GLM_FUNC_QUALIFIER int32 bitfieldInterleave(int8 x, int8 y, int8 z)
466
+ {
467
+ union sign8
468
+ {
469
+ int8 i;
470
+ uint8 u;
471
+ } sign_x, sign_y, sign_z;
472
+
473
+ union sign32
474
+ {
475
+ int32 i;
476
+ uint32 u;
477
+ } result;
478
+
479
+ sign_x.i = x;
480
+ sign_y.i = y;
481
+ sign_z.i = z;
482
+ result.u = bitfieldInterleave(sign_x.u, sign_y.u, sign_z.u);
483
+
484
+ return result.i;
485
+ }
486
+
487
+ GLM_FUNC_QUALIFIER uint32 bitfieldInterleave(uint8 x, uint8 y, uint8 z)
488
+ {
489
+ return detail::bitfieldInterleave<uint8, uint32>(x, y, z);
490
+ }
491
+
492
+ GLM_FUNC_QUALIFIER uint32 bitfieldInterleave(u8vec3 const& v)
493
+ {
494
+ return detail::bitfieldInterleave<uint8, uint32>(v.x, v.y, v.z);
495
+ }
496
+
497
+ GLM_FUNC_QUALIFIER int64 bitfieldInterleave(int16 x, int16 y, int16 z)
498
+ {
499
+ union sign16
500
+ {
501
+ int16 i;
502
+ uint16 u;
503
+ } sign_x, sign_y, sign_z;
504
+
505
+ union sign64
506
+ {
507
+ int64 i;
508
+ uint64 u;
509
+ } result;
510
+
511
+ sign_x.i = x;
512
+ sign_y.i = y;
513
+ sign_z.i = z;
514
+ result.u = bitfieldInterleave(sign_x.u, sign_y.u, sign_z.u);
515
+
516
+ return result.i;
517
+ }
518
+
519
+ GLM_FUNC_QUALIFIER uint64 bitfieldInterleave(uint16 x, uint16 y, uint16 z)
520
+ {
521
+ return detail::bitfieldInterleave<uint32, uint64>(x, y, z);
522
+ }
523
+
524
+ GLM_FUNC_QUALIFIER uint64 bitfieldInterleave(u16vec3 const& v)
525
+ {
526
+ return detail::bitfieldInterleave<uint32, uint64>(v.x, v.y, v.z);
527
+ }
528
+
529
+ GLM_FUNC_QUALIFIER int64 bitfieldInterleave(int32 x, int32 y, int32 z)
530
+ {
531
+ union sign16
532
+ {
533
+ int32 i;
534
+ uint32 u;
535
+ } sign_x, sign_y, sign_z;
536
+
537
+ union sign64
538
+ {
539
+ int64 i;
540
+ uint64 u;
541
+ } result;
542
+
543
+ sign_x.i = x;
544
+ sign_y.i = y;
545
+ sign_z.i = z;
546
+ result.u = bitfieldInterleave(sign_x.u, sign_y.u, sign_z.u);
547
+
548
+ return result.i;
549
+ }
550
+
551
+ GLM_FUNC_QUALIFIER uint64 bitfieldInterleave(uint32 x, uint32 y, uint32 z)
552
+ {
553
+ return detail::bitfieldInterleave<uint32, uint64>(x, y, z);
554
+ }
555
+
556
+ GLM_FUNC_QUALIFIER uint64 bitfieldInterleave(u32vec3 const& v)
557
+ {
558
+ return detail::bitfieldInterleave<uint32, uint64>(v.x, v.y, v.z);
559
+ }
560
+
561
+ GLM_FUNC_QUALIFIER int32 bitfieldInterleave(int8 x, int8 y, int8 z, int8 w)
562
+ {
563
+ union sign8
564
+ {
565
+ int8 i;
566
+ uint8 u;
567
+ } sign_x, sign_y, sign_z, sign_w;
568
+
569
+ union sign32
570
+ {
571
+ int32 i;
572
+ uint32 u;
573
+ } result;
574
+
575
+ sign_x.i = x;
576
+ sign_y.i = y;
577
+ sign_z.i = z;
578
+ sign_w.i = w;
579
+ result.u = bitfieldInterleave(sign_x.u, sign_y.u, sign_z.u, sign_w.u);
580
+
581
+ return result.i;
582
+ }
583
+
584
+ GLM_FUNC_QUALIFIER uint32 bitfieldInterleave(uint8 x, uint8 y, uint8 z, uint8 w)
585
+ {
586
+ return detail::bitfieldInterleave<uint8, uint32>(x, y, z, w);
587
+ }
588
+
589
+ GLM_FUNC_QUALIFIER uint32 bitfieldInterleave(u8vec4 const& v)
590
+ {
591
+ return detail::bitfieldInterleave<uint8, uint32>(v.x, v.y, v.z, v.w);
592
+ }
593
+
594
+ GLM_FUNC_QUALIFIER int64 bitfieldInterleave(int16 x, int16 y, int16 z, int16 w)
595
+ {
596
+ union sign16
597
+ {
598
+ int16 i;
599
+ uint16 u;
600
+ } sign_x, sign_y, sign_z, sign_w;
601
+
602
+ union sign64
603
+ {
604
+ int64 i;
605
+ uint64 u;
606
+ } result;
607
+
608
+ sign_x.i = x;
609
+ sign_y.i = y;
610
+ sign_z.i = z;
611
+ sign_w.i = w;
612
+ result.u = bitfieldInterleave(sign_x.u, sign_y.u, sign_z.u, sign_w.u);
613
+
614
+ return result.i;
615
+ }
616
+
617
+ GLM_FUNC_QUALIFIER uint64 bitfieldInterleave(uint16 x, uint16 y, uint16 z, uint16 w)
618
+ {
619
+ return detail::bitfieldInterleave<uint16, uint64>(x, y, z, w);
620
+ }
621
+
622
+ GLM_FUNC_QUALIFIER uint64 bitfieldInterleave(u16vec4 const& v)
623
+ {
624
+ return detail::bitfieldInterleave<uint16, uint64>(v.x, v.y, v.z, v.w);
625
+ }
626
+ }//namespace glm
cuda_extensions/third_party/glm/glm/gtc/color_space.hpp ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref gtc_color_space
2
+ /// @file glm/gtc/color_space.hpp
3
+ ///
4
+ /// @see core (dependence)
5
+ /// @see gtc_color_space (dependence)
6
+ ///
7
+ /// @defgroup gtc_color_space GLM_GTC_color_space
8
+ /// @ingroup gtc
9
+ ///
10
+ /// Include <glm/gtc/color_space.hpp> to use the features of this extension.
11
+ ///
12
+ /// Allow to perform bit operations on integer values
13
+
14
+ #pragma once
15
+
16
+ // Dependencies
17
+ #include "../detail/setup.hpp"
18
+ #include "../detail/qualifier.hpp"
19
+ #include "../exponential.hpp"
20
+ #include "../vec3.hpp"
21
+ #include "../vec4.hpp"
22
+ #include <limits>
23
+
24
+ #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
25
+ # pragma message("GLM: GLM_GTC_color_space extension included")
26
+ #endif
27
+
28
+ namespace glm
29
+ {
30
+ /// @addtogroup gtc_color_space
31
+ /// @{
32
+
33
+ /// Convert a linear color to sRGB color using a standard gamma correction.
34
+ /// IEC 61966-2-1:1999 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb
35
+ template<length_t L, typename T, qualifier Q>
36
+ GLM_FUNC_DECL vec<L, T, Q> convertLinearToSRGB(vec<L, T, Q> const& ColorLinear);
37
+
38
+ /// Convert a linear color to sRGB color using a custom gamma correction.
39
+ /// IEC 61966-2-1:1999 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb
40
+ template<length_t L, typename T, qualifier Q>
41
+ GLM_FUNC_DECL vec<L, T, Q> convertLinearToSRGB(vec<L, T, Q> const& ColorLinear, T Gamma);
42
+
43
+ /// Convert a sRGB color to linear color using a standard gamma correction.
44
+ /// IEC 61966-2-1:1999 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb
45
+ template<length_t L, typename T, qualifier Q>
46
+ GLM_FUNC_DECL vec<L, T, Q> convertSRGBToLinear(vec<L, T, Q> const& ColorSRGB);
47
+
48
+ /// Convert a sRGB color to linear color using a custom gamma correction.
49
+ // IEC 61966-2-1:1999 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb
50
+ template<length_t L, typename T, qualifier Q>
51
+ GLM_FUNC_DECL vec<L, T, Q> convertSRGBToLinear(vec<L, T, Q> const& ColorSRGB, T Gamma);
52
+
53
+ /// @}
54
+ } //namespace glm
55
+
56
+ #include "color_space.inl"
cuda_extensions/third_party/glm/glm/gtc/color_space.inl ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref gtc_color_space
2
+
3
+ namespace glm{
4
+ namespace detail
5
+ {
6
+ template<length_t L, typename T, qualifier Q>
7
+ struct compute_rgbToSrgb
8
+ {
9
+ GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& ColorRGB, T GammaCorrection)
10
+ {
11
+ vec<L, T, Q> const ClampedColor(clamp(ColorRGB, static_cast<T>(0), static_cast<T>(1)));
12
+
13
+ return mix(
14
+ pow(ClampedColor, vec<L, T, Q>(GammaCorrection)) * static_cast<T>(1.055) - static_cast<T>(0.055),
15
+ ClampedColor * static_cast<T>(12.92),
16
+ lessThan(ClampedColor, vec<L, T, Q>(static_cast<T>(0.0031308))));
17
+ }
18
+ };
19
+
20
+ template<typename T, qualifier Q>
21
+ struct compute_rgbToSrgb<4, T, Q>
22
+ {
23
+ GLM_FUNC_QUALIFIER static vec<4, T, Q> call(vec<4, T, Q> const& ColorRGB, T GammaCorrection)
24
+ {
25
+ return vec<4, T, Q>(compute_rgbToSrgb<3, T, Q>::call(vec<3, T, Q>(ColorRGB), GammaCorrection), ColorRGB.w);
26
+ }
27
+ };
28
+
29
+ template<length_t L, typename T, qualifier Q>
30
+ struct compute_srgbToRgb
31
+ {
32
+ GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& ColorSRGB, T Gamma)
33
+ {
34
+ return mix(
35
+ pow((ColorSRGB + static_cast<T>(0.055)) * static_cast<T>(0.94786729857819905213270142180095), vec<L, T, Q>(Gamma)),
36
+ ColorSRGB * static_cast<T>(0.07739938080495356037151702786378),
37
+ lessThanEqual(ColorSRGB, vec<L, T, Q>(static_cast<T>(0.04045))));
38
+ }
39
+ };
40
+
41
+ template<typename T, qualifier Q>
42
+ struct compute_srgbToRgb<4, T, Q>
43
+ {
44
+ GLM_FUNC_QUALIFIER static vec<4, T, Q> call(vec<4, T, Q> const& ColorSRGB, T Gamma)
45
+ {
46
+ return vec<4, T, Q>(compute_srgbToRgb<3, T, Q>::call(vec<3, T, Q>(ColorSRGB), Gamma), ColorSRGB.w);
47
+ }
48
+ };
49
+ }//namespace detail
50
+
51
+ template<length_t L, typename T, qualifier Q>
52
+ GLM_FUNC_QUALIFIER vec<L, T, Q> convertLinearToSRGB(vec<L, T, Q> const& ColorLinear)
53
+ {
54
+ return detail::compute_rgbToSrgb<L, T, Q>::call(ColorLinear, static_cast<T>(0.41666));
55
+ }
56
+
57
+ // Based on Ian Taylor http://chilliant.blogspot.fr/2012/08/srgb-approximations-for-hlsl.html
58
+ template<>
59
+ GLM_FUNC_QUALIFIER vec<3, float, lowp> convertLinearToSRGB(vec<3, float, lowp> const& ColorLinear)
60
+ {
61
+ vec<3, float, lowp> S1 = sqrt(ColorLinear);
62
+ vec<3, float, lowp> S2 = sqrt(S1);
63
+ vec<3, float, lowp> S3 = sqrt(S2);
64
+ return 0.662002687f * S1 + 0.684122060f * S2 - 0.323583601f * S3 - 0.0225411470f * ColorLinear;
65
+ }
66
+
67
+ template<length_t L, typename T, qualifier Q>
68
+ GLM_FUNC_QUALIFIER vec<L, T, Q> convertLinearToSRGB(vec<L, T, Q> const& ColorLinear, T Gamma)
69
+ {
70
+ return detail::compute_rgbToSrgb<L, T, Q>::call(ColorLinear, static_cast<T>(1) / Gamma);
71
+ }
72
+
73
+ template<length_t L, typename T, qualifier Q>
74
+ GLM_FUNC_QUALIFIER vec<L, T, Q> convertSRGBToLinear(vec<L, T, Q> const& ColorSRGB)
75
+ {
76
+ return detail::compute_srgbToRgb<L, T, Q>::call(ColorSRGB, static_cast<T>(2.4));
77
+ }
78
+
79
+ template<length_t L, typename T, qualifier Q>
80
+ GLM_FUNC_QUALIFIER vec<L, T, Q> convertSRGBToLinear(vec<L, T, Q> const& ColorSRGB, T Gamma)
81
+ {
82
+ return detail::compute_srgbToRgb<L, T, Q>::call(ColorSRGB, Gamma);
83
+ }
84
+ }//namespace glm
cuda_extensions/third_party/glm/glm/gtc/constants.hpp ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref gtc_constants
2
+ /// @file glm/gtc/constants.hpp
3
+ ///
4
+ /// @see core (dependence)
5
+ ///
6
+ /// @defgroup gtc_constants GLM_GTC_constants
7
+ /// @ingroup gtc
8
+ ///
9
+ /// Include <glm/gtc/constants.hpp> to use the features of this extension.
10
+ ///
11
+ /// Provide a list of constants and precomputed useful values.
12
+
13
+ #pragma once
14
+
15
+ // Dependencies
16
+ #include "../ext/scalar_constants.hpp"
17
+
18
+ #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
19
+ # pragma message("GLM: GLM_GTC_constants extension included")
20
+ #endif
21
+
22
+ namespace glm
23
+ {
24
+ /// @addtogroup gtc_constants
25
+ /// @{
26
+
27
+ /// Return 0.
28
+ /// @see gtc_constants
29
+ template<typename genType>
30
+ GLM_FUNC_DECL GLM_CONSTEXPR genType zero();
31
+
32
+ /// Return 1.
33
+ /// @see gtc_constants
34
+ template<typename genType>
35
+ GLM_FUNC_DECL GLM_CONSTEXPR genType one();
36
+
37
+ /// Return pi * 2.
38
+ /// @see gtc_constants
39
+ template<typename genType>
40
+ GLM_FUNC_DECL GLM_CONSTEXPR genType two_pi();
41
+
42
+ /// Return square root of pi.
43
+ /// @see gtc_constants
44
+ template<typename genType>
45
+ GLM_FUNC_DECL GLM_CONSTEXPR genType root_pi();
46
+
47
+ /// Return pi / 2.
48
+ /// @see gtc_constants
49
+ template<typename genType>
50
+ GLM_FUNC_DECL GLM_CONSTEXPR genType half_pi();
51
+
52
+ /// Return pi / 2 * 3.
53
+ /// @see gtc_constants
54
+ template<typename genType>
55
+ GLM_FUNC_DECL GLM_CONSTEXPR genType three_over_two_pi();
56
+
57
+ /// Return pi / 4.
58
+ /// @see gtc_constants
59
+ template<typename genType>
60
+ GLM_FUNC_DECL GLM_CONSTEXPR genType quarter_pi();
61
+
62
+ /// Return 1 / pi.
63
+ /// @see gtc_constants
64
+ template<typename genType>
65
+ GLM_FUNC_DECL GLM_CONSTEXPR genType one_over_pi();
66
+
67
+ /// Return 1 / (pi * 2).
68
+ /// @see gtc_constants
69
+ template<typename genType>
70
+ GLM_FUNC_DECL GLM_CONSTEXPR genType one_over_two_pi();
71
+
72
+ /// Return 2 / pi.
73
+ /// @see gtc_constants
74
+ template<typename genType>
75
+ GLM_FUNC_DECL GLM_CONSTEXPR genType two_over_pi();
76
+
77
+ /// Return 4 / pi.
78
+ /// @see gtc_constants
79
+ template<typename genType>
80
+ GLM_FUNC_DECL GLM_CONSTEXPR genType four_over_pi();
81
+
82
+ /// Return 2 / sqrt(pi).
83
+ /// @see gtc_constants
84
+ template<typename genType>
85
+ GLM_FUNC_DECL GLM_CONSTEXPR genType two_over_root_pi();
86
+
87
+ /// Return 1 / sqrt(2).
88
+ /// @see gtc_constants
89
+ template<typename genType>
90
+ GLM_FUNC_DECL GLM_CONSTEXPR genType one_over_root_two();
91
+
92
+ /// Return sqrt(pi / 2).
93
+ /// @see gtc_constants
94
+ template<typename genType>
95
+ GLM_FUNC_DECL GLM_CONSTEXPR genType root_half_pi();
96
+
97
+ /// Return sqrt(2 * pi).
98
+ /// @see gtc_constants
99
+ template<typename genType>
100
+ GLM_FUNC_DECL GLM_CONSTEXPR genType root_two_pi();
101
+
102
+ /// Return sqrt(ln(4)).
103
+ /// @see gtc_constants
104
+ template<typename genType>
105
+ GLM_FUNC_DECL GLM_CONSTEXPR genType root_ln_four();
106
+
107
+ /// Return e constant.
108
+ /// @see gtc_constants
109
+ template<typename genType>
110
+ GLM_FUNC_DECL GLM_CONSTEXPR genType e();
111
+
112
+ /// Return Euler's constant.
113
+ /// @see gtc_constants
114
+ template<typename genType>
115
+ GLM_FUNC_DECL GLM_CONSTEXPR genType euler();
116
+
117
+ /// Return sqrt(2).
118
+ /// @see gtc_constants
119
+ template<typename genType>
120
+ GLM_FUNC_DECL GLM_CONSTEXPR genType root_two();
121
+
122
+ /// Return sqrt(3).
123
+ /// @see gtc_constants
124
+ template<typename genType>
125
+ GLM_FUNC_DECL GLM_CONSTEXPR genType root_three();
126
+
127
+ /// Return sqrt(5).
128
+ /// @see gtc_constants
129
+ template<typename genType>
130
+ GLM_FUNC_DECL GLM_CONSTEXPR genType root_five();
131
+
132
+ /// Return ln(2).
133
+ /// @see gtc_constants
134
+ template<typename genType>
135
+ GLM_FUNC_DECL GLM_CONSTEXPR genType ln_two();
136
+
137
+ /// Return ln(10).
138
+ /// @see gtc_constants
139
+ template<typename genType>
140
+ GLM_FUNC_DECL GLM_CONSTEXPR genType ln_ten();
141
+
142
+ /// Return ln(ln(2)).
143
+ /// @see gtc_constants
144
+ template<typename genType>
145
+ GLM_FUNC_DECL GLM_CONSTEXPR genType ln_ln_two();
146
+
147
+ /// Return 1 / 3.
148
+ /// @see gtc_constants
149
+ template<typename genType>
150
+ GLM_FUNC_DECL GLM_CONSTEXPR genType third();
151
+
152
+ /// Return 2 / 3.
153
+ /// @see gtc_constants
154
+ template<typename genType>
155
+ GLM_FUNC_DECL GLM_CONSTEXPR genType two_thirds();
156
+
157
+ /// Return the golden ratio constant.
158
+ /// @see gtc_constants
159
+ template<typename genType>
160
+ GLM_FUNC_DECL GLM_CONSTEXPR genType golden_ratio();
161
+
162
+ /// @}
163
+ } //namespace glm
164
+
165
+ #include "constants.inl"
cuda_extensions/third_party/glm/glm/gtc/constants.inl ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref gtc_constants
2
+
3
+ namespace glm
4
+ {
5
+ template<typename genType>
6
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType zero()
7
+ {
8
+ return genType(0);
9
+ }
10
+
11
+ template<typename genType>
12
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType one()
13
+ {
14
+ return genType(1);
15
+ }
16
+
17
+ template<typename genType>
18
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType two_pi()
19
+ {
20
+ return genType(6.28318530717958647692528676655900576);
21
+ }
22
+
23
+ template<typename genType>
24
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType root_pi()
25
+ {
26
+ return genType(1.772453850905516027);
27
+ }
28
+
29
+ template<typename genType>
30
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType half_pi()
31
+ {
32
+ return genType(1.57079632679489661923132169163975144);
33
+ }
34
+
35
+ template<typename genType>
36
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType three_over_two_pi()
37
+ {
38
+ return genType(4.71238898038468985769396507491925432);
39
+ }
40
+
41
+ template<typename genType>
42
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType quarter_pi()
43
+ {
44
+ return genType(0.785398163397448309615660845819875721);
45
+ }
46
+
47
+ template<typename genType>
48
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType one_over_pi()
49
+ {
50
+ return genType(0.318309886183790671537767526745028724);
51
+ }
52
+
53
+ template<typename genType>
54
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType one_over_two_pi()
55
+ {
56
+ return genType(0.159154943091895335768883763372514362);
57
+ }
58
+
59
+ template<typename genType>
60
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType two_over_pi()
61
+ {
62
+ return genType(0.636619772367581343075535053490057448);
63
+ }
64
+
65
+ template<typename genType>
66
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType four_over_pi()
67
+ {
68
+ return genType(1.273239544735162686151070106980114898);
69
+ }
70
+
71
+ template<typename genType>
72
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType two_over_root_pi()
73
+ {
74
+ return genType(1.12837916709551257389615890312154517);
75
+ }
76
+
77
+ template<typename genType>
78
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType one_over_root_two()
79
+ {
80
+ return genType(0.707106781186547524400844362104849039);
81
+ }
82
+
83
+ template<typename genType>
84
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType root_half_pi()
85
+ {
86
+ return genType(1.253314137315500251);
87
+ }
88
+
89
+ template<typename genType>
90
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType root_two_pi()
91
+ {
92
+ return genType(2.506628274631000502);
93
+ }
94
+
95
+ template<typename genType>
96
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType root_ln_four()
97
+ {
98
+ return genType(1.17741002251547469);
99
+ }
100
+
101
+ template<typename genType>
102
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType e()
103
+ {
104
+ return genType(2.71828182845904523536);
105
+ }
106
+
107
+ template<typename genType>
108
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType euler()
109
+ {
110
+ return genType(0.577215664901532860606);
111
+ }
112
+
113
+ template<typename genType>
114
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType root_two()
115
+ {
116
+ return genType(1.41421356237309504880168872420969808);
117
+ }
118
+
119
+ template<typename genType>
120
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType root_three()
121
+ {
122
+ return genType(1.73205080756887729352744634150587236);
123
+ }
124
+
125
+ template<typename genType>
126
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType root_five()
127
+ {
128
+ return genType(2.23606797749978969640917366873127623);
129
+ }
130
+
131
+ template<typename genType>
132
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType ln_two()
133
+ {
134
+ return genType(0.693147180559945309417232121458176568);
135
+ }
136
+
137
+ template<typename genType>
138
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType ln_ten()
139
+ {
140
+ return genType(2.30258509299404568401799145468436421);
141
+ }
142
+
143
+ template<typename genType>
144
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType ln_ln_two()
145
+ {
146
+ return genType(-0.3665129205816643);
147
+ }
148
+
149
+ template<typename genType>
150
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType third()
151
+ {
152
+ return genType(0.3333333333333333333333333333333333333333);
153
+ }
154
+
155
+ template<typename genType>
156
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType two_thirds()
157
+ {
158
+ return genType(0.666666666666666666666666666666666666667);
159
+ }
160
+
161
+ template<typename genType>
162
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType golden_ratio()
163
+ {
164
+ return genType(1.61803398874989484820458683436563811);
165
+ }
166
+
167
+ } //namespace glm
cuda_extensions/third_party/glm/glm/gtc/epsilon.hpp ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref gtc_epsilon
2
+ /// @file glm/gtc/epsilon.hpp
3
+ ///
4
+ /// @see core (dependence)
5
+ /// @see gtc_quaternion (dependence)
6
+ ///
7
+ /// @defgroup gtc_epsilon GLM_GTC_epsilon
8
+ /// @ingroup gtc
9
+ ///
10
+ /// Include <glm/gtc/epsilon.hpp> to use the features of this extension.
11
+ ///
12
+ /// Comparison functions for a user defined epsilon values.
13
+
14
+ #pragma once
15
+
16
+ // Dependencies
17
+ #include "../detail/setup.hpp"
18
+ #include "../detail/qualifier.hpp"
19
+
20
+ #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
21
+ # pragma message("GLM: GLM_GTC_epsilon extension included")
22
+ #endif
23
+
24
+ namespace glm
25
+ {
26
+ /// @addtogroup gtc_epsilon
27
+ /// @{
28
+
29
+ /// Returns the component-wise comparison of |x - y| < epsilon.
30
+ /// True if this expression is satisfied.
31
+ ///
32
+ /// @see gtc_epsilon
33
+ template<length_t L, typename T, qualifier Q>
34
+ GLM_FUNC_DECL vec<L, bool, Q> epsilonEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y, T const& epsilon);
35
+
36
+ /// Returns the component-wise comparison of |x - y| < epsilon.
37
+ /// True if this expression is satisfied.
38
+ ///
39
+ /// @see gtc_epsilon
40
+ template<typename genType>
41
+ GLM_FUNC_DECL bool epsilonEqual(genType const& x, genType const& y, genType const& epsilon);
42
+
43
+ /// Returns the component-wise comparison of |x - y| < epsilon.
44
+ /// True if this expression is not satisfied.
45
+ ///
46
+ /// @see gtc_epsilon
47
+ template<length_t L, typename T, qualifier Q>
48
+ GLM_FUNC_DECL vec<L, bool, Q> epsilonNotEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y, T const& epsilon);
49
+
50
+ /// Returns the component-wise comparison of |x - y| >= epsilon.
51
+ /// True if this expression is not satisfied.
52
+ ///
53
+ /// @see gtc_epsilon
54
+ template<typename genType>
55
+ GLM_FUNC_DECL bool epsilonNotEqual(genType const& x, genType const& y, genType const& epsilon);
56
+
57
+ /// @}
58
+ }//namespace glm
59
+
60
+ #include "epsilon.inl"
cuda_extensions/third_party/glm/glm/gtc/epsilon.inl ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref gtc_epsilon
2
+
3
+ // Dependency:
4
+ #include "../vector_relational.hpp"
5
+ #include "../common.hpp"
6
+
7
+ namespace glm
8
+ {
9
+ template<>
10
+ GLM_FUNC_QUALIFIER bool epsilonEqual
11
+ (
12
+ float const& x,
13
+ float const& y,
14
+ float const& epsilon
15
+ )
16
+ {
17
+ return abs(x - y) < epsilon;
18
+ }
19
+
20
+ template<>
21
+ GLM_FUNC_QUALIFIER bool epsilonEqual
22
+ (
23
+ double const& x,
24
+ double const& y,
25
+ double const& epsilon
26
+ )
27
+ {
28
+ return abs(x - y) < epsilon;
29
+ }
30
+
31
+ template<length_t L, typename T, qualifier Q>
32
+ GLM_FUNC_QUALIFIER vec<L, bool, Q> epsilonEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y, T const& epsilon)
33
+ {
34
+ return lessThan(abs(x - y), vec<L, T, Q>(epsilon));
35
+ }
36
+
37
+ template<length_t L, typename T, qualifier Q>
38
+ GLM_FUNC_QUALIFIER vec<L, bool, Q> epsilonEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y, vec<L, T, Q> const& epsilon)
39
+ {
40
+ return lessThan(abs(x - y), vec<L, T, Q>(epsilon));
41
+ }
42
+
43
+ template<>
44
+ GLM_FUNC_QUALIFIER bool epsilonNotEqual(float const& x, float const& y, float const& epsilon)
45
+ {
46
+ return abs(x - y) >= epsilon;
47
+ }
48
+
49
+ template<>
50
+ GLM_FUNC_QUALIFIER bool epsilonNotEqual(double const& x, double const& y, double const& epsilon)
51
+ {
52
+ return abs(x - y) >= epsilon;
53
+ }
54
+
55
+ template<length_t L, typename T, qualifier Q>
56
+ GLM_FUNC_QUALIFIER vec<L, bool, Q> epsilonNotEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y, T const& epsilon)
57
+ {
58
+ return greaterThanEqual(abs(x - y), vec<L, T, Q>(epsilon));
59
+ }
60
+
61
+ template<length_t L, typename T, qualifier Q>
62
+ GLM_FUNC_QUALIFIER vec<L, bool, Q> epsilonNotEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y, vec<L, T, Q> const& epsilon)
63
+ {
64
+ return greaterThanEqual(abs(x - y), vec<L, T, Q>(epsilon));
65
+ }
66
+
67
+ template<typename T, qualifier Q>
68
+ GLM_FUNC_QUALIFIER vec<4, bool, Q> epsilonEqual(qua<T, Q> const& x, qua<T, Q> const& y, T const& epsilon)
69
+ {
70
+ vec<4, T, Q> v(x.x - y.x, x.y - y.y, x.z - y.z, x.w - y.w);
71
+ return lessThan(abs(v), vec<4, T, Q>(epsilon));
72
+ }
73
+
74
+ template<typename T, qualifier Q>
75
+ GLM_FUNC_QUALIFIER vec<4, bool, Q> epsilonNotEqual(qua<T, Q> const& x, qua<T, Q> const& y, T const& epsilon)
76
+ {
77
+ vec<4, T, Q> v(x.x - y.x, x.y - y.y, x.z - y.z, x.w - y.w);
78
+ return greaterThanEqual(abs(v), vec<4, T, Q>(epsilon));
79
+ }
80
+ }//namespace glm
cuda_extensions/third_party/glm/glm/gtc/integer.hpp ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref gtc_integer
2
+ /// @file glm/gtc/integer.hpp
3
+ ///
4
+ /// @see core (dependence)
5
+ /// @see gtc_integer (dependence)
6
+ ///
7
+ /// @defgroup gtc_integer GLM_GTC_integer
8
+ /// @ingroup gtc
9
+ ///
10
+ /// Include <glm/gtc/integer.hpp> to use the features of this extension.
11
+ ///
12
+ /// @brief Allow to perform bit operations on integer values
13
+
14
+ #pragma once
15
+
16
+ // Dependencies
17
+ #include "../detail/setup.hpp"
18
+ #include "../detail/qualifier.hpp"
19
+ #include "../common.hpp"
20
+ #include "../integer.hpp"
21
+ #include "../exponential.hpp"
22
+ #include "../ext/scalar_common.hpp"
23
+ #include "../ext/vector_common.hpp"
24
+ #include <limits>
25
+
26
+ #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
27
+ # pragma message("GLM: GLM_GTC_integer extension included")
28
+ #endif
29
+
30
+ namespace glm
31
+ {
32
+ /// @addtogroup gtc_integer
33
+ /// @{
34
+
35
+ /// Returns the log2 of x for integer values. Useful to compute mipmap count from the texture size.
36
+ /// @see gtc_integer
37
+ template<typename genIUType>
38
+ GLM_FUNC_DECL genIUType log2(genIUType x);
39
+
40
+ /// @}
41
+ } //namespace glm
42
+
43
+ #include "integer.inl"
cuda_extensions/third_party/glm/glm/gtc/integer.inl ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref gtc_integer
2
+
3
+ namespace glm{
4
+ namespace detail
5
+ {
6
+ template<length_t L, typename T, qualifier Q, bool Aligned>
7
+ struct compute_log2<L, T, Q, false, Aligned>
8
+ {
9
+ GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& v)
10
+ {
11
+ //Equivalent to return findMSB(vec); but save one function call in ASM with VC
12
+ //return findMSB(vec);
13
+ return vec<L, T, Q>(detail::compute_findMSB_vec<L, T, Q, sizeof(T) * 8>::call(v));
14
+ }
15
+ };
16
+
17
+ # if GLM_HAS_BITSCAN_WINDOWS
18
+ template<qualifier Q, bool Aligned>
19
+ struct compute_log2<4, int, Q, false, Aligned>
20
+ {
21
+ GLM_FUNC_QUALIFIER static vec<4, int, Q> call(vec<4, int, Q> const& v)
22
+ {
23
+ vec<4, int, Q> Result;
24
+ _BitScanReverse(reinterpret_cast<unsigned long*>(&Result.x), v.x);
25
+ _BitScanReverse(reinterpret_cast<unsigned long*>(&Result.y), v.y);
26
+ _BitScanReverse(reinterpret_cast<unsigned long*>(&Result.z), v.z);
27
+ _BitScanReverse(reinterpret_cast<unsigned long*>(&Result.w), v.w);
28
+ return Result;
29
+ }
30
+ };
31
+ # endif//GLM_HAS_BITSCAN_WINDOWS
32
+ }//namespace detail
33
+ }//namespace glm
cuda_extensions/third_party/glm/glm/gtc/matrix_access.hpp ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref gtc_matrix_access
2
+ /// @file glm/gtc/matrix_access.hpp
3
+ ///
4
+ /// @see core (dependence)
5
+ ///
6
+ /// @defgroup gtc_matrix_access GLM_GTC_matrix_access
7
+ /// @ingroup gtc
8
+ ///
9
+ /// Include <glm/gtc/matrix_access.hpp> to use the features of this extension.
10
+ ///
11
+ /// Defines functions to access rows or columns of a matrix easily.
12
+
13
+ #pragma once
14
+
15
+ // Dependency:
16
+ #include "../detail/setup.hpp"
17
+
18
+ #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
19
+ # pragma message("GLM: GLM_GTC_matrix_access extension included")
20
+ #endif
21
+
22
+ namespace glm
23
+ {
24
+ /// @addtogroup gtc_matrix_access
25
+ /// @{
26
+
27
+ /// Get a specific row of a matrix.
28
+ /// @see gtc_matrix_access
29
+ template<typename genType>
30
+ GLM_FUNC_DECL typename genType::row_type row(
31
+ genType const& m,
32
+ length_t index);
33
+
34
+ /// Set a specific row to a matrix.
35
+ /// @see gtc_matrix_access
36
+ template<typename genType>
37
+ GLM_FUNC_DECL genType row(
38
+ genType const& m,
39
+ length_t index,
40
+ typename genType::row_type const& x);
41
+
42
+ /// Get a specific column of a matrix.
43
+ /// @see gtc_matrix_access
44
+ template<typename genType>
45
+ GLM_FUNC_DECL typename genType::col_type column(
46
+ genType const& m,
47
+ length_t index);
48
+
49
+ /// Set a specific column to a matrix.
50
+ /// @see gtc_matrix_access
51
+ template<typename genType>
52
+ GLM_FUNC_DECL genType column(
53
+ genType const& m,
54
+ length_t index,
55
+ typename genType::col_type const& x);
56
+
57
+ /// @}
58
+ }//namespace glm
59
+
60
+ #include "matrix_access.inl"
cuda_extensions/third_party/glm/glm/gtc/matrix_access.inl ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref gtc_matrix_access
2
+
3
+ namespace glm
4
+ {
5
+ template<typename genType>
6
+ GLM_FUNC_QUALIFIER genType row
7
+ (
8
+ genType const& m,
9
+ length_t index,
10
+ typename genType::row_type const& x
11
+ )
12
+ {
13
+ assert(index >= 0 && index < m[0].length());
14
+
15
+ genType Result = m;
16
+ for(length_t i = 0; i < m.length(); ++i)
17
+ Result[i][index] = x[i];
18
+ return Result;
19
+ }
20
+
21
+ template<typename genType>
22
+ GLM_FUNC_QUALIFIER typename genType::row_type row
23
+ (
24
+ genType const& m,
25
+ length_t index
26
+ )
27
+ {
28
+ assert(index >= 0 && index < m[0].length());
29
+
30
+ typename genType::row_type Result(0);
31
+ for(length_t i = 0; i < m.length(); ++i)
32
+ Result[i] = m[i][index];
33
+ return Result;
34
+ }
35
+
36
+ template<typename genType>
37
+ GLM_FUNC_QUALIFIER genType column
38
+ (
39
+ genType const& m,
40
+ length_t index,
41
+ typename genType::col_type const& x
42
+ )
43
+ {
44
+ assert(index >= 0 && index < m.length());
45
+
46
+ genType Result = m;
47
+ Result[index] = x;
48
+ return Result;
49
+ }
50
+
51
+ template<typename genType>
52
+ GLM_FUNC_QUALIFIER typename genType::col_type column
53
+ (
54
+ genType const& m,
55
+ length_t index
56
+ )
57
+ {
58
+ assert(index >= 0 && index < m.length());
59
+
60
+ return m[index];
61
+ }
62
+ }//namespace glm
cuda_extensions/third_party/glm/glm/gtc/matrix_integer.hpp ADDED
@@ -0,0 +1,433 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref gtc_matrix_integer
2
+ /// @file glm/gtc/matrix_integer.hpp
3
+ ///
4
+ /// @see core (dependence)
5
+ ///
6
+ /// @defgroup gtc_matrix_integer GLM_GTC_matrix_integer
7
+ /// @ingroup gtc
8
+ ///
9
+ /// Include <glm/gtc/matrix_integer.hpp> to use the features of this extension.
10
+ ///
11
+ /// Defines a number of matrices with integer types.
12
+
13
+ #pragma once
14
+
15
+ // Dependency:
16
+ #include "../mat2x2.hpp"
17
+ #include "../mat2x3.hpp"
18
+ #include "../mat2x4.hpp"
19
+ #include "../mat3x2.hpp"
20
+ #include "../mat3x3.hpp"
21
+ #include "../mat3x4.hpp"
22
+ #include "../mat4x2.hpp"
23
+ #include "../mat4x3.hpp"
24
+ #include "../mat4x4.hpp"
25
+
26
+ #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
27
+ # pragma message("GLM: GLM_GTC_matrix_integer extension included")
28
+ #endif
29
+
30
+ namespace glm
31
+ {
32
+ /// @addtogroup gtc_matrix_integer
33
+ /// @{
34
+
35
+ /// High-qualifier signed integer 2x2 matrix.
36
+ /// @see gtc_matrix_integer
37
+ typedef mat<2, 2, int, highp> highp_imat2;
38
+
39
+ /// High-qualifier signed integer 3x3 matrix.
40
+ /// @see gtc_matrix_integer
41
+ typedef mat<3, 3, int, highp> highp_imat3;
42
+
43
+ /// High-qualifier signed integer 4x4 matrix.
44
+ /// @see gtc_matrix_integer
45
+ typedef mat<4, 4, int, highp> highp_imat4;
46
+
47
+ /// High-qualifier signed integer 2x2 matrix.
48
+ /// @see gtc_matrix_integer
49
+ typedef mat<2, 2, int, highp> highp_imat2x2;
50
+
51
+ /// High-qualifier signed integer 2x3 matrix.
52
+ /// @see gtc_matrix_integer
53
+ typedef mat<2, 3, int, highp> highp_imat2x3;
54
+
55
+ /// High-qualifier signed integer 2x4 matrix.
56
+ /// @see gtc_matrix_integer
57
+ typedef mat<2, 4, int, highp> highp_imat2x4;
58
+
59
+ /// High-qualifier signed integer 3x2 matrix.
60
+ /// @see gtc_matrix_integer
61
+ typedef mat<3, 2, int, highp> highp_imat3x2;
62
+
63
+ /// High-qualifier signed integer 3x3 matrix.
64
+ /// @see gtc_matrix_integer
65
+ typedef mat<3, 3, int, highp> highp_imat3x3;
66
+
67
+ /// High-qualifier signed integer 3x4 matrix.
68
+ /// @see gtc_matrix_integer
69
+ typedef mat<3, 4, int, highp> highp_imat3x4;
70
+
71
+ /// High-qualifier signed integer 4x2 matrix.
72
+ /// @see gtc_matrix_integer
73
+ typedef mat<4, 2, int, highp> highp_imat4x2;
74
+
75
+ /// High-qualifier signed integer 4x3 matrix.
76
+ /// @see gtc_matrix_integer
77
+ typedef mat<4, 3, int, highp> highp_imat4x3;
78
+
79
+ /// High-qualifier signed integer 4x4 matrix.
80
+ /// @see gtc_matrix_integer
81
+ typedef mat<4, 4, int, highp> highp_imat4x4;
82
+
83
+
84
+ /// Medium-qualifier signed integer 2x2 matrix.
85
+ /// @see gtc_matrix_integer
86
+ typedef mat<2, 2, int, mediump> mediump_imat2;
87
+
88
+ /// Medium-qualifier signed integer 3x3 matrix.
89
+ /// @see gtc_matrix_integer
90
+ typedef mat<3, 3, int, mediump> mediump_imat3;
91
+
92
+ /// Medium-qualifier signed integer 4x4 matrix.
93
+ /// @see gtc_matrix_integer
94
+ typedef mat<4, 4, int, mediump> mediump_imat4;
95
+
96
+
97
+ /// Medium-qualifier signed integer 2x2 matrix.
98
+ /// @see gtc_matrix_integer
99
+ typedef mat<2, 2, int, mediump> mediump_imat2x2;
100
+
101
+ /// Medium-qualifier signed integer 2x3 matrix.
102
+ /// @see gtc_matrix_integer
103
+ typedef mat<2, 3, int, mediump> mediump_imat2x3;
104
+
105
+ /// Medium-qualifier signed integer 2x4 matrix.
106
+ /// @see gtc_matrix_integer
107
+ typedef mat<2, 4, int, mediump> mediump_imat2x4;
108
+
109
+ /// Medium-qualifier signed integer 3x2 matrix.
110
+ /// @see gtc_matrix_integer
111
+ typedef mat<3, 2, int, mediump> mediump_imat3x2;
112
+
113
+ /// Medium-qualifier signed integer 3x3 matrix.
114
+ /// @see gtc_matrix_integer
115
+ typedef mat<3, 3, int, mediump> mediump_imat3x3;
116
+
117
+ /// Medium-qualifier signed integer 3x4 matrix.
118
+ /// @see gtc_matrix_integer
119
+ typedef mat<3, 4, int, mediump> mediump_imat3x4;
120
+
121
+ /// Medium-qualifier signed integer 4x2 matrix.
122
+ /// @see gtc_matrix_integer
123
+ typedef mat<4, 2, int, mediump> mediump_imat4x2;
124
+
125
+ /// Medium-qualifier signed integer 4x3 matrix.
126
+ /// @see gtc_matrix_integer
127
+ typedef mat<4, 3, int, mediump> mediump_imat4x3;
128
+
129
+ /// Medium-qualifier signed integer 4x4 matrix.
130
+ /// @see gtc_matrix_integer
131
+ typedef mat<4, 4, int, mediump> mediump_imat4x4;
132
+
133
+
134
+ /// Low-qualifier signed integer 2x2 matrix.
135
+ /// @see gtc_matrix_integer
136
+ typedef mat<2, 2, int, lowp> lowp_imat2;
137
+
138
+ /// Low-qualifier signed integer 3x3 matrix.
139
+ /// @see gtc_matrix_integer
140
+ typedef mat<3, 3, int, lowp> lowp_imat3;
141
+
142
+ /// Low-qualifier signed integer 4x4 matrix.
143
+ /// @see gtc_matrix_integer
144
+ typedef mat<4, 4, int, lowp> lowp_imat4;
145
+
146
+
147
+ /// Low-qualifier signed integer 2x2 matrix.
148
+ /// @see gtc_matrix_integer
149
+ typedef mat<2, 2, int, lowp> lowp_imat2x2;
150
+
151
+ /// Low-qualifier signed integer 2x3 matrix.
152
+ /// @see gtc_matrix_integer
153
+ typedef mat<2, 3, int, lowp> lowp_imat2x3;
154
+
155
+ /// Low-qualifier signed integer 2x4 matrix.
156
+ /// @see gtc_matrix_integer
157
+ typedef mat<2, 4, int, lowp> lowp_imat2x4;
158
+
159
+ /// Low-qualifier signed integer 3x2 matrix.
160
+ /// @see gtc_matrix_integer
161
+ typedef mat<3, 2, int, lowp> lowp_imat3x2;
162
+
163
+ /// Low-qualifier signed integer 3x3 matrix.
164
+ /// @see gtc_matrix_integer
165
+ typedef mat<3, 3, int, lowp> lowp_imat3x3;
166
+
167
+ /// Low-qualifier signed integer 3x4 matrix.
168
+ /// @see gtc_matrix_integer
169
+ typedef mat<3, 4, int, lowp> lowp_imat3x4;
170
+
171
+ /// Low-qualifier signed integer 4x2 matrix.
172
+ /// @see gtc_matrix_integer
173
+ typedef mat<4, 2, int, lowp> lowp_imat4x2;
174
+
175
+ /// Low-qualifier signed integer 4x3 matrix.
176
+ /// @see gtc_matrix_integer
177
+ typedef mat<4, 3, int, lowp> lowp_imat4x3;
178
+
179
+ /// Low-qualifier signed integer 4x4 matrix.
180
+ /// @see gtc_matrix_integer
181
+ typedef mat<4, 4, int, lowp> lowp_imat4x4;
182
+
183
+
184
+ /// High-qualifier unsigned integer 2x2 matrix.
185
+ /// @see gtc_matrix_integer
186
+ typedef mat<2, 2, uint, highp> highp_umat2;
187
+
188
+ /// High-qualifier unsigned integer 3x3 matrix.
189
+ /// @see gtc_matrix_integer
190
+ typedef mat<3, 3, uint, highp> highp_umat3;
191
+
192
+ /// High-qualifier unsigned integer 4x4 matrix.
193
+ /// @see gtc_matrix_integer
194
+ typedef mat<4, 4, uint, highp> highp_umat4;
195
+
196
+ /// High-qualifier unsigned integer 2x2 matrix.
197
+ /// @see gtc_matrix_integer
198
+ typedef mat<2, 2, uint, highp> highp_umat2x2;
199
+
200
+ /// High-qualifier unsigned integer 2x3 matrix.
201
+ /// @see gtc_matrix_integer
202
+ typedef mat<2, 3, uint, highp> highp_umat2x3;
203
+
204
+ /// High-qualifier unsigned integer 2x4 matrix.
205
+ /// @see gtc_matrix_integer
206
+ typedef mat<2, 4, uint, highp> highp_umat2x4;
207
+
208
+ /// High-qualifier unsigned integer 3x2 matrix.
209
+ /// @see gtc_matrix_integer
210
+ typedef mat<3, 2, uint, highp> highp_umat3x2;
211
+
212
+ /// High-qualifier unsigned integer 3x3 matrix.
213
+ /// @see gtc_matrix_integer
214
+ typedef mat<3, 3, uint, highp> highp_umat3x3;
215
+
216
+ /// High-qualifier unsigned integer 3x4 matrix.
217
+ /// @see gtc_matrix_integer
218
+ typedef mat<3, 4, uint, highp> highp_umat3x4;
219
+
220
+ /// High-qualifier unsigned integer 4x2 matrix.
221
+ /// @see gtc_matrix_integer
222
+ typedef mat<4, 2, uint, highp> highp_umat4x2;
223
+
224
+ /// High-qualifier unsigned integer 4x3 matrix.
225
+ /// @see gtc_matrix_integer
226
+ typedef mat<4, 3, uint, highp> highp_umat4x3;
227
+
228
+ /// High-qualifier unsigned integer 4x4 matrix.
229
+ /// @see gtc_matrix_integer
230
+ typedef mat<4, 4, uint, highp> highp_umat4x4;
231
+
232
+
233
+ /// Medium-qualifier unsigned integer 2x2 matrix.
234
+ /// @see gtc_matrix_integer
235
+ typedef mat<2, 2, uint, mediump> mediump_umat2;
236
+
237
+ /// Medium-qualifier unsigned integer 3x3 matrix.
238
+ /// @see gtc_matrix_integer
239
+ typedef mat<3, 3, uint, mediump> mediump_umat3;
240
+
241
+ /// Medium-qualifier unsigned integer 4x4 matrix.
242
+ /// @see gtc_matrix_integer
243
+ typedef mat<4, 4, uint, mediump> mediump_umat4;
244
+
245
+
246
+ /// Medium-qualifier unsigned integer 2x2 matrix.
247
+ /// @see gtc_matrix_integer
248
+ typedef mat<2, 2, uint, mediump> mediump_umat2x2;
249
+
250
+ /// Medium-qualifier unsigned integer 2x3 matrix.
251
+ /// @see gtc_matrix_integer
252
+ typedef mat<2, 3, uint, mediump> mediump_umat2x3;
253
+
254
+ /// Medium-qualifier unsigned integer 2x4 matrix.
255
+ /// @see gtc_matrix_integer
256
+ typedef mat<2, 4, uint, mediump> mediump_umat2x4;
257
+
258
+ /// Medium-qualifier unsigned integer 3x2 matrix.
259
+ /// @see gtc_matrix_integer
260
+ typedef mat<3, 2, uint, mediump> mediump_umat3x2;
261
+
262
+ /// Medium-qualifier unsigned integer 3x3 matrix.
263
+ /// @see gtc_matrix_integer
264
+ typedef mat<3, 3, uint, mediump> mediump_umat3x3;
265
+
266
+ /// Medium-qualifier unsigned integer 3x4 matrix.
267
+ /// @see gtc_matrix_integer
268
+ typedef mat<3, 4, uint, mediump> mediump_umat3x4;
269
+
270
+ /// Medium-qualifier unsigned integer 4x2 matrix.
271
+ /// @see gtc_matrix_integer
272
+ typedef mat<4, 2, uint, mediump> mediump_umat4x2;
273
+
274
+ /// Medium-qualifier unsigned integer 4x3 matrix.
275
+ /// @see gtc_matrix_integer
276
+ typedef mat<4, 3, uint, mediump> mediump_umat4x3;
277
+
278
+ /// Medium-qualifier unsigned integer 4x4 matrix.
279
+ /// @see gtc_matrix_integer
280
+ typedef mat<4, 4, uint, mediump> mediump_umat4x4;
281
+
282
+
283
+ /// Low-qualifier unsigned integer 2x2 matrix.
284
+ /// @see gtc_matrix_integer
285
+ typedef mat<2, 2, uint, lowp> lowp_umat2;
286
+
287
+ /// Low-qualifier unsigned integer 3x3 matrix.
288
+ /// @see gtc_matrix_integer
289
+ typedef mat<3, 3, uint, lowp> lowp_umat3;
290
+
291
+ /// Low-qualifier unsigned integer 4x4 matrix.
292
+ /// @see gtc_matrix_integer
293
+ typedef mat<4, 4, uint, lowp> lowp_umat4;
294
+
295
+
296
+ /// Low-qualifier unsigned integer 2x2 matrix.
297
+ /// @see gtc_matrix_integer
298
+ typedef mat<2, 2, uint, lowp> lowp_umat2x2;
299
+
300
+ /// Low-qualifier unsigned integer 2x3 matrix.
301
+ /// @see gtc_matrix_integer
302
+ typedef mat<2, 3, uint, lowp> lowp_umat2x3;
303
+
304
+ /// Low-qualifier unsigned integer 2x4 matrix.
305
+ /// @see gtc_matrix_integer
306
+ typedef mat<2, 4, uint, lowp> lowp_umat2x4;
307
+
308
+ /// Low-qualifier unsigned integer 3x2 matrix.
309
+ /// @see gtc_matrix_integer
310
+ typedef mat<3, 2, uint, lowp> lowp_umat3x2;
311
+
312
+ /// Low-qualifier unsigned integer 3x3 matrix.
313
+ /// @see gtc_matrix_integer
314
+ typedef mat<3, 3, uint, lowp> lowp_umat3x3;
315
+
316
+ /// Low-qualifier unsigned integer 3x4 matrix.
317
+ /// @see gtc_matrix_integer
318
+ typedef mat<3, 4, uint, lowp> lowp_umat3x4;
319
+
320
+ /// Low-qualifier unsigned integer 4x2 matrix.
321
+ /// @see gtc_matrix_integer
322
+ typedef mat<4, 2, uint, lowp> lowp_umat4x2;
323
+
324
+ /// Low-qualifier unsigned integer 4x3 matrix.
325
+ /// @see gtc_matrix_integer
326
+ typedef mat<4, 3, uint, lowp> lowp_umat4x3;
327
+
328
+ /// Low-qualifier unsigned integer 4x4 matrix.
329
+ /// @see gtc_matrix_integer
330
+ typedef mat<4, 4, uint, lowp> lowp_umat4x4;
331
+
332
+
333
+
334
+ /// Signed integer 2x2 matrix.
335
+ /// @see gtc_matrix_integer
336
+ typedef mat<2, 2, int, defaultp> imat2;
337
+
338
+ /// Signed integer 3x3 matrix.
339
+ /// @see gtc_matrix_integer
340
+ typedef mat<3, 3, int, defaultp> imat3;
341
+
342
+ /// Signed integer 4x4 matrix.
343
+ /// @see gtc_matrix_integer
344
+ typedef mat<4, 4, int, defaultp> imat4;
345
+
346
+ /// Signed integer 2x2 matrix.
347
+ /// @see gtc_matrix_integer
348
+ typedef mat<2, 2, int, defaultp> imat2x2;
349
+
350
+ /// Signed integer 2x3 matrix.
351
+ /// @see gtc_matrix_integer
352
+ typedef mat<2, 3, int, defaultp> imat2x3;
353
+
354
+ /// Signed integer 2x4 matrix.
355
+ /// @see gtc_matrix_integer
356
+ typedef mat<2, 4, int, defaultp> imat2x4;
357
+
358
+ /// Signed integer 3x2 matrix.
359
+ /// @see gtc_matrix_integer
360
+ typedef mat<3, 2, int, defaultp> imat3x2;
361
+
362
+ /// Signed integer 3x3 matrix.
363
+ /// @see gtc_matrix_integer
364
+ typedef mat<3, 3, int, defaultp> imat3x3;
365
+
366
+ /// Signed integer 3x4 matrix.
367
+ /// @see gtc_matrix_integer
368
+ typedef mat<3, 4, int, defaultp> imat3x4;
369
+
370
+ /// Signed integer 4x2 matrix.
371
+ /// @see gtc_matrix_integer
372
+ typedef mat<4, 2, int, defaultp> imat4x2;
373
+
374
+ /// Signed integer 4x3 matrix.
375
+ /// @see gtc_matrix_integer
376
+ typedef mat<4, 3, int, defaultp> imat4x3;
377
+
378
+ /// Signed integer 4x4 matrix.
379
+ /// @see gtc_matrix_integer
380
+ typedef mat<4, 4, int, defaultp> imat4x4;
381
+
382
+
383
+
384
+ /// Unsigned integer 2x2 matrix.
385
+ /// @see gtc_matrix_integer
386
+ typedef mat<2, 2, uint, defaultp> umat2;
387
+
388
+ /// Unsigned integer 3x3 matrix.
389
+ /// @see gtc_matrix_integer
390
+ typedef mat<3, 3, uint, defaultp> umat3;
391
+
392
+ /// Unsigned integer 4x4 matrix.
393
+ /// @see gtc_matrix_integer
394
+ typedef mat<4, 4, uint, defaultp> umat4;
395
+
396
+ /// Unsigned integer 2x2 matrix.
397
+ /// @see gtc_matrix_integer
398
+ typedef mat<2, 2, uint, defaultp> umat2x2;
399
+
400
+ /// Unsigned integer 2x3 matrix.
401
+ /// @see gtc_matrix_integer
402
+ typedef mat<2, 3, uint, defaultp> umat2x3;
403
+
404
+ /// Unsigned integer 2x4 matrix.
405
+ /// @see gtc_matrix_integer
406
+ typedef mat<2, 4, uint, defaultp> umat2x4;
407
+
408
+ /// Unsigned integer 3x2 matrix.
409
+ /// @see gtc_matrix_integer
410
+ typedef mat<3, 2, uint, defaultp> umat3x2;
411
+
412
+ /// Unsigned integer 3x3 matrix.
413
+ /// @see gtc_matrix_integer
414
+ typedef mat<3, 3, uint, defaultp> umat3x3;
415
+
416
+ /// Unsigned integer 3x4 matrix.
417
+ /// @see gtc_matrix_integer
418
+ typedef mat<3, 4, uint, defaultp> umat3x4;
419
+
420
+ /// Unsigned integer 4x2 matrix.
421
+ /// @see gtc_matrix_integer
422
+ typedef mat<4, 2, uint, defaultp> umat4x2;
423
+
424
+ /// Unsigned integer 4x3 matrix.
425
+ /// @see gtc_matrix_integer
426
+ typedef mat<4, 3, uint, defaultp> umat4x3;
427
+
428
+ /// Unsigned integer 4x4 matrix.
429
+ /// @see gtc_matrix_integer
430
+ typedef mat<4, 4, uint, defaultp> umat4x4;
431
+
432
+ /// @}
433
+ }//namespace glm
cuda_extensions/third_party/glm/glm/gtc/matrix_inverse.hpp ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref gtc_matrix_inverse
2
+ /// @file glm/gtc/matrix_inverse.hpp
3
+ ///
4
+ /// @see core (dependence)
5
+ ///
6
+ /// @defgroup gtc_matrix_inverse GLM_GTC_matrix_inverse
7
+ /// @ingroup gtc
8
+ ///
9
+ /// Include <glm/gtc/matrix_inverse.hpp> to use the features of this extension.
10
+ ///
11
+ /// Defines additional matrix inverting functions.
12
+
13
+ #pragma once
14
+
15
+ // Dependencies
16
+ #include "../detail/setup.hpp"
17
+ #include "../matrix.hpp"
18
+ #include "../mat2x2.hpp"
19
+ #include "../mat3x3.hpp"
20
+ #include "../mat4x4.hpp"
21
+
22
+ #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
23
+ # pragma message("GLM: GLM_GTC_matrix_inverse extension included")
24
+ #endif
25
+
26
+ namespace glm
27
+ {
28
+ /// @addtogroup gtc_matrix_inverse
29
+ /// @{
30
+
31
+ /// Fast matrix inverse for affine matrix.
32
+ ///
33
+ /// @param m Input matrix to invert.
34
+ /// @tparam genType Squared floating-point matrix: half, float or double. Inverse of matrix based of half-qualifier floating point value is highly inaccurate.
35
+ /// @see gtc_matrix_inverse
36
+ template<typename genType>
37
+ GLM_FUNC_DECL genType affineInverse(genType const& m);
38
+
39
+ /// Compute the inverse transpose of a matrix.
40
+ ///
41
+ /// @param m Input matrix to invert transpose.
42
+ /// @tparam genType Squared floating-point matrix: half, float or double. Inverse of matrix based of half-qualifier floating point value is highly inaccurate.
43
+ /// @see gtc_matrix_inverse
44
+ template<typename genType>
45
+ GLM_FUNC_DECL genType inverseTranspose(genType const& m);
46
+
47
+ /// @}
48
+ }//namespace glm
49
+
50
+ #include "matrix_inverse.inl"
cuda_extensions/third_party/glm/glm/gtc/matrix_inverse.inl ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref gtc_matrix_inverse
2
+
3
+ namespace glm
4
+ {
5
+ template<typename T, qualifier Q>
6
+ GLM_FUNC_QUALIFIER mat<3, 3, T, Q> affineInverse(mat<3, 3, T, Q> const& m)
7
+ {
8
+ mat<2, 2, T, Q> const Inv(inverse(mat<2, 2, T, Q>(m)));
9
+
10
+ return mat<3, 3, T, Q>(
11
+ vec<3, T, Q>(Inv[0], static_cast<T>(0)),
12
+ vec<3, T, Q>(Inv[1], static_cast<T>(0)),
13
+ vec<3, T, Q>(-Inv * vec<2, T, Q>(m[2]), static_cast<T>(1)));
14
+ }
15
+
16
+ template<typename T, qualifier Q>
17
+ GLM_FUNC_QUALIFIER mat<4, 4, T, Q> affineInverse(mat<4, 4, T, Q> const& m)
18
+ {
19
+ mat<3, 3, T, Q> const Inv(inverse(mat<3, 3, T, Q>(m)));
20
+
21
+ return mat<4, 4, T, Q>(
22
+ vec<4, T, Q>(Inv[0], static_cast<T>(0)),
23
+ vec<4, T, Q>(Inv[1], static_cast<T>(0)),
24
+ vec<4, T, Q>(Inv[2], static_cast<T>(0)),
25
+ vec<4, T, Q>(-Inv * vec<3, T, Q>(m[3]), static_cast<T>(1)));
26
+ }
27
+
28
+ template<typename T, qualifier Q>
29
+ GLM_FUNC_QUALIFIER mat<2, 2, T, Q> inverseTranspose(mat<2, 2, T, Q> const& m)
30
+ {
31
+ T Determinant = m[0][0] * m[1][1] - m[1][0] * m[0][1];
32
+
33
+ mat<2, 2, T, Q> Inverse(
34
+ + m[1][1] / Determinant,
35
+ - m[0][1] / Determinant,
36
+ - m[1][0] / Determinant,
37
+ + m[0][0] / Determinant);
38
+
39
+ return Inverse;
40
+ }
41
+
42
+ template<typename T, qualifier Q>
43
+ GLM_FUNC_QUALIFIER mat<3, 3, T, Q> inverseTranspose(mat<3, 3, T, Q> const& m)
44
+ {
45
+ T Determinant =
46
+ + m[0][0] * (m[1][1] * m[2][2] - m[1][2] * m[2][1])
47
+ - m[0][1] * (m[1][0] * m[2][2] - m[1][2] * m[2][0])
48
+ + m[0][2] * (m[1][0] * m[2][1] - m[1][1] * m[2][0]);
49
+
50
+ mat<3, 3, T, Q> Inverse;
51
+ Inverse[0][0] = + (m[1][1] * m[2][2] - m[2][1] * m[1][2]);
52
+ Inverse[0][1] = - (m[1][0] * m[2][2] - m[2][0] * m[1][2]);
53
+ Inverse[0][2] = + (m[1][0] * m[2][1] - m[2][0] * m[1][1]);
54
+ Inverse[1][0] = - (m[0][1] * m[2][2] - m[2][1] * m[0][2]);
55
+ Inverse[1][1] = + (m[0][0] * m[2][2] - m[2][0] * m[0][2]);
56
+ Inverse[1][2] = - (m[0][0] * m[2][1] - m[2][0] * m[0][1]);
57
+ Inverse[2][0] = + (m[0][1] * m[1][2] - m[1][1] * m[0][2]);
58
+ Inverse[2][1] = - (m[0][0] * m[1][2] - m[1][0] * m[0][2]);
59
+ Inverse[2][2] = + (m[0][0] * m[1][1] - m[1][0] * m[0][1]);
60
+ Inverse /= Determinant;
61
+
62
+ return Inverse;
63
+ }
64
+
65
+ template<typename T, qualifier Q>
66
+ GLM_FUNC_QUALIFIER mat<4, 4, T, Q> inverseTranspose(mat<4, 4, T, Q> const& m)
67
+ {
68
+ T SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];
69
+ T SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3];
70
+ T SubFactor02 = m[2][1] * m[3][2] - m[3][1] * m[2][2];
71
+ T SubFactor03 = m[2][0] * m[3][3] - m[3][0] * m[2][3];
72
+ T SubFactor04 = m[2][0] * m[3][2] - m[3][0] * m[2][2];
73
+ T SubFactor05 = m[2][0] * m[3][1] - m[3][0] * m[2][1];
74
+ T SubFactor06 = m[1][2] * m[3][3] - m[3][2] * m[1][3];
75
+ T SubFactor07 = m[1][1] * m[3][3] - m[3][1] * m[1][3];
76
+ T SubFactor08 = m[1][1] * m[3][2] - m[3][1] * m[1][2];
77
+ T SubFactor09 = m[1][0] * m[3][3] - m[3][0] * m[1][3];
78
+ T SubFactor10 = m[1][0] * m[3][2] - m[3][0] * m[1][2];
79
+ T SubFactor11 = m[1][0] * m[3][1] - m[3][0] * m[1][1];
80
+ T SubFactor12 = m[1][2] * m[2][3] - m[2][2] * m[1][3];
81
+ T SubFactor13 = m[1][1] * m[2][3] - m[2][1] * m[1][3];
82
+ T SubFactor14 = m[1][1] * m[2][2] - m[2][1] * m[1][2];
83
+ T SubFactor15 = m[1][0] * m[2][3] - m[2][0] * m[1][3];
84
+ T SubFactor16 = m[1][0] * m[2][2] - m[2][0] * m[1][2];
85
+ T SubFactor17 = m[1][0] * m[2][1] - m[2][0] * m[1][1];
86
+
87
+ mat<4, 4, T, Q> Inverse;
88
+ Inverse[0][0] = + (m[1][1] * SubFactor00 - m[1][2] * SubFactor01 + m[1][3] * SubFactor02);
89
+ Inverse[0][1] = - (m[1][0] * SubFactor00 - m[1][2] * SubFactor03 + m[1][3] * SubFactor04);
90
+ Inverse[0][2] = + (m[1][0] * SubFactor01 - m[1][1] * SubFactor03 + m[1][3] * SubFactor05);
91
+ Inverse[0][3] = - (m[1][0] * SubFactor02 - m[1][1] * SubFactor04 + m[1][2] * SubFactor05);
92
+
93
+ Inverse[1][0] = - (m[0][1] * SubFactor00 - m[0][2] * SubFactor01 + m[0][3] * SubFactor02);
94
+ Inverse[1][1] = + (m[0][0] * SubFactor00 - m[0][2] * SubFactor03 + m[0][3] * SubFactor04);
95
+ Inverse[1][2] = - (m[0][0] * SubFactor01 - m[0][1] * SubFactor03 + m[0][3] * SubFactor05);
96
+ Inverse[1][3] = + (m[0][0] * SubFactor02 - m[0][1] * SubFactor04 + m[0][2] * SubFactor05);
97
+
98
+ Inverse[2][0] = + (m[0][1] * SubFactor06 - m[0][2] * SubFactor07 + m[0][3] * SubFactor08);
99
+ Inverse[2][1] = - (m[0][0] * SubFactor06 - m[0][2] * SubFactor09 + m[0][3] * SubFactor10);
100
+ Inverse[2][2] = + (m[0][0] * SubFactor07 - m[0][1] * SubFactor09 + m[0][3] * SubFactor11);
101
+ Inverse[2][3] = - (m[0][0] * SubFactor08 - m[0][1] * SubFactor10 + m[0][2] * SubFactor11);
102
+
103
+ Inverse[3][0] = - (m[0][1] * SubFactor12 - m[0][2] * SubFactor13 + m[0][3] * SubFactor14);
104
+ Inverse[3][1] = + (m[0][0] * SubFactor12 - m[0][2] * SubFactor15 + m[0][3] * SubFactor16);
105
+ Inverse[3][2] = - (m[0][0] * SubFactor13 - m[0][1] * SubFactor15 + m[0][3] * SubFactor17);
106
+ Inverse[3][3] = + (m[0][0] * SubFactor14 - m[0][1] * SubFactor16 + m[0][2] * SubFactor17);
107
+
108
+ T Determinant =
109
+ + m[0][0] * Inverse[0][0]
110
+ + m[0][1] * Inverse[0][1]
111
+ + m[0][2] * Inverse[0][2]
112
+ + m[0][3] * Inverse[0][3];
113
+
114
+ Inverse /= Determinant;
115
+
116
+ return Inverse;
117
+ }
118
+ }//namespace glm
cuda_extensions/third_party/glm/glm/gtc/matrix_transform.hpp ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref gtc_matrix_transform
2
+ /// @file glm/gtc/matrix_transform.hpp
3
+ ///
4
+ /// @see core (dependence)
5
+ /// @see gtx_transform
6
+ /// @see gtx_transform2
7
+ ///
8
+ /// @defgroup gtc_matrix_transform GLM_GTC_matrix_transform
9
+ /// @ingroup gtc
10
+ ///
11
+ /// Include <glm/gtc/matrix_transform.hpp> to use the features of this extension.
12
+ ///
13
+ /// Defines functions that generate common transformation matrices.
14
+ ///
15
+ /// The matrices generated by this extension use standard OpenGL fixed-function
16
+ /// conventions. For example, the lookAt function generates a transform from world
17
+ /// space into the specific eye space that the projective matrix functions
18
+ /// (perspective, ortho, etc) are designed to expect. The OpenGL compatibility
19
+ /// specifications defines the particular layout of this eye space.
20
+
21
+ #pragma once
22
+
23
+ // Dependencies
24
+ #include "../mat4x4.hpp"
25
+ #include "../vec2.hpp"
26
+ #include "../vec3.hpp"
27
+ #include "../vec4.hpp"
28
+ #include "../ext/matrix_projection.hpp"
29
+ #include "../ext/matrix_clip_space.hpp"
30
+ #include "../ext/matrix_transform.hpp"
31
+
32
+ #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
33
+ # pragma message("GLM: GLM_GTC_matrix_transform extension included")
34
+ #endif
35
+
36
+ #include "matrix_transform.inl"
cuda_extensions/third_party/glm/glm/gtc/matrix_transform.inl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ #include "../geometric.hpp"
2
+ #include "../trigonometric.hpp"
3
+ #include "../matrix.hpp"
cuda_extensions/third_party/glm/glm/gtc/noise.hpp ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref gtc_noise
2
+ /// @file glm/gtc/noise.hpp
3
+ ///
4
+ /// @see core (dependence)
5
+ ///
6
+ /// @defgroup gtc_noise GLM_GTC_noise
7
+ /// @ingroup gtc
8
+ ///
9
+ /// Include <glm/gtc/noise.hpp> to use the features of this extension.
10
+ ///
11
+ /// Defines 2D, 3D and 4D procedural noise functions
12
+ /// Based on the work of Stefan Gustavson and Ashima Arts on "webgl-noise":
13
+ /// https://github.com/ashima/webgl-noise
14
+ /// Following Stefan Gustavson's paper "Simplex noise demystified":
15
+ /// http://www.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf
16
+
17
+ #pragma once
18
+
19
+ // Dependencies
20
+ #include "../detail/setup.hpp"
21
+ #include "../detail/qualifier.hpp"
22
+ #include "../detail/_noise.hpp"
23
+ #include "../geometric.hpp"
24
+ #include "../common.hpp"
25
+ #include "../vector_relational.hpp"
26
+ #include "../vec2.hpp"
27
+ #include "../vec3.hpp"
28
+ #include "../vec4.hpp"
29
+
30
+ #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
31
+ # pragma message("GLM: GLM_GTC_noise extension included")
32
+ #endif
33
+
34
+ namespace glm
35
+ {
36
+ /// @addtogroup gtc_noise
37
+ /// @{
38
+
39
+ /// Classic perlin noise.
40
+ /// @see gtc_noise
41
+ template<length_t L, typename T, qualifier Q>
42
+ GLM_FUNC_DECL T perlin(
43
+ vec<L, T, Q> const& p);
44
+
45
+ /// Periodic perlin noise.
46
+ /// @see gtc_noise
47
+ template<length_t L, typename T, qualifier Q>
48
+ GLM_FUNC_DECL T perlin(
49
+ vec<L, T, Q> const& p,
50
+ vec<L, T, Q> const& rep);
51
+
52
+ /// Simplex noise.
53
+ /// @see gtc_noise
54
+ template<length_t L, typename T, qualifier Q>
55
+ GLM_FUNC_DECL T simplex(
56
+ vec<L, T, Q> const& p);
57
+
58
+ /// @}
59
+ }//namespace glm
60
+
61
+ #include "noise.inl"
cuda_extensions/third_party/glm/glm/gtc/noise.inl ADDED
@@ -0,0 +1,807 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref gtc_noise
2
+ ///
3
+ // Based on the work of Stefan Gustavson and Ashima Arts on "webgl-noise":
4
+ // https://github.com/ashima/webgl-noise
5
+ // Following Stefan Gustavson's paper "Simplex noise demystified":
6
+ // http://www.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf
7
+
8
+ namespace glm{
9
+ namespace gtc
10
+ {
11
+ template<typename T, qualifier Q>
12
+ GLM_FUNC_QUALIFIER vec<4, T, Q> grad4(T const& j, vec<4, T, Q> const& ip)
13
+ {
14
+ vec<3, T, Q> pXYZ = floor(fract(vec<3, T, Q>(j) * vec<3, T, Q>(ip)) * T(7)) * ip[2] - T(1);
15
+ T pW = static_cast<T>(1.5) - dot(abs(pXYZ), vec<3, T, Q>(1));
16
+ vec<4, T, Q> s = vec<4, T, Q>(lessThan(vec<4, T, Q>(pXYZ, pW), vec<4, T, Q>(0.0)));
17
+ pXYZ = pXYZ + (vec<3, T, Q>(s) * T(2) - T(1)) * s.w;
18
+ return vec<4, T, Q>(pXYZ, pW);
19
+ }
20
+ }//namespace gtc
21
+
22
+ // Classic Perlin noise
23
+ template<typename T, qualifier Q>
24
+ GLM_FUNC_QUALIFIER T perlin(vec<2, T, Q> const& Position)
25
+ {
26
+ vec<4, T, Q> Pi = glm::floor(vec<4, T, Q>(Position.x, Position.y, Position.x, Position.y)) + vec<4, T, Q>(0.0, 0.0, 1.0, 1.0);
27
+ vec<4, T, Q> Pf = glm::fract(vec<4, T, Q>(Position.x, Position.y, Position.x, Position.y)) - vec<4, T, Q>(0.0, 0.0, 1.0, 1.0);
28
+ Pi = mod(Pi, vec<4, T, Q>(289)); // To avoid truncation effects in permutation
29
+ vec<4, T, Q> ix(Pi.x, Pi.z, Pi.x, Pi.z);
30
+ vec<4, T, Q> iy(Pi.y, Pi.y, Pi.w, Pi.w);
31
+ vec<4, T, Q> fx(Pf.x, Pf.z, Pf.x, Pf.z);
32
+ vec<4, T, Q> fy(Pf.y, Pf.y, Pf.w, Pf.w);
33
+
34
+ vec<4, T, Q> i = detail::permute(detail::permute(ix) + iy);
35
+
36
+ vec<4, T, Q> gx = static_cast<T>(2) * glm::fract(i / T(41)) - T(1);
37
+ vec<4, T, Q> gy = glm::abs(gx) - T(0.5);
38
+ vec<4, T, Q> tx = glm::floor(gx + T(0.5));
39
+ gx = gx - tx;
40
+
41
+ vec<2, T, Q> g00(gx.x, gy.x);
42
+ vec<2, T, Q> g10(gx.y, gy.y);
43
+ vec<2, T, Q> g01(gx.z, gy.z);
44
+ vec<2, T, Q> g11(gx.w, gy.w);
45
+
46
+ vec<4, T, Q> norm = detail::taylorInvSqrt(vec<4, T, Q>(dot(g00, g00), dot(g01, g01), dot(g10, g10), dot(g11, g11)));
47
+ g00 *= norm.x;
48
+ g01 *= norm.y;
49
+ g10 *= norm.z;
50
+ g11 *= norm.w;
51
+
52
+ T n00 = dot(g00, vec<2, T, Q>(fx.x, fy.x));
53
+ T n10 = dot(g10, vec<2, T, Q>(fx.y, fy.y));
54
+ T n01 = dot(g01, vec<2, T, Q>(fx.z, fy.z));
55
+ T n11 = dot(g11, vec<2, T, Q>(fx.w, fy.w));
56
+
57
+ vec<2, T, Q> fade_xy = detail::fade(vec<2, T, Q>(Pf.x, Pf.y));
58
+ vec<2, T, Q> n_x = mix(vec<2, T, Q>(n00, n01), vec<2, T, Q>(n10, n11), fade_xy.x);
59
+ T n_xy = mix(n_x.x, n_x.y, fade_xy.y);
60
+ return T(2.3) * n_xy;
61
+ }
62
+
63
+ // Classic Perlin noise
64
+ template<typename T, qualifier Q>
65
+ GLM_FUNC_QUALIFIER T perlin(vec<3, T, Q> const& Position)
66
+ {
67
+ vec<3, T, Q> Pi0 = floor(Position); // Integer part for indexing
68
+ vec<3, T, Q> Pi1 = Pi0 + T(1); // Integer part + 1
69
+ Pi0 = detail::mod289(Pi0);
70
+ Pi1 = detail::mod289(Pi1);
71
+ vec<3, T, Q> Pf0 = fract(Position); // Fractional part for interpolation
72
+ vec<3, T, Q> Pf1 = Pf0 - T(1); // Fractional part - 1.0
73
+ vec<4, T, Q> ix(Pi0.x, Pi1.x, Pi0.x, Pi1.x);
74
+ vec<4, T, Q> iy = vec<4, T, Q>(vec<2, T, Q>(Pi0.y), vec<2, T, Q>(Pi1.y));
75
+ vec<4, T, Q> iz0(Pi0.z);
76
+ vec<4, T, Q> iz1(Pi1.z);
77
+
78
+ vec<4, T, Q> ixy = detail::permute(detail::permute(ix) + iy);
79
+ vec<4, T, Q> ixy0 = detail::permute(ixy + iz0);
80
+ vec<4, T, Q> ixy1 = detail::permute(ixy + iz1);
81
+
82
+ vec<4, T, Q> gx0 = ixy0 * T(1.0 / 7.0);
83
+ vec<4, T, Q> gy0 = fract(floor(gx0) * T(1.0 / 7.0)) - T(0.5);
84
+ gx0 = fract(gx0);
85
+ vec<4, T, Q> gz0 = vec<4, T, Q>(0.5) - abs(gx0) - abs(gy0);
86
+ vec<4, T, Q> sz0 = step(gz0, vec<4, T, Q>(0.0));
87
+ gx0 -= sz0 * (step(T(0), gx0) - T(0.5));
88
+ gy0 -= sz0 * (step(T(0), gy0) - T(0.5));
89
+
90
+ vec<4, T, Q> gx1 = ixy1 * T(1.0 / 7.0);
91
+ vec<4, T, Q> gy1 = fract(floor(gx1) * T(1.0 / 7.0)) - T(0.5);
92
+ gx1 = fract(gx1);
93
+ vec<4, T, Q> gz1 = vec<4, T, Q>(0.5) - abs(gx1) - abs(gy1);
94
+ vec<4, T, Q> sz1 = step(gz1, vec<4, T, Q>(0.0));
95
+ gx1 -= sz1 * (step(T(0), gx1) - T(0.5));
96
+ gy1 -= sz1 * (step(T(0), gy1) - T(0.5));
97
+
98
+ vec<3, T, Q> g000(gx0.x, gy0.x, gz0.x);
99
+ vec<3, T, Q> g100(gx0.y, gy0.y, gz0.y);
100
+ vec<3, T, Q> g010(gx0.z, gy0.z, gz0.z);
101
+ vec<3, T, Q> g110(gx0.w, gy0.w, gz0.w);
102
+ vec<3, T, Q> g001(gx1.x, gy1.x, gz1.x);
103
+ vec<3, T, Q> g101(gx1.y, gy1.y, gz1.y);
104
+ vec<3, T, Q> g011(gx1.z, gy1.z, gz1.z);
105
+ vec<3, T, Q> g111(gx1.w, gy1.w, gz1.w);
106
+
107
+ vec<4, T, Q> norm0 = detail::taylorInvSqrt(vec<4, T, Q>(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));
108
+ g000 *= norm0.x;
109
+ g010 *= norm0.y;
110
+ g100 *= norm0.z;
111
+ g110 *= norm0.w;
112
+ vec<4, T, Q> norm1 = detail::taylorInvSqrt(vec<4, T, Q>(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));
113
+ g001 *= norm1.x;
114
+ g011 *= norm1.y;
115
+ g101 *= norm1.z;
116
+ g111 *= norm1.w;
117
+
118
+ T n000 = dot(g000, Pf0);
119
+ T n100 = dot(g100, vec<3, T, Q>(Pf1.x, Pf0.y, Pf0.z));
120
+ T n010 = dot(g010, vec<3, T, Q>(Pf0.x, Pf1.y, Pf0.z));
121
+ T n110 = dot(g110, vec<3, T, Q>(Pf1.x, Pf1.y, Pf0.z));
122
+ T n001 = dot(g001, vec<3, T, Q>(Pf0.x, Pf0.y, Pf1.z));
123
+ T n101 = dot(g101, vec<3, T, Q>(Pf1.x, Pf0.y, Pf1.z));
124
+ T n011 = dot(g011, vec<3, T, Q>(Pf0.x, Pf1.y, Pf1.z));
125
+ T n111 = dot(g111, Pf1);
126
+
127
+ vec<3, T, Q> fade_xyz = detail::fade(Pf0);
128
+ vec<4, T, Q> n_z = mix(vec<4, T, Q>(n000, n100, n010, n110), vec<4, T, Q>(n001, n101, n011, n111), fade_xyz.z);
129
+ vec<2, T, Q> n_yz = mix(vec<2, T, Q>(n_z.x, n_z.y), vec<2, T, Q>(n_z.z, n_z.w), fade_xyz.y);
130
+ T n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);
131
+ return T(2.2) * n_xyz;
132
+ }
133
+ /*
134
+ // Classic Perlin noise
135
+ template<typename T, qualifier Q>
136
+ GLM_FUNC_QUALIFIER T perlin(vec<3, T, Q> const& P)
137
+ {
138
+ vec<3, T, Q> Pi0 = floor(P); // Integer part for indexing
139
+ vec<3, T, Q> Pi1 = Pi0 + T(1); // Integer part + 1
140
+ Pi0 = mod(Pi0, T(289));
141
+ Pi1 = mod(Pi1, T(289));
142
+ vec<3, T, Q> Pf0 = fract(P); // Fractional part for interpolation
143
+ vec<3, T, Q> Pf1 = Pf0 - T(1); // Fractional part - 1.0
144
+ vec<4, T, Q> ix(Pi0.x, Pi1.x, Pi0.x, Pi1.x);
145
+ vec<4, T, Q> iy(Pi0.y, Pi0.y, Pi1.y, Pi1.y);
146
+ vec<4, T, Q> iz0(Pi0.z);
147
+ vec<4, T, Q> iz1(Pi1.z);
148
+
149
+ vec<4, T, Q> ixy = permute(permute(ix) + iy);
150
+ vec<4, T, Q> ixy0 = permute(ixy + iz0);
151
+ vec<4, T, Q> ixy1 = permute(ixy + iz1);
152
+
153
+ vec<4, T, Q> gx0 = ixy0 / T(7);
154
+ vec<4, T, Q> gy0 = fract(floor(gx0) / T(7)) - T(0.5);
155
+ gx0 = fract(gx0);
156
+ vec<4, T, Q> gz0 = vec<4, T, Q>(0.5) - abs(gx0) - abs(gy0);
157
+ vec<4, T, Q> sz0 = step(gz0, vec<4, T, Q>(0.0));
158
+ gx0 -= sz0 * (step(0.0, gx0) - T(0.5));
159
+ gy0 -= sz0 * (step(0.0, gy0) - T(0.5));
160
+
161
+ vec<4, T, Q> gx1 = ixy1 / T(7);
162
+ vec<4, T, Q> gy1 = fract(floor(gx1) / T(7)) - T(0.5);
163
+ gx1 = fract(gx1);
164
+ vec<4, T, Q> gz1 = vec<4, T, Q>(0.5) - abs(gx1) - abs(gy1);
165
+ vec<4, T, Q> sz1 = step(gz1, vec<4, T, Q>(0.0));
166
+ gx1 -= sz1 * (step(T(0), gx1) - T(0.5));
167
+ gy1 -= sz1 * (step(T(0), gy1) - T(0.5));
168
+
169
+ vec<3, T, Q> g000(gx0.x, gy0.x, gz0.x);
170
+ vec<3, T, Q> g100(gx0.y, gy0.y, gz0.y);
171
+ vec<3, T, Q> g010(gx0.z, gy0.z, gz0.z);
172
+ vec<3, T, Q> g110(gx0.w, gy0.w, gz0.w);
173
+ vec<3, T, Q> g001(gx1.x, gy1.x, gz1.x);
174
+ vec<3, T, Q> g101(gx1.y, gy1.y, gz1.y);
175
+ vec<3, T, Q> g011(gx1.z, gy1.z, gz1.z);
176
+ vec<3, T, Q> g111(gx1.w, gy1.w, gz1.w);
177
+
178
+ vec<4, T, Q> norm0 = taylorInvSqrt(vec<4, T, Q>(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));
179
+ g000 *= norm0.x;
180
+ g010 *= norm0.y;
181
+ g100 *= norm0.z;
182
+ g110 *= norm0.w;
183
+ vec<4, T, Q> norm1 = taylorInvSqrt(vec<4, T, Q>(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));
184
+ g001 *= norm1.x;
185
+ g011 *= norm1.y;
186
+ g101 *= norm1.z;
187
+ g111 *= norm1.w;
188
+
189
+ T n000 = dot(g000, Pf0);
190
+ T n100 = dot(g100, vec<3, T, Q>(Pf1.x, Pf0.y, Pf0.z));
191
+ T n010 = dot(g010, vec<3, T, Q>(Pf0.x, Pf1.y, Pf0.z));
192
+ T n110 = dot(g110, vec<3, T, Q>(Pf1.x, Pf1.y, Pf0.z));
193
+ T n001 = dot(g001, vec<3, T, Q>(Pf0.x, Pf0.y, Pf1.z));
194
+ T n101 = dot(g101, vec<3, T, Q>(Pf1.x, Pf0.y, Pf1.z));
195
+ T n011 = dot(g011, vec<3, T, Q>(Pf0.x, Pf1.y, Pf1.z));
196
+ T n111 = dot(g111, Pf1);
197
+
198
+ vec<3, T, Q> fade_xyz = fade(Pf0);
199
+ vec<4, T, Q> n_z = mix(vec<4, T, Q>(n000, n100, n010, n110), vec<4, T, Q>(n001, n101, n011, n111), fade_xyz.z);
200
+ vec<2, T, Q> n_yz = mix(
201
+ vec<2, T, Q>(n_z.x, n_z.y),
202
+ vec<2, T, Q>(n_z.z, n_z.w), fade_xyz.y);
203
+ T n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);
204
+ return T(2.2) * n_xyz;
205
+ }
206
+ */
207
+ // Classic Perlin noise
208
+ template<typename T, qualifier Q>
209
+ GLM_FUNC_QUALIFIER T perlin(vec<4, T, Q> const& Position)
210
+ {
211
+ vec<4, T, Q> Pi0 = floor(Position); // Integer part for indexing
212
+ vec<4, T, Q> Pi1 = Pi0 + T(1); // Integer part + 1
213
+ Pi0 = mod(Pi0, vec<4, T, Q>(289));
214
+ Pi1 = mod(Pi1, vec<4, T, Q>(289));
215
+ vec<4, T, Q> Pf0 = fract(Position); // Fractional part for interpolation
216
+ vec<4, T, Q> Pf1 = Pf0 - T(1); // Fractional part - 1.0
217
+ vec<4, T, Q> ix(Pi0.x, Pi1.x, Pi0.x, Pi1.x);
218
+ vec<4, T, Q> iy(Pi0.y, Pi0.y, Pi1.y, Pi1.y);
219
+ vec<4, T, Q> iz0(Pi0.z);
220
+ vec<4, T, Q> iz1(Pi1.z);
221
+ vec<4, T, Q> iw0(Pi0.w);
222
+ vec<4, T, Q> iw1(Pi1.w);
223
+
224
+ vec<4, T, Q> ixy = detail::permute(detail::permute(ix) + iy);
225
+ vec<4, T, Q> ixy0 = detail::permute(ixy + iz0);
226
+ vec<4, T, Q> ixy1 = detail::permute(ixy + iz1);
227
+ vec<4, T, Q> ixy00 = detail::permute(ixy0 + iw0);
228
+ vec<4, T, Q> ixy01 = detail::permute(ixy0 + iw1);
229
+ vec<4, T, Q> ixy10 = detail::permute(ixy1 + iw0);
230
+ vec<4, T, Q> ixy11 = detail::permute(ixy1 + iw1);
231
+
232
+ vec<4, T, Q> gx00 = ixy00 / T(7);
233
+ vec<4, T, Q> gy00 = floor(gx00) / T(7);
234
+ vec<4, T, Q> gz00 = floor(gy00) / T(6);
235
+ gx00 = fract(gx00) - T(0.5);
236
+ gy00 = fract(gy00) - T(0.5);
237
+ gz00 = fract(gz00) - T(0.5);
238
+ vec<4, T, Q> gw00 = vec<4, T, Q>(0.75) - abs(gx00) - abs(gy00) - abs(gz00);
239
+ vec<4, T, Q> sw00 = step(gw00, vec<4, T, Q>(0.0));
240
+ gx00 -= sw00 * (step(T(0), gx00) - T(0.5));
241
+ gy00 -= sw00 * (step(T(0), gy00) - T(0.5));
242
+
243
+ vec<4, T, Q> gx01 = ixy01 / T(7);
244
+ vec<4, T, Q> gy01 = floor(gx01) / T(7);
245
+ vec<4, T, Q> gz01 = floor(gy01) / T(6);
246
+ gx01 = fract(gx01) - T(0.5);
247
+ gy01 = fract(gy01) - T(0.5);
248
+ gz01 = fract(gz01) - T(0.5);
249
+ vec<4, T, Q> gw01 = vec<4, T, Q>(0.75) - abs(gx01) - abs(gy01) - abs(gz01);
250
+ vec<4, T, Q> sw01 = step(gw01, vec<4, T, Q>(0.0));
251
+ gx01 -= sw01 * (step(T(0), gx01) - T(0.5));
252
+ gy01 -= sw01 * (step(T(0), gy01) - T(0.5));
253
+
254
+ vec<4, T, Q> gx10 = ixy10 / T(7);
255
+ vec<4, T, Q> gy10 = floor(gx10) / T(7);
256
+ vec<4, T, Q> gz10 = floor(gy10) / T(6);
257
+ gx10 = fract(gx10) - T(0.5);
258
+ gy10 = fract(gy10) - T(0.5);
259
+ gz10 = fract(gz10) - T(0.5);
260
+ vec<4, T, Q> gw10 = vec<4, T, Q>(0.75) - abs(gx10) - abs(gy10) - abs(gz10);
261
+ vec<4, T, Q> sw10 = step(gw10, vec<4, T, Q>(0));
262
+ gx10 -= sw10 * (step(T(0), gx10) - T(0.5));
263
+ gy10 -= sw10 * (step(T(0), gy10) - T(0.5));
264
+
265
+ vec<4, T, Q> gx11 = ixy11 / T(7);
266
+ vec<4, T, Q> gy11 = floor(gx11) / T(7);
267
+ vec<4, T, Q> gz11 = floor(gy11) / T(6);
268
+ gx11 = fract(gx11) - T(0.5);
269
+ gy11 = fract(gy11) - T(0.5);
270
+ gz11 = fract(gz11) - T(0.5);
271
+ vec<4, T, Q> gw11 = vec<4, T, Q>(0.75) - abs(gx11) - abs(gy11) - abs(gz11);
272
+ vec<4, T, Q> sw11 = step(gw11, vec<4, T, Q>(0.0));
273
+ gx11 -= sw11 * (step(T(0), gx11) - T(0.5));
274
+ gy11 -= sw11 * (step(T(0), gy11) - T(0.5));
275
+
276
+ vec<4, T, Q> g0000(gx00.x, gy00.x, gz00.x, gw00.x);
277
+ vec<4, T, Q> g1000(gx00.y, gy00.y, gz00.y, gw00.y);
278
+ vec<4, T, Q> g0100(gx00.z, gy00.z, gz00.z, gw00.z);
279
+ vec<4, T, Q> g1100(gx00.w, gy00.w, gz00.w, gw00.w);
280
+ vec<4, T, Q> g0010(gx10.x, gy10.x, gz10.x, gw10.x);
281
+ vec<4, T, Q> g1010(gx10.y, gy10.y, gz10.y, gw10.y);
282
+ vec<4, T, Q> g0110(gx10.z, gy10.z, gz10.z, gw10.z);
283
+ vec<4, T, Q> g1110(gx10.w, gy10.w, gz10.w, gw10.w);
284
+ vec<4, T, Q> g0001(gx01.x, gy01.x, gz01.x, gw01.x);
285
+ vec<4, T, Q> g1001(gx01.y, gy01.y, gz01.y, gw01.y);
286
+ vec<4, T, Q> g0101(gx01.z, gy01.z, gz01.z, gw01.z);
287
+ vec<4, T, Q> g1101(gx01.w, gy01.w, gz01.w, gw01.w);
288
+ vec<4, T, Q> g0011(gx11.x, gy11.x, gz11.x, gw11.x);
289
+ vec<4, T, Q> g1011(gx11.y, gy11.y, gz11.y, gw11.y);
290
+ vec<4, T, Q> g0111(gx11.z, gy11.z, gz11.z, gw11.z);
291
+ vec<4, T, Q> g1111(gx11.w, gy11.w, gz11.w, gw11.w);
292
+
293
+ vec<4, T, Q> norm00 = detail::taylorInvSqrt(vec<4, T, Q>(dot(g0000, g0000), dot(g0100, g0100), dot(g1000, g1000), dot(g1100, g1100)));
294
+ g0000 *= norm00.x;
295
+ g0100 *= norm00.y;
296
+ g1000 *= norm00.z;
297
+ g1100 *= norm00.w;
298
+
299
+ vec<4, T, Q> norm01 = detail::taylorInvSqrt(vec<4, T, Q>(dot(g0001, g0001), dot(g0101, g0101), dot(g1001, g1001), dot(g1101, g1101)));
300
+ g0001 *= norm01.x;
301
+ g0101 *= norm01.y;
302
+ g1001 *= norm01.z;
303
+ g1101 *= norm01.w;
304
+
305
+ vec<4, T, Q> norm10 = detail::taylorInvSqrt(vec<4, T, Q>(dot(g0010, g0010), dot(g0110, g0110), dot(g1010, g1010), dot(g1110, g1110)));
306
+ g0010 *= norm10.x;
307
+ g0110 *= norm10.y;
308
+ g1010 *= norm10.z;
309
+ g1110 *= norm10.w;
310
+
311
+ vec<4, T, Q> norm11 = detail::taylorInvSqrt(vec<4, T, Q>(dot(g0011, g0011), dot(g0111, g0111), dot(g1011, g1011), dot(g1111, g1111)));
312
+ g0011 *= norm11.x;
313
+ g0111 *= norm11.y;
314
+ g1011 *= norm11.z;
315
+ g1111 *= norm11.w;
316
+
317
+ T n0000 = dot(g0000, Pf0);
318
+ T n1000 = dot(g1000, vec<4, T, Q>(Pf1.x, Pf0.y, Pf0.z, Pf0.w));
319
+ T n0100 = dot(g0100, vec<4, T, Q>(Pf0.x, Pf1.y, Pf0.z, Pf0.w));
320
+ T n1100 = dot(g1100, vec<4, T, Q>(Pf1.x, Pf1.y, Pf0.z, Pf0.w));
321
+ T n0010 = dot(g0010, vec<4, T, Q>(Pf0.x, Pf0.y, Pf1.z, Pf0.w));
322
+ T n1010 = dot(g1010, vec<4, T, Q>(Pf1.x, Pf0.y, Pf1.z, Pf0.w));
323
+ T n0110 = dot(g0110, vec<4, T, Q>(Pf0.x, Pf1.y, Pf1.z, Pf0.w));
324
+ T n1110 = dot(g1110, vec<4, T, Q>(Pf1.x, Pf1.y, Pf1.z, Pf0.w));
325
+ T n0001 = dot(g0001, vec<4, T, Q>(Pf0.x, Pf0.y, Pf0.z, Pf1.w));
326
+ T n1001 = dot(g1001, vec<4, T, Q>(Pf1.x, Pf0.y, Pf0.z, Pf1.w));
327
+ T n0101 = dot(g0101, vec<4, T, Q>(Pf0.x, Pf1.y, Pf0.z, Pf1.w));
328
+ T n1101 = dot(g1101, vec<4, T, Q>(Pf1.x, Pf1.y, Pf0.z, Pf1.w));
329
+ T n0011 = dot(g0011, vec<4, T, Q>(Pf0.x, Pf0.y, Pf1.z, Pf1.w));
330
+ T n1011 = dot(g1011, vec<4, T, Q>(Pf1.x, Pf0.y, Pf1.z, Pf1.w));
331
+ T n0111 = dot(g0111, vec<4, T, Q>(Pf0.x, Pf1.y, Pf1.z, Pf1.w));
332
+ T n1111 = dot(g1111, Pf1);
333
+
334
+ vec<4, T, Q> fade_xyzw = detail::fade(Pf0);
335
+ vec<4, T, Q> n_0w = mix(vec<4, T, Q>(n0000, n1000, n0100, n1100), vec<4, T, Q>(n0001, n1001, n0101, n1101), fade_xyzw.w);
336
+ vec<4, T, Q> n_1w = mix(vec<4, T, Q>(n0010, n1010, n0110, n1110), vec<4, T, Q>(n0011, n1011, n0111, n1111), fade_xyzw.w);
337
+ vec<4, T, Q> n_zw = mix(n_0w, n_1w, fade_xyzw.z);
338
+ vec<2, T, Q> n_yzw = mix(vec<2, T, Q>(n_zw.x, n_zw.y), vec<2, T, Q>(n_zw.z, n_zw.w), fade_xyzw.y);
339
+ T n_xyzw = mix(n_yzw.x, n_yzw.y, fade_xyzw.x);
340
+ return T(2.2) * n_xyzw;
341
+ }
342
+
343
+ // Classic Perlin noise, periodic variant
344
+ template<typename T, qualifier Q>
345
+ GLM_FUNC_QUALIFIER T perlin(vec<2, T, Q> const& Position, vec<2, T, Q> const& rep)
346
+ {
347
+ vec<4, T, Q> Pi = floor(vec<4, T, Q>(Position.x, Position.y, Position.x, Position.y)) + vec<4, T, Q>(0.0, 0.0, 1.0, 1.0);
348
+ vec<4, T, Q> Pf = fract(vec<4, T, Q>(Position.x, Position.y, Position.x, Position.y)) - vec<4, T, Q>(0.0, 0.0, 1.0, 1.0);
349
+ Pi = mod(Pi, vec<4, T, Q>(rep.x, rep.y, rep.x, rep.y)); // To create noise with explicit period
350
+ Pi = mod(Pi, vec<4, T, Q>(289)); // To avoid truncation effects in permutation
351
+ vec<4, T, Q> ix(Pi.x, Pi.z, Pi.x, Pi.z);
352
+ vec<4, T, Q> iy(Pi.y, Pi.y, Pi.w, Pi.w);
353
+ vec<4, T, Q> fx(Pf.x, Pf.z, Pf.x, Pf.z);
354
+ vec<4, T, Q> fy(Pf.y, Pf.y, Pf.w, Pf.w);
355
+
356
+ vec<4, T, Q> i = detail::permute(detail::permute(ix) + iy);
357
+
358
+ vec<4, T, Q> gx = static_cast<T>(2) * fract(i / T(41)) - T(1);
359
+ vec<4, T, Q> gy = abs(gx) - T(0.5);
360
+ vec<4, T, Q> tx = floor(gx + T(0.5));
361
+ gx = gx - tx;
362
+
363
+ vec<2, T, Q> g00(gx.x, gy.x);
364
+ vec<2, T, Q> g10(gx.y, gy.y);
365
+ vec<2, T, Q> g01(gx.z, gy.z);
366
+ vec<2, T, Q> g11(gx.w, gy.w);
367
+
368
+ vec<4, T, Q> norm = detail::taylorInvSqrt(vec<4, T, Q>(dot(g00, g00), dot(g01, g01), dot(g10, g10), dot(g11, g11)));
369
+ g00 *= norm.x;
370
+ g01 *= norm.y;
371
+ g10 *= norm.z;
372
+ g11 *= norm.w;
373
+
374
+ T n00 = dot(g00, vec<2, T, Q>(fx.x, fy.x));
375
+ T n10 = dot(g10, vec<2, T, Q>(fx.y, fy.y));
376
+ T n01 = dot(g01, vec<2, T, Q>(fx.z, fy.z));
377
+ T n11 = dot(g11, vec<2, T, Q>(fx.w, fy.w));
378
+
379
+ vec<2, T, Q> fade_xy = detail::fade(vec<2, T, Q>(Pf.x, Pf.y));
380
+ vec<2, T, Q> n_x = mix(vec<2, T, Q>(n00, n01), vec<2, T, Q>(n10, n11), fade_xy.x);
381
+ T n_xy = mix(n_x.x, n_x.y, fade_xy.y);
382
+ return T(2.3) * n_xy;
383
+ }
384
+
385
+ // Classic Perlin noise, periodic variant
386
+ template<typename T, qualifier Q>
387
+ GLM_FUNC_QUALIFIER T perlin(vec<3, T, Q> const& Position, vec<3, T, Q> const& rep)
388
+ {
389
+ vec<3, T, Q> Pi0 = mod(floor(Position), rep); // Integer part, modulo period
390
+ vec<3, T, Q> Pi1 = mod(Pi0 + vec<3, T, Q>(T(1)), rep); // Integer part + 1, mod period
391
+ Pi0 = mod(Pi0, vec<3, T, Q>(289));
392
+ Pi1 = mod(Pi1, vec<3, T, Q>(289));
393
+ vec<3, T, Q> Pf0 = fract(Position); // Fractional part for interpolation
394
+ vec<3, T, Q> Pf1 = Pf0 - vec<3, T, Q>(T(1)); // Fractional part - 1.0
395
+ vec<4, T, Q> ix = vec<4, T, Q>(Pi0.x, Pi1.x, Pi0.x, Pi1.x);
396
+ vec<4, T, Q> iy = vec<4, T, Q>(Pi0.y, Pi0.y, Pi1.y, Pi1.y);
397
+ vec<4, T, Q> iz0(Pi0.z);
398
+ vec<4, T, Q> iz1(Pi1.z);
399
+
400
+ vec<4, T, Q> ixy = detail::permute(detail::permute(ix) + iy);
401
+ vec<4, T, Q> ixy0 = detail::permute(ixy + iz0);
402
+ vec<4, T, Q> ixy1 = detail::permute(ixy + iz1);
403
+
404
+ vec<4, T, Q> gx0 = ixy0 / T(7);
405
+ vec<4, T, Q> gy0 = fract(floor(gx0) / T(7)) - T(0.5);
406
+ gx0 = fract(gx0);
407
+ vec<4, T, Q> gz0 = vec<4, T, Q>(0.5) - abs(gx0) - abs(gy0);
408
+ vec<4, T, Q> sz0 = step(gz0, vec<4, T, Q>(0));
409
+ gx0 -= sz0 * (step(T(0), gx0) - T(0.5));
410
+ gy0 -= sz0 * (step(T(0), gy0) - T(0.5));
411
+
412
+ vec<4, T, Q> gx1 = ixy1 / T(7);
413
+ vec<4, T, Q> gy1 = fract(floor(gx1) / T(7)) - T(0.5);
414
+ gx1 = fract(gx1);
415
+ vec<4, T, Q> gz1 = vec<4, T, Q>(0.5) - abs(gx1) - abs(gy1);
416
+ vec<4, T, Q> sz1 = step(gz1, vec<4, T, Q>(T(0)));
417
+ gx1 -= sz1 * (step(T(0), gx1) - T(0.5));
418
+ gy1 -= sz1 * (step(T(0), gy1) - T(0.5));
419
+
420
+ vec<3, T, Q> g000 = vec<3, T, Q>(gx0.x, gy0.x, gz0.x);
421
+ vec<3, T, Q> g100 = vec<3, T, Q>(gx0.y, gy0.y, gz0.y);
422
+ vec<3, T, Q> g010 = vec<3, T, Q>(gx0.z, gy0.z, gz0.z);
423
+ vec<3, T, Q> g110 = vec<3, T, Q>(gx0.w, gy0.w, gz0.w);
424
+ vec<3, T, Q> g001 = vec<3, T, Q>(gx1.x, gy1.x, gz1.x);
425
+ vec<3, T, Q> g101 = vec<3, T, Q>(gx1.y, gy1.y, gz1.y);
426
+ vec<3, T, Q> g011 = vec<3, T, Q>(gx1.z, gy1.z, gz1.z);
427
+ vec<3, T, Q> g111 = vec<3, T, Q>(gx1.w, gy1.w, gz1.w);
428
+
429
+ vec<4, T, Q> norm0 = detail::taylorInvSqrt(vec<4, T, Q>(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));
430
+ g000 *= norm0.x;
431
+ g010 *= norm0.y;
432
+ g100 *= norm0.z;
433
+ g110 *= norm0.w;
434
+ vec<4, T, Q> norm1 = detail::taylorInvSqrt(vec<4, T, Q>(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));
435
+ g001 *= norm1.x;
436
+ g011 *= norm1.y;
437
+ g101 *= norm1.z;
438
+ g111 *= norm1.w;
439
+
440
+ T n000 = dot(g000, Pf0);
441
+ T n100 = dot(g100, vec<3, T, Q>(Pf1.x, Pf0.y, Pf0.z));
442
+ T n010 = dot(g010, vec<3, T, Q>(Pf0.x, Pf1.y, Pf0.z));
443
+ T n110 = dot(g110, vec<3, T, Q>(Pf1.x, Pf1.y, Pf0.z));
444
+ T n001 = dot(g001, vec<3, T, Q>(Pf0.x, Pf0.y, Pf1.z));
445
+ T n101 = dot(g101, vec<3, T, Q>(Pf1.x, Pf0.y, Pf1.z));
446
+ T n011 = dot(g011, vec<3, T, Q>(Pf0.x, Pf1.y, Pf1.z));
447
+ T n111 = dot(g111, Pf1);
448
+
449
+ vec<3, T, Q> fade_xyz = detail::fade(Pf0);
450
+ vec<4, T, Q> n_z = mix(vec<4, T, Q>(n000, n100, n010, n110), vec<4, T, Q>(n001, n101, n011, n111), fade_xyz.z);
451
+ vec<2, T, Q> n_yz = mix(vec<2, T, Q>(n_z.x, n_z.y), vec<2, T, Q>(n_z.z, n_z.w), fade_xyz.y);
452
+ T n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);
453
+ return T(2.2) * n_xyz;
454
+ }
455
+
456
+ // Classic Perlin noise, periodic version
457
+ template<typename T, qualifier Q>
458
+ GLM_FUNC_QUALIFIER T perlin(vec<4, T, Q> const& Position, vec<4, T, Q> const& rep)
459
+ {
460
+ vec<4, T, Q> Pi0 = mod(floor(Position), rep); // Integer part modulo rep
461
+ vec<4, T, Q> Pi1 = mod(Pi0 + T(1), rep); // Integer part + 1 mod rep
462
+ vec<4, T, Q> Pf0 = fract(Position); // Fractional part for interpolation
463
+ vec<4, T, Q> Pf1 = Pf0 - T(1); // Fractional part - 1.0
464
+ vec<4, T, Q> ix = vec<4, T, Q>(Pi0.x, Pi1.x, Pi0.x, Pi1.x);
465
+ vec<4, T, Q> iy = vec<4, T, Q>(Pi0.y, Pi0.y, Pi1.y, Pi1.y);
466
+ vec<4, T, Q> iz0(Pi0.z);
467
+ vec<4, T, Q> iz1(Pi1.z);
468
+ vec<4, T, Q> iw0(Pi0.w);
469
+ vec<4, T, Q> iw1(Pi1.w);
470
+
471
+ vec<4, T, Q> ixy = detail::permute(detail::permute(ix) + iy);
472
+ vec<4, T, Q> ixy0 = detail::permute(ixy + iz0);
473
+ vec<4, T, Q> ixy1 = detail::permute(ixy + iz1);
474
+ vec<4, T, Q> ixy00 = detail::permute(ixy0 + iw0);
475
+ vec<4, T, Q> ixy01 = detail::permute(ixy0 + iw1);
476
+ vec<4, T, Q> ixy10 = detail::permute(ixy1 + iw0);
477
+ vec<4, T, Q> ixy11 = detail::permute(ixy1 + iw1);
478
+
479
+ vec<4, T, Q> gx00 = ixy00 / T(7);
480
+ vec<4, T, Q> gy00 = floor(gx00) / T(7);
481
+ vec<4, T, Q> gz00 = floor(gy00) / T(6);
482
+ gx00 = fract(gx00) - T(0.5);
483
+ gy00 = fract(gy00) - T(0.5);
484
+ gz00 = fract(gz00) - T(0.5);
485
+ vec<4, T, Q> gw00 = vec<4, T, Q>(0.75) - abs(gx00) - abs(gy00) - abs(gz00);
486
+ vec<4, T, Q> sw00 = step(gw00, vec<4, T, Q>(0));
487
+ gx00 -= sw00 * (step(T(0), gx00) - T(0.5));
488
+ gy00 -= sw00 * (step(T(0), gy00) - T(0.5));
489
+
490
+ vec<4, T, Q> gx01 = ixy01 / T(7);
491
+ vec<4, T, Q> gy01 = floor(gx01) / T(7);
492
+ vec<4, T, Q> gz01 = floor(gy01) / T(6);
493
+ gx01 = fract(gx01) - T(0.5);
494
+ gy01 = fract(gy01) - T(0.5);
495
+ gz01 = fract(gz01) - T(0.5);
496
+ vec<4, T, Q> gw01 = vec<4, T, Q>(0.75) - abs(gx01) - abs(gy01) - abs(gz01);
497
+ vec<4, T, Q> sw01 = step(gw01, vec<4, T, Q>(0.0));
498
+ gx01 -= sw01 * (step(T(0), gx01) - T(0.5));
499
+ gy01 -= sw01 * (step(T(0), gy01) - T(0.5));
500
+
501
+ vec<4, T, Q> gx10 = ixy10 / T(7);
502
+ vec<4, T, Q> gy10 = floor(gx10) / T(7);
503
+ vec<4, T, Q> gz10 = floor(gy10) / T(6);
504
+ gx10 = fract(gx10) - T(0.5);
505
+ gy10 = fract(gy10) - T(0.5);
506
+ gz10 = fract(gz10) - T(0.5);
507
+ vec<4, T, Q> gw10 = vec<4, T, Q>(0.75) - abs(gx10) - abs(gy10) - abs(gz10);
508
+ vec<4, T, Q> sw10 = step(gw10, vec<4, T, Q>(0.0));
509
+ gx10 -= sw10 * (step(T(0), gx10) - T(0.5));
510
+ gy10 -= sw10 * (step(T(0), gy10) - T(0.5));
511
+
512
+ vec<4, T, Q> gx11 = ixy11 / T(7);
513
+ vec<4, T, Q> gy11 = floor(gx11) / T(7);
514
+ vec<4, T, Q> gz11 = floor(gy11) / T(6);
515
+ gx11 = fract(gx11) - T(0.5);
516
+ gy11 = fract(gy11) - T(0.5);
517
+ gz11 = fract(gz11) - T(0.5);
518
+ vec<4, T, Q> gw11 = vec<4, T, Q>(0.75) - abs(gx11) - abs(gy11) - abs(gz11);
519
+ vec<4, T, Q> sw11 = step(gw11, vec<4, T, Q>(T(0)));
520
+ gx11 -= sw11 * (step(T(0), gx11) - T(0.5));
521
+ gy11 -= sw11 * (step(T(0), gy11) - T(0.5));
522
+
523
+ vec<4, T, Q> g0000(gx00.x, gy00.x, gz00.x, gw00.x);
524
+ vec<4, T, Q> g1000(gx00.y, gy00.y, gz00.y, gw00.y);
525
+ vec<4, T, Q> g0100(gx00.z, gy00.z, gz00.z, gw00.z);
526
+ vec<4, T, Q> g1100(gx00.w, gy00.w, gz00.w, gw00.w);
527
+ vec<4, T, Q> g0010(gx10.x, gy10.x, gz10.x, gw10.x);
528
+ vec<4, T, Q> g1010(gx10.y, gy10.y, gz10.y, gw10.y);
529
+ vec<4, T, Q> g0110(gx10.z, gy10.z, gz10.z, gw10.z);
530
+ vec<4, T, Q> g1110(gx10.w, gy10.w, gz10.w, gw10.w);
531
+ vec<4, T, Q> g0001(gx01.x, gy01.x, gz01.x, gw01.x);
532
+ vec<4, T, Q> g1001(gx01.y, gy01.y, gz01.y, gw01.y);
533
+ vec<4, T, Q> g0101(gx01.z, gy01.z, gz01.z, gw01.z);
534
+ vec<4, T, Q> g1101(gx01.w, gy01.w, gz01.w, gw01.w);
535
+ vec<4, T, Q> g0011(gx11.x, gy11.x, gz11.x, gw11.x);
536
+ vec<4, T, Q> g1011(gx11.y, gy11.y, gz11.y, gw11.y);
537
+ vec<4, T, Q> g0111(gx11.z, gy11.z, gz11.z, gw11.z);
538
+ vec<4, T, Q> g1111(gx11.w, gy11.w, gz11.w, gw11.w);
539
+
540
+ vec<4, T, Q> norm00 = detail::taylorInvSqrt(vec<4, T, Q>(dot(g0000, g0000), dot(g0100, g0100), dot(g1000, g1000), dot(g1100, g1100)));
541
+ g0000 *= norm00.x;
542
+ g0100 *= norm00.y;
543
+ g1000 *= norm00.z;
544
+ g1100 *= norm00.w;
545
+
546
+ vec<4, T, Q> norm01 = detail::taylorInvSqrt(vec<4, T, Q>(dot(g0001, g0001), dot(g0101, g0101), dot(g1001, g1001), dot(g1101, g1101)));
547
+ g0001 *= norm01.x;
548
+ g0101 *= norm01.y;
549
+ g1001 *= norm01.z;
550
+ g1101 *= norm01.w;
551
+
552
+ vec<4, T, Q> norm10 = detail::taylorInvSqrt(vec<4, T, Q>(dot(g0010, g0010), dot(g0110, g0110), dot(g1010, g1010), dot(g1110, g1110)));
553
+ g0010 *= norm10.x;
554
+ g0110 *= norm10.y;
555
+ g1010 *= norm10.z;
556
+ g1110 *= norm10.w;
557
+
558
+ vec<4, T, Q> norm11 = detail::taylorInvSqrt(vec<4, T, Q>(dot(g0011, g0011), dot(g0111, g0111), dot(g1011, g1011), dot(g1111, g1111)));
559
+ g0011 *= norm11.x;
560
+ g0111 *= norm11.y;
561
+ g1011 *= norm11.z;
562
+ g1111 *= norm11.w;
563
+
564
+ T n0000 = dot(g0000, Pf0);
565
+ T n1000 = dot(g1000, vec<4, T, Q>(Pf1.x, Pf0.y, Pf0.z, Pf0.w));
566
+ T n0100 = dot(g0100, vec<4, T, Q>(Pf0.x, Pf1.y, Pf0.z, Pf0.w));
567
+ T n1100 = dot(g1100, vec<4, T, Q>(Pf1.x, Pf1.y, Pf0.z, Pf0.w));
568
+ T n0010 = dot(g0010, vec<4, T, Q>(Pf0.x, Pf0.y, Pf1.z, Pf0.w));
569
+ T n1010 = dot(g1010, vec<4, T, Q>(Pf1.x, Pf0.y, Pf1.z, Pf0.w));
570
+ T n0110 = dot(g0110, vec<4, T, Q>(Pf0.x, Pf1.y, Pf1.z, Pf0.w));
571
+ T n1110 = dot(g1110, vec<4, T, Q>(Pf1.x, Pf1.y, Pf1.z, Pf0.w));
572
+ T n0001 = dot(g0001, vec<4, T, Q>(Pf0.x, Pf0.y, Pf0.z, Pf1.w));
573
+ T n1001 = dot(g1001, vec<4, T, Q>(Pf1.x, Pf0.y, Pf0.z, Pf1.w));
574
+ T n0101 = dot(g0101, vec<4, T, Q>(Pf0.x, Pf1.y, Pf0.z, Pf1.w));
575
+ T n1101 = dot(g1101, vec<4, T, Q>(Pf1.x, Pf1.y, Pf0.z, Pf1.w));
576
+ T n0011 = dot(g0011, vec<4, T, Q>(Pf0.x, Pf0.y, Pf1.z, Pf1.w));
577
+ T n1011 = dot(g1011, vec<4, T, Q>(Pf1.x, Pf0.y, Pf1.z, Pf1.w));
578
+ T n0111 = dot(g0111, vec<4, T, Q>(Pf0.x, Pf1.y, Pf1.z, Pf1.w));
579
+ T n1111 = dot(g1111, Pf1);
580
+
581
+ vec<4, T, Q> fade_xyzw = detail::fade(Pf0);
582
+ vec<4, T, Q> n_0w = mix(vec<4, T, Q>(n0000, n1000, n0100, n1100), vec<4, T, Q>(n0001, n1001, n0101, n1101), fade_xyzw.w);
583
+ vec<4, T, Q> n_1w = mix(vec<4, T, Q>(n0010, n1010, n0110, n1110), vec<4, T, Q>(n0011, n1011, n0111, n1111), fade_xyzw.w);
584
+ vec<4, T, Q> n_zw = mix(n_0w, n_1w, fade_xyzw.z);
585
+ vec<2, T, Q> n_yzw = mix(vec<2, T, Q>(n_zw.x, n_zw.y), vec<2, T, Q>(n_zw.z, n_zw.w), fade_xyzw.y);
586
+ T n_xyzw = mix(n_yzw.x, n_yzw.y, fade_xyzw.x);
587
+ return T(2.2) * n_xyzw;
588
+ }
589
+
590
+ template<typename T, qualifier Q>
591
+ GLM_FUNC_QUALIFIER T simplex(glm::vec<2, T, Q> const& v)
592
+ {
593
+ vec<4, T, Q> const C = vec<4, T, Q>(
594
+ T( 0.211324865405187), // (3.0 - sqrt(3.0)) / 6.0
595
+ T( 0.366025403784439), // 0.5 * (sqrt(3.0) - 1.0)
596
+ T(-0.577350269189626), // -1.0 + 2.0 * C.x
597
+ T( 0.024390243902439)); // 1.0 / 41.0
598
+
599
+ // First corner
600
+ vec<2, T, Q> i = floor(v + dot(v, vec<2, T, Q>(C[1])));
601
+ vec<2, T, Q> x0 = v - i + dot(i, vec<2, T, Q>(C[0]));
602
+
603
+ // Other corners
604
+ //i1.x = step( x0.y, x0.x ); // x0.x > x0.y ? 1.0 : 0.0
605
+ //i1.y = 1.0 - i1.x;
606
+ vec<2, T, Q> i1 = (x0.x > x0.y) ? vec<2, T, Q>(1, 0) : vec<2, T, Q>(0, 1);
607
+ // x0 = x0 - 0.0 + 0.0 * C.xx ;
608
+ // x1 = x0 - i1 + 1.0 * C.xx ;
609
+ // x2 = x0 - 1.0 + 2.0 * C.xx ;
610
+ vec<4, T, Q> x12 = vec<4, T, Q>(x0.x, x0.y, x0.x, x0.y) + vec<4, T, Q>(C.x, C.x, C.z, C.z);
611
+ x12 = vec<4, T, Q>(vec<2, T, Q>(x12) - i1, x12.z, x12.w);
612
+
613
+ // Permutations
614
+ i = mod(i, vec<2, T, Q>(289)); // Avoid truncation effects in permutation
615
+ vec<3, T, Q> p = detail::permute(
616
+ detail::permute(i.y + vec<3, T, Q>(T(0), i1.y, T(1)))
617
+ + i.x + vec<3, T, Q>(T(0), i1.x, T(1)));
618
+
619
+ vec<3, T, Q> m = max(vec<3, T, Q>(0.5) - vec<3, T, Q>(
620
+ dot(x0, x0),
621
+ dot(vec<2, T, Q>(x12.x, x12.y), vec<2, T, Q>(x12.x, x12.y)),
622
+ dot(vec<2, T, Q>(x12.z, x12.w), vec<2, T, Q>(x12.z, x12.w))), vec<3, T, Q>(0));
623
+ m = m * m ;
624
+ m = m * m ;
625
+
626
+ // Gradients: 41 points uniformly over a line, mapped onto a diamond.
627
+ // The ring size 17*17 = 289 is close to a multiple of 41 (41*7 = 287)
628
+
629
+ vec<3, T, Q> x = static_cast<T>(2) * fract(p * C.w) - T(1);
630
+ vec<3, T, Q> h = abs(x) - T(0.5);
631
+ vec<3, T, Q> ox = floor(x + T(0.5));
632
+ vec<3, T, Q> a0 = x - ox;
633
+
634
+ // Normalise gradients implicitly by scaling m
635
+ // Inlined for speed: m *= taylorInvSqrt( a0*a0 + h*h );
636
+ m *= static_cast<T>(1.79284291400159) - T(0.85373472095314) * (a0 * a0 + h * h);
637
+
638
+ // Compute final noise value at P
639
+ vec<3, T, Q> g;
640
+ g.x = a0.x * x0.x + h.x * x0.y;
641
+ //g.yz = a0.yz * x12.xz + h.yz * x12.yw;
642
+ g.y = a0.y * x12.x + h.y * x12.y;
643
+ g.z = a0.z * x12.z + h.z * x12.w;
644
+ return T(130) * dot(m, g);
645
+ }
646
+
647
+ template<typename T, qualifier Q>
648
+ GLM_FUNC_QUALIFIER T simplex(vec<3, T, Q> const& v)
649
+ {
650
+ vec<2, T, Q> const C(1.0 / 6.0, 1.0 / 3.0);
651
+ vec<4, T, Q> const D(0.0, 0.5, 1.0, 2.0);
652
+
653
+ // First corner
654
+ vec<3, T, Q> i(floor(v + dot(v, vec<3, T, Q>(C.y))));
655
+ vec<3, T, Q> x0(v - i + dot(i, vec<3, T, Q>(C.x)));
656
+
657
+ // Other corners
658
+ vec<3, T, Q> g(step(vec<3, T, Q>(x0.y, x0.z, x0.x), x0));
659
+ vec<3, T, Q> l(T(1) - g);
660
+ vec<3, T, Q> i1(min(g, vec<3, T, Q>(l.z, l.x, l.y)));
661
+ vec<3, T, Q> i2(max(g, vec<3, T, Q>(l.z, l.x, l.y)));
662
+
663
+ // x0 = x0 - 0.0 + 0.0 * C.xxx;
664
+ // x1 = x0 - i1 + 1.0 * C.xxx;
665
+ // x2 = x0 - i2 + 2.0 * C.xxx;
666
+ // x3 = x0 - 1.0 + 3.0 * C.xxx;
667
+ vec<3, T, Q> x1(x0 - i1 + C.x);
668
+ vec<3, T, Q> x2(x0 - i2 + C.y); // 2.0*C.x = 1/3 = C.y
669
+ vec<3, T, Q> x3(x0 - D.y); // -1.0+3.0*C.x = -0.5 = -D.y
670
+
671
+ // Permutations
672
+ i = detail::mod289(i);
673
+ vec<4, T, Q> p(detail::permute(detail::permute(detail::permute(
674
+ i.z + vec<4, T, Q>(T(0), i1.z, i2.z, T(1))) +
675
+ i.y + vec<4, T, Q>(T(0), i1.y, i2.y, T(1))) +
676
+ i.x + vec<4, T, Q>(T(0), i1.x, i2.x, T(1))));
677
+
678
+ // Gradients: 7x7 points over a square, mapped onto an octahedron.
679
+ // The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294)
680
+ T n_ = static_cast<T>(0.142857142857); // 1.0/7.0
681
+ vec<3, T, Q> ns(n_ * vec<3, T, Q>(D.w, D.y, D.z) - vec<3, T, Q>(D.x, D.z, D.x));
682
+
683
+ vec<4, T, Q> j(p - T(49) * floor(p * ns.z * ns.z)); // mod(p,7*7)
684
+
685
+ vec<4, T, Q> x_(floor(j * ns.z));
686
+ vec<4, T, Q> y_(floor(j - T(7) * x_)); // mod(j,N)
687
+
688
+ vec<4, T, Q> x(x_ * ns.x + ns.y);
689
+ vec<4, T, Q> y(y_ * ns.x + ns.y);
690
+ vec<4, T, Q> h(T(1) - abs(x) - abs(y));
691
+
692
+ vec<4, T, Q> b0(x.x, x.y, y.x, y.y);
693
+ vec<4, T, Q> b1(x.z, x.w, y.z, y.w);
694
+
695
+ // vec4 s0 = vec4(lessThan(b0,0.0))*2.0 - 1.0;
696
+ // vec4 s1 = vec4(lessThan(b1,0.0))*2.0 - 1.0;
697
+ vec<4, T, Q> s0(floor(b0) * T(2) + T(1));
698
+ vec<4, T, Q> s1(floor(b1) * T(2) + T(1));
699
+ vec<4, T, Q> sh(-step(h, vec<4, T, Q>(0.0)));
700
+
701
+ vec<4, T, Q> a0 = vec<4, T, Q>(b0.x, b0.z, b0.y, b0.w) + vec<4, T, Q>(s0.x, s0.z, s0.y, s0.w) * vec<4, T, Q>(sh.x, sh.x, sh.y, sh.y);
702
+ vec<4, T, Q> a1 = vec<4, T, Q>(b1.x, b1.z, b1.y, b1.w) + vec<4, T, Q>(s1.x, s1.z, s1.y, s1.w) * vec<4, T, Q>(sh.z, sh.z, sh.w, sh.w);
703
+
704
+ vec<3, T, Q> p0(a0.x, a0.y, h.x);
705
+ vec<3, T, Q> p1(a0.z, a0.w, h.y);
706
+ vec<3, T, Q> p2(a1.x, a1.y, h.z);
707
+ vec<3, T, Q> p3(a1.z, a1.w, h.w);
708
+
709
+ // Normalise gradients
710
+ vec<4, T, Q> norm = detail::taylorInvSqrt(vec<4, T, Q>(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));
711
+ p0 *= norm.x;
712
+ p1 *= norm.y;
713
+ p2 *= norm.z;
714
+ p3 *= norm.w;
715
+
716
+ // Mix final noise value
717
+ vec<4, T, Q> m = max(T(0.6) - vec<4, T, Q>(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), vec<4, T, Q>(0));
718
+ m = m * m;
719
+ return T(42) * dot(m * m, vec<4, T, Q>(dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3)));
720
+ }
721
+
722
+ template<typename T, qualifier Q>
723
+ GLM_FUNC_QUALIFIER T simplex(vec<4, T, Q> const& v)
724
+ {
725
+ vec<4, T, Q> const C(
726
+ 0.138196601125011, // (5 - sqrt(5))/20 G4
727
+ 0.276393202250021, // 2 * G4
728
+ 0.414589803375032, // 3 * G4
729
+ -0.447213595499958); // -1 + 4 * G4
730
+
731
+ // (sqrt(5) - 1)/4 = F4, used once below
732
+ T const F4 = static_cast<T>(0.309016994374947451);
733
+
734
+ // First corner
735
+ vec<4, T, Q> i = floor(v + dot(v, vec<4, T, Q>(F4)));
736
+ vec<4, T, Q> x0 = v - i + dot(i, vec<4, T, Q>(C.x));
737
+
738
+ // Other corners
739
+
740
+ // Rank sorting originally contributed by Bill Licea-Kane, AMD (formerly ATI)
741
+ vec<4, T, Q> i0;
742
+ vec<3, T, Q> isX = step(vec<3, T, Q>(x0.y, x0.z, x0.w), vec<3, T, Q>(x0.x));
743
+ vec<3, T, Q> isYZ = step(vec<3, T, Q>(x0.z, x0.w, x0.w), vec<3, T, Q>(x0.y, x0.y, x0.z));
744
+ // i0.x = dot(isX, vec3(1.0));
745
+ //i0.x = isX.x + isX.y + isX.z;
746
+ //i0.yzw = static_cast<T>(1) - isX;
747
+ i0 = vec<4, T, Q>(isX.x + isX.y + isX.z, T(1) - isX);
748
+ // i0.y += dot(isYZ.xy, vec2(1.0));
749
+ i0.y += isYZ.x + isYZ.y;
750
+ //i0.zw += 1.0 - vec<2, T, Q>(isYZ.x, isYZ.y);
751
+ i0.z += static_cast<T>(1) - isYZ.x;
752
+ i0.w += static_cast<T>(1) - isYZ.y;
753
+ i0.z += isYZ.z;
754
+ i0.w += static_cast<T>(1) - isYZ.z;
755
+
756
+ // i0 now contains the unique values 0,1,2,3 in each channel
757
+ vec<4, T, Q> i3 = clamp(i0, T(0), T(1));
758
+ vec<4, T, Q> i2 = clamp(i0 - T(1), T(0), T(1));
759
+ vec<4, T, Q> i1 = clamp(i0 - T(2), T(0), T(1));
760
+
761
+ // x0 = x0 - 0.0 + 0.0 * C.xxxx
762
+ // x1 = x0 - i1 + 0.0 * C.xxxx
763
+ // x2 = x0 - i2 + 0.0 * C.xxxx
764
+ // x3 = x0 - i3 + 0.0 * C.xxxx
765
+ // x4 = x0 - 1.0 + 4.0 * C.xxxx
766
+ vec<4, T, Q> x1 = x0 - i1 + C.x;
767
+ vec<4, T, Q> x2 = x0 - i2 + C.y;
768
+ vec<4, T, Q> x3 = x0 - i3 + C.z;
769
+ vec<4, T, Q> x4 = x0 + C.w;
770
+
771
+ // Permutations
772
+ i = mod(i, vec<4, T, Q>(289));
773
+ T j0 = detail::permute(detail::permute(detail::permute(detail::permute(i.w) + i.z) + i.y) + i.x);
774
+ vec<4, T, Q> j1 = detail::permute(detail::permute(detail::permute(detail::permute(
775
+ i.w + vec<4, T, Q>(i1.w, i2.w, i3.w, T(1))) +
776
+ i.z + vec<4, T, Q>(i1.z, i2.z, i3.z, T(1))) +
777
+ i.y + vec<4, T, Q>(i1.y, i2.y, i3.y, T(1))) +
778
+ i.x + vec<4, T, Q>(i1.x, i2.x, i3.x, T(1)));
779
+
780
+ // Gradients: 7x7x6 points over a cube, mapped onto a 4-cross polytope
781
+ // 7*7*6 = 294, which is close to the ring size 17*17 = 289.
782
+ vec<4, T, Q> ip = vec<4, T, Q>(T(1) / T(294), T(1) / T(49), T(1) / T(7), T(0));
783
+
784
+ vec<4, T, Q> p0 = gtc::grad4(j0, ip);
785
+ vec<4, T, Q> p1 = gtc::grad4(j1.x, ip);
786
+ vec<4, T, Q> p2 = gtc::grad4(j1.y, ip);
787
+ vec<4, T, Q> p3 = gtc::grad4(j1.z, ip);
788
+ vec<4, T, Q> p4 = gtc::grad4(j1.w, ip);
789
+
790
+ // Normalise gradients
791
+ vec<4, T, Q> norm = detail::taylorInvSqrt(vec<4, T, Q>(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));
792
+ p0 *= norm.x;
793
+ p1 *= norm.y;
794
+ p2 *= norm.z;
795
+ p3 *= norm.w;
796
+ p4 *= detail::taylorInvSqrt(dot(p4, p4));
797
+
798
+ // Mix contributions from the five corners
799
+ vec<3, T, Q> m0 = max(T(0.6) - vec<3, T, Q>(dot(x0, x0), dot(x1, x1), dot(x2, x2)), vec<3, T, Q>(0));
800
+ vec<2, T, Q> m1 = max(T(0.6) - vec<2, T, Q>(dot(x3, x3), dot(x4, x4) ), vec<2, T, Q>(0));
801
+ m0 = m0 * m0;
802
+ m1 = m1 * m1;
803
+ return T(49) *
804
+ (dot(m0 * m0, vec<3, T, Q>(dot(p0, x0), dot(p1, x1), dot(p2, x2))) +
805
+ dot(m1 * m1, vec<2, T, Q>(dot(p3, x3), dot(p4, x4))));
806
+ }
807
+ }//namespace glm
cuda_extensions/third_party/glm/glm/gtc/packing.hpp ADDED
@@ -0,0 +1,728 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref gtc_packing
2
+ /// @file glm/gtc/packing.hpp
3
+ ///
4
+ /// @see core (dependence)
5
+ ///
6
+ /// @defgroup gtc_packing GLM_GTC_packing
7
+ /// @ingroup gtc
8
+ ///
9
+ /// Include <glm/gtc/packing.hpp> to use the features of this extension.
10
+ ///
11
+ /// This extension provides a set of function to convert vertors to packed
12
+ /// formats.
13
+
14
+ #pragma once
15
+
16
+ // Dependency:
17
+ #include "type_precision.hpp"
18
+ #include "../ext/vector_packing.hpp"
19
+
20
+ #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
21
+ # pragma message("GLM: GLM_GTC_packing extension included")
22
+ #endif
23
+
24
+ namespace glm
25
+ {
26
+ /// @addtogroup gtc_packing
27
+ /// @{
28
+
29
+ /// First, converts the normalized floating-point value v into a 8-bit integer value.
30
+ /// Then, the results are packed into the returned 8-bit unsigned integer.
31
+ ///
32
+ /// The conversion for component c of v to fixed point is done as follows:
33
+ /// packUnorm1x8: round(clamp(c, 0, +1) * 255.0)
34
+ ///
35
+ /// @see gtc_packing
36
+ /// @see uint16 packUnorm2x8(vec2 const& v)
37
+ /// @see uint32 packUnorm4x8(vec4 const& v)
38
+ /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packUnorm4x8.xml">GLSL packUnorm4x8 man page</a>
39
+ /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
40
+ GLM_FUNC_DECL uint8 packUnorm1x8(float v);
41
+
42
+ /// Convert a single 8-bit integer to a normalized floating-point value.
43
+ ///
44
+ /// The conversion for unpacked fixed-point value f to floating point is done as follows:
45
+ /// unpackUnorm4x8: f / 255.0
46
+ ///
47
+ /// @see gtc_packing
48
+ /// @see vec2 unpackUnorm2x8(uint16 p)
49
+ /// @see vec4 unpackUnorm4x8(uint32 p)
50
+ /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm4x8.xml">GLSL unpackUnorm4x8 man page</a>
51
+ /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
52
+ GLM_FUNC_DECL float unpackUnorm1x8(uint8 p);
53
+
54
+ /// First, converts each component of the normalized floating-point value v into 8-bit integer values.
55
+ /// Then, the results are packed into the returned 16-bit unsigned integer.
56
+ ///
57
+ /// The conversion for component c of v to fixed point is done as follows:
58
+ /// packUnorm2x8: round(clamp(c, 0, +1) * 255.0)
59
+ ///
60
+ /// The first component of the vector will be written to the least significant bits of the output;
61
+ /// the last component will be written to the most significant bits.
62
+ ///
63
+ /// @see gtc_packing
64
+ /// @see uint8 packUnorm1x8(float const& v)
65
+ /// @see uint32 packUnorm4x8(vec4 const& v)
66
+ /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packUnorm4x8.xml">GLSL packUnorm4x8 man page</a>
67
+ /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
68
+ GLM_FUNC_DECL uint16 packUnorm2x8(vec2 const& v);
69
+
70
+ /// First, unpacks a single 16-bit unsigned integer p into a pair of 8-bit unsigned integers.
71
+ /// Then, each component is converted to a normalized floating-point value to generate the returned two-component vector.
72
+ ///
73
+ /// The conversion for unpacked fixed-point value f to floating point is done as follows:
74
+ /// unpackUnorm4x8: f / 255.0
75
+ ///
76
+ /// The first component of the returned vector will be extracted from the least significant bits of the input;
77
+ /// the last component will be extracted from the most significant bits.
78
+ ///
79
+ /// @see gtc_packing
80
+ /// @see float unpackUnorm1x8(uint8 v)
81
+ /// @see vec4 unpackUnorm4x8(uint32 p)
82
+ /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm4x8.xml">GLSL unpackUnorm4x8 man page</a>
83
+ /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
84
+ GLM_FUNC_DECL vec2 unpackUnorm2x8(uint16 p);
85
+
86
+ /// First, converts the normalized floating-point value v into 8-bit integer value.
87
+ /// Then, the results are packed into the returned 8-bit unsigned integer.
88
+ ///
89
+ /// The conversion to fixed point is done as follows:
90
+ /// packSnorm1x8: round(clamp(s, -1, +1) * 127.0)
91
+ ///
92
+ /// @see gtc_packing
93
+ /// @see uint16 packSnorm2x8(vec2 const& v)
94
+ /// @see uint32 packSnorm4x8(vec4 const& v)
95
+ /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packSnorm4x8.xml">GLSL packSnorm4x8 man page</a>
96
+ /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
97
+ GLM_FUNC_DECL uint8 packSnorm1x8(float s);
98
+
99
+ /// First, unpacks a single 8-bit unsigned integer p into a single 8-bit signed integers.
100
+ /// Then, the value is converted to a normalized floating-point value to generate the returned scalar.
101
+ ///
102
+ /// The conversion for unpacked fixed-point value f to floating point is done as follows:
103
+ /// unpackSnorm1x8: clamp(f / 127.0, -1, +1)
104
+ ///
105
+ /// @see gtc_packing
106
+ /// @see vec2 unpackSnorm2x8(uint16 p)
107
+ /// @see vec4 unpackSnorm4x8(uint32 p)
108
+ /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm4x8.xml">GLSL unpackSnorm4x8 man page</a>
109
+ /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
110
+ GLM_FUNC_DECL float unpackSnorm1x8(uint8 p);
111
+
112
+ /// First, converts each component of the normalized floating-point value v into 8-bit integer values.
113
+ /// Then, the results are packed into the returned 16-bit unsigned integer.
114
+ ///
115
+ /// The conversion for component c of v to fixed point is done as follows:
116
+ /// packSnorm2x8: round(clamp(c, -1, +1) * 127.0)
117
+ ///
118
+ /// The first component of the vector will be written to the least significant bits of the output;
119
+ /// the last component will be written to the most significant bits.
120
+ ///
121
+ /// @see gtc_packing
122
+ /// @see uint8 packSnorm1x8(float const& v)
123
+ /// @see uint32 packSnorm4x8(vec4 const& v)
124
+ /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packSnorm4x8.xml">GLSL packSnorm4x8 man page</a>
125
+ /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
126
+ GLM_FUNC_DECL uint16 packSnorm2x8(vec2 const& v);
127
+
128
+ /// First, unpacks a single 16-bit unsigned integer p into a pair of 8-bit signed integers.
129
+ /// Then, each component is converted to a normalized floating-point value to generate the returned two-component vector.
130
+ ///
131
+ /// The conversion for unpacked fixed-point value f to floating point is done as follows:
132
+ /// unpackSnorm2x8: clamp(f / 127.0, -1, +1)
133
+ ///
134
+ /// The first component of the returned vector will be extracted from the least significant bits of the input;
135
+ /// the last component will be extracted from the most significant bits.
136
+ ///
137
+ /// @see gtc_packing
138
+ /// @see float unpackSnorm1x8(uint8 p)
139
+ /// @see vec4 unpackSnorm4x8(uint32 p)
140
+ /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm4x8.xml">GLSL unpackSnorm4x8 man page</a>
141
+ /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
142
+ GLM_FUNC_DECL vec2 unpackSnorm2x8(uint16 p);
143
+
144
+ /// First, converts the normalized floating-point value v into a 16-bit integer value.
145
+ /// Then, the results are packed into the returned 16-bit unsigned integer.
146
+ ///
147
+ /// The conversion for component c of v to fixed point is done as follows:
148
+ /// packUnorm1x16: round(clamp(c, 0, +1) * 65535.0)
149
+ ///
150
+ /// @see gtc_packing
151
+ /// @see uint16 packSnorm1x16(float const& v)
152
+ /// @see uint64 packSnorm4x16(vec4 const& v)
153
+ /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packUnorm4x8.xml">GLSL packUnorm4x8 man page</a>
154
+ /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
155
+ GLM_FUNC_DECL uint16 packUnorm1x16(float v);
156
+
157
+ /// First, unpacks a single 16-bit unsigned integer p into a of 16-bit unsigned integers.
158
+ /// Then, the value is converted to a normalized floating-point value to generate the returned scalar.
159
+ ///
160
+ /// The conversion for unpacked fixed-point value f to floating point is done as follows:
161
+ /// unpackUnorm1x16: f / 65535.0
162
+ ///
163
+ /// @see gtc_packing
164
+ /// @see vec2 unpackUnorm2x16(uint32 p)
165
+ /// @see vec4 unpackUnorm4x16(uint64 p)
166
+ /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm2x16.xml">GLSL unpackUnorm2x16 man page</a>
167
+ /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
168
+ GLM_FUNC_DECL float unpackUnorm1x16(uint16 p);
169
+
170
+ /// First, converts each component of the normalized floating-point value v into 16-bit integer values.
171
+ /// Then, the results are packed into the returned 64-bit unsigned integer.
172
+ ///
173
+ /// The conversion for component c of v to fixed point is done as follows:
174
+ /// packUnorm4x16: round(clamp(c, 0, +1) * 65535.0)
175
+ ///
176
+ /// The first component of the vector will be written to the least significant bits of the output;
177
+ /// the last component will be written to the most significant bits.
178
+ ///
179
+ /// @see gtc_packing
180
+ /// @see uint16 packUnorm1x16(float const& v)
181
+ /// @see uint32 packUnorm2x16(vec2 const& v)
182
+ /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packUnorm4x8.xml">GLSL packUnorm4x8 man page</a>
183
+ /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
184
+ GLM_FUNC_DECL uint64 packUnorm4x16(vec4 const& v);
185
+
186
+ /// First, unpacks a single 64-bit unsigned integer p into four 16-bit unsigned integers.
187
+ /// Then, each component is converted to a normalized floating-point value to generate the returned four-component vector.
188
+ ///
189
+ /// The conversion for unpacked fixed-point value f to floating point is done as follows:
190
+ /// unpackUnormx4x16: f / 65535.0
191
+ ///
192
+ /// The first component of the returned vector will be extracted from the least significant bits of the input;
193
+ /// the last component will be extracted from the most significant bits.
194
+ ///
195
+ /// @see gtc_packing
196
+ /// @see float unpackUnorm1x16(uint16 p)
197
+ /// @see vec2 unpackUnorm2x16(uint32 p)
198
+ /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm2x16.xml">GLSL unpackUnorm2x16 man page</a>
199
+ /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
200
+ GLM_FUNC_DECL vec4 unpackUnorm4x16(uint64 p);
201
+
202
+ /// First, converts the normalized floating-point value v into 16-bit integer value.
203
+ /// Then, the results are packed into the returned 16-bit unsigned integer.
204
+ ///
205
+ /// The conversion to fixed point is done as follows:
206
+ /// packSnorm1x8: round(clamp(s, -1, +1) * 32767.0)
207
+ ///
208
+ /// @see gtc_packing
209
+ /// @see uint32 packSnorm2x16(vec2 const& v)
210
+ /// @see uint64 packSnorm4x16(vec4 const& v)
211
+ /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packSnorm4x8.xml">GLSL packSnorm4x8 man page</a>
212
+ /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
213
+ GLM_FUNC_DECL uint16 packSnorm1x16(float v);
214
+
215
+ /// First, unpacks a single 16-bit unsigned integer p into a single 16-bit signed integers.
216
+ /// Then, each component is converted to a normalized floating-point value to generate the returned scalar.
217
+ ///
218
+ /// The conversion for unpacked fixed-point value f to floating point is done as follows:
219
+ /// unpackSnorm1x16: clamp(f / 32767.0, -1, +1)
220
+ ///
221
+ /// @see gtc_packing
222
+ /// @see vec2 unpackSnorm2x16(uint32 p)
223
+ /// @see vec4 unpackSnorm4x16(uint64 p)
224
+ /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm1x16.xml">GLSL unpackSnorm4x8 man page</a>
225
+ /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
226
+ GLM_FUNC_DECL float unpackSnorm1x16(uint16 p);
227
+
228
+ /// First, converts each component of the normalized floating-point value v into 16-bit integer values.
229
+ /// Then, the results are packed into the returned 64-bit unsigned integer.
230
+ ///
231
+ /// The conversion for component c of v to fixed point is done as follows:
232
+ /// packSnorm2x8: round(clamp(c, -1, +1) * 32767.0)
233
+ ///
234
+ /// The first component of the vector will be written to the least significant bits of the output;
235
+ /// the last component will be written to the most significant bits.
236
+ ///
237
+ /// @see gtc_packing
238
+ /// @see uint16 packSnorm1x16(float const& v)
239
+ /// @see uint32 packSnorm2x16(vec2 const& v)
240
+ /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packSnorm4x8.xml">GLSL packSnorm4x8 man page</a>
241
+ /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
242
+ GLM_FUNC_DECL uint64 packSnorm4x16(vec4 const& v);
243
+
244
+ /// First, unpacks a single 64-bit unsigned integer p into four 16-bit signed integers.
245
+ /// Then, each component is converted to a normalized floating-point value to generate the returned four-component vector.
246
+ ///
247
+ /// The conversion for unpacked fixed-point value f to floating point is done as follows:
248
+ /// unpackSnorm4x16: clamp(f / 32767.0, -1, +1)
249
+ ///
250
+ /// The first component of the returned vector will be extracted from the least significant bits of the input;
251
+ /// the last component will be extracted from the most significant bits.
252
+ ///
253
+ /// @see gtc_packing
254
+ /// @see float unpackSnorm1x16(uint16 p)
255
+ /// @see vec2 unpackSnorm2x16(uint32 p)
256
+ /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm2x16.xml">GLSL unpackSnorm4x8 man page</a>
257
+ /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
258
+ GLM_FUNC_DECL vec4 unpackSnorm4x16(uint64 p);
259
+
260
+ /// Returns an unsigned integer obtained by converting the components of a floating-point scalar
261
+ /// to the 16-bit floating-point representation found in the OpenGL Specification,
262
+ /// and then packing this 16-bit value into a 16-bit unsigned integer.
263
+ ///
264
+ /// @see gtc_packing
265
+ /// @see uint32 packHalf2x16(vec2 const& v)
266
+ /// @see uint64 packHalf4x16(vec4 const& v)
267
+ /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packHalf2x16.xml">GLSL packHalf2x16 man page</a>
268
+ /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
269
+ GLM_FUNC_DECL uint16 packHalf1x16(float v);
270
+
271
+ /// Returns a floating-point scalar with components obtained by unpacking a 16-bit unsigned integer into a 16-bit value,
272
+ /// interpreted as a 16-bit floating-point number according to the OpenGL Specification,
273
+ /// and converting it to 32-bit floating-point values.
274
+ ///
275
+ /// @see gtc_packing
276
+ /// @see vec2 unpackHalf2x16(uint32 const& v)
277
+ /// @see vec4 unpackHalf4x16(uint64 const& v)
278
+ /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackHalf2x16.xml">GLSL unpackHalf2x16 man page</a>
279
+ /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
280
+ GLM_FUNC_DECL float unpackHalf1x16(uint16 v);
281
+
282
+ /// Returns an unsigned integer obtained by converting the components of a four-component floating-point vector
283
+ /// to the 16-bit floating-point representation found in the OpenGL Specification,
284
+ /// and then packing these four 16-bit values into a 64-bit unsigned integer.
285
+ /// The first vector component specifies the 16 least-significant bits of the result;
286
+ /// the forth component specifies the 16 most-significant bits.
287
+ ///
288
+ /// @see gtc_packing
289
+ /// @see uint16 packHalf1x16(float const& v)
290
+ /// @see uint32 packHalf2x16(vec2 const& v)
291
+ /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packHalf2x16.xml">GLSL packHalf2x16 man page</a>
292
+ /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
293
+ GLM_FUNC_DECL uint64 packHalf4x16(vec4 const& v);
294
+
295
+ /// Returns a four-component floating-point vector with components obtained by unpacking a 64-bit unsigned integer into four 16-bit values,
296
+ /// interpreting those values as 16-bit floating-point numbers according to the OpenGL Specification,
297
+ /// and converting them to 32-bit floating-point values.
298
+ /// The first component of the vector is obtained from the 16 least-significant bits of v;
299
+ /// the forth component is obtained from the 16 most-significant bits of v.
300
+ ///
301
+ /// @see gtc_packing
302
+ /// @see float unpackHalf1x16(uint16 const& v)
303
+ /// @see vec2 unpackHalf2x16(uint32 const& v)
304
+ /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackHalf2x16.xml">GLSL unpackHalf2x16 man page</a>
305
+ /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
306
+ GLM_FUNC_DECL vec4 unpackHalf4x16(uint64 p);
307
+
308
+ /// Returns an unsigned integer obtained by converting the components of a four-component signed integer vector
309
+ /// to the 10-10-10-2-bit signed integer representation found in the OpenGL Specification,
310
+ /// and then packing these four values into a 32-bit unsigned integer.
311
+ /// The first vector component specifies the 10 least-significant bits of the result;
312
+ /// the forth component specifies the 2 most-significant bits.
313
+ ///
314
+ /// @see gtc_packing
315
+ /// @see uint32 packI3x10_1x2(uvec4 const& v)
316
+ /// @see uint32 packSnorm3x10_1x2(vec4 const& v)
317
+ /// @see uint32 packUnorm3x10_1x2(vec4 const& v)
318
+ /// @see ivec4 unpackI3x10_1x2(uint32 const& p)
319
+ GLM_FUNC_DECL uint32 packI3x10_1x2(ivec4 const& v);
320
+
321
+ /// Unpacks a single 32-bit unsigned integer p into three 10-bit and one 2-bit signed integers.
322
+ ///
323
+ /// The first component of the returned vector will be extracted from the least significant bits of the input;
324
+ /// the last component will be extracted from the most significant bits.
325
+ ///
326
+ /// @see gtc_packing
327
+ /// @see uint32 packU3x10_1x2(uvec4 const& v)
328
+ /// @see vec4 unpackSnorm3x10_1x2(uint32 const& p);
329
+ /// @see uvec4 unpackI3x10_1x2(uint32 const& p);
330
+ GLM_FUNC_DECL ivec4 unpackI3x10_1x2(uint32 p);
331
+
332
+ /// Returns an unsigned integer obtained by converting the components of a four-component unsigned integer vector
333
+ /// to the 10-10-10-2-bit unsigned integer representation found in the OpenGL Specification,
334
+ /// and then packing these four values into a 32-bit unsigned integer.
335
+ /// The first vector component specifies the 10 least-significant bits of the result;
336
+ /// the forth component specifies the 2 most-significant bits.
337
+ ///
338
+ /// @see gtc_packing
339
+ /// @see uint32 packI3x10_1x2(ivec4 const& v)
340
+ /// @see uint32 packSnorm3x10_1x2(vec4 const& v)
341
+ /// @see uint32 packUnorm3x10_1x2(vec4 const& v)
342
+ /// @see ivec4 unpackU3x10_1x2(uint32 const& p)
343
+ GLM_FUNC_DECL uint32 packU3x10_1x2(uvec4 const& v);
344
+
345
+ /// Unpacks a single 32-bit unsigned integer p into three 10-bit and one 2-bit unsigned integers.
346
+ ///
347
+ /// The first component of the returned vector will be extracted from the least significant bits of the input;
348
+ /// the last component will be extracted from the most significant bits.
349
+ ///
350
+ /// @see gtc_packing
351
+ /// @see uint32 packU3x10_1x2(uvec4 const& v)
352
+ /// @see vec4 unpackSnorm3x10_1x2(uint32 const& p);
353
+ /// @see uvec4 unpackI3x10_1x2(uint32 const& p);
354
+ GLM_FUNC_DECL uvec4 unpackU3x10_1x2(uint32 p);
355
+
356
+ /// First, converts the first three components of the normalized floating-point value v into 10-bit signed integer values.
357
+ /// Then, converts the forth component of the normalized floating-point value v into 2-bit signed integer values.
358
+ /// Then, the results are packed into the returned 32-bit unsigned integer.
359
+ ///
360
+ /// The conversion for component c of v to fixed point is done as follows:
361
+ /// packSnorm3x10_1x2(xyz): round(clamp(c, -1, +1) * 511.0)
362
+ /// packSnorm3x10_1x2(w): round(clamp(c, -1, +1) * 1.0)
363
+ ///
364
+ /// The first vector component specifies the 10 least-significant bits of the result;
365
+ /// the forth component specifies the 2 most-significant bits.
366
+ ///
367
+ /// @see gtc_packing
368
+ /// @see vec4 unpackSnorm3x10_1x2(uint32 const& p)
369
+ /// @see uint32 packUnorm3x10_1x2(vec4 const& v)
370
+ /// @see uint32 packU3x10_1x2(uvec4 const& v)
371
+ /// @see uint32 packI3x10_1x2(ivec4 const& v)
372
+ GLM_FUNC_DECL uint32 packSnorm3x10_1x2(vec4 const& v);
373
+
374
+ /// First, unpacks a single 32-bit unsigned integer p into four 16-bit signed integers.
375
+ /// Then, each component is converted to a normalized floating-point value to generate the returned four-component vector.
376
+ ///
377
+ /// The conversion for unpacked fixed-point value f to floating point is done as follows:
378
+ /// unpackSnorm3x10_1x2(xyz): clamp(f / 511.0, -1, +1)
379
+ /// unpackSnorm3x10_1x2(w): clamp(f / 511.0, -1, +1)
380
+ ///
381
+ /// The first component of the returned vector will be extracted from the least significant bits of the input;
382
+ /// the last component will be extracted from the most significant bits.
383
+ ///
384
+ /// @see gtc_packing
385
+ /// @see uint32 packSnorm3x10_1x2(vec4 const& v)
386
+ /// @see vec4 unpackUnorm3x10_1x2(uint32 const& p))
387
+ /// @see uvec4 unpackI3x10_1x2(uint32 const& p)
388
+ /// @see uvec4 unpackU3x10_1x2(uint32 const& p)
389
+ GLM_FUNC_DECL vec4 unpackSnorm3x10_1x2(uint32 p);
390
+
391
+ /// First, converts the first three components of the normalized floating-point value v into 10-bit unsigned integer values.
392
+ /// Then, converts the forth component of the normalized floating-point value v into 2-bit signed uninteger values.
393
+ /// Then, the results are packed into the returned 32-bit unsigned integer.
394
+ ///
395
+ /// The conversion for component c of v to fixed point is done as follows:
396
+ /// packUnorm3x10_1x2(xyz): round(clamp(c, 0, +1) * 1023.0)
397
+ /// packUnorm3x10_1x2(w): round(clamp(c, 0, +1) * 3.0)
398
+ ///
399
+ /// The first vector component specifies the 10 least-significant bits of the result;
400
+ /// the forth component specifies the 2 most-significant bits.
401
+ ///
402
+ /// @see gtc_packing
403
+ /// @see vec4 unpackUnorm3x10_1x2(uint32 const& p)
404
+ /// @see uint32 packUnorm3x10_1x2(vec4 const& v)
405
+ /// @see uint32 packU3x10_1x2(uvec4 const& v)
406
+ /// @see uint32 packI3x10_1x2(ivec4 const& v)
407
+ GLM_FUNC_DECL uint32 packUnorm3x10_1x2(vec4 const& v);
408
+
409
+ /// First, unpacks a single 32-bit unsigned integer p into four 16-bit signed integers.
410
+ /// Then, each component is converted to a normalized floating-point value to generate the returned four-component vector.
411
+ ///
412
+ /// The conversion for unpacked fixed-point value f to floating point is done as follows:
413
+ /// unpackSnorm3x10_1x2(xyz): clamp(f / 1023.0, 0, +1)
414
+ /// unpackSnorm3x10_1x2(w): clamp(f / 3.0, 0, +1)
415
+ ///
416
+ /// The first component of the returned vector will be extracted from the least significant bits of the input;
417
+ /// the last component will be extracted from the most significant bits.
418
+ ///
419
+ /// @see gtc_packing
420
+ /// @see uint32 packSnorm3x10_1x2(vec4 const& v)
421
+ /// @see vec4 unpackInorm3x10_1x2(uint32 const& p))
422
+ /// @see uvec4 unpackI3x10_1x2(uint32 const& p)
423
+ /// @see uvec4 unpackU3x10_1x2(uint32 const& p)
424
+ GLM_FUNC_DECL vec4 unpackUnorm3x10_1x2(uint32 p);
425
+
426
+ /// First, converts the first two components of the normalized floating-point value v into 11-bit signless floating-point values.
427
+ /// Then, converts the third component of the normalized floating-point value v into a 10-bit signless floating-point value.
428
+ /// Then, the results are packed into the returned 32-bit unsigned integer.
429
+ ///
430
+ /// The first vector component specifies the 11 least-significant bits of the result;
431
+ /// the last component specifies the 10 most-significant bits.
432
+ ///
433
+ /// @see gtc_packing
434
+ /// @see vec3 unpackF2x11_1x10(uint32 const& p)
435
+ GLM_FUNC_DECL uint32 packF2x11_1x10(vec3 const& v);
436
+
437
+ /// First, unpacks a single 32-bit unsigned integer p into two 11-bit signless floating-point values and one 10-bit signless floating-point value .
438
+ /// Then, each component is converted to a normalized floating-point value to generate the returned three-component vector.
439
+ ///
440
+ /// The first component of the returned vector will be extracted from the least significant bits of the input;
441
+ /// the last component will be extracted from the most significant bits.
442
+ ///
443
+ /// @see gtc_packing
444
+ /// @see uint32 packF2x11_1x10(vec3 const& v)
445
+ GLM_FUNC_DECL vec3 unpackF2x11_1x10(uint32 p);
446
+
447
+
448
+ /// First, converts the first two components of the normalized floating-point value v into 11-bit signless floating-point values.
449
+ /// Then, converts the third component of the normalized floating-point value v into a 10-bit signless floating-point value.
450
+ /// Then, the results are packed into the returned 32-bit unsigned integer.
451
+ ///
452
+ /// The first vector component specifies the 11 least-significant bits of the result;
453
+ /// the last component specifies the 10 most-significant bits.
454
+ ///
455
+ /// packF3x9_E1x5 allows encoding into RGBE / RGB9E5 format
456
+ ///
457
+ /// @see gtc_packing
458
+ /// @see vec3 unpackF3x9_E1x5(uint32 const& p)
459
+ GLM_FUNC_DECL uint32 packF3x9_E1x5(vec3 const& v);
460
+
461
+ /// First, unpacks a single 32-bit unsigned integer p into two 11-bit signless floating-point values and one 10-bit signless floating-point value .
462
+ /// Then, each component is converted to a normalized floating-point value to generate the returned three-component vector.
463
+ ///
464
+ /// The first component of the returned vector will be extracted from the least significant bits of the input;
465
+ /// the last component will be extracted from the most significant bits.
466
+ ///
467
+ /// unpackF3x9_E1x5 allows decoding RGBE / RGB9E5 data
468
+ ///
469
+ /// @see gtc_packing
470
+ /// @see uint32 packF3x9_E1x5(vec3 const& v)
471
+ GLM_FUNC_DECL vec3 unpackF3x9_E1x5(uint32 p);
472
+
473
+ /// Returns an unsigned integer vector obtained by converting the components of a floating-point vector
474
+ /// to the 16-bit floating-point representation found in the OpenGL Specification.
475
+ /// The first vector component specifies the 16 least-significant bits of the result;
476
+ /// the forth component specifies the 16 most-significant bits.
477
+ ///
478
+ /// @see gtc_packing
479
+ /// @see vec<3, T, Q> unpackRGBM(vec<4, T, Q> const& p)
480
+ /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
481
+ template<length_t L, typename T, qualifier Q>
482
+ GLM_FUNC_DECL vec<4, T, Q> packRGBM(vec<3, T, Q> const& rgb);
483
+
484
+ /// Returns a floating-point vector with components obtained by reinterpreting an integer vector as 16-bit floating-point numbers and converting them to 32-bit floating-point values.
485
+ /// The first component of the vector is obtained from the 16 least-significant bits of v;
486
+ /// the forth component is obtained from the 16 most-significant bits of v.
487
+ ///
488
+ /// @see gtc_packing
489
+ /// @see vec<4, T, Q> packRGBM(vec<3, float, Q> const& v)
490
+ /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
491
+ template<length_t L, typename T, qualifier Q>
492
+ GLM_FUNC_DECL vec<3, T, Q> unpackRGBM(vec<4, T, Q> const& rgbm);
493
+
494
+ /// Returns an unsigned integer vector obtained by converting the components of a floating-point vector
495
+ /// to the 16-bit floating-point representation found in the OpenGL Specification.
496
+ /// The first vector component specifies the 16 least-significant bits of the result;
497
+ /// the forth component specifies the 16 most-significant bits.
498
+ ///
499
+ /// @see gtc_packing
500
+ /// @see vec<L, float, Q> unpackHalf(vec<L, uint16, Q> const& p)
501
+ /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
502
+ template<length_t L, qualifier Q>
503
+ GLM_FUNC_DECL vec<L, uint16, Q> packHalf(vec<L, float, Q> const& v);
504
+
505
+ /// Returns a floating-point vector with components obtained by reinterpreting an integer vector as 16-bit floating-point numbers and converting them to 32-bit floating-point values.
506
+ /// The first component of the vector is obtained from the 16 least-significant bits of v;
507
+ /// the forth component is obtained from the 16 most-significant bits of v.
508
+ ///
509
+ /// @see gtc_packing
510
+ /// @see vec<L, uint16, Q> packHalf(vec<L, float, Q> const& v)
511
+ /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
512
+ template<length_t L, qualifier Q>
513
+ GLM_FUNC_DECL vec<L, float, Q> unpackHalf(vec<L, uint16, Q> const& p);
514
+
515
+ /// Convert each component of the normalized floating-point vector into unsigned integer values.
516
+ ///
517
+ /// @see gtc_packing
518
+ /// @see vec<L, floatType, Q> unpackUnorm(vec<L, intType, Q> const& p);
519
+ template<typename uintType, length_t L, typename floatType, qualifier Q>
520
+ GLM_FUNC_DECL vec<L, uintType, Q> packUnorm(vec<L, floatType, Q> const& v);
521
+
522
+ /// Convert a packed integer to a normalized floating-point vector.
523
+ ///
524
+ /// @see gtc_packing
525
+ /// @see vec<L, intType, Q> packUnorm(vec<L, floatType, Q> const& v)
526
+ template<typename floatType, length_t L, typename uintType, qualifier Q>
527
+ GLM_FUNC_DECL vec<L, floatType, Q> unpackUnorm(vec<L, uintType, Q> const& v);
528
+
529
+ /// Convert each component of the normalized floating-point vector into signed integer values.
530
+ ///
531
+ /// @see gtc_packing
532
+ /// @see vec<L, floatType, Q> unpackSnorm(vec<L, intType, Q> const& p);
533
+ template<typename intType, length_t L, typename floatType, qualifier Q>
534
+ GLM_FUNC_DECL vec<L, intType, Q> packSnorm(vec<L, floatType, Q> const& v);
535
+
536
+ /// Convert a packed integer to a normalized floating-point vector.
537
+ ///
538
+ /// @see gtc_packing
539
+ /// @see vec<L, intType, Q> packSnorm(vec<L, floatType, Q> const& v)
540
+ template<typename floatType, length_t L, typename intType, qualifier Q>
541
+ GLM_FUNC_DECL vec<L, floatType, Q> unpackSnorm(vec<L, intType, Q> const& v);
542
+
543
+ /// Convert each component of the normalized floating-point vector into unsigned integer values.
544
+ ///
545
+ /// @see gtc_packing
546
+ /// @see vec2 unpackUnorm2x4(uint8 p)
547
+ GLM_FUNC_DECL uint8 packUnorm2x4(vec2 const& v);
548
+
549
+ /// Convert a packed integer to a normalized floating-point vector.
550
+ ///
551
+ /// @see gtc_packing
552
+ /// @see uint8 packUnorm2x4(vec2 const& v)
553
+ GLM_FUNC_DECL vec2 unpackUnorm2x4(uint8 p);
554
+
555
+ /// Convert each component of the normalized floating-point vector into unsigned integer values.
556
+ ///
557
+ /// @see gtc_packing
558
+ /// @see vec4 unpackUnorm4x4(uint16 p)
559
+ GLM_FUNC_DECL uint16 packUnorm4x4(vec4 const& v);
560
+
561
+ /// Convert a packed integer to a normalized floating-point vector.
562
+ ///
563
+ /// @see gtc_packing
564
+ /// @see uint16 packUnorm4x4(vec4 const& v)
565
+ GLM_FUNC_DECL vec4 unpackUnorm4x4(uint16 p);
566
+
567
+ /// Convert each component of the normalized floating-point vector into unsigned integer values.
568
+ ///
569
+ /// @see gtc_packing
570
+ /// @see vec3 unpackUnorm1x5_1x6_1x5(uint16 p)
571
+ GLM_FUNC_DECL uint16 packUnorm1x5_1x6_1x5(vec3 const& v);
572
+
573
+ /// Convert a packed integer to a normalized floating-point vector.
574
+ ///
575
+ /// @see gtc_packing
576
+ /// @see uint16 packUnorm1x5_1x6_1x5(vec3 const& v)
577
+ GLM_FUNC_DECL vec3 unpackUnorm1x5_1x6_1x5(uint16 p);
578
+
579
+ /// Convert each component of the normalized floating-point vector into unsigned integer values.
580
+ ///
581
+ /// @see gtc_packing
582
+ /// @see vec4 unpackUnorm3x5_1x1(uint16 p)
583
+ GLM_FUNC_DECL uint16 packUnorm3x5_1x1(vec4 const& v);
584
+
585
+ /// Convert a packed integer to a normalized floating-point vector.
586
+ ///
587
+ /// @see gtc_packing
588
+ /// @see uint16 packUnorm3x5_1x1(vec4 const& v)
589
+ GLM_FUNC_DECL vec4 unpackUnorm3x5_1x1(uint16 p);
590
+
591
+ /// Convert each component of the normalized floating-point vector into unsigned integer values.
592
+ ///
593
+ /// @see gtc_packing
594
+ /// @see vec3 unpackUnorm2x3_1x2(uint8 p)
595
+ GLM_FUNC_DECL uint8 packUnorm2x3_1x2(vec3 const& v);
596
+
597
+ /// Convert a packed integer to a normalized floating-point vector.
598
+ ///
599
+ /// @see gtc_packing
600
+ /// @see uint8 packUnorm2x3_1x2(vec3 const& v)
601
+ GLM_FUNC_DECL vec3 unpackUnorm2x3_1x2(uint8 p);
602
+
603
+
604
+
605
+ /// Convert each component from an integer vector into a packed integer.
606
+ ///
607
+ /// @see gtc_packing
608
+ /// @see i8vec2 unpackInt2x8(int16 p)
609
+ GLM_FUNC_DECL int16 packInt2x8(i8vec2 const& v);
610
+
611
+ /// Convert a packed integer into an integer vector.
612
+ ///
613
+ /// @see gtc_packing
614
+ /// @see int16 packInt2x8(i8vec2 const& v)
615
+ GLM_FUNC_DECL i8vec2 unpackInt2x8(int16 p);
616
+
617
+ /// Convert each component from an integer vector into a packed unsigned integer.
618
+ ///
619
+ /// @see gtc_packing
620
+ /// @see u8vec2 unpackInt2x8(uint16 p)
621
+ GLM_FUNC_DECL uint16 packUint2x8(u8vec2 const& v);
622
+
623
+ /// Convert a packed integer into an integer vector.
624
+ ///
625
+ /// @see gtc_packing
626
+ /// @see uint16 packInt2x8(u8vec2 const& v)
627
+ GLM_FUNC_DECL u8vec2 unpackUint2x8(uint16 p);
628
+
629
+ /// Convert each component from an integer vector into a packed integer.
630
+ ///
631
+ /// @see gtc_packing
632
+ /// @see i8vec4 unpackInt4x8(int32 p)
633
+ GLM_FUNC_DECL int32 packInt4x8(i8vec4 const& v);
634
+
635
+ /// Convert a packed integer into an integer vector.
636
+ ///
637
+ /// @see gtc_packing
638
+ /// @see int32 packInt2x8(i8vec4 const& v)
639
+ GLM_FUNC_DECL i8vec4 unpackInt4x8(int32 p);
640
+
641
+ /// Convert each component from an integer vector into a packed unsigned integer.
642
+ ///
643
+ /// @see gtc_packing
644
+ /// @see u8vec4 unpackUint4x8(uint32 p)
645
+ GLM_FUNC_DECL uint32 packUint4x8(u8vec4 const& v);
646
+
647
+ /// Convert a packed integer into an integer vector.
648
+ ///
649
+ /// @see gtc_packing
650
+ /// @see uint32 packUint4x8(u8vec2 const& v)
651
+ GLM_FUNC_DECL u8vec4 unpackUint4x8(uint32 p);
652
+
653
+ /// Convert each component from an integer vector into a packed integer.
654
+ ///
655
+ /// @see gtc_packing
656
+ /// @see i16vec2 unpackInt2x16(int p)
657
+ GLM_FUNC_DECL int packInt2x16(i16vec2 const& v);
658
+
659
+ /// Convert a packed integer into an integer vector.
660
+ ///
661
+ /// @see gtc_packing
662
+ /// @see int packInt2x16(i16vec2 const& v)
663
+ GLM_FUNC_DECL i16vec2 unpackInt2x16(int p);
664
+
665
+ /// Convert each component from an integer vector into a packed integer.
666
+ ///
667
+ /// @see gtc_packing
668
+ /// @see i16vec4 unpackInt4x16(int64 p)
669
+ GLM_FUNC_DECL int64 packInt4x16(i16vec4 const& v);
670
+
671
+ /// Convert a packed integer into an integer vector.
672
+ ///
673
+ /// @see gtc_packing
674
+ /// @see int64 packInt4x16(i16vec4 const& v)
675
+ GLM_FUNC_DECL i16vec4 unpackInt4x16(int64 p);
676
+
677
+ /// Convert each component from an integer vector into a packed unsigned integer.
678
+ ///
679
+ /// @see gtc_packing
680
+ /// @see u16vec2 unpackUint2x16(uint p)
681
+ GLM_FUNC_DECL uint packUint2x16(u16vec2 const& v);
682
+
683
+ /// Convert a packed integer into an integer vector.
684
+ ///
685
+ /// @see gtc_packing
686
+ /// @see uint packUint2x16(u16vec2 const& v)
687
+ GLM_FUNC_DECL u16vec2 unpackUint2x16(uint p);
688
+
689
+ /// Convert each component from an integer vector into a packed unsigned integer.
690
+ ///
691
+ /// @see gtc_packing
692
+ /// @see u16vec4 unpackUint4x16(uint64 p)
693
+ GLM_FUNC_DECL uint64 packUint4x16(u16vec4 const& v);
694
+
695
+ /// Convert a packed integer into an integer vector.
696
+ ///
697
+ /// @see gtc_packing
698
+ /// @see uint64 packUint4x16(u16vec4 const& v)
699
+ GLM_FUNC_DECL u16vec4 unpackUint4x16(uint64 p);
700
+
701
+ /// Convert each component from an integer vector into a packed integer.
702
+ ///
703
+ /// @see gtc_packing
704
+ /// @see i32vec2 unpackInt2x32(int p)
705
+ GLM_FUNC_DECL int64 packInt2x32(i32vec2 const& v);
706
+
707
+ /// Convert a packed integer into an integer vector.
708
+ ///
709
+ /// @see gtc_packing
710
+ /// @see int packInt2x16(i32vec2 const& v)
711
+ GLM_FUNC_DECL i32vec2 unpackInt2x32(int64 p);
712
+
713
+ /// Convert each component from an integer vector into a packed unsigned integer.
714
+ ///
715
+ /// @see gtc_packing
716
+ /// @see u32vec2 unpackUint2x32(int p)
717
+ GLM_FUNC_DECL uint64 packUint2x32(u32vec2 const& v);
718
+
719
+ /// Convert a packed integer into an integer vector.
720
+ ///
721
+ /// @see gtc_packing
722
+ /// @see int packUint2x16(u32vec2 const& v)
723
+ GLM_FUNC_DECL u32vec2 unpackUint2x32(uint64 p);
724
+
725
+ /// @}
726
+ }// namespace glm
727
+
728
+ #include "packing.inl"
cuda_extensions/third_party/glm/glm/gtc/packing.inl ADDED
@@ -0,0 +1,938 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref gtc_packing
2
+
3
+ #include "../ext/scalar_relational.hpp"
4
+ #include "../ext/vector_relational.hpp"
5
+ #include "../common.hpp"
6
+ #include "../vec2.hpp"
7
+ #include "../vec3.hpp"
8
+ #include "../vec4.hpp"
9
+ #include "../detail/type_half.hpp"
10
+ #include <cstring>
11
+ #include <limits>
12
+
13
+ namespace glm{
14
+ namespace detail
15
+ {
16
+ GLM_FUNC_QUALIFIER glm::uint16 float2half(glm::uint32 f)
17
+ {
18
+ // 10 bits => EE EEEFFFFF
19
+ // 11 bits => EEE EEFFFFFF
20
+ // Half bits => SEEEEEFF FFFFFFFF
21
+ // Float bits => SEEEEEEE EFFFFFFF FFFFFFFF FFFFFFFF
22
+
23
+ // 0x00007c00 => 00000000 00000000 01111100 00000000
24
+ // 0x000003ff => 00000000 00000000 00000011 11111111
25
+ // 0x38000000 => 00111000 00000000 00000000 00000000
26
+ // 0x7f800000 => 01111111 10000000 00000000 00000000
27
+ // 0x00008000 => 00000000 00000000 10000000 00000000
28
+ return
29
+ ((f >> 16) & 0x8000) | // sign
30
+ ((((f & 0x7f800000) - 0x38000000) >> 13) & 0x7c00) | // exponential
31
+ ((f >> 13) & 0x03ff); // Mantissa
32
+ }
33
+
34
+ GLM_FUNC_QUALIFIER glm::uint32 float2packed11(glm::uint32 f)
35
+ {
36
+ // 10 bits => EE EEEFFFFF
37
+ // 11 bits => EEE EEFFFFFF
38
+ // Half bits => SEEEEEFF FFFFFFFF
39
+ // Float bits => SEEEEEEE EFFFFFFF FFFFFFFF FFFFFFFF
40
+
41
+ // 0x000007c0 => 00000000 00000000 00000111 11000000
42
+ // 0x00007c00 => 00000000 00000000 01111100 00000000
43
+ // 0x000003ff => 00000000 00000000 00000011 11111111
44
+ // 0x38000000 => 00111000 00000000 00000000 00000000
45
+ // 0x7f800000 => 01111111 10000000 00000000 00000000
46
+ // 0x00008000 => 00000000 00000000 10000000 00000000
47
+ return
48
+ ((((f & 0x7f800000) - 0x38000000) >> 17) & 0x07c0) | // exponential
49
+ ((f >> 17) & 0x003f); // Mantissa
50
+ }
51
+
52
+ GLM_FUNC_QUALIFIER glm::uint32 packed11ToFloat(glm::uint32 p)
53
+ {
54
+ // 10 bits => EE EEEFFFFF
55
+ // 11 bits => EEE EEFFFFFF
56
+ // Half bits => SEEEEEFF FFFFFFFF
57
+ // Float bits => SEEEEEEE EFFFFFFF FFFFFFFF FFFFFFFF
58
+
59
+ // 0x000007c0 => 00000000 00000000 00000111 11000000
60
+ // 0x00007c00 => 00000000 00000000 01111100 00000000
61
+ // 0x000003ff => 00000000 00000000 00000011 11111111
62
+ // 0x38000000 => 00111000 00000000 00000000 00000000
63
+ // 0x7f800000 => 01111111 10000000 00000000 00000000
64
+ // 0x00008000 => 00000000 00000000 10000000 00000000
65
+ return
66
+ ((((p & 0x07c0) << 17) + 0x38000000) & 0x7f800000) | // exponential
67
+ ((p & 0x003f) << 17); // Mantissa
68
+ }
69
+
70
+ GLM_FUNC_QUALIFIER glm::uint32 float2packed10(glm::uint32 f)
71
+ {
72
+ // 10 bits => EE EEEFFFFF
73
+ // 11 bits => EEE EEFFFFFF
74
+ // Half bits => SEEEEEFF FFFFFFFF
75
+ // Float bits => SEEEEEEE EFFFFFFF FFFFFFFF FFFFFFFF
76
+
77
+ // 0x0000001F => 00000000 00000000 00000000 00011111
78
+ // 0x0000003F => 00000000 00000000 00000000 00111111
79
+ // 0x000003E0 => 00000000 00000000 00000011 11100000
80
+ // 0x000007C0 => 00000000 00000000 00000111 11000000
81
+ // 0x00007C00 => 00000000 00000000 01111100 00000000
82
+ // 0x000003FF => 00000000 00000000 00000011 11111111
83
+ // 0x38000000 => 00111000 00000000 00000000 00000000
84
+ // 0x7f800000 => 01111111 10000000 00000000 00000000
85
+ // 0x00008000 => 00000000 00000000 10000000 00000000
86
+ return
87
+ ((((f & 0x7f800000) - 0x38000000) >> 18) & 0x03E0) | // exponential
88
+ ((f >> 18) & 0x001f); // Mantissa
89
+ }
90
+
91
+ GLM_FUNC_QUALIFIER glm::uint32 packed10ToFloat(glm::uint32 p)
92
+ {
93
+ // 10 bits => EE EEEFFFFF
94
+ // 11 bits => EEE EEFFFFFF
95
+ // Half bits => SEEEEEFF FFFFFFFF
96
+ // Float bits => SEEEEEEE EFFFFFFF FFFFFFFF FFFFFFFF
97
+
98
+ // 0x0000001F => 00000000 00000000 00000000 00011111
99
+ // 0x0000003F => 00000000 00000000 00000000 00111111
100
+ // 0x000003E0 => 00000000 00000000 00000011 11100000
101
+ // 0x000007C0 => 00000000 00000000 00000111 11000000
102
+ // 0x00007C00 => 00000000 00000000 01111100 00000000
103
+ // 0x000003FF => 00000000 00000000 00000011 11111111
104
+ // 0x38000000 => 00111000 00000000 00000000 00000000
105
+ // 0x7f800000 => 01111111 10000000 00000000 00000000
106
+ // 0x00008000 => 00000000 00000000 10000000 00000000
107
+ return
108
+ ((((p & 0x03E0) << 18) + 0x38000000) & 0x7f800000) | // exponential
109
+ ((p & 0x001f) << 18); // Mantissa
110
+ }
111
+
112
+ GLM_FUNC_QUALIFIER glm::uint half2float(glm::uint h)
113
+ {
114
+ return ((h & 0x8000) << 16) | ((( h & 0x7c00) + 0x1C000) << 13) | ((h & 0x03FF) << 13);
115
+ }
116
+
117
+ GLM_FUNC_QUALIFIER glm::uint floatTo11bit(float x)
118
+ {
119
+ if(x == 0.0f)
120
+ return 0u;
121
+ else if(glm::isnan(x))
122
+ return ~0u;
123
+ else if(glm::isinf(x))
124
+ return 0x1Fu << 6u;
125
+
126
+ uint Pack = 0u;
127
+ memcpy(&Pack, &x, sizeof(Pack));
128
+ return float2packed11(Pack);
129
+ }
130
+
131
+ GLM_FUNC_QUALIFIER float packed11bitToFloat(glm::uint x)
132
+ {
133
+ if(x == 0)
134
+ return 0.0f;
135
+ else if(x == ((1 << 11) - 1))
136
+ return ~0;//NaN
137
+ else if(x == (0x1f << 6))
138
+ return ~0;//Inf
139
+
140
+ uint Result = packed11ToFloat(x);
141
+
142
+ float Temp = 0;
143
+ memcpy(&Temp, &Result, sizeof(Temp));
144
+ return Temp;
145
+ }
146
+
147
+ GLM_FUNC_QUALIFIER glm::uint floatTo10bit(float x)
148
+ {
149
+ if(x == 0.0f)
150
+ return 0u;
151
+ else if(glm::isnan(x))
152
+ return ~0u;
153
+ else if(glm::isinf(x))
154
+ return 0x1Fu << 5u;
155
+
156
+ uint Pack = 0;
157
+ memcpy(&Pack, &x, sizeof(Pack));
158
+ return float2packed10(Pack);
159
+ }
160
+
161
+ GLM_FUNC_QUALIFIER float packed10bitToFloat(glm::uint x)
162
+ {
163
+ if(x == 0)
164
+ return 0.0f;
165
+ else if(x == ((1 << 10) - 1))
166
+ return ~0;//NaN
167
+ else if(x == (0x1f << 5))
168
+ return ~0;//Inf
169
+
170
+ uint Result = packed10ToFloat(x);
171
+
172
+ float Temp = 0;
173
+ memcpy(&Temp, &Result, sizeof(Temp));
174
+ return Temp;
175
+ }
176
+
177
+ // GLM_FUNC_QUALIFIER glm::uint f11_f11_f10(float x, float y, float z)
178
+ // {
179
+ // return ((floatTo11bit(x) & ((1 << 11) - 1)) << 0) | ((floatTo11bit(y) & ((1 << 11) - 1)) << 11) | ((floatTo10bit(z) & ((1 << 10) - 1)) << 22);
180
+ // }
181
+
182
+ union u3u3u2
183
+ {
184
+ struct
185
+ {
186
+ uint x : 3;
187
+ uint y : 3;
188
+ uint z : 2;
189
+ } data;
190
+ uint8 pack;
191
+ };
192
+
193
+ union u4u4
194
+ {
195
+ struct
196
+ {
197
+ uint x : 4;
198
+ uint y : 4;
199
+ } data;
200
+ uint8 pack;
201
+ };
202
+
203
+ union u4u4u4u4
204
+ {
205
+ struct
206
+ {
207
+ uint x : 4;
208
+ uint y : 4;
209
+ uint z : 4;
210
+ uint w : 4;
211
+ } data;
212
+ uint16 pack;
213
+ };
214
+
215
+ union u5u6u5
216
+ {
217
+ struct
218
+ {
219
+ uint x : 5;
220
+ uint y : 6;
221
+ uint z : 5;
222
+ } data;
223
+ uint16 pack;
224
+ };
225
+
226
+ union u5u5u5u1
227
+ {
228
+ struct
229
+ {
230
+ uint x : 5;
231
+ uint y : 5;
232
+ uint z : 5;
233
+ uint w : 1;
234
+ } data;
235
+ uint16 pack;
236
+ };
237
+
238
+ union u10u10u10u2
239
+ {
240
+ struct
241
+ {
242
+ uint x : 10;
243
+ uint y : 10;
244
+ uint z : 10;
245
+ uint w : 2;
246
+ } data;
247
+ uint32 pack;
248
+ };
249
+
250
+ union i10i10i10i2
251
+ {
252
+ struct
253
+ {
254
+ int x : 10;
255
+ int y : 10;
256
+ int z : 10;
257
+ int w : 2;
258
+ } data;
259
+ uint32 pack;
260
+ };
261
+
262
+ union u9u9u9e5
263
+ {
264
+ struct
265
+ {
266
+ uint x : 9;
267
+ uint y : 9;
268
+ uint z : 9;
269
+ uint w : 5;
270
+ } data;
271
+ uint32 pack;
272
+ };
273
+
274
+ template<length_t L, qualifier Q>
275
+ struct compute_half
276
+ {};
277
+
278
+ template<qualifier Q>
279
+ struct compute_half<1, Q>
280
+ {
281
+ GLM_FUNC_QUALIFIER static vec<1, uint16, Q> pack(vec<1, float, Q> const& v)
282
+ {
283
+ int16 const Unpack(detail::toFloat16(v.x));
284
+ u16vec1 Packed;
285
+ memcpy(&Packed, &Unpack, sizeof(Packed));
286
+ return Packed;
287
+ }
288
+
289
+ GLM_FUNC_QUALIFIER static vec<1, float, Q> unpack(vec<1, uint16, Q> const& v)
290
+ {
291
+ i16vec1 Unpack;
292
+ memcpy(&Unpack, &v, sizeof(Unpack));
293
+ return vec<1, float, Q>(detail::toFloat32(v.x));
294
+ }
295
+ };
296
+
297
+ template<qualifier Q>
298
+ struct compute_half<2, Q>
299
+ {
300
+ GLM_FUNC_QUALIFIER static vec<2, uint16, Q> pack(vec<2, float, Q> const& v)
301
+ {
302
+ vec<2, int16, Q> const Unpack(detail::toFloat16(v.x), detail::toFloat16(v.y));
303
+ u16vec2 Packed;
304
+ memcpy(&Packed, &Unpack, sizeof(Packed));
305
+ return Packed;
306
+ }
307
+
308
+ GLM_FUNC_QUALIFIER static vec<2, float, Q> unpack(vec<2, uint16, Q> const& v)
309
+ {
310
+ i16vec2 Unpack;
311
+ memcpy(&Unpack, &v, sizeof(Unpack));
312
+ return vec<2, float, Q>(detail::toFloat32(v.x), detail::toFloat32(v.y));
313
+ }
314
+ };
315
+
316
+ template<qualifier Q>
317
+ struct compute_half<3, Q>
318
+ {
319
+ GLM_FUNC_QUALIFIER static vec<3, uint16, Q> pack(vec<3, float, Q> const& v)
320
+ {
321
+ vec<3, int16, Q> const Unpack(detail::toFloat16(v.x), detail::toFloat16(v.y), detail::toFloat16(v.z));
322
+ u16vec3 Packed;
323
+ memcpy(&Packed, &Unpack, sizeof(Packed));
324
+ return Packed;
325
+ }
326
+
327
+ GLM_FUNC_QUALIFIER static vec<3, float, Q> unpack(vec<3, uint16, Q> const& v)
328
+ {
329
+ i16vec3 Unpack;
330
+ memcpy(&Unpack, &v, sizeof(Unpack));
331
+ return vec<3, float, Q>(detail::toFloat32(v.x), detail::toFloat32(v.y), detail::toFloat32(v.z));
332
+ }
333
+ };
334
+
335
+ template<qualifier Q>
336
+ struct compute_half<4, Q>
337
+ {
338
+ GLM_FUNC_QUALIFIER static vec<4, uint16, Q> pack(vec<4, float, Q> const& v)
339
+ {
340
+ vec<4, int16, Q> const Unpack(detail::toFloat16(v.x), detail::toFloat16(v.y), detail::toFloat16(v.z), detail::toFloat16(v.w));
341
+ u16vec4 Packed;
342
+ memcpy(&Packed, &Unpack, sizeof(Packed));
343
+ return Packed;
344
+ }
345
+
346
+ GLM_FUNC_QUALIFIER static vec<4, float, Q> unpack(vec<4, uint16, Q> const& v)
347
+ {
348
+ i16vec4 Unpack;
349
+ memcpy(&Unpack, &v, sizeof(Unpack));
350
+ return vec<4, float, Q>(detail::toFloat32(v.x), detail::toFloat32(v.y), detail::toFloat32(v.z), detail::toFloat32(v.w));
351
+ }
352
+ };
353
+ }//namespace detail
354
+
355
+ GLM_FUNC_QUALIFIER uint8 packUnorm1x8(float v)
356
+ {
357
+ return static_cast<uint8>(round(clamp(v, 0.0f, 1.0f) * 255.0f));
358
+ }
359
+
360
+ GLM_FUNC_QUALIFIER float unpackUnorm1x8(uint8 p)
361
+ {
362
+ float const Unpack(p);
363
+ return Unpack * static_cast<float>(0.0039215686274509803921568627451); // 1 / 255
364
+ }
365
+
366
+ GLM_FUNC_QUALIFIER uint16 packUnorm2x8(vec2 const& v)
367
+ {
368
+ u8vec2 const Topack(round(clamp(v, 0.0f, 1.0f) * 255.0f));
369
+
370
+ uint16 Unpack = 0;
371
+ memcpy(&Unpack, &Topack, sizeof(Unpack));
372
+ return Unpack;
373
+ }
374
+
375
+ GLM_FUNC_QUALIFIER vec2 unpackUnorm2x8(uint16 p)
376
+ {
377
+ u8vec2 Unpack;
378
+ memcpy(&Unpack, &p, sizeof(Unpack));
379
+ return vec2(Unpack) * float(0.0039215686274509803921568627451); // 1 / 255
380
+ }
381
+
382
+ GLM_FUNC_QUALIFIER uint8 packSnorm1x8(float v)
383
+ {
384
+ int8 const Topack(static_cast<int8>(round(clamp(v ,-1.0f, 1.0f) * 127.0f)));
385
+ uint8 Packed = 0;
386
+ memcpy(&Packed, &Topack, sizeof(Packed));
387
+ return Packed;
388
+ }
389
+
390
+ GLM_FUNC_QUALIFIER float unpackSnorm1x8(uint8 p)
391
+ {
392
+ int8 Unpack = 0;
393
+ memcpy(&Unpack, &p, sizeof(Unpack));
394
+ return clamp(
395
+ static_cast<float>(Unpack) * 0.00787401574803149606299212598425f, // 1.0f / 127.0f
396
+ -1.0f, 1.0f);
397
+ }
398
+
399
+ GLM_FUNC_QUALIFIER uint16 packSnorm2x8(vec2 const& v)
400
+ {
401
+ i8vec2 const Topack(round(clamp(v, -1.0f, 1.0f) * 127.0f));
402
+ uint16 Packed = 0;
403
+ memcpy(&Packed, &Topack, sizeof(Packed));
404
+ return Packed;
405
+ }
406
+
407
+ GLM_FUNC_QUALIFIER vec2 unpackSnorm2x8(uint16 p)
408
+ {
409
+ i8vec2 Unpack;
410
+ memcpy(&Unpack, &p, sizeof(Unpack));
411
+ return clamp(
412
+ vec2(Unpack) * 0.00787401574803149606299212598425f, // 1.0f / 127.0f
413
+ -1.0f, 1.0f);
414
+ }
415
+
416
+ GLM_FUNC_QUALIFIER uint16 packUnorm1x16(float s)
417
+ {
418
+ return static_cast<uint16>(round(clamp(s, 0.0f, 1.0f) * 65535.0f));
419
+ }
420
+
421
+ GLM_FUNC_QUALIFIER float unpackUnorm1x16(uint16 p)
422
+ {
423
+ float const Unpack(p);
424
+ return Unpack * 1.5259021896696421759365224689097e-5f; // 1.0 / 65535.0
425
+ }
426
+
427
+ GLM_FUNC_QUALIFIER uint64 packUnorm4x16(vec4 const& v)
428
+ {
429
+ u16vec4 const Topack(round(clamp(v , 0.0f, 1.0f) * 65535.0f));
430
+ uint64 Packed = 0;
431
+ memcpy(&Packed, &Topack, sizeof(Packed));
432
+ return Packed;
433
+ }
434
+
435
+ GLM_FUNC_QUALIFIER vec4 unpackUnorm4x16(uint64 p)
436
+ {
437
+ u16vec4 Unpack;
438
+ memcpy(&Unpack, &p, sizeof(Unpack));
439
+ return vec4(Unpack) * 1.5259021896696421759365224689097e-5f; // 1.0 / 65535.0
440
+ }
441
+
442
+ GLM_FUNC_QUALIFIER uint16 packSnorm1x16(float v)
443
+ {
444
+ int16 const Topack = static_cast<int16>(round(clamp(v ,-1.0f, 1.0f) * 32767.0f));
445
+ uint16 Packed = 0;
446
+ memcpy(&Packed, &Topack, sizeof(Packed));
447
+ return Packed;
448
+ }
449
+
450
+ GLM_FUNC_QUALIFIER float unpackSnorm1x16(uint16 p)
451
+ {
452
+ int16 Unpack = 0;
453
+ memcpy(&Unpack, &p, sizeof(Unpack));
454
+ return clamp(
455
+ static_cast<float>(Unpack) * 3.0518509475997192297128208258309e-5f, //1.0f / 32767.0f,
456
+ -1.0f, 1.0f);
457
+ }
458
+
459
+ GLM_FUNC_QUALIFIER uint64 packSnorm4x16(vec4 const& v)
460
+ {
461
+ i16vec4 const Topack(round(clamp(v ,-1.0f, 1.0f) * 32767.0f));
462
+ uint64 Packed = 0;
463
+ memcpy(&Packed, &Topack, sizeof(Packed));
464
+ return Packed;
465
+ }
466
+
467
+ GLM_FUNC_QUALIFIER vec4 unpackSnorm4x16(uint64 p)
468
+ {
469
+ i16vec4 Unpack;
470
+ memcpy(&Unpack, &p, sizeof(Unpack));
471
+ return clamp(
472
+ vec4(Unpack) * 3.0518509475997192297128208258309e-5f, //1.0f / 32767.0f,
473
+ -1.0f, 1.0f);
474
+ }
475
+
476
+ GLM_FUNC_QUALIFIER uint16 packHalf1x16(float v)
477
+ {
478
+ int16 const Topack(detail::toFloat16(v));
479
+ uint16 Packed = 0;
480
+ memcpy(&Packed, &Topack, sizeof(Packed));
481
+ return Packed;
482
+ }
483
+
484
+ GLM_FUNC_QUALIFIER float unpackHalf1x16(uint16 v)
485
+ {
486
+ int16 Unpack = 0;
487
+ memcpy(&Unpack, &v, sizeof(Unpack));
488
+ return detail::toFloat32(Unpack);
489
+ }
490
+
491
+ GLM_FUNC_QUALIFIER uint64 packHalf4x16(glm::vec4 const& v)
492
+ {
493
+ i16vec4 const Unpack(
494
+ detail::toFloat16(v.x),
495
+ detail::toFloat16(v.y),
496
+ detail::toFloat16(v.z),
497
+ detail::toFloat16(v.w));
498
+ uint64 Packed = 0;
499
+ memcpy(&Packed, &Unpack, sizeof(Packed));
500
+ return Packed;
501
+ }
502
+
503
+ GLM_FUNC_QUALIFIER glm::vec4 unpackHalf4x16(uint64 v)
504
+ {
505
+ i16vec4 Unpack;
506
+ memcpy(&Unpack, &v, sizeof(Unpack));
507
+ return vec4(
508
+ detail::toFloat32(Unpack.x),
509
+ detail::toFloat32(Unpack.y),
510
+ detail::toFloat32(Unpack.z),
511
+ detail::toFloat32(Unpack.w));
512
+ }
513
+
514
+ GLM_FUNC_QUALIFIER uint32 packI3x10_1x2(ivec4 const& v)
515
+ {
516
+ detail::i10i10i10i2 Result;
517
+ Result.data.x = v.x;
518
+ Result.data.y = v.y;
519
+ Result.data.z = v.z;
520
+ Result.data.w = v.w;
521
+ return Result.pack;
522
+ }
523
+
524
+ GLM_FUNC_QUALIFIER ivec4 unpackI3x10_1x2(uint32 v)
525
+ {
526
+ detail::i10i10i10i2 Unpack;
527
+ Unpack.pack = v;
528
+ return ivec4(
529
+ Unpack.data.x,
530
+ Unpack.data.y,
531
+ Unpack.data.z,
532
+ Unpack.data.w);
533
+ }
534
+
535
+ GLM_FUNC_QUALIFIER uint32 packU3x10_1x2(uvec4 const& v)
536
+ {
537
+ detail::u10u10u10u2 Result;
538
+ Result.data.x = v.x;
539
+ Result.data.y = v.y;
540
+ Result.data.z = v.z;
541
+ Result.data.w = v.w;
542
+ return Result.pack;
543
+ }
544
+
545
+ GLM_FUNC_QUALIFIER uvec4 unpackU3x10_1x2(uint32 v)
546
+ {
547
+ detail::u10u10u10u2 Unpack;
548
+ Unpack.pack = v;
549
+ return uvec4(
550
+ Unpack.data.x,
551
+ Unpack.data.y,
552
+ Unpack.data.z,
553
+ Unpack.data.w);
554
+ }
555
+
556
+ GLM_FUNC_QUALIFIER uint32 packSnorm3x10_1x2(vec4 const& v)
557
+ {
558
+ ivec4 const Pack(round(clamp(v,-1.0f, 1.0f) * vec4(511.f, 511.f, 511.f, 1.f)));
559
+
560
+ detail::i10i10i10i2 Result;
561
+ Result.data.x = Pack.x;
562
+ Result.data.y = Pack.y;
563
+ Result.data.z = Pack.z;
564
+ Result.data.w = Pack.w;
565
+ return Result.pack;
566
+ }
567
+
568
+ GLM_FUNC_QUALIFIER vec4 unpackSnorm3x10_1x2(uint32 v)
569
+ {
570
+ detail::i10i10i10i2 Unpack;
571
+ Unpack.pack = v;
572
+
573
+ vec4 const Result(Unpack.data.x, Unpack.data.y, Unpack.data.z, Unpack.data.w);
574
+
575
+ return clamp(Result * vec4(1.f / 511.f, 1.f / 511.f, 1.f / 511.f, 1.f), -1.0f, 1.0f);
576
+ }
577
+
578
+ GLM_FUNC_QUALIFIER uint32 packUnorm3x10_1x2(vec4 const& v)
579
+ {
580
+ uvec4 const Unpack(round(clamp(v, 0.0f, 1.0f) * vec4(1023.f, 1023.f, 1023.f, 3.f)));
581
+
582
+ detail::u10u10u10u2 Result;
583
+ Result.data.x = Unpack.x;
584
+ Result.data.y = Unpack.y;
585
+ Result.data.z = Unpack.z;
586
+ Result.data.w = Unpack.w;
587
+ return Result.pack;
588
+ }
589
+
590
+ GLM_FUNC_QUALIFIER vec4 unpackUnorm3x10_1x2(uint32 v)
591
+ {
592
+ vec4 const ScaleFactors(1.0f / 1023.f, 1.0f / 1023.f, 1.0f / 1023.f, 1.0f / 3.f);
593
+
594
+ detail::u10u10u10u2 Unpack;
595
+ Unpack.pack = v;
596
+ return vec4(Unpack.data.x, Unpack.data.y, Unpack.data.z, Unpack.data.w) * ScaleFactors;
597
+ }
598
+
599
+ GLM_FUNC_QUALIFIER uint32 packF2x11_1x10(vec3 const& v)
600
+ {
601
+ return
602
+ ((detail::floatTo11bit(v.x) & ((1 << 11) - 1)) << 0) |
603
+ ((detail::floatTo11bit(v.y) & ((1 << 11) - 1)) << 11) |
604
+ ((detail::floatTo10bit(v.z) & ((1 << 10) - 1)) << 22);
605
+ }
606
+
607
+ GLM_FUNC_QUALIFIER vec3 unpackF2x11_1x10(uint32 v)
608
+ {
609
+ return vec3(
610
+ detail::packed11bitToFloat(v >> 0),
611
+ detail::packed11bitToFloat(v >> 11),
612
+ detail::packed10bitToFloat(v >> 22));
613
+ }
614
+
615
+ GLM_FUNC_QUALIFIER uint32 packF3x9_E1x5(vec3 const& v)
616
+ {
617
+ float const SharedExpMax = (pow(2.0f, 9.0f - 1.0f) / pow(2.0f, 9.0f)) * pow(2.0f, 31.f - 15.f);
618
+ vec3 const Color = clamp(v, 0.0f, SharedExpMax);
619
+ float const MaxColor = max(Color.x, max(Color.y, Color.z));
620
+
621
+ float const ExpSharedP = max(-15.f - 1.f, floor(log2(MaxColor))) + 1.0f + 15.f;
622
+ float const MaxShared = floor(MaxColor / pow(2.0f, (ExpSharedP - 15.f - 9.f)) + 0.5f);
623
+ float const ExpShared = equal(MaxShared, pow(2.0f, 9.0f), epsilon<float>()) ? ExpSharedP + 1.0f : ExpSharedP;
624
+
625
+ uvec3 const ColorComp(floor(Color / pow(2.f, (ExpShared - 15.f - 9.f)) + 0.5f));
626
+
627
+ detail::u9u9u9e5 Unpack;
628
+ Unpack.data.x = ColorComp.x;
629
+ Unpack.data.y = ColorComp.y;
630
+ Unpack.data.z = ColorComp.z;
631
+ Unpack.data.w = uint(ExpShared);
632
+ return Unpack.pack;
633
+ }
634
+
635
+ GLM_FUNC_QUALIFIER vec3 unpackF3x9_E1x5(uint32 v)
636
+ {
637
+ detail::u9u9u9e5 Unpack;
638
+ Unpack.pack = v;
639
+
640
+ return vec3(Unpack.data.x, Unpack.data.y, Unpack.data.z) * pow(2.0f, Unpack.data.w - 15.f - 9.f);
641
+ }
642
+
643
+ // Based on Brian Karis http://graphicrants.blogspot.fr/2009/04/rgbm-color-encoding.html
644
+ template<typename T, qualifier Q>
645
+ GLM_FUNC_QUALIFIER vec<4, T, Q> packRGBM(vec<3, T, Q> const& rgb)
646
+ {
647
+ vec<3, T, Q> const Color(rgb * static_cast<T>(1.0 / 6.0));
648
+ T Alpha = clamp(max(max(Color.x, Color.y), max(Color.z, static_cast<T>(1e-6))), static_cast<T>(0), static_cast<T>(1));
649
+ Alpha = ceil(Alpha * static_cast<T>(255.0)) / static_cast<T>(255.0);
650
+ return vec<4, T, Q>(Color / Alpha, Alpha);
651
+ }
652
+
653
+ template<typename T, qualifier Q>
654
+ GLM_FUNC_QUALIFIER vec<3, T, Q> unpackRGBM(vec<4, T, Q> const& rgbm)
655
+ {
656
+ return vec<3, T, Q>(rgbm.x, rgbm.y, rgbm.z) * rgbm.w * static_cast<T>(6);
657
+ }
658
+
659
+ template<length_t L, qualifier Q>
660
+ GLM_FUNC_QUALIFIER vec<L, uint16, Q> packHalf(vec<L, float, Q> const& v)
661
+ {
662
+ return detail::compute_half<L, Q>::pack(v);
663
+ }
664
+
665
+ template<length_t L, qualifier Q>
666
+ GLM_FUNC_QUALIFIER vec<L, float, Q> unpackHalf(vec<L, uint16, Q> const& v)
667
+ {
668
+ return detail::compute_half<L, Q>::unpack(v);
669
+ }
670
+
671
+ template<typename uintType, length_t L, typename floatType, qualifier Q>
672
+ GLM_FUNC_QUALIFIER vec<L, uintType, Q> packUnorm(vec<L, floatType, Q> const& v)
673
+ {
674
+ GLM_STATIC_ASSERT(std::numeric_limits<uintType>::is_integer, "uintType must be an integer type");
675
+ GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "floatType must be a floating point type");
676
+
677
+ return vec<L, uintType, Q>(round(clamp(v, static_cast<floatType>(0), static_cast<floatType>(1)) * static_cast<floatType>(std::numeric_limits<uintType>::max())));
678
+ }
679
+
680
+ template<typename floatType, length_t L, typename uintType, qualifier Q>
681
+ GLM_FUNC_QUALIFIER vec<L, floatType, Q> unpackUnorm(vec<L, uintType, Q> const& v)
682
+ {
683
+ GLM_STATIC_ASSERT(std::numeric_limits<uintType>::is_integer, "uintType must be an integer type");
684
+ GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "floatType must be a floating point type");
685
+
686
+ return vec<L, floatType, Q>(v) * (static_cast<floatType>(1) / static_cast<floatType>(std::numeric_limits<uintType>::max()));
687
+ }
688
+
689
+ template<typename intType, length_t L, typename floatType, qualifier Q>
690
+ GLM_FUNC_QUALIFIER vec<L, intType, Q> packSnorm(vec<L, floatType, Q> const& v)
691
+ {
692
+ GLM_STATIC_ASSERT(std::numeric_limits<intType>::is_integer, "uintType must be an integer type");
693
+ GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "floatType must be a floating point type");
694
+
695
+ return vec<L, intType, Q>(round(clamp(v , static_cast<floatType>(-1), static_cast<floatType>(1)) * static_cast<floatType>(std::numeric_limits<intType>::max())));
696
+ }
697
+
698
+ template<typename floatType, length_t L, typename intType, qualifier Q>
699
+ GLM_FUNC_QUALIFIER vec<L, floatType, Q> unpackSnorm(vec<L, intType, Q> const& v)
700
+ {
701
+ GLM_STATIC_ASSERT(std::numeric_limits<intType>::is_integer, "uintType must be an integer type");
702
+ GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "floatType must be a floating point type");
703
+
704
+ return clamp(vec<L, floatType, Q>(v) * (static_cast<floatType>(1) / static_cast<floatType>(std::numeric_limits<intType>::max())), static_cast<floatType>(-1), static_cast<floatType>(1));
705
+ }
706
+
707
+ GLM_FUNC_QUALIFIER uint8 packUnorm2x4(vec2 const& v)
708
+ {
709
+ u32vec2 const Unpack(round(clamp(v, 0.0f, 1.0f) * 15.0f));
710
+ detail::u4u4 Result;
711
+ Result.data.x = Unpack.x;
712
+ Result.data.y = Unpack.y;
713
+ return Result.pack;
714
+ }
715
+
716
+ GLM_FUNC_QUALIFIER vec2 unpackUnorm2x4(uint8 v)
717
+ {
718
+ float const ScaleFactor(1.f / 15.f);
719
+ detail::u4u4 Unpack;
720
+ Unpack.pack = v;
721
+ return vec2(Unpack.data.x, Unpack.data.y) * ScaleFactor;
722
+ }
723
+
724
+ GLM_FUNC_QUALIFIER uint16 packUnorm4x4(vec4 const& v)
725
+ {
726
+ u32vec4 const Unpack(round(clamp(v, 0.0f, 1.0f) * 15.0f));
727
+ detail::u4u4u4u4 Result;
728
+ Result.data.x = Unpack.x;
729
+ Result.data.y = Unpack.y;
730
+ Result.data.z = Unpack.z;
731
+ Result.data.w = Unpack.w;
732
+ return Result.pack;
733
+ }
734
+
735
+ GLM_FUNC_QUALIFIER vec4 unpackUnorm4x4(uint16 v)
736
+ {
737
+ float const ScaleFactor(1.f / 15.f);
738
+ detail::u4u4u4u4 Unpack;
739
+ Unpack.pack = v;
740
+ return vec4(Unpack.data.x, Unpack.data.y, Unpack.data.z, Unpack.data.w) * ScaleFactor;
741
+ }
742
+
743
+ GLM_FUNC_QUALIFIER uint16 packUnorm1x5_1x6_1x5(vec3 const& v)
744
+ {
745
+ u32vec3 const Unpack(round(clamp(v, 0.0f, 1.0f) * vec3(31.f, 63.f, 31.f)));
746
+ detail::u5u6u5 Result;
747
+ Result.data.x = Unpack.x;
748
+ Result.data.y = Unpack.y;
749
+ Result.data.z = Unpack.z;
750
+ return Result.pack;
751
+ }
752
+
753
+ GLM_FUNC_QUALIFIER vec3 unpackUnorm1x5_1x6_1x5(uint16 v)
754
+ {
755
+ vec3 const ScaleFactor(1.f / 31.f, 1.f / 63.f, 1.f / 31.f);
756
+ detail::u5u6u5 Unpack;
757
+ Unpack.pack = v;
758
+ return vec3(Unpack.data.x, Unpack.data.y, Unpack.data.z) * ScaleFactor;
759
+ }
760
+
761
+ GLM_FUNC_QUALIFIER uint16 packUnorm3x5_1x1(vec4 const& v)
762
+ {
763
+ u32vec4 const Unpack(round(clamp(v, 0.0f, 1.0f) * vec4(31.f, 31.f, 31.f, 1.f)));
764
+ detail::u5u5u5u1 Result;
765
+ Result.data.x = Unpack.x;
766
+ Result.data.y = Unpack.y;
767
+ Result.data.z = Unpack.z;
768
+ Result.data.w = Unpack.w;
769
+ return Result.pack;
770
+ }
771
+
772
+ GLM_FUNC_QUALIFIER vec4 unpackUnorm3x5_1x1(uint16 v)
773
+ {
774
+ vec4 const ScaleFactor(1.f / 31.f, 1.f / 31.f, 1.f / 31.f, 1.f);
775
+ detail::u5u5u5u1 Unpack;
776
+ Unpack.pack = v;
777
+ return vec4(Unpack.data.x, Unpack.data.y, Unpack.data.z, Unpack.data.w) * ScaleFactor;
778
+ }
779
+
780
+ GLM_FUNC_QUALIFIER uint8 packUnorm2x3_1x2(vec3 const& v)
781
+ {
782
+ u32vec3 const Unpack(round(clamp(v, 0.0f, 1.0f) * vec3(7.f, 7.f, 3.f)));
783
+ detail::u3u3u2 Result;
784
+ Result.data.x = Unpack.x;
785
+ Result.data.y = Unpack.y;
786
+ Result.data.z = Unpack.z;
787
+ return Result.pack;
788
+ }
789
+
790
+ GLM_FUNC_QUALIFIER vec3 unpackUnorm2x3_1x2(uint8 v)
791
+ {
792
+ vec3 const ScaleFactor(1.f / 7.f, 1.f / 7.f, 1.f / 3.f);
793
+ detail::u3u3u2 Unpack;
794
+ Unpack.pack = v;
795
+ return vec3(Unpack.data.x, Unpack.data.y, Unpack.data.z) * ScaleFactor;
796
+ }
797
+
798
+ GLM_FUNC_QUALIFIER int16 packInt2x8(i8vec2 const& v)
799
+ {
800
+ int16 Pack = 0;
801
+ memcpy(&Pack, &v, sizeof(Pack));
802
+ return Pack;
803
+ }
804
+
805
+ GLM_FUNC_QUALIFIER i8vec2 unpackInt2x8(int16 p)
806
+ {
807
+ i8vec2 Unpack;
808
+ memcpy(&Unpack, &p, sizeof(Unpack));
809
+ return Unpack;
810
+ }
811
+
812
+ GLM_FUNC_QUALIFIER uint16 packUint2x8(u8vec2 const& v)
813
+ {
814
+ uint16 Pack = 0;
815
+ memcpy(&Pack, &v, sizeof(Pack));
816
+ return Pack;
817
+ }
818
+
819
+ GLM_FUNC_QUALIFIER u8vec2 unpackUint2x8(uint16 p)
820
+ {
821
+ u8vec2 Unpack;
822
+ memcpy(&Unpack, &p, sizeof(Unpack));
823
+ return Unpack;
824
+ }
825
+
826
+ GLM_FUNC_QUALIFIER int32 packInt4x8(i8vec4 const& v)
827
+ {
828
+ int32 Pack = 0;
829
+ memcpy(&Pack, &v, sizeof(Pack));
830
+ return Pack;
831
+ }
832
+
833
+ GLM_FUNC_QUALIFIER i8vec4 unpackInt4x8(int32 p)
834
+ {
835
+ i8vec4 Unpack;
836
+ memcpy(&Unpack, &p, sizeof(Unpack));
837
+ return Unpack;
838
+ }
839
+
840
+ GLM_FUNC_QUALIFIER uint32 packUint4x8(u8vec4 const& v)
841
+ {
842
+ uint32 Pack = 0;
843
+ memcpy(&Pack, &v, sizeof(Pack));
844
+ return Pack;
845
+ }
846
+
847
+ GLM_FUNC_QUALIFIER u8vec4 unpackUint4x8(uint32 p)
848
+ {
849
+ u8vec4 Unpack;
850
+ memcpy(&Unpack, &p, sizeof(Unpack));
851
+ return Unpack;
852
+ }
853
+
854
+ GLM_FUNC_QUALIFIER int packInt2x16(i16vec2 const& v)
855
+ {
856
+ int Pack = 0;
857
+ memcpy(&Pack, &v, sizeof(Pack));
858
+ return Pack;
859
+ }
860
+
861
+ GLM_FUNC_QUALIFIER i16vec2 unpackInt2x16(int p)
862
+ {
863
+ i16vec2 Unpack;
864
+ memcpy(&Unpack, &p, sizeof(Unpack));
865
+ return Unpack;
866
+ }
867
+
868
+ GLM_FUNC_QUALIFIER int64 packInt4x16(i16vec4 const& v)
869
+ {
870
+ int64 Pack = 0;
871
+ memcpy(&Pack, &v, sizeof(Pack));
872
+ return Pack;
873
+ }
874
+
875
+ GLM_FUNC_QUALIFIER i16vec4 unpackInt4x16(int64 p)
876
+ {
877
+ i16vec4 Unpack;
878
+ memcpy(&Unpack, &p, sizeof(Unpack));
879
+ return Unpack;
880
+ }
881
+
882
+ GLM_FUNC_QUALIFIER uint packUint2x16(u16vec2 const& v)
883
+ {
884
+ uint Pack = 0;
885
+ memcpy(&Pack, &v, sizeof(Pack));
886
+ return Pack;
887
+ }
888
+
889
+ GLM_FUNC_QUALIFIER u16vec2 unpackUint2x16(uint p)
890
+ {
891
+ u16vec2 Unpack;
892
+ memcpy(&Unpack, &p, sizeof(Unpack));
893
+ return Unpack;
894
+ }
895
+
896
+ GLM_FUNC_QUALIFIER uint64 packUint4x16(u16vec4 const& v)
897
+ {
898
+ uint64 Pack = 0;
899
+ memcpy(&Pack, &v, sizeof(Pack));
900
+ return Pack;
901
+ }
902
+
903
+ GLM_FUNC_QUALIFIER u16vec4 unpackUint4x16(uint64 p)
904
+ {
905
+ u16vec4 Unpack;
906
+ memcpy(&Unpack, &p, sizeof(Unpack));
907
+ return Unpack;
908
+ }
909
+
910
+ GLM_FUNC_QUALIFIER int64 packInt2x32(i32vec2 const& v)
911
+ {
912
+ int64 Pack = 0;
913
+ memcpy(&Pack, &v, sizeof(Pack));
914
+ return Pack;
915
+ }
916
+
917
+ GLM_FUNC_QUALIFIER i32vec2 unpackInt2x32(int64 p)
918
+ {
919
+ i32vec2 Unpack;
920
+ memcpy(&Unpack, &p, sizeof(Unpack));
921
+ return Unpack;
922
+ }
923
+
924
+ GLM_FUNC_QUALIFIER uint64 packUint2x32(u32vec2 const& v)
925
+ {
926
+ uint64 Pack = 0;
927
+ memcpy(&Pack, &v, sizeof(Pack));
928
+ return Pack;
929
+ }
930
+
931
+ GLM_FUNC_QUALIFIER u32vec2 unpackUint2x32(uint64 p)
932
+ {
933
+ u32vec2 Unpack;
934
+ memcpy(&Unpack, &p, sizeof(Unpack));
935
+ return Unpack;
936
+ }
937
+ }//namespace glm
938
+
cuda_extensions/third_party/glm/glm/gtc/quaternion.hpp ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref gtc_quaternion
2
+ /// @file glm/gtc/quaternion.hpp
3
+ ///
4
+ /// @see core (dependence)
5
+ /// @see gtc_constants (dependence)
6
+ ///
7
+ /// @defgroup gtc_quaternion GLM_GTC_quaternion
8
+ /// @ingroup gtc
9
+ ///
10
+ /// Include <glm/gtc/quaternion.hpp> to use the features of this extension.
11
+ ///
12
+ /// Defines a templated quaternion type and several quaternion operations.
13
+
14
+ #pragma once
15
+
16
+ // Dependency:
17
+ #include "../gtc/constants.hpp"
18
+ #include "../gtc/matrix_transform.hpp"
19
+ #include "../ext/vector_relational.hpp"
20
+ #include "../ext/quaternion_common.hpp"
21
+ #include "../ext/quaternion_float.hpp"
22
+ #include "../ext/quaternion_float_precision.hpp"
23
+ #include "../ext/quaternion_double.hpp"
24
+ #include "../ext/quaternion_double_precision.hpp"
25
+ #include "../ext/quaternion_relational.hpp"
26
+ #include "../ext/quaternion_geometric.hpp"
27
+ #include "../ext/quaternion_trigonometric.hpp"
28
+ #include "../ext/quaternion_transform.hpp"
29
+ #include "../detail/type_mat3x3.hpp"
30
+ #include "../detail/type_mat4x4.hpp"
31
+ #include "../detail/type_vec3.hpp"
32
+ #include "../detail/type_vec4.hpp"
33
+
34
+ #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
35
+ # pragma message("GLM: GLM_GTC_quaternion extension included")
36
+ #endif
37
+
38
+ namespace glm
39
+ {
40
+ /// @addtogroup gtc_quaternion
41
+ /// @{
42
+
43
+ /// Returns euler angles, pitch as x, yaw as y, roll as z.
44
+ /// The result is expressed in radians.
45
+ ///
46
+ /// @tparam T Floating-point scalar types.
47
+ ///
48
+ /// @see gtc_quaternion
49
+ template<typename T, qualifier Q>
50
+ GLM_FUNC_DECL vec<3, T, Q> eulerAngles(qua<T, Q> const& x);
51
+
52
+ /// Returns roll value of euler angles expressed in radians.
53
+ ///
54
+ /// @tparam T Floating-point scalar types.
55
+ ///
56
+ /// @see gtc_quaternion
57
+ template<typename T, qualifier Q>
58
+ GLM_FUNC_DECL T roll(qua<T, Q> const& x);
59
+
60
+ /// Returns pitch value of euler angles expressed in radians.
61
+ ///
62
+ /// @tparam T Floating-point scalar types.
63
+ ///
64
+ /// @see gtc_quaternion
65
+ template<typename T, qualifier Q>
66
+ GLM_FUNC_DECL T pitch(qua<T, Q> const& x);
67
+
68
+ /// Returns yaw value of euler angles expressed in radians.
69
+ ///
70
+ /// @tparam T Floating-point scalar types.
71
+ ///
72
+ /// @see gtc_quaternion
73
+ template<typename T, qualifier Q>
74
+ GLM_FUNC_DECL T yaw(qua<T, Q> const& x);
75
+
76
+ /// Converts a quaternion to a 3 * 3 matrix.
77
+ ///
78
+ /// @tparam T Floating-point scalar types.
79
+ ///
80
+ /// @see gtc_quaternion
81
+ template<typename T, qualifier Q>
82
+ GLM_FUNC_DECL mat<3, 3, T, Q> mat3_cast(qua<T, Q> const& x);
83
+
84
+ /// Converts a quaternion to a 4 * 4 matrix.
85
+ ///
86
+ /// @tparam T Floating-point scalar types.
87
+ ///
88
+ /// @see gtc_quaternion
89
+ template<typename T, qualifier Q>
90
+ GLM_FUNC_DECL mat<4, 4, T, Q> mat4_cast(qua<T, Q> const& x);
91
+
92
+ /// Converts a pure rotation 3 * 3 matrix to a quaternion.
93
+ ///
94
+ /// @tparam T Floating-point scalar types.
95
+ ///
96
+ /// @see gtc_quaternion
97
+ template<typename T, qualifier Q>
98
+ GLM_FUNC_DECL qua<T, Q> quat_cast(mat<3, 3, T, Q> const& x);
99
+
100
+ /// Converts a pure rotation 4 * 4 matrix to a quaternion.
101
+ ///
102
+ /// @tparam T Floating-point scalar types.
103
+ ///
104
+ /// @see gtc_quaternion
105
+ template<typename T, qualifier Q>
106
+ GLM_FUNC_DECL qua<T, Q> quat_cast(mat<4, 4, T, Q> const& x);
107
+
108
+ /// Returns the component-wise comparison result of x < y.
109
+ ///
110
+ /// @tparam T Floating-point scalar types
111
+ /// @tparam Q Value from qualifier enum
112
+ ///
113
+ /// @see ext_quaternion_relational
114
+ template<typename T, qualifier Q>
115
+ GLM_FUNC_DECL vec<4, bool, Q> lessThan(qua<T, Q> const& x, qua<T, Q> const& y);
116
+
117
+ /// Returns the component-wise comparison of result x <= y.
118
+ ///
119
+ /// @tparam T Floating-point scalar types
120
+ /// @tparam Q Value from qualifier enum
121
+ ///
122
+ /// @see ext_quaternion_relational
123
+ template<typename T, qualifier Q>
124
+ GLM_FUNC_DECL vec<4, bool, Q> lessThanEqual(qua<T, Q> const& x, qua<T, Q> const& y);
125
+
126
+ /// Returns the component-wise comparison of result x > y.
127
+ ///
128
+ /// @tparam T Floating-point scalar types
129
+ /// @tparam Q Value from qualifier enum
130
+ ///
131
+ /// @see ext_quaternion_relational
132
+ template<typename T, qualifier Q>
133
+ GLM_FUNC_DECL vec<4, bool, Q> greaterThan(qua<T, Q> const& x, qua<T, Q> const& y);
134
+
135
+ /// Returns the component-wise comparison of result x >= y.
136
+ ///
137
+ /// @tparam T Floating-point scalar types
138
+ /// @tparam Q Value from qualifier enum
139
+ ///
140
+ /// @see ext_quaternion_relational
141
+ template<typename T, qualifier Q>
142
+ GLM_FUNC_DECL vec<4, bool, Q> greaterThanEqual(qua<T, Q> const& x, qua<T, Q> const& y);
143
+
144
+ /// Build a look at quaternion based on the default handedness.
145
+ ///
146
+ /// @param direction Desired forward direction. Needs to be normalized.
147
+ /// @param up Up vector, how the camera is oriented. Typically (0, 1, 0).
148
+ template<typename T, qualifier Q>
149
+ GLM_FUNC_DECL qua<T, Q> quatLookAt(
150
+ vec<3, T, Q> const& direction,
151
+ vec<3, T, Q> const& up);
152
+
153
+ /// Build a right-handed look at quaternion.
154
+ ///
155
+ /// @param direction Desired forward direction onto which the -z-axis gets mapped. Needs to be normalized.
156
+ /// @param up Up vector, how the camera is oriented. Typically (0, 1, 0).
157
+ template<typename T, qualifier Q>
158
+ GLM_FUNC_DECL qua<T, Q> quatLookAtRH(
159
+ vec<3, T, Q> const& direction,
160
+ vec<3, T, Q> const& up);
161
+
162
+ /// Build a left-handed look at quaternion.
163
+ ///
164
+ /// @param direction Desired forward direction onto which the +z-axis gets mapped. Needs to be normalized.
165
+ /// @param up Up vector, how the camera is oriented. Typically (0, 1, 0).
166
+ template<typename T, qualifier Q>
167
+ GLM_FUNC_DECL qua<T, Q> quatLookAtLH(
168
+ vec<3, T, Q> const& direction,
169
+ vec<3, T, Q> const& up);
170
+ /// @}
171
+ } //namespace glm
172
+
173
+ #include "quaternion.inl"
cuda_extensions/third_party/glm/glm/gtc/quaternion.inl ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include "../trigonometric.hpp"
2
+ #include "../geometric.hpp"
3
+ #include "../exponential.hpp"
4
+ #include "epsilon.hpp"
5
+ #include <limits>
6
+
7
+ namespace glm
8
+ {
9
+ template<typename T, qualifier Q>
10
+ GLM_FUNC_QUALIFIER vec<3, T, Q> eulerAngles(qua<T, Q> const& x)
11
+ {
12
+ return vec<3, T, Q>(pitch(x), yaw(x), roll(x));
13
+ }
14
+
15
+ template<typename T, qualifier Q>
16
+ GLM_FUNC_QUALIFIER T roll(qua<T, Q> const& q)
17
+ {
18
+ T const y = static_cast<T>(2) * (q.x * q.y + q.w * q.z);
19
+ T const x = q.w * q.w + q.x * q.x - q.y * q.y - q.z * q.z;
20
+
21
+ if(all(equal(vec<2, T, Q>(x, y), vec<2, T, Q>(0), epsilon<T>()))) //avoid atan2(0,0) - handle singularity - Matiis
22
+ return static_cast<T>(0);
23
+
24
+ return static_cast<T>(atan(y, x));
25
+ }
26
+
27
+ template<typename T, qualifier Q>
28
+ GLM_FUNC_QUALIFIER T pitch(qua<T, Q> const& q)
29
+ {
30
+ //return T(atan(T(2) * (q.y * q.z + q.w * q.x), q.w * q.w - q.x * q.x - q.y * q.y + q.z * q.z));
31
+ T const y = static_cast<T>(2) * (q.y * q.z + q.w * q.x);
32
+ T const x = q.w * q.w - q.x * q.x - q.y * q.y + q.z * q.z;
33
+
34
+ if(all(equal(vec<2, T, Q>(x, y), vec<2, T, Q>(0), epsilon<T>()))) //avoid atan2(0,0) - handle singularity - Matiis
35
+ return static_cast<T>(static_cast<T>(2) * atan(q.x, q.w));
36
+
37
+ return static_cast<T>(atan(y, x));
38
+ }
39
+
40
+ template<typename T, qualifier Q>
41
+ GLM_FUNC_QUALIFIER T yaw(qua<T, Q> const& q)
42
+ {
43
+ return asin(clamp(static_cast<T>(-2) * (q.x * q.z - q.w * q.y), static_cast<T>(-1), static_cast<T>(1)));
44
+ }
45
+
46
+ template<typename T, qualifier Q>
47
+ GLM_FUNC_QUALIFIER mat<3, 3, T, Q> mat3_cast(qua<T, Q> const& q)
48
+ {
49
+ mat<3, 3, T, Q> Result(T(1));
50
+ T qxx(q.x * q.x);
51
+ T qyy(q.y * q.y);
52
+ T qzz(q.z * q.z);
53
+ T qxz(q.x * q.z);
54
+ T qxy(q.x * q.y);
55
+ T qyz(q.y * q.z);
56
+ T qwx(q.w * q.x);
57
+ T qwy(q.w * q.y);
58
+ T qwz(q.w * q.z);
59
+
60
+ Result[0][0] = T(1) - T(2) * (qyy + qzz);
61
+ Result[0][1] = T(2) * (qxy + qwz);
62
+ Result[0][2] = T(2) * (qxz - qwy);
63
+
64
+ Result[1][0] = T(2) * (qxy - qwz);
65
+ Result[1][1] = T(1) - T(2) * (qxx + qzz);
66
+ Result[1][2] = T(2) * (qyz + qwx);
67
+
68
+ Result[2][0] = T(2) * (qxz + qwy);
69
+ Result[2][1] = T(2) * (qyz - qwx);
70
+ Result[2][2] = T(1) - T(2) * (qxx + qyy);
71
+ return Result;
72
+ }
73
+
74
+ template<typename T, qualifier Q>
75
+ GLM_FUNC_QUALIFIER mat<4, 4, T, Q> mat4_cast(qua<T, Q> const& q)
76
+ {
77
+ return mat<4, 4, T, Q>(mat3_cast(q));
78
+ }
79
+
80
+ template<typename T, qualifier Q>
81
+ GLM_FUNC_QUALIFIER qua<T, Q> quat_cast(mat<3, 3, T, Q> const& m)
82
+ {
83
+ T fourXSquaredMinus1 = m[0][0] - m[1][1] - m[2][2];
84
+ T fourYSquaredMinus1 = m[1][1] - m[0][0] - m[2][2];
85
+ T fourZSquaredMinus1 = m[2][2] - m[0][0] - m[1][1];
86
+ T fourWSquaredMinus1 = m[0][0] + m[1][1] + m[2][2];
87
+
88
+ int biggestIndex = 0;
89
+ T fourBiggestSquaredMinus1 = fourWSquaredMinus1;
90
+ if(fourXSquaredMinus1 > fourBiggestSquaredMinus1)
91
+ {
92
+ fourBiggestSquaredMinus1 = fourXSquaredMinus1;
93
+ biggestIndex = 1;
94
+ }
95
+ if(fourYSquaredMinus1 > fourBiggestSquaredMinus1)
96
+ {
97
+ fourBiggestSquaredMinus1 = fourYSquaredMinus1;
98
+ biggestIndex = 2;
99
+ }
100
+ if(fourZSquaredMinus1 > fourBiggestSquaredMinus1)
101
+ {
102
+ fourBiggestSquaredMinus1 = fourZSquaredMinus1;
103
+ biggestIndex = 3;
104
+ }
105
+
106
+ T biggestVal = sqrt(fourBiggestSquaredMinus1 + static_cast<T>(1)) * static_cast<T>(0.5);
107
+ T mult = static_cast<T>(0.25) / biggestVal;
108
+
109
+ switch(biggestIndex)
110
+ {
111
+ case 0:
112
+ return qua<T, Q>(biggestVal, (m[1][2] - m[2][1]) * mult, (m[2][0] - m[0][2]) * mult, (m[0][1] - m[1][0]) * mult);
113
+ case 1:
114
+ return qua<T, Q>((m[1][2] - m[2][1]) * mult, biggestVal, (m[0][1] + m[1][0]) * mult, (m[2][0] + m[0][2]) * mult);
115
+ case 2:
116
+ return qua<T, Q>((m[2][0] - m[0][2]) * mult, (m[0][1] + m[1][0]) * mult, biggestVal, (m[1][2] + m[2][1]) * mult);
117
+ case 3:
118
+ return qua<T, Q>((m[0][1] - m[1][0]) * mult, (m[2][0] + m[0][2]) * mult, (m[1][2] + m[2][1]) * mult, biggestVal);
119
+ default: // Silence a -Wswitch-default warning in GCC. Should never actually get here. Assert is just for sanity.
120
+ assert(false);
121
+ return qua<T, Q>(1, 0, 0, 0);
122
+ }
123
+ }
124
+
125
+ template<typename T, qualifier Q>
126
+ GLM_FUNC_QUALIFIER qua<T, Q> quat_cast(mat<4, 4, T, Q> const& m4)
127
+ {
128
+ return quat_cast(mat<3, 3, T, Q>(m4));
129
+ }
130
+
131
+ template<typename T, qualifier Q>
132
+ GLM_FUNC_QUALIFIER vec<4, bool, Q> lessThan(qua<T, Q> const& x, qua<T, Q> const& y)
133
+ {
134
+ vec<4, bool, Q> Result;
135
+ for(length_t i = 0; i < x.length(); ++i)
136
+ Result[i] = x[i] < y[i];
137
+ return Result;
138
+ }
139
+
140
+ template<typename T, qualifier Q>
141
+ GLM_FUNC_QUALIFIER vec<4, bool, Q> lessThanEqual(qua<T, Q> const& x, qua<T, Q> const& y)
142
+ {
143
+ vec<4, bool, Q> Result;
144
+ for(length_t i = 0; i < x.length(); ++i)
145
+ Result[i] = x[i] <= y[i];
146
+ return Result;
147
+ }
148
+
149
+ template<typename T, qualifier Q>
150
+ GLM_FUNC_QUALIFIER vec<4, bool, Q> greaterThan(qua<T, Q> const& x, qua<T, Q> const& y)
151
+ {
152
+ vec<4, bool, Q> Result;
153
+ for(length_t i = 0; i < x.length(); ++i)
154
+ Result[i] = x[i] > y[i];
155
+ return Result;
156
+ }
157
+
158
+ template<typename T, qualifier Q>
159
+ GLM_FUNC_QUALIFIER vec<4, bool, Q> greaterThanEqual(qua<T, Q> const& x, qua<T, Q> const& y)
160
+ {
161
+ vec<4, bool, Q> Result;
162
+ for(length_t i = 0; i < x.length(); ++i)
163
+ Result[i] = x[i] >= y[i];
164
+ return Result;
165
+ }
166
+
167
+
168
+ template<typename T, qualifier Q>
169
+ GLM_FUNC_QUALIFIER qua<T, Q> quatLookAt(vec<3, T, Q> const& direction, vec<3, T, Q> const& up)
170
+ {
171
+ # if GLM_CONFIG_CLIP_CONTROL & GLM_CLIP_CONTROL_LH_BIT
172
+ return quatLookAtLH(direction, up);
173
+ # else
174
+ return quatLookAtRH(direction, up);
175
+ # endif
176
+ }
177
+
178
+ template<typename T, qualifier Q>
179
+ GLM_FUNC_QUALIFIER qua<T, Q> quatLookAtRH(vec<3, T, Q> const& direction, vec<3, T, Q> const& up)
180
+ {
181
+ mat<3, 3, T, Q> Result;
182
+
183
+ Result[2] = -direction;
184
+ vec<3, T, Q> const& Right = cross(up, Result[2]);
185
+ Result[0] = Right * inversesqrt(max(static_cast<T>(0.00001), dot(Right, Right)));
186
+ Result[1] = cross(Result[2], Result[0]);
187
+
188
+ return quat_cast(Result);
189
+ }
190
+
191
+ template<typename T, qualifier Q>
192
+ GLM_FUNC_QUALIFIER qua<T, Q> quatLookAtLH(vec<3, T, Q> const& direction, vec<3, T, Q> const& up)
193
+ {
194
+ mat<3, 3, T, Q> Result;
195
+
196
+ Result[2] = direction;
197
+ vec<3, T, Q> const& Right = cross(up, Result[2]);
198
+ Result[0] = Right * inversesqrt(max(static_cast<T>(0.00001), dot(Right, Right)));
199
+ Result[1] = cross(Result[2], Result[0]);
200
+
201
+ return quat_cast(Result);
202
+ }
203
+ }//namespace glm
204
+
205
+ #if GLM_CONFIG_SIMD == GLM_ENABLE
206
+ # include "quaternion_simd.inl"
207
+ #endif
208
+
cuda_extensions/third_party/glm/glm/gtc/quaternion_simd.inl ADDED
File without changes
cuda_extensions/third_party/glm/glm/gtc/random.hpp ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /// @ref gtc_random
2
+ /// @file glm/gtc/random.hpp
3
+ ///
4
+ /// @see core (dependence)
5
+ /// @see gtx_random (extended)
6
+ ///
7
+ /// @defgroup gtc_random GLM_GTC_random
8
+ /// @ingroup gtc
9
+ ///
10
+ /// Include <glm/gtc/random.hpp> to use the features of this extension.
11
+ ///
12
+ /// Generate random number from various distribution methods.
13
+
14
+ #pragma once
15
+
16
+ // Dependency:
17
+ #include "../ext/scalar_int_sized.hpp"
18
+ #include "../ext/scalar_uint_sized.hpp"
19
+ #include "../detail/qualifier.hpp"
20
+
21
+ #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
22
+ # pragma message("GLM: GLM_GTC_random extension included")
23
+ #endif
24
+
25
+ namespace glm
26
+ {
27
+ /// @addtogroup gtc_random
28
+ /// @{
29
+
30
+ /// Generate random numbers in the interval [Min, Max], according a linear distribution
31
+ ///
32
+ /// @param Min Minimum value included in the sampling
33
+ /// @param Max Maximum value included in the sampling
34
+ /// @tparam genType Value type. Currently supported: float or double scalars.
35
+ /// @see gtc_random
36
+ template<typename genType>
37
+ GLM_FUNC_DECL genType linearRand(genType Min, genType Max);
38
+
39
+ /// Generate random numbers in the interval [Min, Max], according a linear distribution
40
+ ///
41
+ /// @param Min Minimum value included in the sampling
42
+ /// @param Max Maximum value included in the sampling
43
+ /// @tparam T Value type. Currently supported: float or double.
44
+ ///
45
+ /// @see gtc_random
46
+ template<length_t L, typename T, qualifier Q>
47
+ GLM_FUNC_DECL vec<L, T, Q> linearRand(vec<L, T, Q> const& Min, vec<L, T, Q> const& Max);
48
+
49
+ /// Generate random numbers in the interval [Min, Max], according a gaussian distribution
50
+ ///
51
+ /// @see gtc_random
52
+ template<typename genType>
53
+ GLM_FUNC_DECL genType gaussRand(genType Mean, genType Deviation);
54
+
55
+ /// Generate a random 2D vector which coordinates are regularly distributed on a circle of a given radius
56
+ ///
57
+ /// @see gtc_random
58
+ template<typename T>
59
+ GLM_FUNC_DECL vec<2, T, defaultp> circularRand(T Radius);
60
+
61
+ /// Generate a random 3D vector which coordinates are regularly distributed on a sphere of a given radius
62
+ ///
63
+ /// @see gtc_random
64
+ template<typename T>
65
+ GLM_FUNC_DECL vec<3, T, defaultp> sphericalRand(T Radius);
66
+
67
+ /// Generate a random 2D vector which coordinates are regularly distributed within the area of a disk of a given radius
68
+ ///
69
+ /// @see gtc_random
70
+ template<typename T>
71
+ GLM_FUNC_DECL vec<2, T, defaultp> diskRand(T Radius);
72
+
73
+ /// Generate a random 3D vector which coordinates are regularly distributed within the volume of a ball of a given radius
74
+ ///
75
+ /// @see gtc_random
76
+ template<typename T>
77
+ GLM_FUNC_DECL vec<3, T, defaultp> ballRand(T Radius);
78
+
79
+ /// @}
80
+ }//namespace glm
81
+
82
+ #include "random.inl"