Author: ArcRiley
Date: 2008-05-19 19:37:00 -0400 (Mon, 19 May 2008)
New Revision: 1279

Modified:
   trunk/pysoy/include/soy.bodies.pxd
   trunk/pysoy/src/bodies/Body.pym
   trunk/pysoy/src/models/Mesh.pym
   trunk/pysoy/src/models/Shape.pym
   trunk/pysoy/src/scenes/Scene.pym
Log:
Ticket #956 :
  * basic move finished with Mesh and Shape
  * _render removed from Body, Scene now calls _body._model._render()


Modified: trunk/pysoy/include/soy.bodies.pxd
===================================================================
--- trunk/pysoy/include/soy.bodies.pxd  2008-05-19 22:57:46 UTC (rev 1278)
+++ trunk/pysoy/include/soy.bodies.pxd  2008-05-19 23:37:00 UTC (rev 1279)
@@ -78,7 +78,6 @@
   cdef void                     _copyFrom                ( self, ode.dReal* )
   cdef void                     _addForce                ( self, ode.dVector3 )
   # WindowLoop functions
-  cdef void                     _render                  ( self )        #nogil
   cdef void                     _calcFogCoords           ( self )         nogil
   cdef void                     _getModelviewInv         ( self, float* ) nogil
 

Modified: trunk/pysoy/src/bodies/Body.pym
===================================================================
--- trunk/pysoy/src/bodies/Body.pym     2008-05-19 22:57:46 UTC (rev 1278)
+++ trunk/pysoy/src/bodies/Body.pym     2008-05-19 23:37:00 UTC (rev 1279)
@@ -452,59 +452,6 @@
   # WindowLoop Functions
   #
 
-  cdef void _render(self) :
-    cdef gl.GLfloat _mtx[16]
-    #
-    ######################################
-    #
-    # return now if there's nothing to render
-    #
-    if self._model is None :
-      return
-    #
-    ######################################
-    #
-    # save current matrix
-    #
-    gl.glPushMatrix()
-    #
-    ######################################
-    #
-    # set model's matrix
-    #
-    _mtx[0]  = self._rotation[0]
-    _mtx[1]  = self._rotation[4]
-    _mtx[2]  = self._rotation[8]
-    _mtx[3]  = 0.0
-    _mtx[4]  = self._rotation[1]
-    _mtx[5]  = self._rotation[5]
-    _mtx[6]  = self._rotation[9]
-    _mtx[7]  = 0.0
-    _mtx[8]  = self._rotation[2]
-    _mtx[9]  = self._rotation[6]
-    _mtx[10] = self._rotation[10]
-    _mtx[11] = 0.0
-    _mtx[12] = self._position[0]
-    _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])

Modified: trunk/pysoy/src/models/Mesh.pym
===================================================================
--- trunk/pysoy/src/models/Mesh.pym     2008-05-19 22:57:46 UTC (rev 1278)
+++ trunk/pysoy/src/models/Mesh.pym     2008-05-19 23:37:00 UTC (rev 1279)
@@ -129,10 +129,53 @@
   #
 
   cdef void _render(self, soy.bodies.Body _body) :
+    cdef gl.GLfloat _mtx[16]
+    #
+    ######################################
+    #
+    # save current matrix
+    #
+    gl.glPushMatrix()
+    #
+    ######################################
+    #
+    # set model's matrix
+    #
+    _mtx[0]  = _body._rotation[0]
+    _mtx[1]  = _body._rotation[4]
+    _mtx[2]  = _body._rotation[8]
+    _mtx[3]  = 0.0
+    _mtx[4]  = _body._rotation[1]
+    _mtx[5]  = _body._rotation[5]
+    _mtx[6]  = _body._rotation[9]
+    _mtx[7]  = 0.0
+    _mtx[8]  = _body._rotation[2]
+    _mtx[9]  = _body._rotation[6]
+    _mtx[10] = _body._rotation[10]
+    _mtx[11] = 0.0
+    _mtx[12] = _body._position[0]
+    _mtx[13] = _body._position[1]
+    _mtx[14] = _body._position[2]
+    _mtx[15] = 1.0
+    gl.glMultMatrixf(_mtx)
+    #
+    ######################################
+    #
+    # render materials - insert new code here
+    #
     py.PyThread_acquire_lock(self._mutex, 1)
     self._mates._render(<void*> _body)
     py.PyThread_release_lock(self._mutex)
+    #
+    ######################################
+    #
+    # restore previous matrix
+    #
+    gl.glPopMatrix()
+    #
+    ######################################
 
+
   #
   # Rendering Pipeline :
   # 

Modified: trunk/pysoy/src/models/Shape.pym
===================================================================
--- trunk/pysoy/src/models/Shape.pym    2008-05-19 22:57:46 UTC (rev 1278)
+++ trunk/pysoy/src/models/Shape.pym    2008-05-19 23:37:00 UTC (rev 1279)
@@ -57,16 +57,53 @@
   #
 
   cdef void _render(self, soy.bodies.Body _body) :
-    cdef int              _shapeclass
+    cdef int         _shapeclass
+    cdef gl.GLfloat  _mtx[16]
     #
+    ######################################
+    #
     # Don't attempt to render a non-existant shape
+    #
     if _body._shape is None :
       return
     #
+    ######################################
+    #
+    # save current matrix
+    #
+    gl.glPushMatrix()
+    #
+    ######################################
+    #
+    # set model's matrix
+    #
+    _mtx[0]  = _body._rotation[0]
+    _mtx[1]  = _body._rotation[4]
+    _mtx[2]  = _body._rotation[8]
+    _mtx[3]  = 0.0
+    _mtx[4]  = _body._rotation[1]
+    _mtx[5]  = _body._rotation[5]
+    _mtx[6]  = _body._rotation[9]
+    _mtx[7]  = 0.0
+    _mtx[8]  = _body._rotation[2]
+    _mtx[9]  = _body._rotation[6]
+    _mtx[10] = _body._rotation[10]
+    _mtx[11] = 0.0
+    _mtx[12] = _body._position[0]
+    _mtx[13] = _body._position[1]
+    _mtx[14] = _body._position[2]
+    _mtx[15] = 1.0
+    gl.glMultMatrixf(_mtx)
+    #
+    ######################################
+    #
     # Grab the shape's class
     _shapeclass = ode.dGeomGetClass(_body._shape._geomID)
     #
-    # Render the specific shape
+    ######################################
+    #
+    # render the specific shape
+    #
     if _shapeclass == ode.dSphereClass :
       self._renderSphere(_body._shape)
     elif _shapeclass == ode.dCapsuleClass :
@@ -75,6 +112,14 @@
       self._renderBox(_body._shape)
     elif _shapeclass == ode.dRayClass :
       self._renderRay(_body._shape)
+    #
+    ######################################
+    #
+    # restore previous matrix
+    #
+    gl.glPopMatrix()
+    #
+    ######################################
 
 
   cdef void _renderSphere(self, soy.shapes.Shape _shape) :

Modified: trunk/pysoy/src/scenes/Scene.pym
===================================================================
--- trunk/pysoy/src/scenes/Scene.pym    2008-05-19 22:57:46 UTC (rev 1278)
+++ trunk/pysoy/src/scenes/Scene.pym    2008-05-19 23:37:00 UTC (rev 1279)
@@ -141,7 +141,10 @@
     # Iterate over bodies
     self._bodies._iterStart()
     for _i from 0 <= _i < self._bodies._current :
-      (<soy.bodies.Body> self._bodies._list[_i])._render()
+      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()
     #
     # Turn off all lights and finish iteration loop

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

Reply via email to