cglm 0.1.0 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -1
  3. data/Gemfile.lock +18 -16
  4. data/README.md +2 -0
  5. data/cglm.gemspec +3 -3
  6. data/ext/cglm/cglm-0.6.2/include/cglm/affine-mat.h +168 -0
  7. data/ext/cglm/cglm-0.6.2/include/cglm/affine.h +490 -0
  8. data/ext/cglm/cglm-0.6.2/include/cglm/applesimd.h +95 -0
  9. data/ext/cglm/cglm-0.6.2/include/cglm/bezier.h +154 -0
  10. data/ext/cglm/cglm-0.6.2/include/cglm/box.h +279 -0
  11. data/ext/cglm/cglm-0.6.2/include/cglm/call/affine.h +117 -0
  12. data/ext/cglm/cglm-0.6.2/include/cglm/call/bezier.h +31 -0
  13. data/ext/cglm/cglm-0.6.2/include/cglm/call/box.h +79 -0
  14. data/ext/cglm/cglm-0.6.2/include/cglm/call/cam.h +143 -0
  15. data/ext/cglm/cglm-0.6.2/include/cglm/call/curve.h +23 -0
  16. data/ext/cglm/cglm-0.6.2/include/cglm/call/ease.h +143 -0
  17. data/ext/cglm/cglm-0.6.2/include/cglm/call/euler.h +55 -0
  18. data/ext/cglm/cglm-0.6.2/include/cglm/call/frustum.h +41 -0
  19. data/ext/cglm/cglm-0.6.2/include/cglm/call/io.h +44 -0
  20. data/ext/cglm/cglm-0.6.2/include/cglm/call/mat3.h +86 -0
  21. data/ext/cglm/cglm-0.6.2/include/cglm/call/mat4.h +127 -0
  22. data/ext/cglm/cglm-0.6.2/include/cglm/call/plane.h +23 -0
  23. data/ext/cglm/cglm-0.6.2/include/cglm/call/project.h +33 -0
  24. data/ext/cglm/cglm-0.6.2/include/cglm/call/quat.h +159 -0
  25. data/ext/cglm/cglm-0.6.2/include/cglm/call/sphere.h +39 -0
  26. data/ext/cglm/cglm-0.6.2/include/cglm/call/vec3.h +312 -0
  27. data/ext/cglm/cglm-0.6.2/include/cglm/call/vec4.h +290 -0
  28. data/ext/cglm/cglm-0.6.2/include/cglm/call.h +36 -0
  29. data/ext/cglm/cglm-0.6.2/include/cglm/cam.h +585 -0
  30. data/ext/cglm/cglm-0.6.2/include/cglm/cglm.h +32 -0
  31. data/ext/cglm/cglm-0.6.2/include/cglm/color.h +26 -0
  32. data/ext/cglm/cglm-0.6.2/include/cglm/common.h +37 -0
  33. data/ext/cglm/cglm-0.6.2/include/cglm/curve.h +40 -0
  34. data/ext/cglm/cglm-0.6.2/include/cglm/ease.h +317 -0
  35. data/ext/cglm/cglm-0.6.2/include/cglm/euler.h +453 -0
  36. data/ext/cglm/cglm-0.6.2/include/cglm/frustum.h +255 -0
  37. data/ext/cglm/cglm-0.6.2/include/cglm/io.h +203 -0
  38. data/ext/cglm/cglm-0.6.2/include/cglm/mat3.h +422 -0
  39. data/ext/cglm/cglm-0.6.2/include/cglm/mat4.h +726 -0
  40. data/ext/cglm/cglm-0.6.2/include/cglm/plane.h +36 -0
  41. data/ext/cglm/cglm-0.6.2/include/cglm/project.h +118 -0
  42. data/ext/cglm/cglm-0.6.2/include/cglm/quat.h +828 -0
  43. data/ext/cglm/cglm-0.6.2/include/cglm/simd/arm.h +83 -0
  44. data/ext/cglm/cglm-0.6.2/include/cglm/simd/avx/affine.h +66 -0
  45. data/ext/cglm/cglm-0.6.2/include/cglm/simd/avx/mat4.h +66 -0
  46. data/ext/cglm/cglm-0.6.2/include/cglm/simd/intrin.h +90 -0
  47. data/ext/cglm/cglm-0.6.2/include/cglm/simd/neon/mat4.h +57 -0
  48. data/ext/cglm/cglm-0.6.2/include/cglm/simd/sse2/affine.h +111 -0
  49. data/ext/cglm/cglm-0.6.2/include/cglm/simd/sse2/mat3.h +59 -0
  50. data/ext/cglm/cglm-0.6.2/include/cglm/simd/sse2/mat4.h +405 -0
  51. data/ext/cglm/cglm-0.6.2/include/cglm/simd/sse2/quat.h +46 -0
  52. data/ext/cglm/cglm-0.6.2/include/cglm/simd/x86.h +192 -0
  53. data/ext/cglm/cglm-0.6.2/include/cglm/sphere.h +99 -0
  54. data/ext/cglm/cglm-0.6.2/include/cglm/struct/affine.h +337 -0
  55. data/ext/cglm/cglm-0.6.2/include/cglm/struct/box.h +256 -0
  56. data/ext/cglm/cglm-0.6.2/include/cglm/struct/cam.h +451 -0
  57. data/ext/cglm/cglm-0.6.2/include/cglm/struct/color.h +27 -0
  58. data/ext/cglm/cglm-0.6.2/include/cglm/struct/curve.h +40 -0
  59. data/ext/cglm/cglm-0.6.2/include/cglm/struct/euler.h +152 -0
  60. data/ext/cglm/cglm-0.6.2/include/cglm/struct/frustum.h +155 -0
  61. data/ext/cglm/cglm-0.6.2/include/cglm/struct/io.h +82 -0
  62. data/ext/cglm/cglm-0.6.2/include/cglm/struct/mat3.h +285 -0
  63. data/ext/cglm/cglm-0.6.2/include/cglm/struct/mat4.h +459 -0
  64. data/ext/cglm/cglm-0.6.2/include/cglm/struct/plane.h +40 -0
  65. data/ext/cglm/cglm-0.6.2/include/cglm/struct/project.h +104 -0
  66. data/ext/cglm/cglm-0.6.2/include/cglm/struct/quat.h +532 -0
  67. data/ext/cglm/cglm-0.6.2/include/cglm/struct/sphere.h +93 -0
  68. data/ext/cglm/cglm-0.6.2/include/cglm/struct/vec3-ext.h +257 -0
  69. data/ext/cglm/cglm-0.6.2/include/cglm/struct/vec3.h +970 -0
  70. data/ext/cglm/cglm-0.6.2/include/cglm/struct/vec4-ext.h +257 -0
  71. data/ext/cglm/cglm-0.6.2/include/cglm/struct/vec4.h +814 -0
  72. data/ext/cglm/cglm-0.6.2/include/cglm/struct.h +36 -0
  73. data/ext/cglm/cglm-0.6.2/include/cglm/types-struct.h +129 -0
  74. data/ext/cglm/cglm-0.6.2/include/cglm/types.h +76 -0
  75. data/ext/cglm/cglm-0.6.2/include/cglm/util.h +328 -0
  76. data/ext/cglm/cglm-0.6.2/include/cglm/vec3-ext.h +272 -0
  77. data/ext/cglm/cglm-0.6.2/include/cglm/vec3.h +1078 -0
  78. data/ext/cglm/cglm-0.6.2/include/cglm/vec4-ext.h +315 -0
  79. data/ext/cglm/cglm-0.6.2/include/cglm/vec4.h +1078 -0
  80. data/ext/cglm/cglm-0.6.2/include/cglm/version.h +15 -0
  81. data/ext/cglm/extconf.rb +2 -3
  82. data/ext/cglm/rb_cglm.h +5 -3
  83. data/ext/cglm/rb_cglm_mat3.c +3 -3
  84. data/ext/cglm/rb_cglm_mat4.c +3 -3
  85. data/ext/cglm/rb_cglm_quat.c +2 -2
  86. data/ext/cglm/rb_cglm_vec3.c +63 -61
  87. data/ext/cglm/rb_cglm_vec4.c +2 -0
  88. data/ext/cglm/ruby_pre27.h +35 -0
  89. data/lib/cglm/vec3.rb +2 -2
  90. data/lib/cglm/vec4.rb +2 -2
  91. data/lib/cglm/vector_type.rb +15 -0
  92. data/lib/cglm/version.rb +1 -1
  93. metadata +89 -13
