tiny_gltf 1.0.2 → 2.5.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -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);
@@ -14,40 +14,40 @@ VALUE rNode_new(const Node *node, VALUE rmodel) {
14
14
 
15
15
  VALUE rmatrix = Qnil, rrotation = Qnil, rtranslation = Qnil, rscale = Qnil;
16
16
  if (node->matrix.size() == 0) {
17
+ rtranslation = rb_ary_new();
18
+ if (node->translation.size() == 0) {
19
+ rb_ary_push(rtranslation, DBL2NUM(0.0));
20
+ rb_ary_push(rtranslation, DBL2NUM(0.0));
21
+ rb_ary_push(rtranslation, DBL2NUM(0.0));
22
+ } else {
23
+ for (size_t i = 0; i < node->translation.size(); i++)
24
+ rb_ary_push(rtranslation, DBL2NUM(node->translation[i]));
25
+ }
26
+
17
27
  rrotation = rb_ary_new();
18
28
  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));
29
+ rb_ary_push(rrotation, DBL2NUM(0.0));
30
+ rb_ary_push(rrotation, DBL2NUM(0.0));
31
+ rb_ary_push(rrotation, DBL2NUM(0.0));
32
+ rb_ary_push(rrotation, DBL2NUM(1.0));
23
33
  } else {
24
34
  for (size_t i = 0; i < node->rotation.size(); i++)
25
- rb_ary_push(rrotation, INT2NUM(node->rotation[i]));
35
+ rb_ary_push(rrotation, DBL2NUM(node->rotation[i]));
26
36
  }
27
37
 
28
38
  rscale = rb_ary_new();
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));
39
+ if (node->scale.size() == 0) {
40
+ rb_ary_push(rscale, DBL2NUM(1.0));
41
+ rb_ary_push(rscale, DBL2NUM(1.0));
42
+ rb_ary_push(rscale, DBL2NUM(1.0));
33
43
  } else {
34
44
  for (size_t i = 0; i < node->scale.size(); i++)
35
- rb_ary_push(rscale, INT2NUM(node->scale[i]));
36
- }
37
-
38
- rtranslation = rb_ary_new();
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));
43
- } else {
44
- for (size_t i = 0; i < node->translation.size(); i++)
45
- rb_ary_push(rtranslation, INT2NUM(node->translation[i]));
45
+ rb_ary_push(rscale, DBL2NUM(node->scale[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;