From 589f12aeee06540b6c098e8cf8c509e5f8e2ce01 Mon Sep 17 00:00:00 2001 From: Thomas FORGIONE Date: Tue, 22 Nov 2016 11:54:59 +0100 Subject: [PATCH] Corrected splits and draws --- conv3d/model.py | 2 +- conv3d/obj.py | 5 ++++- conv3d/ply.py | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/conv3d/model.py b/conv3d/model.py index 1964e1b..c154c01 100644 --- a/conv3d/model.py +++ b/conv3d/model.py @@ -75,7 +75,7 @@ class ModelParser: import OpenGL.GL as gl gl.glColor3f(1.0,0.0,0.0) - gl.glBegin(gl.GL_QUADS) + gl.glBegin(gl.GL_TRIANGLES) for face in self.faces: v1 = self.vertices[face.a.vertex] v2 = self.vertices[face.b.vertex] diff --git a/conv3d/obj.py b/conv3d/obj.py index 87384a1..9edd74d 100644 --- a/conv3d/obj.py +++ b/conv3d/obj.py @@ -13,7 +13,10 @@ class OBJParser(ModelParser): self.materials = [] def parse_line(self, string): - split = string.split(' ') + if string == '': + return + + split = string.split() first = split[0] split = split[1:] diff --git a/conv3d/ply.py b/conv3d/ply.py index 5c7a86e..a0c973d 100644 --- a/conv3d/ply.py +++ b/conv3d/ply.py @@ -22,7 +22,7 @@ class PLYHeaderParser: self.parent = parent def parse_line(self, string): - split = string.split(' ') + split = string.split() if string == 'ply': return @@ -60,7 +60,7 @@ class PLYContentParser: def parse_line(self, string): - split = string.split(' ') + split = string.split() if self.current_element.name == 'vertex': self.parent.add_vertex(Vertex().from_array(split))