diff --git a/assets/models/cube.obj b/assets/models/cube.obj deleted file mode 100644 index 905ecdb..0000000 --- a/assets/models/cube.obj +++ /dev/null @@ -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 diff --git a/assets/models/cube/cube.mtl b/assets/models/cube/cube.mtl new file mode 100644 index 0000000..5a4b37f --- /dev/null +++ b/assets/models/cube/cube.mtl @@ -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 diff --git a/assets/models/cube/cube.obj b/assets/models/cube/cube.obj new file mode 100644 index 0000000..778151b --- /dev/null +++ b/assets/models/cube/cube.obj @@ -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 diff --git a/assets/models/cube/cube.png b/assets/models/cube/cube.png new file mode 100644 index 0000000..b1928b0 Binary files /dev/null and b/assets/models/cube/cube.png differ diff --git a/d3/model/mesh.py b/d3/model/mesh.py index 980a21d..e91118d 100644 --- a/d3/model/mesh.py +++ b/d3/model/mesh.py @@ -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) diff --git a/d3/model/obj.py b/d3/model/obj.py index 823e660..a509484 100644 --- a/d3/model/obj.py +++ b/d3/model/obj.py @@ -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)