Author: ArcRiley
Date: 2008-05-16 01:26:53 -0400 (Fri, 16 May 2008)
New Revision: 1260

Modified:
   trunk/pysoy/include/soy.bodies.pxd
   trunk/pysoy/src/bodies/Body.pym
Log:
No Ticket :
  * streamlined rendering by folding _getModelview into _render
  * added comments, additional formatting for (hopefully) easier reading


Modified: trunk/pysoy/include/soy.bodies.pxd
===================================================================
--- trunk/pysoy/include/soy.bodies.pxd  2008-05-16 01:24:46 UTC (rev 1259)
+++ trunk/pysoy/include/soy.bodies.pxd  2008-05-16 05:26:53 UTC (rev 1260)
@@ -80,7 +80,6 @@
   # WindowLoop functions
   cdef void                     _render                  ( self )         nogil
   cdef void                     _calcFogCoords           ( self )         nogil
-  cdef void                     _getModelview            ( self, float* ) nogil
   cdef void                     _getModelviewInv         ( self, float* ) nogil
 
 

Modified: trunk/pysoy/src/bodies/Body.pym
===================================================================
--- trunk/pysoy/src/bodies/Body.pym     2008-05-16 01:24:46 UTC (rev 1259)
+++ trunk/pysoy/src/bodies/Body.pym     2008-05-16 05:26:53 UTC (rev 1260)
@@ -454,21 +454,24 @@
 
   cdef void _render(self) nogil :
     cdef gl.GLfloat _mtx[16]
+    #
+    ######################################
+    #
+    # return now if there's nothing to render
+    #
     if self._model is None :
       return
-    self._getModelview(_mtx)
+    #
+    ######################################
+    #
+    # save current matrix
+    #
     gl.glPushMatrix()
-    gl.glMultMatrixf(_mtx)
-    self._model._render(self)
-    gl.glPopMatrix()
-
-
-  cdef void _calcFogCoords(self) nogil :
-    if self._model is not None :
-      self._model._calcFogCoords(<float> self._position[1])
-
-
-  cdef void _getModelview(self, float* _mtx) nogil :
+    #
+    ######################################
+    #
+    # set model's matrix
+    #
     _mtx[0]  = self._rotation[0]
     _mtx[1]  = self._rotation[4]
     _mtx[2]  = self._rotation[8]
@@ -485,8 +488,28 @@
     _mtx[13] = self._position[1]
     _mtx[14] = self._position[2]
     _mtx[15] = 1.0
+    gl.glMultMatrixf(_mtx)
+    #
+    ######################################
+    #
+    # call model's rendering function
+    #
+    self._model._render(self)
+    #
+    ######################################
+    #
+    # restore previous matrix
+    #
+    gl.glPopMatrix()
+    #
+    ######################################
 
 
+  cdef void _calcFogCoords(self) nogil :
+    if self._model is not None :
+      self._model._calcFogCoords(<float> self._position[1])
+
+
   cdef void _getModelviewInv(self, float* _mtx) nogil :
     _mtx[0]  = self._rotation[0]
     _mtx[4]  = self._rotation[4]

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

Reply via email to