Fixed problems, textured cube

This commit is contained in:
Thomas FORGIONE 2016-12-02 09:53:07 +01:00
parent 6c1e288b78
commit c81dbc8715
No known key found for this signature in database
GPG Key ID: 2A210FFC062E00C3
6 changed files with 43 additions and 23 deletions

View File

@ -1,21 +0,0 @@
v 0.5 -0.5 -0.5
v 0.5 0.5 -0.5
v -0.5 0.5 -0.5
v -0.5 -0.5 -0.5
v 0.5 -0.5 0.5
v 0.5 0.5 0.5
v -0.5 0.5 0.5
v -0.5 -0.5 0.5
f 1 2 5
f 2 6 5
f 2 3 6
f 3 7 6
f 2 1 4
f 2 4 3
f 5 6 8
f 6 7 8
f 3 4 8
f 3 8 7
f 4 1 5
f 4 5 8

View File

@ -0,0 +1,10 @@
newmtl cubemtl
Ns 10
Ni 1.0
d 1.0
Tf 1 1 1
illum 2
Ka 0.5 0.5 0.
Kd 0.9 0.9 0.9
Ks 0.0 0.0 0.0
map_Kd cube.png

View File

@ -0,0 +1,31 @@
mtllib cube.mtl
usemtl cubemtl
v -0.5 -0.5 -0.5
v -0.5 -0.5 0.5
v -0.5 0.5 -0.5
v -0.5 0.5 0.5
v 0.5 -0.5 -0.5
v 0.5 -0.5 0.5
v 0.5 0.5 -0.5
v 0.5 0.5 0.5
vt 0.0 0.0
vt 0.0 1.0
vt 1.0 0.0
vt 1.0 1.0
vn 1.0 0.0 0.0
vn 0.0 1.0 0.0
vn 0.0 0.0 1.0
vn -1.0 0.0 0.0
vn 0.0 -1.0 0.0
vn 0.0 0.0 -1.0
f 1/1/4 2/3/4 4/4/4 3/2/4
f 2/1/3 6/3/3 8/4/3 4/2/3
f 6/1/1 5/3/1 7/4/1 8/2/1
f 5/1/6 1/3/6 3/4/6 7/2/6
f 4/1/2 8/3/2 7/4/2 3/2/2
f 2/1/5 1/3/5 5/4/5 6/2/5

BIN
assets/models/cube/cube.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

View File

@ -23,7 +23,7 @@ class Material:
try:
ix, iy, image = self.map_Kd.size[0], self.map_Kd.size[1], self.map_Kd.tobytes("raw", "RGBA", 0, -1)
except SystemError:
except:
ix, iy, image = self.map_Kd.size[0], self.map_Kd.size[1], self.map_Kd.tobytes("raw", "RGBX", 0, -1)
self.id = gl.glGenTextures(1)

View File

@ -53,7 +53,7 @@ class OBJParser(ModelParser):
face.material = self.current_material
self.add_face(face)
elif len(split) == 4:
face = Face().form_array(splits[:3])
face = Face().from_array(splits[:3])
face.material = self.current_material
self.add_face(face)