Added Face4 support for .obj

This commit is contained in:
Thomas FORGIONE 2016-12-02 09:26:07 +01:00
parent 69286684d5
commit 6c1e288b78
No known key found for this signature in database
GPG Key ID: 2A210FFC062E00C3
1 changed files with 15 additions and 3 deletions

View File

@ -47,9 +47,21 @@ class OBJParser(ModelParser):
if splits[i][j] is not '':
splits[i][j] = int(splits[i][j]) - 1
face = Face().from_array(splits)
face.material = self.current_material
self.add_face(face)
# if Face3
if len(split) == 3:
face = Face().from_array(splits)
face.material = self.current_material
self.add_face(face)
elif len(split) == 4:
face = Face().form_array(splits[:3])
face.material = self.current_material
self.add_face(face)
face = Face().from_array([splits[0], splits[2], splits[3]])
face.material = self.current_material
self.add_face(face)
else:
print('Face with more than 4 vertices are not supported', file=sys.stderr)
class MTLParser: