snow-math 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/extconf.rb +3 -0
- data/ext/snow-math/mat4.c +2 -2
- data/ext/snow-math/maths_local.h +6 -1
- data/ext/snow-math/snow-math.c +6 -5
- data/lib/snow-math/ptr.rb +21 -8
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69bcab44215ebbcc4cddd9cd6128e606dd3badf2
|
4
|
+
data.tar.gz: f302d2bb8d7a3895bb84473f605b691e88038f60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7695e785485cb2e0dfad66d044bed4e9e92e82ab74a6bb0d1210de6c31e1fdca9a84f1c2265ac55160873104ef011d3bfe16e52f54cb73a0e2f3c60edba55de
|
7
|
+
data.tar.gz: 520dda557d59c66f7660406f88cead654645d1b481202649e112833df966c15f91aa937a37efbcefdc15e344326d51e1c1dbf60ab11caf0d9929fb6c8123fa78
|
data/ext/extconf.rb
CHANGED
data/ext/snow-math/mat4.c
CHANGED
@@ -29,7 +29,7 @@ const mat4_t g_mat4_identity = {
|
|
29
29
|
0.0, 0.0, 0.0, 1.0
|
30
30
|
};
|
31
31
|
|
32
|
-
static
|
32
|
+
static s_float_t mat4_cofactor(const mat4_t m, int r0, int r1, int r2, int c0, int c1, int c2);
|
33
33
|
|
34
34
|
void mat4_identity(mat4_t out)
|
35
35
|
{
|
@@ -540,7 +540,7 @@ int mat4_inverse_affine(const mat4_t in, mat4_t out)
|
|
540
540
|
return 1;
|
541
541
|
}
|
542
542
|
|
543
|
-
|
543
|
+
static s_float_t mat4_cofactor(const mat4_t m, int r0, int r1, int r2, int c0, int c1, int c2)
|
544
544
|
{
|
545
545
|
#define cofactor_addr(l, r) (m[l*4+r])
|
546
546
|
return (
|
data/ext/snow-math/maths_local.h
CHANGED
@@ -14,10 +14,15 @@
|
|
14
14
|
#include <math.h>
|
15
15
|
#endif
|
16
16
|
|
17
|
+
#define S_STATIC_INLINE
|
18
|
+
#ifndef S_STATIC_INLINE
|
17
19
|
#ifdef __SNOW__MATHS_C__
|
18
20
|
#define S_INLINE
|
19
21
|
#else
|
20
|
-
#define S_INLINE inline
|
22
|
+
#define S_INLINE extern inline
|
23
|
+
#endif
|
24
|
+
#else
|
25
|
+
#define S_INLINE static
|
21
26
|
#endif
|
22
27
|
|
23
28
|
#if defined(__cplusplus)
|
data/ext/snow-math/snow-math.c
CHANGED
@@ -89,10 +89,11 @@ static TYPE##_t * SM_UNWRAP(TYPE) (VALUE sm_value, TYPE##_t store)
|
|
89
89
|
DECL_SM_WRAP_OP(TYPE) \
|
90
90
|
{ \
|
91
91
|
TYPE##_t *copy; \
|
92
|
+
VALUE sm_wrapped = Qnil; \
|
92
93
|
if (!RTEST(klass)) { \
|
93
94
|
klass = SM_KLASS(TYPE); \
|
94
95
|
} \
|
95
|
-
|
96
|
+
sm_wrapped = Data_Make_Struct(klass, TYPE##_t, 0, free, copy); \
|
96
97
|
if (value) { \
|
97
98
|
TYPE##_copy(value, *copy); \
|
98
99
|
} \
|
@@ -140,11 +141,11 @@ static VALUE sm_##TYPE##_##FUNC (int argc, VALUE *argv, VALUE sm_self)
|
|
140
141
|
if (argc == 2) { \
|
141
142
|
if (!RTEST(sm_out)) { \
|
142
143
|
goto SM_LABEL(skip_output); \
|
143
|
-
}
|
144
|
+
}{ \
|
144
145
|
SM_RAISE_IF_NOT_TYPE(sm_out, OTYPE); \
|
145
146
|
OTYPE##_t *output = SM_UNWRAP(OTYPE)(sm_out, NULL); \
|
146
147
|
TYPE##_##FUNC (*self, *rhs, *output); \
|
147
|
-
} else if (argc == 1) {
|
148
|
+
}} else if (argc == 1) { \
|
148
149
|
SM_LABEL(skip_output): { \
|
149
150
|
OTYPE##_t output; \
|
150
151
|
TYPE##_##FUNC (*self, *rhs, output); \
|
@@ -178,11 +179,11 @@ static VALUE sm_##TYPE##_##FUNC (int argc, VALUE *argv, VALUE sm_self)
|
|
178
179
|
if (argc == 1) { \
|
179
180
|
if (!RTEST(sm_out)) { \
|
180
181
|
goto SM_LABEL(skip_output); \
|
181
|
-
}
|
182
|
+
}{ \
|
182
183
|
SM_RAISE_IF_NOT_TYPE(sm_out, OTYPE); \
|
183
184
|
OTYPE##_t *output = SM_UNWRAP(OTYPE)(sm_out, NULL); \
|
184
185
|
TYPE##_##FUNC (*self, *output); \
|
185
|
-
} else if (argc == 0) {
|
186
|
+
}} else if (argc == 0) { \
|
186
187
|
SM_LABEL(skip_output): { \
|
187
188
|
OTYPE##_t output; \
|
188
189
|
TYPE##_##FUNC (*self, output); \
|
data/lib/snow-math/ptr.rb
CHANGED
@@ -15,11 +15,24 @@ module Snow::MathPointers
|
|
15
15
|
|
16
16
|
end
|
17
17
|
|
18
|
-
Snow::Vec3
|
19
|
-
Snow::Vec4
|
20
|
-
Snow::Quat
|
21
|
-
Snow::Mat4
|
22
|
-
|
23
|
-
|
24
|
-
Snow::
|
25
|
-
|
18
|
+
class Snow::Vec3 ; include Snow::MathPointers ; end
|
19
|
+
class Snow::Vec4 ; include Snow::MathPointers ; end
|
20
|
+
class Snow::Quat ; include Snow::MathPointers ; end
|
21
|
+
class Snow::Mat4 ; include Snow::MathPointers ; end
|
22
|
+
|
23
|
+
if Snow.const_defined?(:Vec3Array)
|
24
|
+
class Snow::Vec3Array ; include Snow::MathPointers ; end
|
25
|
+
end
|
26
|
+
|
27
|
+
if Snow.const_defined?(:Vec4Array)
|
28
|
+
class Snow::Vec4Array ; include Snow::MathPointers ; end
|
29
|
+
end
|
30
|
+
|
31
|
+
if Snow.const_defined?(:QuatArray)
|
32
|
+
class Snow::QuatArray ; include Snow::MathPointers ; end
|
33
|
+
end
|
34
|
+
|
35
|
+
if Snow.const_defined?(:Mat4Array)
|
36
|
+
class Snow::Mat4Array ; include Snow::MathPointers ; end
|
37
|
+
end
|
38
|
+
|