Corrected splits and draws

This commit is contained in:
Thomas FORGIONE 2016-11-22 11:54:59 +01:00
parent 8a38f66ce7
commit 589f12aeee
3 changed files with 7 additions and 4 deletions

View File

@ -75,7 +75,7 @@ class ModelParser:
import OpenGL.GL as gl import OpenGL.GL as gl
gl.glColor3f(1.0,0.0,0.0) gl.glColor3f(1.0,0.0,0.0)
gl.glBegin(gl.GL_QUADS) gl.glBegin(gl.GL_TRIANGLES)
for face in self.faces: for face in self.faces:
v1 = self.vertices[face.a.vertex] v1 = self.vertices[face.a.vertex]
v2 = self.vertices[face.b.vertex] v2 = self.vertices[face.b.vertex]

View File

@ -13,7 +13,10 @@ class OBJParser(ModelParser):
self.materials = [] self.materials = []
def parse_line(self, string): def parse_line(self, string):
split = string.split(' ') if string == '':
return
split = string.split()
first = split[0] first = split[0]
split = split[1:] split = split[1:]

View File

@ -22,7 +22,7 @@ class PLYHeaderParser:
self.parent = parent self.parent = parent
def parse_line(self, string): def parse_line(self, string):
split = string.split(' ') split = string.split()
if string == 'ply': if string == 'ply':
return return
@ -60,7 +60,7 @@ class PLYContentParser:
def parse_line(self, string): def parse_line(self, string):
split = string.split(' ') split = string.split()
if self.current_element.name == 'vertex': if self.current_element.name == 'vertex':
self.parent.add_vertex(Vertex().from_array(split)) self.parent.add_vertex(Vertex().from_array(split))