Changed operation order, normalise vectors before computing normals

This commit is contained in:
Thomas FORGIONE
2017-01-19 14:32:02 +01:00
parent 7720dcd6ba
commit 7836f327e0
3 changed files with 23 additions and 11 deletions
+2
View File
@@ -218,6 +218,8 @@ class ModelParser:
for face in part.faces:
v1 = Vertex.from_points(self.vertices[face.a.vertex], self.vertices[face.b.vertex])
v2 = Vertex.from_points(self.vertices[face.a.vertex], self.vertices[face.c.vertex])
v1.normalize()
v2.normalize()
cross = Vertex.cross_product(v1, v2)
self.normals[face.a.vertex] += cross
self.normals[face.b.vertex] += cross
+3
View File
@@ -189,6 +189,9 @@ class PLY_ASCII_ContentParser:
def parse_line(self, string):
if string == '':
return
if self.current_element is None:
self.current_element = self.parent.elements[0]