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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 19a3f42ccb51ce6b8f3ce302da01828ccf1b9456
4
- data.tar.gz: cd4fea9cddf77d8e9d3b3656eb428101aff96786
3
+ metadata.gz: 69bcab44215ebbcc4cddd9cd6128e606dd3badf2
4
+ data.tar.gz: f302d2bb8d7a3895bb84473f605b691e88038f60
5
5
  SHA512:
6
- metadata.gz: 937dc344b4c8c9925b014faf86fd6edccd93e010dbbf344c83e2c302f310baa1c97a7aa73f02f34ee97497a75a80d78e4932064083c685d124861169d9ef003a
7
- data.tar.gz: d3113bcfacd41fe382c6f89c3fbd4e320344d60b7eb26c64bceab5d551986677217f9a284457098789377afef9817bc62ffa787d793c58179ad4afd89ba74453
6
+ metadata.gz: a7695e785485cb2e0dfad66d044bed4e9e92e82ab74a6bb0d1210de6c31e1fdca9a84f1c2265ac55160873104ef011d3bfe16e52f54cb73a0e2f3c60edba55de
7
+ data.tar.gz: 520dda557d59c66f7660406f88cead654645d1b481202649e112833df966c15f91aa937a37efbcefdc15e344326d51e1c1dbf60ab11caf0d9929fb6c8123fa78
data/ext/extconf.rb CHANGED
@@ -5,6 +5,9 @@
5
5
 
6
6
  require 'mkmf'
7
7
 
8
+ # Compile as C99
9
+ $CFLAGS += " -std=c99"
10
+
8
11
  if ARGV.include?("--use-float") || ARGV.include?("-F")
9
12
  $CFLAGS += " -DUSE_FLOAT"
10
13
  puts "Using float as base type"
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 inline s_float_t mat4_cofactor(const mat4_t m, int r0, int r1, int r2, int c0, int c1, int c2);
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
- inline s_float_t mat4_cofactor(const mat4_t m, int r0, int r1, int r2, int c0, int c1, int c2)
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 (
@@ -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)
@@ -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
- VALUE sm_wrapped = Data_Make_Struct(klass, TYPE##_t, 0, free, copy); \
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.include(Snow::MathPointers)
19
- Snow::Vec4.include(Snow::MathPointers)
20
- Snow::Quat.include(Snow::MathPointers)
21
- Snow::Mat4.include(Snow::MathPointers)
22
- Snow::Vec3Array.include(Snow::MathPointers) if Snow.const_defined?(:Vec3Array)
23
- Snow::Vec4Array.include(Snow::MathPointers) if Snow.const_defined?(:Vec4Array)
24
- Snow::QuatArray.include(Snow::MathPointers) if Snow.const_defined?(:QuatArray)
25
- Snow::Mat4Array.include(Snow::MathPointers) if Snow.const_defined?(:Mat4Array)
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
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snow-math
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Noel Raymond Cower