tiny_gltf 1.0.1 → 2.5.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.
@@ -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(rprimitives, DBL2NUM(mesh->weights[i]));
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, INT2NUM(0));
20
- rb_ary_push(rrotation, INT2NUM(0));
21
- rb_ary_push(rrotation, INT2NUM(0));
22
- rb_ary_push(rrotation, INT2NUM(1));
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, INT2NUM(node->rotation[i]));
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, INT2NUM(0));
31
- rb_ary_push(rscale, INT2NUM(0));
32
- rb_ary_push(rscale, INT2NUM(0));
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, INT2NUM(node->scale[i]));
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, INT2NUM(0));
41
- rb_ary_push(rtranslation, INT2NUM(0));
42
- rb_ary_push(rtranslation, INT2NUM(0));
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, INT2NUM(node->translation[i]));
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, INT2NUM(node->matrix[i]));
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
- rb_ivar_set(rsampler, rb_intern("@wrap_r"), texture_wrap_to_sym(sampler->wrapR));
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;