From e8e6e0181d8d0c48db11a06b32cdb4a94554010d Mon Sep 17 00:00:00 2001 From: James Smith Date: Sun, 25 Feb 2024 10:26:55 +0000 Subject: [PATCH] Fix a few bugs in json export --- lib/mittsu/core/geometry.rb | 4 ++-- lib/mittsu/core/object_3d.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/mittsu/core/geometry.rb b/lib/mittsu/core/geometry.rb index 42d4e263..a1ba747e 100644 --- a/lib/mittsu/core/geometry.rb +++ b/lib/mittsu/core/geometry.rb @@ -469,7 +469,7 @@ def to_json end vertices = [] @vertices.each do |vert| - vertices << vertex.x << vertex.y << vertex.z + vertices << vert.x << vert.y << vert.z end faces = [] normals = [] @@ -507,7 +507,7 @@ def to_json faces << get_uv_index(face_vertex_uvs[2], uvs_hash, uvs) end if has_face_normal - faces << get_normal_index(face.normal) + faces << get_normal_index(face.normal, normals_hash, normals) end if has_face_vertex_normal vertex_normals = face.vertex_normals diff --git a/lib/mittsu/core/object_3d.rb b/lib/mittsu/core/object_3d.rb index ceadfdc0..fb1a5bdd 100644 --- a/lib/mittsu/core/object_3d.rb +++ b/lib/mittsu/core/object_3d.rb @@ -357,7 +357,7 @@ def jsonify if !self.children.empty? data[:children] = @children.map do |child| - child.jsonify + child.to_json end end