lib/mittsu/core/geometry.rb in mittsu-0.4.0 vs lib/mittsu/core/geometry.rb in mittsu-0.4.1

- old
+ new

@@ -395,11 +395,11 @@ uvs1 << uv_copy end end def merge_mesh(mesh) - if mesh instanceof Mittsu::Mesh == false + if mesh.is_a?(Mittsu::Mesh) == false puts('ERROR: Mittsu::Geometry#merge_mesh: mesh not an instance of Mittsu::Mesh.', mesh.inspect) return end mesh.matrix_auto_update && mesh.update_matrix self.merge(mesh.geometry, mesh.matrix) @@ -467,11 +467,11 @@ end return output end vertices = [] @vertices.each do |vert| - vertices << vertex.x << vertex.y << vertex.z + vertices << vert.x << vert.y << vert.z end faces = [] normals = [] normals_hash = {} colors = [] @@ -505,10 +505,10 @@ faces << get_uv_index(face_vertex_uvs[0], uvs_hash, uvs) faces << get_uv_index(face_vertex_uvs[1], uvs_hash, uvs) 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 faces << get_normal_index(vertex_normals[0], normals_hash, normals) faces << get_normal_index(vertex_normals[1], normals_hash, normals)