Mercurial > touhou
comparison stageviewer.py @ 8:f3ff96192476
Fix z-sorting issues
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Tue, 02 Aug 2011 13:21:28 +0200 |
parents | 02a5f5314a19 |
children | 668b808b73ef |
comparison
equal
deleted
inserted
replaced
7:02a5f5314a19 | 8:f3ff96192476 |
---|---|
173 obj_instance = [] | 173 obj_instance = [] |
174 for face_vertices, face_uvs in objects_faces[obj_id]: | 174 for face_vertices, face_uvs in objects_faces[obj_id]: |
175 obj_instance.append((tuple((x + ox, y + oy, z + oz) for x, y, z in face_vertices), | 175 obj_instance.append((tuple((x + ox, y + oy, z + oz) for x, y, z in face_vertices), |
176 face_uvs)) | 176 face_uvs)) |
177 objects_instances_faces.append(obj_instance) | 177 objects_instances_faces.append(obj_instance) |
178 | |
179 def keyfunc(obj): | |
180 return min(z for face in obj for x, y, z in face[0]) | |
181 objects_instances_faces.sort(key=keyfunc, reverse=True) | |
178 | 182 |
179 vertices, uvs = objects_faces_to_vertices_uvs(objects_instances_faces) | 183 vertices, uvs = objects_faces_to_vertices_uvs(objects_instances_faces) |
180 nb_vertices = len(vertices) | 184 nb_vertices = len(vertices) |
181 vertices_format = 'f' * (3 * nb_vertices) | 185 vertices_format = 'f' * (3 * nb_vertices) |
182 uvs_format = 'f' * (2 * nb_vertices) | 186 uvs_format = 'f' * (2 * nb_vertices) |