@@ -0,0 +1,257 @@
1
+ /*
2
+ * Copyright (c), Recep Aslantas.
3
+ *
4
+ * MIT License (MIT), http://opensource.org/licenses/MIT
5
+ * Full license can be found in the LICENSE file
6
+ */
7
+
8
+ /*!
9
+ * @brief SIMD like functions
10
+ */
11
+
12
+ /*
13
+ Functions:
14
+ CGLM_INLINE vec3s glms_vec3_broadcast(float val);
15
+ CGLM_INLINE vec3s glms_vec3_fill(float val);
16
+ CGLM_INLINE bool glms_vec3_eq(vec3s v, float val);
17
+ CGLM_INLINE bool glms_vec3_eq_eps(vec3s v, float val);
18
+ CGLM_INLINE bool glms_vec3_eq_all(vec3s v);
19
+ CGLM_INLINE bool glms_vec3_eqv(vec3s a, vec3s b);
20
+ CGLM_INLINE bool glms_vec3_eqv_eps(vec3s a, vec3s b);
21
+ CGLM_INLINE float glms_vec3_max(vec3s v);
22
+ CGLM_INLINE float glms_vec3_min(vec3s v);
23
+ CGLM_INLINE bool glms_vec3_isnan(vec3s v);
24
+ CGLM_INLINE bool glms_vec3_isinf(vec3s v);
25
+ CGLM_INLINE bool glms_vec3_isvalid(vec3s v);
26
+ CGLM_INLINE vec3s glms_vec3_sign(vec3s v);
27
+ CGLM_INLINE vec3s glms_vec3_abs(vec3s v);
28
+ CGLM_INLINE vec3s glms_vec3_fract(vec3s v);
29
+ CGLM_INLINE float glms_vec3_hadd(vec3s v);
30
+ CGLM_INLINE vec3s glms_vec3_sqrt(vec3s v);
31
+ */
32
+
33
+ #ifndef cglms_vec3s_ext_h
34
+ #define cglms_vec3s_ext_h
35
+
36
+ #include "../common.h"
37
+ #include "../types-struct.h"
38
+ #include "../util.h"
39
+ #include "../vec3-ext.h"
40
+
41
+ /*!
42
+ * @brief fill a vector with specified value
43
+ *
44
+ * @param[in] val value
45
+ * @returns dest
46
+ */
47
+ CGLM_INLINE
48
+ vec3s
49
+ glms_vec3_broadcast(float val) {
50
+ vec3s r;
51
+ glm_vec3_broadcast(val, r.raw);
52
+ return r;
53
+ }
54
+
55
+ /*!
56
+ * @brief fill a vector with specified value
57
+ *
58
+ * @param[in] val value
59
+ * @returns dest
60
+ */
61
+ CGLM_INLINE
62
+ vec3s
63
+ glms_vec3_fill(float val) {
64
+ vec3s r;
65
+ glm_vec3_fill(r.raw, val);
66
+ return r;
67
+ }
68
+
69
+ /*!
70
+ * @brief check if vector is equal to value (without epsilon)
71
+ *
72
+ * @param[in] v vector
73
+ * @param[in] val value
74
+ */
75
+ CGLM_INLINE
76
+ bool
77
+ glms_vec3_eq(vec3s v, float val) {
78
+ return glm_vec3_eq(v.raw, val);
79
+ }
80
+
81
+ /*!
82
+ * @brief check if vector is equal to value (with epsilon)
83
+ *
84
+ * @param[in] v vector
85
+ * @param[in] val value
86
+ */
87
+ CGLM_INLINE
88
+ bool
89
+ glms_vec3_eq_eps(vec3s v, float val) {
90
+ return glm_vec3_eq_eps(v.raw, val);
91
+ }
92
+
93
+ /*!
94
+ * @brief check if vectors members are equal (without epsilon)
95
+ *
96
+ * @param[in] v vector
97
+ */
98
+ CGLM_INLINE
99
+ bool
100
+ glms_vec3_eq_all(vec3s v) {
101
+ return glm_vec3_eq_all(v.raw);
102
+ }
103
+
104
+ /*!
105
+ * @brief check if vector is equal to another (without epsilon)
106
+ *
107
+ * @param[in] a vector
108
+ * @param[in] b vector
109
+ */
110
+ CGLM_INLINE
111
+ bool
112
+ glms_vec3_eqv(vec3s a, vec3s b) {
113
+ return glm_vec3_eqv(a.raw, b.raw);
114
+ }
115
+
116
+ /*!
117
+ * @brief check if vector is equal to another (with epsilon)
118
+ *
119
+ * @param[in] a vector
120
+ * @param[in] b vector
121
+ */
122
+ CGLM_INLINE
123
+ bool
124
+ glms_vec3_eqv_eps(vec3s a, vec3s b) {
125
+ return glm_vec3_eqv_eps(a.raw, b.raw);
126
+ }
127
+
128
+ /*!
129
+ * @brief max value of vector
130
+ *
131
+ * @param[in] v vector
132
+ */
133
+ CGLM_INLINE
134
+ float
135
+ glms_vec3_max(vec3s v) {
136
+ return glm_vec3_max(v.raw);
137
+ }
138
+
139
+ /*!
140
+ * @brief min value of vector
141
+ *
142
+ * @param[in] v vector
143
+ */
144
+ CGLM_INLINE
145
+ float
146
+ glms_vec3_min(vec3s v) {
147
+ return glm_vec3_min(v.raw);
148
+ }
149
+
150
+ /*!
151
+ * @brief check if all items are NaN (not a number)
152
+ * you should only use this in DEBUG mode or very critical asserts
153
+ *
154
+ * @param[in] v vector
155
+ */
156
+ CGLM_INLINE
157
+ bool
158
+ glms_vec3_isnan(vec3s v) {
159
+ return glm_vec3_isnan(v.raw);
160
+ }
161
+
162
+ /*!
163
+ * @brief check if all items are INFINITY
164
+ * you should only use this in DEBUG mode or very critical asserts
165
+ *
166
+ * @param[in] v vector
167
+ */
168
+ CGLM_INLINE
169
+ bool
170
+ glms_vec3_isinf(vec3s v) {
171
+ return glm_vec3_isinf(v.raw);
172
+ }
173
+
174
+ /*!
175
+ * @brief check if all items are valid number
176
+ * you should only use this in DEBUG mode or very critical asserts
177
+ *
178
+ * @param[in] v vector
179
+ */
180
+ CGLM_INLINE
181
+ bool
182
+ glms_vec3_isvalid(vec3s v) {
183
+ return glm_vec3_isvalid(v.raw);
184
+ }
185
+
186
+ /*!
187
+ * @brief get sign of 32 bit float as +1, -1, 0
188
+ *
189
+ * Important: It returns 0 for zero/NaN input
190
+ *
191
+ * @param v vector
192
+ * @returns sign vector
193
+ */
194
+ CGLM_INLINE
195
+ vec3s
196
+ glms_vec3_sign(vec3s v) {
197
+ vec3s r;
198
+ glm_vec3_sign(v.raw, r.raw);
199
+ return r;
200
+ }
201
+
202
+ /*!
203
+ * @brief absolute value of each vector item
204
+ *
205
+ * @param[in] v vector
206
+ * @return destination vector
207
+ */
208
+ CGLM_INLINE
209
+ vec3s
210
+ glms_vec3_abs(vec3s v) {
211
+ vec3s r;
212
+ glm_vec3_abs(v.raw, r.raw);
213
+ return r;
214
+ }
215
+
216
+ /*!
217
+ * @brief fractional part of each vector item
218
+ *
219
+ * @param[in] v vector
220
+ * @return dest destination vector
221
+ */
222
+ CGLM_INLINE
223
+ vec3s
224
+ glms_vec3_fract(vec3s v) {
225
+ vec3s r;
226
+ glm_vec3_fract(v.raw, r.raw);
227
+ return r;
228
+ }
229
+
230
+ /*!
231
+ * @brief vector reduction by summation
232
+ * @warning could overflow
233
+ *
234
+ * @param[in] v vector
235
+ * @return sum of all vector's elements
236
+ */
237
+ CGLM_INLINE
238
+ float
239
+ glms_vec3_hadd(vec3s v) {
240
+ return glm_vec3_hadd(v.raw);
241
+ }
242
+
243
+ /*!
244
+ * @brief square root of each vector item
245
+ *
246
+ * @param[in] v vector
247
+ * @returns destination vector
248
+ */
249
+ CGLM_INLINE
250
+ vec3s
251
+ glms_vec3_sqrt(vec3s v) {
252
+ vec3s r;
253
+ glm_vec3_sqrt(v.raw, r.raw);
254
+ return r;
255
+ }
256
+
257
+ #endif /* cglms_vec3s_ext_h */