cglm 0.1.0 → 0.1.1
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/.travis.yml +2 -1
- data/Gemfile.lock +13 -13
- data/README.md +2 -0
- data/cglm.gemspec +3 -3
- data/ext/cglm/extconf.rb +2 -3
- data/ext/cglm/rb_cglm.h +3 -1
- data/ext/cglm/rb_cglm_mat3.c +3 -3
- data/ext/cglm/rb_cglm_mat4.c +3 -3
- data/ext/cglm/rb_cglm_vec3.c +63 -61
- data/ext/cglm/rb_cglm_vec4.c +2 -0
- data/ext/cglm/ruby_pre27.h +35 -0
- data/lib/cglm/vec3.rb +2 -2
- data/lib/cglm/vec4.rb +2 -2
- data/lib/cglm/vector_type.rb +15 -0
- data/lib/cglm/version.rb +1 -1
- metadata +85 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 239ddc2c75a6a3939ded1179375071ae43924887a73f8c193e256e2f6e45879f
|
4
|
+
data.tar.gz: 5b3f6be03330019caa0024adb0062e5a20d9e88e5b9141debb3028c39bb4f7b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76c5578265a2e6130746a46a47aa3f2749e9d7202dea356dc2f2e7708515112986d7dee9602a272f2b0d2cd32b98aceddfb4292cd3e5aaf09a7c3afade0c6c9e
|
7
|
+
data.tar.gz: 730f64f9d352059b73d38d2b1da7020eae9bc3ea8b49f91514a853d7f12eb95fd00e1b5cc89320bc5a722f143930348d6c865f935e50e987cdc4b536d5d3f7fd
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,39 +1,39 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cglm (0.1.
|
4
|
+
cglm (0.1.1)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
docile (1.3.
|
10
|
-
github-markup (3.0.
|
11
|
-
json (2.
|
12
|
-
minitest (5.
|
13
|
-
rake (
|
14
|
-
rake-compiler (1.0
|
9
|
+
docile (1.3.2)
|
10
|
+
github-markup (3.0.4)
|
11
|
+
json (2.3.0)
|
12
|
+
minitest (5.14.0)
|
13
|
+
rake (13.0.1)
|
14
|
+
rake-compiler (1.1.0)
|
15
15
|
rake
|
16
|
-
redcarpet (3.
|
17
|
-
simplecov (0.
|
16
|
+
redcarpet (3.5.0)
|
17
|
+
simplecov (0.17.1)
|
18
18
|
docile (~> 1.1)
|
19
19
|
json (>= 1.8, < 3)
|
20
20
|
simplecov-html (~> 0.10.0)
|
21
21
|
simplecov-html (0.10.2)
|
22
|
-
yard (0.9.
|
22
|
+
yard (0.9.24)
|
23
23
|
|
24
24
|
PLATFORMS
|
25
25
|
ruby
|
26
26
|
|
27
27
|
DEPENDENCIES
|
28
|
-
bundler (~> 1
|
28
|
+
bundler (~> 2.1)
|
29
29
|
cglm!
|
30
30
|
github-markup
|
31
31
|
minitest (~> 5.0)
|
32
|
-
rake (~>
|
32
|
+
rake (~> 13.0)
|
33
33
|
rake-compiler
|
34
34
|
redcarpet
|
35
35
|
simplecov
|
36
36
|
yard (~> 0.9)
|
37
37
|
|
38
38
|
BUNDLED WITH
|
39
|
-
1.
|
39
|
+
2.1.2
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# CGLM
|
2
2
|
|
3
|
+
[](https://travis-ci.org/sinisterchipmunk/cglm-ruby)
|
4
|
+
|
3
5
|
Ruby bindings for [CGLM](https://github.com/recp/cglm), a high performance math library for OpenGL.
|
4
6
|
|
5
7
|
[CGLM](https://github.com/recp/cglm) provides support for SIMD on CPUs that support it in order to deliver better performance. This requires the variables to be aligned to 8-, 16- and 32-byte boundaries, but this gem automatically handles this requirement so you don't have to think about that.
|
data/cglm.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Colin MacKenzie IV"]
|
10
10
|
spec.email = ["sinisterchipmunk@gmail.com"]
|
11
11
|
|
12
|
-
spec.summary = %q{
|
12
|
+
spec.summary = %q{Ruby bindings for CGLM (https://github.com/recp/cglm), a high performance math library for graphics applications.}
|
13
13
|
spec.homepage = "https://github.com/sinisterchipmunk/cglm-ruby"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
@@ -35,8 +35,8 @@ Gem::Specification.new do |spec|
|
|
35
35
|
spec.require_paths = ["lib"]
|
36
36
|
spec.extensions = ["ext/cglm/extconf.rb"]
|
37
37
|
|
38
|
-
spec.add_development_dependency "bundler", "~> 1
|
39
|
-
spec.add_development_dependency "rake", "~>
|
38
|
+
spec.add_development_dependency "bundler", "~> 2.1"
|
39
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
40
40
|
spec.add_development_dependency "rake-compiler"
|
41
41
|
spec.add_development_dependency "minitest", "~> 5.0"
|
42
42
|
spec.add_development_dependency "yard", "~> 0.9"
|
data/ext/cglm/extconf.rb
CHANGED
@@ -3,11 +3,10 @@ require 'fileutils'
|
|
3
3
|
require 'rubygems/package'
|
4
4
|
require 'zlib'
|
5
5
|
|
6
|
-
|
7
|
-
CGLM_VERSION = '89f64f079477b1af15f47e6b96db52c767acb057'
|
6
|
+
CGLM_VERSION = 'v0.6.2'
|
8
7
|
cglm_source_url = "https://github.com/recp/cglm/archive/#{CGLM_VERSION}.tar.gz"
|
9
8
|
cglm_tar_gz = File.expand_path("cglm-#{CGLM_VERSION}.tar.gz", __dir__)
|
10
|
-
cglm_dir = File.expand_path("cglm
|
9
|
+
cglm_dir = File.expand_path("cglm-0.6.2", __dir__)
|
11
10
|
|
12
11
|
# fetch cglm unless it's already on the file system
|
13
12
|
unless File.exist?(cglm_dir)
|
data/ext/cglm/rb_cglm.h
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
#define RB_CGLM_H 1
|
3
3
|
|
4
4
|
#include "ruby.h"
|
5
|
+
#include "ruby_pre27.h"
|
5
6
|
#include <errno.h>
|
6
7
|
|
7
8
|
// Based on unit test results I think the FLT_EPSILON that is used for fuzzy
|
@@ -106,7 +107,8 @@ static inline VALUE CGLM_NEW(VALUE klass, size_t size, void *addr) {
|
|
106
107
|
VALUE kw = rb_hash_new();
|
107
108
|
VALUE ptr = PTR2FIDDLE(addr, size);
|
108
109
|
rb_hash_aset(kw, ID2SYM(rb_intern("addr")), ptr);
|
109
|
-
|
110
|
+
VALUE kwarg[] = { kw };
|
111
|
+
return rb_funcallv_kw(klass, rb_intern("new"), 1, kwarg, 1);
|
110
112
|
}
|
111
113
|
|
112
114
|
static inline void *__aligned_alloc(size_t align, size_t size) {
|
data/ext/cglm/rb_cglm_mat3.c
CHANGED
@@ -54,7 +54,7 @@ VALUE rb_cglm_mat3_transpose(int argc, VALUE *argv, VALUE self) {
|
|
54
54
|
*
|
55
55
|
* Transposes this matrix in-place and returns `self`.
|
56
56
|
*/
|
57
|
-
VALUE rb_cglm_mat3_transpose_self(
|
57
|
+
VALUE rb_cglm_mat3_transpose_self(VALUE self) {
|
58
58
|
glm_mat3_transpose(VAL2MAT3(self));
|
59
59
|
return self;
|
60
60
|
}
|
@@ -117,7 +117,7 @@ VALUE rb_cglm_mat3_inverse(int argc, VALUE *argv, VALUE self) {
|
|
117
117
|
* Calcaultes the inverse of `self`, modifies `self` in-place, and returns
|
118
118
|
* `self`.
|
119
119
|
*/
|
120
|
-
VALUE rb_cglm_mat3_inverse_self(
|
120
|
+
VALUE rb_cglm_mat3_inverse_self(VALUE self) {
|
121
121
|
glm_mat3_inv(VAL2MAT3(self), VAL2MAT3(self));
|
122
122
|
return self;
|
123
123
|
}
|
@@ -230,7 +230,7 @@ void Init_cglm_mat3() {
|
|
230
230
|
rb_define_method(rb_cMat3, "mul_mat3", rb_cglm_mat3_mul_mat3, -1);
|
231
231
|
rb_define_method(rb_cMat3, "mul_vec3", rb_cglm_mat3_mul_vec3, -1);
|
232
232
|
rb_define_method(rb_cMat3, "mul_scalar", rb_cglm_mat3_mul_scalar, -1);
|
233
|
-
rb_define_method(rb_cMat3, "mul_scalar!", rb_cglm_mat3_mul_scalar_self,
|
233
|
+
rb_define_method(rb_cMat3, "mul_scalar!", rb_cglm_mat3_mul_scalar_self, 1);
|
234
234
|
rb_define_method(rb_cMat3, "transpose", rb_cglm_mat3_transpose, -1);
|
235
235
|
rb_define_method(rb_cMat3, "transpose!", rb_cglm_mat3_transpose_self, 0);
|
236
236
|
rb_define_method(rb_cMat3, "to_quat", rb_cglm_mat3_to_quat, -1);
|
data/ext/cglm/rb_cglm_mat4.c
CHANGED
@@ -161,7 +161,7 @@ VALUE rb_cglm_mat4_invert(int argc, VALUE *argv, VALUE self) {
|
|
161
161
|
*
|
162
162
|
* Computes the inverse of this matrix in-place and returns `self`.
|
163
163
|
*/
|
164
|
-
VALUE rb_cglm_mat4_invert_self(
|
164
|
+
VALUE rb_cglm_mat4_invert_self(VALUE self) {
|
165
165
|
glm_mat4_inv(VAL2MAT4(self), VAL2MAT4(self));
|
166
166
|
return self;
|
167
167
|
}
|
@@ -191,7 +191,7 @@ VALUE rb_cglm_mat4_invert_fast(int argc, VALUE *argv, VALUE self) {
|
|
191
191
|
* e.g Newton-Raphson. This should work faster than normal, but will be less
|
192
192
|
* precise.
|
193
193
|
*/
|
194
|
-
VALUE rb_cglm_mat4_invert_fast_self(
|
194
|
+
VALUE rb_cglm_mat4_invert_fast_self(VALUE self) {
|
195
195
|
glm_mat4_inv_fast(VAL2MAT4(self), VAL2MAT4(self));
|
196
196
|
return self;
|
197
197
|
}
|
@@ -285,7 +285,7 @@ void Init_cglm_mat4() {
|
|
285
285
|
rb_define_method(rb_cMat4, "mul_vec4", rb_cglm_mat4_mul_vec4, -1);
|
286
286
|
rb_define_method(rb_cMat4, "mul_vec3", rb_cglm_mat4_mul_vec3, -1);
|
287
287
|
rb_define_method(rb_cMat4, "mul_scalar", rb_cglm_mat4_mul_scalar, -1);
|
288
|
-
rb_define_method(rb_cMat4, "mul_scalar!", rb_cglm_mat4_mul_scalar_self,
|
288
|
+
rb_define_method(rb_cMat4, "mul_scalar!", rb_cglm_mat4_mul_scalar_self, 1);
|
289
289
|
rb_define_method(rb_cMat4, "transpose", rb_cglm_mat4_transpose, -1);
|
290
290
|
rb_define_method(rb_cMat4, "transpose!", rb_cglm_mat4_transpose_self, 0);
|
291
291
|
rb_define_method(rb_cMat4, "determinant", rb_cglm_mat4_determinant, 0);
|
data/ext/cglm/rb_cglm_vec3.c
CHANGED
@@ -55,17 +55,17 @@ VALUE rb_cglm_vec3_zero(VALUE self) {
|
|
55
55
|
}
|
56
56
|
|
57
57
|
VALUE rb_cglm_vec3_zero_self(VALUE self) {
|
58
|
-
|
58
|
+
glm_vec3_zero(VAL2VEC3(self));
|
59
59
|
return self;
|
60
60
|
}
|
61
61
|
|
62
62
|
VALUE rb_cglm_vec3_one_self(VALUE self) {
|
63
|
-
|
63
|
+
glm_vec3_one(VAL2VEC3(self));
|
64
64
|
return self;
|
65
65
|
}
|
66
66
|
|
67
67
|
VALUE rb_cglm_vec3_dot(VALUE self, VALUE other) {
|
68
|
-
return DBL2NUM(
|
68
|
+
return DBL2NUM(glm_vec3_dot(VAL2VEC3(self), VAL2VEC3(self)));
|
69
69
|
}
|
70
70
|
|
71
71
|
/* call-seq: cross(b[, dest]) => dest | new Vec3 */
|
@@ -73,7 +73,7 @@ VALUE rb_cglm_vec3_cross(int argc, VALUE *argv, VALUE self) {
|
|
73
73
|
VALUE b, dest;
|
74
74
|
rb_scan_args(argc, argv, "11", &b, &dest);
|
75
75
|
if (NIL_P(dest)) dest = VEC3_NEW(ALLOC_VEC3);
|
76
|
-
|
76
|
+
glm_vec3_cross(VAL2VEC3(self), VAL2VEC3(b), VAL2VEC3(dest));
|
77
77
|
return dest;
|
78
78
|
}
|
79
79
|
|
@@ -83,7 +83,7 @@ VALUE rb_cglm_vec3_cross(int argc, VALUE *argv, VALUE self) {
|
|
83
83
|
* `norm ** 2` to avoid an unnecessary square root.
|
84
84
|
*/
|
85
85
|
VALUE rb_cglm_vec3_norm2(VALUE self) {
|
86
|
-
return DBL2NUM(
|
86
|
+
return DBL2NUM(glm_vec3_norm2(VAL2VEC3(self)));
|
87
87
|
}
|
88
88
|
|
89
89
|
/* call-seq: norm => Numeric
|
@@ -91,7 +91,7 @@ VALUE rb_cglm_vec3_norm2(VALUE self) {
|
|
91
91
|
* Returns the norm (magnitude) of this vector.
|
92
92
|
*/
|
93
93
|
VALUE rb_cglm_vec3_norm(VALUE self) {
|
94
|
-
return DBL2NUM(
|
94
|
+
return DBL2NUM(glm_vec3_norm(VAL2VEC3(self)));
|
95
95
|
}
|
96
96
|
|
97
97
|
/* call-seq: add_vec3(b[, dest]) => dest | new Vec3
|
@@ -103,7 +103,7 @@ VALUE rb_cglm_vec3_add_vec3(int argc, VALUE *argv, VALUE self) {
|
|
103
103
|
VALUE b, dest;
|
104
104
|
rb_scan_args(argc, argv, "11", &b, &dest);
|
105
105
|
if (NIL_P(dest)) dest = VEC3_NEW(ALLOC_VEC3);
|
106
|
-
|
106
|
+
glm_vec3_add(VAL2VEC3(self), VAL2VEC3(b), VAL2VEC3(dest));
|
107
107
|
return dest;
|
108
108
|
}
|
109
109
|
|
@@ -116,7 +116,7 @@ VALUE rb_cglm_vec3_add_scalar(int argc, VALUE *argv, VALUE self) {
|
|
116
116
|
VALUE b, dest;
|
117
117
|
rb_scan_args(argc, argv, "11", &b, &dest);
|
118
118
|
if (NIL_P(dest)) dest = VEC3_NEW(ALLOC_VEC3);
|
119
|
-
|
119
|
+
glm_vec3_adds(VAL2VEC3(self), NUM2FLT(b), VAL2VEC3(dest));
|
120
120
|
return dest;
|
121
121
|
}
|
122
122
|
|
@@ -129,7 +129,7 @@ VALUE rb_cglm_vec3_sub_vec3(int argc, VALUE *argv, VALUE self) {
|
|
129
129
|
VALUE b, dest;
|
130
130
|
rb_scan_args(argc, argv, "11", &b, &dest);
|
131
131
|
if (NIL_P(dest)) dest = VEC3_NEW(ALLOC_VEC3);
|
132
|
-
|
132
|
+
glm_vec3_sub(VAL2VEC3(self), VAL2VEC3(b), VAL2VEC3(dest));
|
133
133
|
return dest;
|
134
134
|
}
|
135
135
|
|
@@ -142,7 +142,7 @@ VALUE rb_cglm_vec3_sub_scalar(int argc, VALUE *argv, VALUE self) {
|
|
142
142
|
VALUE b, dest;
|
143
143
|
rb_scan_args(argc, argv, "11", &b, &dest);
|
144
144
|
if (NIL_P(dest)) dest = VEC3_NEW(ALLOC_VEC3);
|
145
|
-
|
145
|
+
glm_vec3_subs(VAL2VEC3(self), NUM2FLT(b), VAL2VEC3(dest));
|
146
146
|
return dest;
|
147
147
|
}
|
148
148
|
|
@@ -151,7 +151,7 @@ VALUE rb_cglm_vec3_sub_scalar(int argc, VALUE *argv, VALUE self) {
|
|
151
151
|
* Adds `self` and `b` together, modifying `self` in-place and returning it.
|
152
152
|
*/
|
153
153
|
VALUE rb_cglm_vec3_add_vec3_self(VALUE self, VALUE b) {
|
154
|
-
|
154
|
+
glm_vec3_add(VAL2VEC3(self), VAL2VEC3(b), VAL2VEC3(self));
|
155
155
|
return self;
|
156
156
|
}
|
157
157
|
|
@@ -161,7 +161,7 @@ VALUE rb_cglm_vec3_add_vec3_self(VALUE self, VALUE b) {
|
|
161
161
|
* and returning it.
|
162
162
|
*/
|
163
163
|
VALUE rb_cglm_vec3_add_scalar_self(VALUE self, VALUE b) {
|
164
|
-
|
164
|
+
glm_vec3_adds(VAL2VEC3(self), NUM2FLT(b), VAL2VEC3(self));
|
165
165
|
return self;
|
166
166
|
}
|
167
167
|
|
@@ -170,7 +170,7 @@ VALUE rb_cglm_vec3_add_scalar_self(VALUE self, VALUE b) {
|
|
170
170
|
* Subtracts `b` from `self`, modifying `self` in-place and returning it.
|
171
171
|
*/
|
172
172
|
VALUE rb_cglm_vec3_sub_vec3_self(VALUE self, VALUE b) {
|
173
|
-
|
173
|
+
glm_vec3_sub(VAL2VEC3(self), VAL2VEC3(b), VAL2VEC3(self));
|
174
174
|
return self;
|
175
175
|
}
|
176
176
|
|
@@ -180,7 +180,7 @@ VALUE rb_cglm_vec3_sub_vec3_self(VALUE self, VALUE b) {
|
|
180
180
|
* in-place and returning it.
|
181
181
|
*/
|
182
182
|
VALUE rb_cglm_vec3_sub_scalar_self(VALUE self, VALUE b) {
|
183
|
-
|
183
|
+
glm_vec3_subs(VAL2VEC3(self), NUM2FLT(b), VAL2VEC3(self));
|
184
184
|
return self;
|
185
185
|
}
|
186
186
|
|
@@ -194,7 +194,7 @@ VALUE rb_cglm_vec3_mul_vec3(int argc, VALUE *argv, VALUE self) {
|
|
194
194
|
VALUE b, dest;
|
195
195
|
rb_scan_args(argc, argv, "11", &b, &dest);
|
196
196
|
if (NIL_P(dest)) dest = VEC3_NEW(ALLOC_VEC3);
|
197
|
-
|
197
|
+
glm_vec3_mul(VAL2VEC3(self), VAL2VEC3(b), VAL2VEC3(dest));
|
198
198
|
return dest;
|
199
199
|
}
|
200
200
|
|
@@ -204,7 +204,7 @@ VALUE rb_cglm_vec3_mul_vec3(int argc, VALUE *argv, VALUE self) {
|
|
204
204
|
* in-place and returns `self`.
|
205
205
|
*/
|
206
206
|
VALUE rb_cglm_vec3_mul_vec3_self(VALUE self, VALUE b) {
|
207
|
-
|
207
|
+
glm_vec3_mul(VAL2VEC3(self), VAL2VEC3(b), VAL2VEC3(self));
|
208
208
|
return self;
|
209
209
|
}
|
210
210
|
|
@@ -218,7 +218,7 @@ VALUE rb_cglm_vec3_mul_scalar(int argc, VALUE *argv, VALUE self) {
|
|
218
218
|
VALUE b, dest;
|
219
219
|
rb_scan_args(argc, argv, "11", &b, &dest);
|
220
220
|
if (NIL_P(dest)) dest = VEC3_NEW(ALLOC_VEC3);
|
221
|
-
|
221
|
+
glm_vec3_scale(VAL2VEC3(self), NUM2FLT(b), VAL2VEC3(dest));
|
222
222
|
return dest;
|
223
223
|
}
|
224
224
|
|
@@ -228,7 +228,7 @@ VALUE rb_cglm_vec3_mul_scalar(int argc, VALUE *argv, VALUE self) {
|
|
228
228
|
* in-place and returns `self`.
|
229
229
|
*/
|
230
230
|
VALUE rb_cglm_vec3_mul_scalar_self(VALUE self, VALUE b) {
|
231
|
-
|
231
|
+
glm_vec3_scale(VAL2VEC3(self), NUM2FLT(b), VAL2VEC3(self));
|
232
232
|
return self;
|
233
233
|
}
|
234
234
|
|
@@ -241,7 +241,7 @@ VALUE rb_cglm_vec3_resize(int argc, VALUE *argv, VALUE self) {
|
|
241
241
|
VALUE b, dest;
|
242
242
|
rb_scan_args(argc, argv, "11", &b, &dest);
|
243
243
|
if (NIL_P(dest)) dest = VEC3_NEW(ALLOC_VEC3);
|
244
|
-
|
244
|
+
glm_vec3_scale_as(VAL2VEC3(self), NUM2FLT(b), VAL2VEC3(dest));
|
245
245
|
return dest;
|
246
246
|
}
|
247
247
|
|
@@ -250,7 +250,7 @@ VALUE rb_cglm_vec3_resize(int argc, VALUE *argv, VALUE self) {
|
|
250
250
|
* Same as `normalize(self) * b`. Modifies `self` in-place and returns `self`.
|
251
251
|
*/
|
252
252
|
VALUE rb_cglm_vec3_resize_self(VALUE self, VALUE b) {
|
253
|
-
|
253
|
+
glm_vec3_scale_as(VAL2VEC3(self), NUM2FLT(b), VAL2VEC3(self));
|
254
254
|
return self;
|
255
255
|
}
|
256
256
|
|
@@ -264,7 +264,7 @@ VALUE rb_cglm_vec3_div_vec3(int argc, VALUE *argv, VALUE self) {
|
|
264
264
|
VALUE b, dest;
|
265
265
|
rb_scan_args(argc, argv, "11", &b, &dest);
|
266
266
|
if (NIL_P(dest)) dest = VEC3_NEW(ALLOC_VEC3);
|
267
|
-
|
267
|
+
glm_vec3_div(VAL2VEC3(self), VAL2VEC3(b), VAL2VEC3(dest));
|
268
268
|
return dest;
|
269
269
|
}
|
270
270
|
|
@@ -274,7 +274,7 @@ VALUE rb_cglm_vec3_div_vec3(int argc, VALUE *argv, VALUE self) {
|
|
274
274
|
* in-place and returns `self`.
|
275
275
|
*/
|
276
276
|
VALUE rb_cglm_vec3_div_vec3_self(VALUE self, VALUE b) {
|
277
|
-
|
277
|
+
glm_vec3_div(VAL2VEC3(self), VAL2VEC3(b), VAL2VEC3(self));
|
278
278
|
return self;
|
279
279
|
}
|
280
280
|
|
@@ -288,7 +288,7 @@ VALUE rb_cglm_vec3_div_scalar(int argc, VALUE *argv, VALUE self) {
|
|
288
288
|
VALUE b, dest;
|
289
289
|
rb_scan_args(argc, argv, "11", &b, &dest);
|
290
290
|
if (NIL_P(dest)) dest = VEC3_NEW(ALLOC_VEC3);
|
291
|
-
|
291
|
+
glm_vec3_divs(VAL2VEC3(self), NUM2FLT(b), VAL2VEC3(dest));
|
292
292
|
return dest;
|
293
293
|
}
|
294
294
|
|
@@ -298,7 +298,7 @@ VALUE rb_cglm_vec3_div_scalar(int argc, VALUE *argv, VALUE self) {
|
|
298
298
|
* in-place and returns `self`.
|
299
299
|
*/
|
300
300
|
VALUE rb_cglm_vec3_div_scalar_self(VALUE self, VALUE b) {
|
301
|
-
|
301
|
+
glm_vec3_divs(VAL2VEC3(self), NUM2FLT(b), VAL2VEC3(self));
|
302
302
|
return self;
|
303
303
|
}
|
304
304
|
|
@@ -310,7 +310,7 @@ VALUE rb_cglm_vec3_div_scalar_self(VALUE self, VALUE b) {
|
|
310
310
|
* * `dest` is not optional for this method, as it is for most others.
|
311
311
|
*/
|
312
312
|
VALUE rb_cglm_vec3_addadd_vec3(VALUE self, VALUE other, VALUE dest) {
|
313
|
-
|
313
|
+
glm_vec3_addadd(VAL2VEC3(self), VAL2VEC3(other), VAL2VEC3(dest));
|
314
314
|
return dest;
|
315
315
|
}
|
316
316
|
|
@@ -322,7 +322,7 @@ VALUE rb_cglm_vec3_addadd_vec3(VALUE self, VALUE other, VALUE dest) {
|
|
322
322
|
* * `dest` is not optional for this method, as it is for most others.
|
323
323
|
*/
|
324
324
|
VALUE rb_cglm_vec3_subadd_vec3(VALUE self, VALUE other, VALUE dest) {
|
325
|
-
|
325
|
+
glm_vec3_subadd(VAL2VEC3(self), VAL2VEC3(other), VAL2VEC3(dest));
|
326
326
|
return dest;
|
327
327
|
}
|
328
328
|
|
@@ -334,7 +334,7 @@ VALUE rb_cglm_vec3_subadd_vec3(VALUE self, VALUE other, VALUE dest) {
|
|
334
334
|
* * `dest` is not optional for this method, as it is for most others.
|
335
335
|
*/
|
336
336
|
VALUE rb_cglm_vec3_muladd_vec3(VALUE self, VALUE other, VALUE dest) {
|
337
|
-
|
337
|
+
glm_vec3_muladd(VAL2VEC3(self), VAL2VEC3(other), VAL2VEC3(dest));
|
338
338
|
return dest;
|
339
339
|
}
|
340
340
|
|
@@ -348,7 +348,7 @@ VALUE rb_cglm_vec3_muladd_vec3(VALUE self, VALUE other, VALUE dest) {
|
|
348
348
|
* * `dest` is not optional for this method, as it is for most others.
|
349
349
|
*/
|
350
350
|
VALUE rb_cglm_vec3_muladd_scalar(VALUE self, VALUE other, VALUE dest) {
|
351
|
-
|
351
|
+
glm_vec3_muladds(VAL2VEC3(self), NUM2FLT(other), VAL2VEC3(dest));
|
352
352
|
return dest;
|
353
353
|
}
|
354
354
|
|
@@ -361,7 +361,7 @@ VALUE rb_cglm_vec3_flip_signs(int argc, VALUE *argv, VALUE self) {
|
|
361
361
|
VALUE dest;
|
362
362
|
rb_scan_args(argc, argv, "01", &dest);
|
363
363
|
if (NIL_P(dest)) dest = VEC3_NEW(ALLOC_VEC3);
|
364
|
-
|
364
|
+
glm_vec3_flipsign_to(VAL2VEC3(self), VAL2VEC3(dest));
|
365
365
|
return dest;
|
366
366
|
}
|
367
367
|
|
@@ -370,7 +370,7 @@ VALUE rb_cglm_vec3_flip_signs(int argc, VALUE *argv, VALUE self) {
|
|
370
370
|
* Flips the sign of each component, modifying `self` in-place. Returns `self`.
|
371
371
|
*/
|
372
372
|
VALUE rb_cglm_vec3_flip_signs_self(VALUE self) {
|
373
|
-
|
373
|
+
glm_vec3_flipsign(VAL2VEC3(self));
|
374
374
|
return self;
|
375
375
|
}
|
376
376
|
|
@@ -383,7 +383,7 @@ VALUE rb_cglm_vec3_normalize(int argc, VALUE *argv, VALUE self) {
|
|
383
383
|
VALUE dest;
|
384
384
|
rb_scan_args(argc, argv, "01", &dest);
|
385
385
|
if (NIL_P(dest)) dest = VEC3_NEW(ALLOC_VEC3);
|
386
|
-
|
386
|
+
glm_vec3_normalize_to(VAL2VEC3(self), VAL2VEC3(dest));
|
387
387
|
return dest;
|
388
388
|
}
|
389
389
|
|
@@ -392,7 +392,7 @@ VALUE rb_cglm_vec3_normalize(int argc, VALUE *argv, VALUE self) {
|
|
392
392
|
* Normalizes `self` in-place, and returns `self`.
|
393
393
|
*/
|
394
394
|
VALUE rb_cglm_vec3_normalize_self(VALUE self) {
|
395
|
-
|
395
|
+
glm_vec3_normalize(VAL2VEC3(self));
|
396
396
|
return self;
|
397
397
|
}
|
398
398
|
|
@@ -401,7 +401,7 @@ VALUE rb_cglm_vec3_normalize_self(VALUE self) {
|
|
401
401
|
* Returns the angle between `self` and `other`, in radians.
|
402
402
|
*/
|
403
403
|
VALUE rb_cglm_vec3_angle(VALUE self, VALUE other) {
|
404
|
-
return DBL2NUM(
|
404
|
+
return DBL2NUM(glm_vec3_angle(VAL2VEC3(self), VAL2VEC3(other)));
|
405
405
|
}
|
406
406
|
|
407
407
|
/* call-seq: rotate_axis_angle(axis, angle[, dest]) => dest | new Vec3
|
@@ -415,7 +415,7 @@ VALUE rb_cglm_vec3_rotate_axis_angle(int argc, VALUE *argv, VALUE self) {
|
|
415
415
|
rb_scan_args(argc, argv, "21", &axis, &angle, &dest);
|
416
416
|
if (NIL_P(dest)) dest = VEC3_NEW(ALLOC_VEC3);
|
417
417
|
memcpy(&VAL2VEC3(dest), &VAL2VEC3(self), sizeof(vec3));
|
418
|
-
|
418
|
+
glm_vec3_rotate(VAL2VEC3(dest), NUM2FLT(angle), VAL2VEC3(axis));
|
419
419
|
return dest;
|
420
420
|
}
|
421
421
|
|
@@ -426,7 +426,7 @@ VALUE rb_cglm_vec3_rotate_axis_angle(int argc, VALUE *argv, VALUE self) {
|
|
426
426
|
* returns `self`.
|
427
427
|
*/
|
428
428
|
VALUE rb_cglm_vec3_rotate_axis_angle_self(VALUE self, VALUE axis, VALUE angle) {
|
429
|
-
|
429
|
+
glm_vec3_rotate(VAL2VEC3(self), NUM2FLT(angle), VAL2VEC3(axis));
|
430
430
|
return self;
|
431
431
|
}
|
432
432
|
|
@@ -447,7 +447,7 @@ VALUE rb_cglm_vec3_rotate_mat4(int argc, VALUE *argv, VALUE self) {
|
|
447
447
|
VALUE matrix, dest;
|
448
448
|
rb_scan_args(argc, argv, "11", &matrix, &dest);
|
449
449
|
if (NIL_P(dest)) dest = VEC3_NEW(ALLOC_VEC3);
|
450
|
-
|
450
|
+
glm_vec3_rotate_m4(VAL2MAT4(matrix), VAL2VEC3(self), VAL2VEC3(dest));
|
451
451
|
return dest;
|
452
452
|
}
|
453
453
|
|
@@ -464,7 +464,7 @@ VALUE rb_cglm_vec3_rotate_mat4(int argc, VALUE *argv, VALUE self) {
|
|
464
464
|
* 0 0 0 w
|
465
465
|
*/
|
466
466
|
VALUE rb_cglm_vec3_rotate_mat4_self(VALUE self, VALUE matrix) {
|
467
|
-
|
467
|
+
glm_vec3_rotate_m4(VAL2MAT4(matrix), VAL2VEC3(self), VAL2VEC3(self));
|
468
468
|
return self;
|
469
469
|
}
|
470
470
|
|
@@ -478,7 +478,7 @@ VALUE rb_cglm_vec3_rotate_mat3(int argc, VALUE *argv, VALUE self) {
|
|
478
478
|
VALUE matrix, dest;
|
479
479
|
rb_scan_args(argc, argv, "11", &matrix, &dest);
|
480
480
|
if (NIL_P(dest)) dest = VEC3_NEW(ALLOC_VEC3);
|
481
|
-
|
481
|
+
glm_vec3_rotate_m3(VAL2MAT3(matrix), VAL2VEC3(self), VAL2VEC3(dest));
|
482
482
|
return dest;
|
483
483
|
}
|
484
484
|
|
@@ -488,7 +488,7 @@ VALUE rb_cglm_vec3_rotate_mat3(int argc, VALUE *argv, VALUE self) {
|
|
488
488
|
* `self` and returns `self`.
|
489
489
|
*/
|
490
490
|
VALUE rb_cglm_vec3_rotate_mat3_self(VALUE self, VALUE matrix) {
|
491
|
-
|
491
|
+
glm_vec3_rotate_m3(VAL2MAT3(matrix), VAL2VEC3(self), VAL2VEC3(self));
|
492
492
|
return self;
|
493
493
|
}
|
494
494
|
|
@@ -501,7 +501,7 @@ VALUE rb_cglm_vec3_project(int argc, VALUE *argv, VALUE self) {
|
|
501
501
|
VALUE b, dest;
|
502
502
|
rb_scan_args(argc, argv, "11", &b, &dest);
|
503
503
|
if (NIL_P(dest)) dest = VEC3_NEW(ALLOC_VEC3);
|
504
|
-
|
504
|
+
glm_vec3_proj(VAL2VEC3(self), VAL2VEC3(b), VAL2VEC3(dest));
|
505
505
|
return dest;
|
506
506
|
}
|
507
507
|
|
@@ -511,7 +511,7 @@ VALUE rb_cglm_vec3_project(int argc, VALUE *argv, VALUE self) {
|
|
511
511
|
* returns `self`.
|
512
512
|
*/
|
513
513
|
VALUE rb_cglm_vec3_project_self(VALUE self, VALUE b) {
|
514
|
-
|
514
|
+
glm_vec3_proj(VAL2VEC3(self), VAL2VEC3(b), VAL2VEC3(self));
|
515
515
|
return self;
|
516
516
|
}
|
517
517
|
|
@@ -525,7 +525,7 @@ VALUE rb_cglm_vec3_center(int argc, VALUE *argv, VALUE self) {
|
|
525
525
|
VALUE b, dest;
|
526
526
|
rb_scan_args(argc, argv, "11", &b, &dest);
|
527
527
|
if (NIL_P(dest)) dest = VEC3_NEW(ALLOC_VEC3);
|
528
|
-
|
528
|
+
glm_vec3_center(VAL2VEC3(self), VAL2VEC3(b), VAL2VEC3(dest));
|
529
529
|
return dest;
|
530
530
|
}
|
531
531
|
|
@@ -534,7 +534,7 @@ VALUE rb_cglm_vec3_center(int argc, VALUE *argv, VALUE self) {
|
|
534
534
|
* Returns the squared distance between this vector and the specified one.
|
535
535
|
*/
|
536
536
|
VALUE rb_cglm_vec3_distance2(VALUE self, VALUE b) {
|
537
|
-
return DBL2NUM(
|
537
|
+
return DBL2NUM(glm_vec3_distance2(VAL2VEC3(self), VAL2VEC3(b)));
|
538
538
|
}
|
539
539
|
|
540
540
|
/* call-seq: distance(vec) => Numeric
|
@@ -542,7 +542,7 @@ VALUE rb_cglm_vec3_distance2(VALUE self, VALUE b) {
|
|
542
542
|
* Returns the distance between this vector and the specified one.
|
543
543
|
*/
|
544
544
|
VALUE rb_cglm_vec3_distance(VALUE self, VALUE b) {
|
545
|
-
return DBL2NUM(
|
545
|
+
return DBL2NUM(glm_vec3_distance(VAL2VEC3(self), VAL2VEC3(b)));
|
546
546
|
}
|
547
547
|
|
548
548
|
/* call-seq: max(vec[, dest]) => dest | new Vec3
|
@@ -555,7 +555,7 @@ VALUE rb_cglm_vec3_max(int argc, VALUE *argv, VALUE self) {
|
|
555
555
|
VALUE b, dest;
|
556
556
|
rb_scan_args(argc, argv, "11", &b, &dest);
|
557
557
|
if (NIL_P(dest)) dest = VEC3_NEW(ALLOC_VEC3);
|
558
|
-
|
558
|
+
glm_vec3_maxv(VAL2VEC3(self), VAL2VEC3(b), VAL2VEC3(dest));
|
559
559
|
return dest;
|
560
560
|
}
|
561
561
|
|
@@ -569,7 +569,7 @@ VALUE rb_cglm_vec3_min(int argc, VALUE *argv, VALUE self) {
|
|
569
569
|
VALUE b, dest;
|
570
570
|
rb_scan_args(argc, argv, "11", &b, &dest);
|
571
571
|
if (NIL_P(dest)) dest = VEC3_NEW(ALLOC_VEC3);
|
572
|
-
|
572
|
+
glm_vec3_minv(VAL2VEC3(self), VAL2VEC3(b), VAL2VEC3(dest));
|
573
573
|
return dest;
|
574
574
|
}
|
575
575
|
|
@@ -583,7 +583,7 @@ VALUE rb_cglm_vec3_ortho(int argc, VALUE *argv, VALUE self) {
|
|
583
583
|
VALUE dest;
|
584
584
|
rb_scan_args(argc, argv, "01", &dest);
|
585
585
|
if (NIL_P(dest)) dest = VEC3_NEW(ALLOC_VEC3);
|
586
|
-
|
586
|
+
glm_vec3_ortho(VAL2VEC3(self), VAL2VEC3(dest));
|
587
587
|
return dest;
|
588
588
|
}
|
589
589
|
|
@@ -598,7 +598,7 @@ VALUE rb_cglm_vec3_clamp_scalar(int argc, VALUE *argv, VALUE self) {
|
|
598
598
|
rb_scan_args(argc, argv, "21", &a, &b, &dest);
|
599
599
|
if (NIL_P(dest)) dest = VEC3_NEW(ALLOC_VEC3);
|
600
600
|
memcpy(&VAL2VEC3(dest), &VAL2VEC3(self), sizeof(vec3));
|
601
|
-
|
601
|
+
glm_vec3_clamp(VAL2VEC3(dest), NUM2FLT(a), NUM2FLT(b));
|
602
602
|
return dest;
|
603
603
|
}
|
604
604
|
|
@@ -608,7 +608,7 @@ VALUE rb_cglm_vec3_clamp_scalar(int argc, VALUE *argv, VALUE self) {
|
|
608
608
|
* Places the result into `self` and returns `self`.
|
609
609
|
*/
|
610
610
|
VALUE rb_cglm_vec3_clamp_scalar_self(VALUE self, VALUE a, VALUE b) {
|
611
|
-
|
611
|
+
glm_vec3_clamp(VAL2VEC3(self), NUM2FLT(a), NUM2FLT(b));
|
612
612
|
return self;
|
613
613
|
}
|
614
614
|
|
@@ -619,7 +619,7 @@ VALUE rb_cglm_vec3_clamp_scalar_self(VALUE self, VALUE a, VALUE b) {
|
|
619
619
|
* `self` in-place and returns `self`.
|
620
620
|
*/
|
621
621
|
VALUE rb_cglm_vec3_lerp_self(VALUE self, VALUE from, VALUE to, VALUE amount) {
|
622
|
-
|
622
|
+
glm_vec3_lerp(VAL2VEC3(from), VAL2VEC3(to), NUM2FLT(amount), VAL2VEC3(self));
|
623
623
|
return self;
|
624
624
|
}
|
625
625
|
|
@@ -629,7 +629,7 @@ VALUE rb_cglm_vec3_lerp_self(VALUE self, VALUE from, VALUE to, VALUE amount) {
|
|
629
629
|
* `self`.
|
630
630
|
*/
|
631
631
|
VALUE rb_cglm_vec3_broadcast_self(VALUE self, VALUE val) {
|
632
|
-
|
632
|
+
glm_vec3_broadcast(NUM2FLT(val), VAL2VEC3(self));
|
633
633
|
return self;
|
634
634
|
}
|
635
635
|
|
@@ -639,7 +639,7 @@ VALUE rb_cglm_vec3_broadcast_self(VALUE self, VALUE val) {
|
|
639
639
|
* this Vec3, false otherwise.
|
640
640
|
*/
|
641
641
|
VALUE rb_cglm_vec3_equals_scalar(VALUE self, VALUE val) {
|
642
|
-
return
|
642
|
+
return glm_vec3_eq(VAL2VEC3(self), NUM2FLT(val)) ? Qtrue : Qfalse;
|
643
643
|
}
|
644
644
|
|
645
645
|
/* call-seq: equalish_scalar(val[, epsilon]) => true|false
|
@@ -665,7 +665,7 @@ VALUE rb_cglm_vec3_equalish_scalar(int argc, VALUE *argv, VALUE self) {
|
|
665
665
|
* Returns true if each component in this Vec3 has the same exact value.
|
666
666
|
*/
|
667
667
|
VALUE rb_cglm_vec3_equals_all(VALUE self) {
|
668
|
-
return
|
668
|
+
return glm_vec3_eq_all(VAL2VEC3(self)) ? Qtrue : Qfalse;
|
669
669
|
}
|
670
670
|
|
671
671
|
/* call-seq: equals_vec3(other) => true|false
|
@@ -673,7 +673,7 @@ VALUE rb_cglm_vec3_equals_all(VALUE self) {
|
|
673
673
|
* Returns true if this vector exactly matches the given one.
|
674
674
|
*/
|
675
675
|
VALUE rb_cglm_vec3_equals_vec3(VALUE self, VALUE other) {
|
676
|
-
return
|
676
|
+
return glm_vec3_eqv(VAL2VEC3(self), VAL2VEC3(other)) ? Qtrue : Qfalse;
|
677
677
|
}
|
678
678
|
|
679
679
|
/* call-seq: equalish_vec3(other[, epsilon]) => true|false
|
@@ -698,7 +698,7 @@ VALUE rb_cglm_vec3_equalish_vec3(int argc, VALUE *argv, VALUE self) {
|
|
698
698
|
* Returns the value of the highest component in this Vec3.
|
699
699
|
*/
|
700
700
|
VALUE rb_cglm_vec3_highest(VALUE self) {
|
701
|
-
return DBL2NUM(
|
701
|
+
return DBL2NUM(glm_vec3_max(VAL2VEC3(self)));
|
702
702
|
}
|
703
703
|
|
704
704
|
/* call-seq: lowest => Numeric
|
@@ -706,7 +706,7 @@ VALUE rb_cglm_vec3_highest(VALUE self) {
|
|
706
706
|
* Returns the value of the lowest component in this Vec3.
|
707
707
|
*/
|
708
708
|
VALUE rb_cglm_vec3_lowest(VALUE self) {
|
709
|
-
return DBL2NUM(
|
709
|
+
return DBL2NUM(glm_vec3_min(VAL2VEC3(self)));
|
710
710
|
}
|
711
711
|
|
712
712
|
/* call-seq: nan? => true|false
|
@@ -715,7 +715,7 @@ VALUE rb_cglm_vec3_lowest(VALUE self) {
|
|
715
715
|
* You should only use this in DEBUG mode or very critical asserts.
|
716
716
|
*/
|
717
717
|
VALUE rb_cglm_vec3_is_nan(VALUE self) {
|
718
|
-
return
|
718
|
+
return glm_vec3_isnan(VAL2VEC3(self)) ? Qtrue : Qfalse;
|
719
719
|
}
|
720
720
|
|
721
721
|
/* call-seq: inf? => true|false
|
@@ -724,7 +724,7 @@ VALUE rb_cglm_vec3_is_nan(VALUE self) {
|
|
724
724
|
* You should only use this in DEBUG mode or very critical asserts.
|
725
725
|
*/
|
726
726
|
VALUE rb_cglm_vec3_is_inf(VALUE self) {
|
727
|
-
return
|
727
|
+
return glm_vec3_isinf(VAL2VEC3(self)) ? Qtrue : Qfalse;
|
728
728
|
}
|
729
729
|
|
730
730
|
/* call-seq: valid? => true|false
|
@@ -733,7 +733,7 @@ VALUE rb_cglm_vec3_is_inf(VALUE self) {
|
|
733
733
|
* otherwise. You should only use this in DEBUG mode or very critical asserts.
|
734
734
|
*/
|
735
735
|
VALUE rb_cglm_vec3_is_valid(VALUE self) {
|
736
|
-
return
|
736
|
+
return glm_vec3_isvalid(VAL2VEC3(self)) ? Qtrue : Qfalse;
|
737
737
|
}
|
738
738
|
|
739
739
|
/* call-seq: signs([dest]) => dest | new Vec3
|
@@ -746,7 +746,7 @@ VALUE rb_cglm_vec3_signs(int argc, VALUE *argv, VALUE self) {
|
|
746
746
|
VALUE dest;
|
747
747
|
rb_scan_args(argc, argv, "01", &dest);
|
748
748
|
if (NIL_P(dest)) dest = VEC3_NEW(ALLOC_VEC3);
|
749
|
-
|
749
|
+
glm_vec3_sign(VAL2VEC3(self), VAL2VEC3(dest));
|
750
750
|
return dest;
|
751
751
|
}
|
752
752
|
|
@@ -759,7 +759,7 @@ VALUE rb_cglm_vec3_sqrt(int argc, VALUE *argv, VALUE self) {
|
|
759
759
|
VALUE dest;
|
760
760
|
rb_scan_args(argc, argv, "01", &dest);
|
761
761
|
if (NIL_P(dest)) dest = VEC3_NEW(ALLOC_VEC3);
|
762
|
-
|
762
|
+
glm_vec3_sqrt(VAL2VEC3(self), VAL2VEC3(dest));
|
763
763
|
return dest;
|
764
764
|
}
|
765
765
|
|
@@ -865,6 +865,8 @@ void Init_cglm_vec3() {
|
|
865
865
|
|
866
866
|
rb_define_alias(rb_cVec3, "invert", "flip_signs");
|
867
867
|
rb_define_alias(rb_cVec3, "invert!", "flip_signs!");
|
868
|
+
rb_define_alias(rb_cVec3, "negate", "flip_signs");
|
869
|
+
rb_define_alias(rb_cVec3, "negate!", "flip_signs!");
|
868
870
|
rb_define_alias(rb_cVec3, "magnitude", "norm");
|
869
871
|
rb_define_alias(rb_cVec3, "mag", "norm");
|
870
872
|
rb_define_alias(rb_cVec3, "magnitude2", "norm2");
|
data/ext/cglm/rb_cglm_vec4.c
CHANGED
@@ -711,6 +711,8 @@ void Init_cglm_vec4() {
|
|
711
711
|
|
712
712
|
rb_define_alias(rb_cVec4, "invert", "flip_signs");
|
713
713
|
rb_define_alias(rb_cVec4, "invert!", "flip_signs!");
|
714
|
+
rb_define_alias(rb_cVec4, "negate", "flip_signs");
|
715
|
+
rb_define_alias(rb_cVec4, "negate!", "flip_signs!");
|
714
716
|
rb_define_alias(rb_cVec4, "magnitude", "norm");
|
715
717
|
rb_define_alias(rb_cVec4, "mag", "norm");
|
716
718
|
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#ifndef RUBY_PRE27_H
|
2
|
+
#define RUBY_PRE27_H
|
3
|
+
|
4
|
+
#ifndef RB_PASS_KEYWORDS
|
5
|
+
/* Only define macros on Ruby <2.7 */
|
6
|
+
#define rb_funcallv_kw(o, m, c, v, kw) rb_funcallv(o, m, c, v)
|
7
|
+
#define rb_funcallv_public_kw(o, m, c, v, kw) rb_funcallv_public(o, m, c, v)
|
8
|
+
#define rb_funcall_passing_block_kw(o, m, c, v, kw) rb_funcall_passing_block(o, m, c, v)
|
9
|
+
#define rb_funcall_with_block_kw(o, m, c, v, b, kw) rb_funcall_with_block(o, m, c, v, b)
|
10
|
+
#define rb_scan_args_kw(kw, c, v, s, ...) rb_scan_args(c, v, s, __VA_ARGS__)
|
11
|
+
#define rb_call_super_kw(c, v, kw) rb_call_super(c, v)
|
12
|
+
#define rb_yield_values_kw(c, v, kw) rb_yield_values2(c, v)
|
13
|
+
#define rb_yield_splat_kw(a, kw) rb_yield_splat(a)
|
14
|
+
#define rb_block_call_kw(o, m, c, v, f, p, kw) rb_block_call(o, m, c, v, f, p)
|
15
|
+
#define rb_fiber_resume_kw(o, c, v, kw) rb_fiber_resume(o, c, v)
|
16
|
+
#define rb_fiber_yield_kw(c, v, kw) rb_fiber_yield(c, v)
|
17
|
+
#define rb_enumeratorize_with_size_kw(o, m, c, v, f, kw) rb_enumeratorize_with_size(o, m, c, v, f)
|
18
|
+
#define SIZED_ENUMERATOR_KW(obj, argc, argv, size_fn, kw_splat) \
|
19
|
+
rb_enumeratorize_with_size((obj), ID2SYM(rb_frame_this_func()), \
|
20
|
+
(argc), (argv), (size_fn))
|
21
|
+
#define RETURN_SIZED_ENUMERATOR_KW(obj, argc, argv, size_fn, kw_splat) do { \
|
22
|
+
if (!rb_block_given_p()) \
|
23
|
+
return SIZED_ENUMERATOR(obj, argc, argv, size_fn); \
|
24
|
+
} while (0)
|
25
|
+
#define RETURN_ENUMERATOR_KW(obj, argc, argv, kw_splat) RETURN_SIZED_ENUMERATOR(obj, argc, argv, 0)
|
26
|
+
#define rb_check_funcall_kw(o, m, c, v, kw) rb_check_funcall(o, m, c, v)
|
27
|
+
#define rb_obj_call_init_kw(o, c, v, kw) rb_obj_call_init(o, c, v)
|
28
|
+
#define rb_class_new_instance_kw(c, v, k, kw) rb_class_new_instance(c, v, k)
|
29
|
+
#define rb_proc_call_kw(p, a, kw) rb_proc_call(p, a)
|
30
|
+
#define rb_proc_call_with_block_kw(p, c, v, b, kw) rb_proc_call_with_block(p, c, v, b)
|
31
|
+
#define rb_method_call_kw(c, v, m, kw) rb_method_call(c, v, m)
|
32
|
+
#define rb_method_call_with_block_kw(c, v, m, b, kw) rb_method_call_with_block(c, v, m, b)
|
33
|
+
#endif
|
34
|
+
|
35
|
+
#endif // RUBY_PRE27_H
|
data/lib/cglm/vec3.rb
CHANGED
data/lib/cglm/vec4.rb
CHANGED
data/lib/cglm/vector_type.rb
CHANGED
@@ -13,5 +13,20 @@ module CGLM
|
|
13
13
|
raise ArgumentError, 'initial values must be an Array, Quat, Vec3 or Vec4'
|
14
14
|
end
|
15
15
|
end
|
16
|
+
|
17
|
+
def to_enum
|
18
|
+
size = self.size
|
19
|
+
Enumerator.new(size) do |y|
|
20
|
+
size.times { |i| y << self[i] }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def each(&block)
|
25
|
+
to_enum.each(&block)
|
26
|
+
end
|
27
|
+
|
28
|
+
def to_a
|
29
|
+
to_enum.to_a
|
30
|
+
end
|
16
31
|
end
|
17
32
|
end
|
data/lib/cglm/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cglm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Colin MacKenzie IV
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1
|
19
|
+
version: '2.1'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1
|
26
|
+
version: '2.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '13.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '13.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake-compiler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -141,6 +141,81 @@ files:
|
|
141
141
|
- bin/console
|
142
142
|
- bin/setup
|
143
143
|
- cglm.gemspec
|
144
|
+
- ext/cglm/cglm-0.6.2/include/cglm/affine-mat.h
|
145
|
+
- ext/cglm/cglm-0.6.2/include/cglm/affine.h
|
146
|
+
- ext/cglm/cglm-0.6.2/include/cglm/applesimd.h
|
147
|
+
- ext/cglm/cglm-0.6.2/include/cglm/bezier.h
|
148
|
+
- ext/cglm/cglm-0.6.2/include/cglm/box.h
|
149
|
+
- ext/cglm/cglm-0.6.2/include/cglm/call.h
|
150
|
+
- ext/cglm/cglm-0.6.2/include/cglm/call/affine.h
|
151
|
+
- ext/cglm/cglm-0.6.2/include/cglm/call/bezier.h
|
152
|
+
- ext/cglm/cglm-0.6.2/include/cglm/call/box.h
|
153
|
+
- ext/cglm/cglm-0.6.2/include/cglm/call/cam.h
|
154
|
+
- ext/cglm/cglm-0.6.2/include/cglm/call/curve.h
|
155
|
+
- ext/cglm/cglm-0.6.2/include/cglm/call/ease.h
|
156
|
+
- ext/cglm/cglm-0.6.2/include/cglm/call/euler.h
|
157
|
+
- ext/cglm/cglm-0.6.2/include/cglm/call/frustum.h
|
158
|
+
- ext/cglm/cglm-0.6.2/include/cglm/call/io.h
|
159
|
+
- ext/cglm/cglm-0.6.2/include/cglm/call/mat3.h
|
160
|
+
- ext/cglm/cglm-0.6.2/include/cglm/call/mat4.h
|
161
|
+
- ext/cglm/cglm-0.6.2/include/cglm/call/plane.h
|
162
|
+
- ext/cglm/cglm-0.6.2/include/cglm/call/project.h
|
163
|
+
- ext/cglm/cglm-0.6.2/include/cglm/call/quat.h
|
164
|
+
- ext/cglm/cglm-0.6.2/include/cglm/call/sphere.h
|
165
|
+
- ext/cglm/cglm-0.6.2/include/cglm/call/vec3.h
|
166
|
+
- ext/cglm/cglm-0.6.2/include/cglm/call/vec4.h
|
167
|
+
- ext/cglm/cglm-0.6.2/include/cglm/cam.h
|
168
|
+
- ext/cglm/cglm-0.6.2/include/cglm/cglm.h
|
169
|
+
- ext/cglm/cglm-0.6.2/include/cglm/color.h
|
170
|
+
- ext/cglm/cglm-0.6.2/include/cglm/common.h
|
171
|
+
- ext/cglm/cglm-0.6.2/include/cglm/curve.h
|
172
|
+
- ext/cglm/cglm-0.6.2/include/cglm/ease.h
|
173
|
+
- ext/cglm/cglm-0.6.2/include/cglm/euler.h
|
174
|
+
- ext/cglm/cglm-0.6.2/include/cglm/frustum.h
|
175
|
+
- ext/cglm/cglm-0.6.2/include/cglm/io.h
|
176
|
+
- ext/cglm/cglm-0.6.2/include/cglm/mat3.h
|
177
|
+
- ext/cglm/cglm-0.6.2/include/cglm/mat4.h
|
178
|
+
- ext/cglm/cglm-0.6.2/include/cglm/plane.h
|
179
|
+
- ext/cglm/cglm-0.6.2/include/cglm/project.h
|
180
|
+
- ext/cglm/cglm-0.6.2/include/cglm/quat.h
|
181
|
+
- ext/cglm/cglm-0.6.2/include/cglm/simd/arm.h
|
182
|
+
- ext/cglm/cglm-0.6.2/include/cglm/simd/avx/affine.h
|
183
|
+
- ext/cglm/cglm-0.6.2/include/cglm/simd/avx/mat4.h
|
184
|
+
- ext/cglm/cglm-0.6.2/include/cglm/simd/intrin.h
|
185
|
+
- ext/cglm/cglm-0.6.2/include/cglm/simd/neon/mat4.h
|
186
|
+
- ext/cglm/cglm-0.6.2/include/cglm/simd/sse2/affine.h
|
187
|
+
- ext/cglm/cglm-0.6.2/include/cglm/simd/sse2/mat3.h
|
188
|
+
- ext/cglm/cglm-0.6.2/include/cglm/simd/sse2/mat4.h
|
189
|
+
- ext/cglm/cglm-0.6.2/include/cglm/simd/sse2/quat.h
|
190
|
+
- ext/cglm/cglm-0.6.2/include/cglm/simd/x86.h
|
191
|
+
- ext/cglm/cglm-0.6.2/include/cglm/sphere.h
|
192
|
+
- ext/cglm/cglm-0.6.2/include/cglm/struct.h
|
193
|
+
- ext/cglm/cglm-0.6.2/include/cglm/struct/affine.h
|
194
|
+
- ext/cglm/cglm-0.6.2/include/cglm/struct/box.h
|
195
|
+
- ext/cglm/cglm-0.6.2/include/cglm/struct/cam.h
|
196
|
+
- ext/cglm/cglm-0.6.2/include/cglm/struct/color.h
|
197
|
+
- ext/cglm/cglm-0.6.2/include/cglm/struct/curve.h
|
198
|
+
- ext/cglm/cglm-0.6.2/include/cglm/struct/euler.h
|
199
|
+
- ext/cglm/cglm-0.6.2/include/cglm/struct/frustum.h
|
200
|
+
- ext/cglm/cglm-0.6.2/include/cglm/struct/io.h
|
201
|
+
- ext/cglm/cglm-0.6.2/include/cglm/struct/mat3.h
|
202
|
+
- ext/cglm/cglm-0.6.2/include/cglm/struct/mat4.h
|
203
|
+
- ext/cglm/cglm-0.6.2/include/cglm/struct/plane.h
|
204
|
+
- ext/cglm/cglm-0.6.2/include/cglm/struct/project.h
|
205
|
+
- ext/cglm/cglm-0.6.2/include/cglm/struct/quat.h
|
206
|
+
- ext/cglm/cglm-0.6.2/include/cglm/struct/sphere.h
|
207
|
+
- ext/cglm/cglm-0.6.2/include/cglm/struct/vec3-ext.h
|
208
|
+
- ext/cglm/cglm-0.6.2/include/cglm/struct/vec3.h
|
209
|
+
- ext/cglm/cglm-0.6.2/include/cglm/struct/vec4-ext.h
|
210
|
+
- ext/cglm/cglm-0.6.2/include/cglm/struct/vec4.h
|
211
|
+
- ext/cglm/cglm-0.6.2/include/cglm/types-struct.h
|
212
|
+
- ext/cglm/cglm-0.6.2/include/cglm/types.h
|
213
|
+
- ext/cglm/cglm-0.6.2/include/cglm/util.h
|
214
|
+
- ext/cglm/cglm-0.6.2/include/cglm/vec3-ext.h
|
215
|
+
- ext/cglm/cglm-0.6.2/include/cglm/vec3.h
|
216
|
+
- ext/cglm/cglm-0.6.2/include/cglm/vec4-ext.h
|
217
|
+
- ext/cglm/cglm-0.6.2/include/cglm/vec4.h
|
218
|
+
- ext/cglm/cglm-0.6.2/include/cglm/version.h
|
144
219
|
- ext/cglm/extconf.rb
|
145
220
|
- ext/cglm/rb_cglm.c
|
146
221
|
- ext/cglm/rb_cglm.h
|
@@ -159,6 +234,7 @@ files:
|
|
159
234
|
- ext/cglm/rb_cglm_sphere.c
|
160
235
|
- ext/cglm/rb_cglm_vec3.c
|
161
236
|
- ext/cglm/rb_cglm_vec4.c
|
237
|
+
- ext/cglm/ruby_pre27.h
|
162
238
|
- lib/cglm.rb
|
163
239
|
- lib/cglm/aabb.rb
|
164
240
|
- lib/cglm/base.rb
|
@@ -194,9 +270,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
194
270
|
- !ruby/object:Gem::Version
|
195
271
|
version: '0'
|
196
272
|
requirements: []
|
197
|
-
|
198
|
-
rubygems_version: 2.7.8
|
273
|
+
rubygems_version: 3.1.2
|
199
274
|
signing_key:
|
200
275
|
specification_version: 4
|
201
|
-
summary:
|
276
|
+
summary: Ruby bindings for CGLM (https://github.com/recp/cglm), a high performance
|
277
|
+
math library for graphics applications.
|
202
278
|
test_files: []
|