diff 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
line wrap: on
line diff
--- a/stageviewer.py
+++ b/stageviewer.py
@@ -176,6 +176,10 @@ def main(path, stage_num):
                                 face_uvs))
         objects_instances_faces.append(obj_instance)
 
+    def keyfunc(obj):
+        return min(z for face in obj for x, y, z in face[0])
+    objects_instances_faces.sort(key=keyfunc, reverse=True)
+
     vertices, uvs = objects_faces_to_vertices_uvs(objects_instances_faces)
     nb_vertices = len(vertices)
     vertices_format = 'f' * (3 * nb_vertices)