Don't overload types in AMFReader

The typing really doesn't like it if we first let a variable be a list and then
an numpy array
This commit is contained in:
Jaime van Kessel 2021-04-07 11:32:09 +02:00
parent 0d38035944
commit 00a360aca6
No known key found for this signature in database
GPG Key ID: 3710727397403C91

View File

@ -157,22 +157,22 @@ class AMFReader(MeshReader):
tri_faces = tri_node.faces tri_faces = tri_node.faces
tri_vertices = tri_node.vertices tri_vertices = tri_node.vertices
indices = [] indices_list = []
vertices = [] vertices_list = []
index_count = 0 index_count = 0
face_count = 0 face_count = 0
for tri_face in tri_faces: for tri_face in tri_faces:
face = [] face = []
for tri_index in tri_face: for tri_index in tri_face:
vertices.append(tri_vertices[tri_index]) vertices_list.append(tri_vertices[tri_index])
face.append(index_count) face.append(index_count)
index_count += 1 index_count += 1
indices.append(face) indices_list.append(face)
face_count += 1 face_count += 1
vertices = numpy.asarray(vertices, dtype = numpy.float32) vertices = numpy.asarray(vertices_list, dtype = numpy.float32)
indices = numpy.asarray(indices, dtype = numpy.int32) indices = numpy.asarray(indices_list, dtype = numpy.int32)
normals = calculateNormalsFromIndexedVertices(vertices, indices, face_count) normals = calculateNormalsFromIndexedVertices(vertices, indices, face_count)
mesh_data = MeshData(vertices = vertices, indices = indices, normals = normals,file_name = file_name) mesh_data = MeshData(vertices = vertices, indices = indices, normals = normals,file_name = file_name)