Author: ArcRiley
Date: 2008-07-18 00:47:13 -0400 (Fri, 18 Jul 2008)
New Revision: 1329

Modified:
   trunk/pysoy/src/scenes/Landscape.pym
Log:
Ticket #929 :
  * fixed depth buffer issue
  * Landscape._render is complete without needing to call Scene._render


Modified: trunk/pysoy/src/scenes/Landscape.pym
===================================================================
--- trunk/pysoy/src/scenes/Landscape.pym        2008-07-18 01:36:57 UTC (rev 
1328)
+++ trunk/pysoy/src/scenes/Landscape.pym        2008-07-18 04:47:13 UTC (rev 
1329)
@@ -259,6 +259,11 @@
     # Setup projection matrix
     cdef int _i, _pass
     _pass = 0
+    gl.glMatrixMode(gl.GL_PROJECTION)
+    gl.glLoadIdentity()
+    gl.gluPerspective(_fovy, _aspect, _znear, 1000.0)
+    gl.glMatrixMode(gl.GL_MODELVIEW)
+    gl.glClear(gl.GL_DEPTH_BUFFER_BIT)
     gl.glEnable(gl.GL_DEPTH_TEST)
     gl.glEnable(gl.GL_LIGHTING)
     gl.glLightModelfv(gl.GL_LIGHT_MODEL_AMBIENT, self._ambient._rgba)
@@ -268,9 +273,6 @@
     for _i from 0 <= _i < self._lights._current :
       # This is a quick hack (gl.GL_LIGHT0 + _i)
       (<soy.bodies.Light> self._lights._list[_i])._on(gl.GL_LIGHT0 + _i)
-    gl.glMatrixMode(gl.GL_PROJECTION)
-    gl.glLoadIdentity()
-    gl.gluPerspective(_fovy, _aspect, _znear, 1000.0)
     gl.glPushMatrix()
     gl.glTranslatef(self._position[0], self._position[1], self._position[2])
     if self._buffer:
@@ -297,13 +299,29 @@
     #
     # Render the rest of the scene normally    
     gl.glPopMatrix()
+    gl.glMatrixMode(gl.GL_PROJECTION)
+    gl.glLoadIdentity()
+    gl.gluPerspective(_fovy, _aspect, _znear, _zfar)
+    gl.glMatrixMode(gl.GL_MODELVIEW)
+    #
+    # Iterate over bodies
+    self._bodies._iterStart()
+    for _i from 0 <= _i < self._bodies._current :
+      if (<soy.bodies.Body> self._bodies._list[_i])._model is not None :
+        (<soy.models.Model>
+         (<soy.bodies.Body> self._bodies._list[_i])._model)._render(
+         (<soy.bodies.Body> self._bodies._list[_i]))
+    self._bodies._iterDone()
+    #
+    # Remember - turn off the lights before you leave
     for _i from 0 <= _i < self._lights._current :
       # This is a quick hack (gl.GL_LIGHT0 + _i)
       (<soy.bodies.Light> self._lights._list[_i])._off(gl.GL_LIGHT0 + _i)
     self._lights._iterDone()
     gl.glDisable(gl.GL_LIGHTING)
     gl.glDisable(gl.GL_DEPTH_TEST)
-    Scene._render(self, _fovy, _aspect, _znear, _zfar)
+
+
 """
 
 TODO : LOD

_______________________________________________
PySoy-SVN mailing list
PySoy-SVN@pysoy.org
http://www.pysoy.org/mailman/listinfo/pysoy-svn

Reply via email to