tiny_gltf 1.0.1 → 2.5.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +11 -9
- data/ext/tiny_gltf/json.hpp +19421 -7390
- data/ext/tiny_gltf/rb_tiny_gltf.h +1 -2
- data/ext/tiny_gltf/rb_tiny_gltf_mesh.cpp +1 -1
- data/ext/tiny_gltf/rb_tiny_gltf_node.cpp +14 -14
- data/ext/tiny_gltf/rb_tiny_gltf_sampler.cpp +3 -1
- data/ext/tiny_gltf/tiny_gltf.h +573 -244
- data/lib/tiny_gltf/version.rb +1 -1
- data/tiny_gltf.gemspec +1 -1
- metadata +9 -9
@@ -7,6 +7,7 @@
|
|
7
7
|
#endif
|
8
8
|
|
9
9
|
#include <time.h> // work around C++/C linkage error on some platforms
|
10
|
+
#include "ruby.h"
|
10
11
|
|
11
12
|
#if __cplusplus
|
12
13
|
#include <algorithm>
|
@@ -15,8 +16,6 @@
|
|
15
16
|
extern "C" {
|
16
17
|
#endif
|
17
18
|
|
18
|
-
#include "ruby.h"
|
19
|
-
|
20
19
|
void Init_tiny_gltf(void);
|
21
20
|
VALUE rb_tgltf_load(int argc, VALUE *argv, VALUE self);
|
22
21
|
|
@@ -11,7 +11,7 @@ VALUE rMesh_new(const Mesh *mesh, VALUE rmodel) {
|
|
11
11
|
|
12
12
|
VALUE rweights = rb_ary_new();
|
13
13
|
for (size_t i = 0; i < mesh->weights.size(); i++) {
|
14
|
-
rb_ary_push(
|
14
|
+
rb_ary_push(rweights, DBL2NUM(mesh->weights[i]));
|
15
15
|
}
|
16
16
|
|
17
17
|
rb_ivar_set(rmesh, rb_intern("@model"), rmodel);
|
@@ -16,38 +16,38 @@ VALUE rNode_new(const Node *node, VALUE rmodel) {
|
|
16
16
|
if (node->matrix.size() == 0) {
|
17
17
|
rrotation = rb_ary_new();
|
18
18
|
if (node->rotation.size() == 0) {
|
19
|
-
rb_ary_push(rrotation,
|
20
|
-
rb_ary_push(rrotation,
|
21
|
-
rb_ary_push(rrotation,
|
22
|
-
rb_ary_push(rrotation,
|
19
|
+
rb_ary_push(rrotation, DBL2NUM(0.0));
|
20
|
+
rb_ary_push(rrotation, DBL2NUM(0.0));
|
21
|
+
rb_ary_push(rrotation, DBL2NUM(0.0));
|
22
|
+
rb_ary_push(rrotation, DBL2NUM(1.0));
|
23
23
|
} else {
|
24
24
|
for (size_t i = 0; i < node->rotation.size(); i++)
|
25
|
-
rb_ary_push(rrotation,
|
25
|
+
rb_ary_push(rrotation, DBL2NUM(node->rotation[i]));
|
26
26
|
}
|
27
27
|
|
28
28
|
rscale = rb_ary_new();
|
29
29
|
if (node->rotation.size() == 0) {
|
30
|
-
rb_ary_push(rscale,
|
31
|
-
rb_ary_push(rscale,
|
32
|
-
rb_ary_push(rscale,
|
30
|
+
rb_ary_push(rscale, DBL2NUM(0.0));
|
31
|
+
rb_ary_push(rscale, DBL2NUM(0.0));
|
32
|
+
rb_ary_push(rscale, DBL2NUM(0.0));
|
33
33
|
} else {
|
34
34
|
for (size_t i = 0; i < node->scale.size(); i++)
|
35
|
-
rb_ary_push(rscale,
|
35
|
+
rb_ary_push(rscale, DBL2NUM(node->scale[i]));
|
36
36
|
}
|
37
37
|
|
38
38
|
rtranslation = rb_ary_new();
|
39
39
|
if (node->translation.size() == 0) {
|
40
|
-
rb_ary_push(rtranslation,
|
41
|
-
rb_ary_push(rtranslation,
|
42
|
-
rb_ary_push(rtranslation,
|
40
|
+
rb_ary_push(rtranslation, DBL2NUM(0.0));
|
41
|
+
rb_ary_push(rtranslation, DBL2NUM(0.0));
|
42
|
+
rb_ary_push(rtranslation, DBL2NUM(0.0));
|
43
43
|
} else {
|
44
44
|
for (size_t i = 0; i < node->translation.size(); i++)
|
45
|
-
rb_ary_push(rtranslation,
|
45
|
+
rb_ary_push(rtranslation, DBL2NUM(node->translation[i]));
|
46
46
|
}
|
47
47
|
} else {
|
48
48
|
rmatrix = rb_ary_new();
|
49
49
|
for (size_t i = 0; i < node->matrix.size(); i++)
|
50
|
-
rb_ary_push(rmatrix,
|
50
|
+
rb_ary_push(rmatrix, DBL2NUM(node->matrix[i]));
|
51
51
|
}
|
52
52
|
|
53
53
|
rb_ivar_set(rnode, rb_intern("@model"), rmodel);
|
@@ -10,7 +10,9 @@ VALUE rSampler_new(const Sampler *sampler, VALUE rmodel) {
|
|
10
10
|
rb_ivar_set(rsampler, rb_intern("@mag_filter"), texture_filter_to_sym(sampler->magFilter));
|
11
11
|
rb_ivar_set(rsampler, rb_intern("@wrap_s"), texture_wrap_to_sym(sampler->wrapS));
|
12
12
|
rb_ivar_set(rsampler, rb_intern("@wrap_t"), texture_wrap_to_sym(sampler->wrapT));
|
13
|
-
|
13
|
+
// removed from tiny_gltf until a spec or extension actually calls for it
|
14
|
+
// https://github.com/syoyo/tinygltf/issues/287
|
15
|
+
// rb_ivar_set(rsampler, rb_intern("@wrap_r"), texture_wrap_to_sym(sampler->wrapR));
|
14
16
|
rb_ivar_set(rsampler, rb_intern("@extras"), rValue_new(&sampler->extras, rmodel));
|
15
17
|
|
16
18
|
return rsampler;
|