Do Depth Sorting later
authorAntonio Ospite <ospite@studenti.unina.it>
Thu, 17 Aug 2006 10:58:49 +0000 (12:58 +0200)
committerAntonio Ospite <ospite@studenti.unina.it>
Thu, 24 Sep 2009 16:03:14 +0000 (18:03 +0200)
Posticipate depth sorting after BackFace culling so we have less faces to
process

Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
vrm.py

diff --git a/vrm.py b/vrm.py
index c7d7a87..0d35415 100755 (executable)
--- a/vrm.py
+++ b/vrm.py
@@ -257,6 +257,7 @@ class Projector:
 
         return p
 
 
         return p
 
+
     ##
     # Private methods
     #
     ##
     # Private methods
     #
@@ -764,7 +765,7 @@ class Renderer:
 
         self._doConvertGeometricObjToMesh(workScene)
 
 
         self._doConvertGeometricObjToMesh(workScene)
 
-        self._doSceneClipping(workScene)
+        #self._doSceneClipping(workScene)
 
         if config.output['JOIN_OBJECTS']:
             self._joinMeshObjectsInScene(workScene)
 
         if config.output['JOIN_OBJECTS']:
             self._joinMeshObjectsInScene(workScene)
@@ -775,6 +776,7 @@ class Renderer:
 
         Objects = workScene.getChildren()
         for obj in Objects:
 
         Objects = workScene.getChildren()
         for obj in Objects:
+
             
             if obj.getType() != 'Mesh':
                 print "Only Mesh supported! - Skipping type:", obj.getType()
             
             if obj.getType() != 'Mesh':
                 print "Only Mesh supported! - Skipping type:", obj.getType()
@@ -786,10 +788,10 @@ class Renderer:
 
             self._doModelToWorldCoordinates(mesh, obj.matrix)
 
 
             self._doModelToWorldCoordinates(mesh, obj.matrix)
 
-            self._doObjectDepthSorting(mesh)
-            
             self._doBackFaceCulling(mesh)
             
             self._doBackFaceCulling(mesh)
             
+            self._doObjectDepthSorting(mesh)
+            
             self._doColorAndLighting(mesh)
 
             self._doEdgesStyle(mesh, edgeStyles[config.edges['STYLE']])
             self._doColorAndLighting(mesh)
 
             self._doEdgesStyle(mesh, edgeStyles[config.edges['STYLE']])
@@ -1051,12 +1053,20 @@ class Renderer:
         nmesh.faces.sort(by_max_vert_dist)
         nmesh.faces.reverse()
 
         nmesh.faces.sort(by_max_vert_dist)
         nmesh.faces.reverse()
 
+        # Get visible faces
+        #vf = nmesh.faces
+        #while len(vf)>1:
+        #    p1 = vf[0]
+        #    insideList = 
+
+        
         mesh.faces.delete(1, range(0, len(mesh.faces)))
 
         for i,f in enumerate(nmesh.faces):
             fv = [v.index for v in f.v] 
             mesh.faces.extend(fv)
             mesh.faces[i].mat = f.mat
         mesh.faces.delete(1, range(0, len(mesh.faces)))
 
         for i,f in enumerate(nmesh.faces):
             fv = [v.index for v in f.v] 
             mesh.faces.extend(fv)
             mesh.faces[i].mat = f.mat
+            mesh.faces[i].sel = f.sel
 
 
     def _doBackFaceCulling(self, mesh):
 
 
     def _doBackFaceCulling(self, mesh):