@@ -123,7 +123,7 @@ cdef class Model:
123123 logger.debug(" Filled holes in non-manifold mesh: {}" , self .name)
124124 elif merged:
125125 logger.trace(" Merged vertices of non-manifold mesh: {}" , self .name)
126- return manifold3d.Manifold(mesh = manifold3d.Mesh(vert_properties = np.array(trimesh_model.vertices, dtype = np.float32 ),
126+ return manifold3d.Manifold(mesh = manifold3d.Mesh(vert_properties = np.array(trimesh_model.vertices, dtype = ' f4 ' ),
127127 tri_verts = np.array(trimesh_model.faces, dtype = np.uint32)))
128128
129129 cpdef void add_dependent(self , Model model):
@@ -205,8 +205,8 @@ cdef class Model:
205205 vertex_uvs = visual.uv
206206 else :
207207 vertex_uvs = np.zeros((len (trimesh_model.vertices), 2 ))
208- vertex_data = np.hstack((trimesh_model.vertices, trimesh_model.vertex_normals, vertex_uvs)).astype(' f4' )
209- index_data = trimesh_model.faces.astype(' i4' )
208+ vertex_data = np.hstack((trimesh_model.vertices, trimesh_model.vertex_normals, vertex_uvs)).astype(' f4' , copy = False )
209+ index_data = trimesh_model.faces.astype(' i4' , copy = False )
210210 buffers = (glctx.buffer(vertex_data), glctx.buffer(index_data))
211211 logger.trace(" Constructed model {} with {} vertices and {} faces" , name, len (vertex_data), len (index_data))
212212 objects[name] = buffers
@@ -494,7 +494,7 @@ cdef class Transform(UnaryOperation):
494494 cpdef object build_trimesh(self ):
495495 trimesh_model = self .original.get_trimesh()
496496 if trimesh_model is not None :
497- transform_array = np.array(self .transform_matrix, dtype = ' float64 ' ).reshape((4 , 4 )).transpose()
497+ transform_array = np.array(self .transform_matrix, dtype = ' f8 ' ).reshape((4 , 4 )).transpose()
498498 trimesh_model = trimesh_model.copy().apply_transform(transform_array)
499499 if self .original.is_manifold() and not trimesh_model.is_volume:
500500 logger.warning(" Result of transform is no longer a volume: {}" , self .name)
@@ -504,7 +504,7 @@ cdef class Transform(UnaryOperation):
504504 cpdef object build_manifold(self ):
505505 manifold = self .original.get_manifold()
506506 if manifold is not None :
507- transform_matrix = np.array(self .transform_matrix, dtype = ' float64 ' ).reshape((4 , 4 )).transpose()[:3 ].tolist()
507+ transform_matrix = np.array(self .transform_matrix, dtype = ' f8 ' ).reshape((4 , 4 )).transpose()[:3 ].tolist()
508508 manifold = manifold.transform(transform_matrix)
509509 return manifold
510510
@@ -527,14 +527,14 @@ cdef class UVRemap(UnaryOperation):
527527 return model
528528
529529 cdef object remap_sphere(self , trimesh_model):
530- cdef const double [:, :] vertices
530+ cdef const float [:, :] vertices
531531 cdef object vertex_uv_array
532- cdef double [:, :] vertex_uv
532+ cdef float [:, :] vertex_uv
533533 cdef int64_t i, n
534- cdef double x, y, z
534+ cdef float x, y, z
535535 n = len (trimesh_model.vertices)
536- vertices = trimesh_model.vertices.astype(' float64 ' )
537- vertex_uv_array = np.zeros((n, 2 ), dtype = ' float64 ' )
536+ vertices = trimesh_model.vertices.astype(' f4 ' , copy = False )
537+ vertex_uv_array = np.zeros((n, 2 ), dtype = ' f4 ' )
538538 vertex_uv = vertex_uv_array
539539 for i in range (n):
540540 x, y, z = vertices[i][0 ], vertices[i][1 ], vertices[i][2 ]
0 commit comments