Changeset 1279

Show
Ignore:
Timestamp:
05/19/08 19:37:00 (5 months ago)
Author:
ArcRiley
Message:

Ticket #956 :

  • basic move finished with Mesh and Shape
  • _render removed from Body, Scene now calls _body._model._render()
Location:
trunk/pysoy
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • trunk/pysoy/include/soy.bodies.pxd

    r1274 r1279  
    7979  cdef void                     _addForce                ( self, ode.dVector3 ) 
    8080  # WindowLoop functions 
    81   cdef void                     _render                  ( self )        #nogil 
    8281  cdef void                     _calcFogCoords           ( self )         nogil 
    8382  cdef void                     _getModelviewInv         ( self, float* ) nogil 
  • trunk/pysoy/src/bodies/Body.pym

    r1274 r1279  
    453453  # 
    454454 
    455   cdef void _render(self) : 
    456     cdef gl.GLfloat _mtx[16] 
    457     # 
    458     ###################################### 
    459     # 
    460     # return now if there's nothing to render 
    461     # 
    462     if self._model is None : 
    463       return 
    464     # 
    465     ###################################### 
    466     # 
    467     # save current matrix 
    468     # 
    469     gl.glPushMatrix() 
    470     # 
    471     ###################################### 
    472     # 
    473     # set model's matrix 
    474     # 
    475     _mtx[0]  = self._rotation[0] 
    476     _mtx[1]  = self._rotation[4] 
    477     _mtx[2]  = self._rotation[8] 
    478     _mtx[3]  = 0.0 
    479     _mtx[4]  = self._rotation[1] 
    480     _mtx[5]  = self._rotation[5] 
    481     _mtx[6]  = self._rotation[9] 
    482     _mtx[7]  = 0.0 
    483     _mtx[8]  = self._rotation[2] 
    484     _mtx[9]  = self._rotation[6] 
    485     _mtx[10] = self._rotation[10] 
    486     _mtx[11] = 0.0 
    487     _mtx[12] = self._position[0] 
    488     _mtx[13] = self._position[1] 
    489     _mtx[14] = self._position[2] 
    490     _mtx[15] = 1.0 
    491     gl.glMultMatrixf(_mtx) 
    492     # 
    493     ###################################### 
    494     # 
    495     # call model's rendering function 
    496     # 
    497     self._model._render(self) 
    498     # 
    499     ###################################### 
    500     # 
    501     # restore previous matrix 
    502     # 
    503     gl.glPopMatrix() 
    504     # 
    505     ###################################### 
    506  
    507  
    508455  cdef void _calcFogCoords(self) nogil : 
    509456    if self._model is not None : 
  • trunk/pysoy/src/models/Mesh.pym

    r1272 r1279  
    130130 
    131131  cdef void _render(self, soy.bodies.Body _body) : 
     132    cdef gl.GLfloat _mtx[16] 
     133    # 
     134    ###################################### 
     135    # 
     136    # save current matrix 
     137    # 
     138    gl.glPushMatrix() 
     139    # 
     140    ###################################### 
     141    # 
     142    # set model's matrix 
     143    # 
     144    _mtx[0]  = _body._rotation[0] 
     145    _mtx[1]  = _body._rotation[4] 
     146    _mtx[2]  = _body._rotation[8] 
     147    _mtx[3]  = 0.0 
     148    _mtx[4]  = _body._rotation[1] 
     149    _mtx[5]  = _body._rotation[5] 
     150    _mtx[6]  = _body._rotation[9] 
     151    _mtx[7]  = 0.0 
     152    _mtx[8]  = _body._rotation[2] 
     153    _mtx[9]  = _body._rotation[6] 
     154    _mtx[10] = _body._rotation[10] 
     155    _mtx[11] = 0.0 
     156    _mtx[12] = _body._position[0] 
     157    _mtx[13] = _body._position[1] 
     158    _mtx[14] = _body._position[2] 
     159    _mtx[15] = 1.0 
     160    gl.glMultMatrixf(_mtx) 
     161    # 
     162    ###################################### 
     163    # 
     164    # render materials - insert new code here 
     165    # 
    132166    py.PyThread_acquire_lock(self._mutex, 1) 
    133167    self._mates._render(<void*> _body) 
    134168    py.PyThread_release_lock(self._mutex) 
     169    # 
     170    ###################################### 
     171    # 
     172    # restore previous matrix 
     173    # 
     174    gl.glPopMatrix() 
     175    # 
     176    ###################################### 
     177 
    135178 
    136179  # 
  • trunk/pysoy/src/models/Shape.pym

    r1278 r1279  
    5858 
    5959  cdef void _render(self, soy.bodies.Body _body) : 
    60     cdef int              _shapeclass 
     60    cdef int         _shapeclass 
     61    cdef gl.GLfloat  _mtx[16] 
     62    # 
     63    ###################################### 
    6164    # 
    6265    # Don't attempt to render a non-existant shape 
     66    # 
    6367    if _body._shape is None : 
    6468      return 
    6569    # 
     70    ###################################### 
     71    # 
     72    # save current matrix 
     73    # 
     74    gl.glPushMatrix() 
     75    # 
     76    ###################################### 
     77    # 
     78    # set model's matrix 
     79    # 
     80    _mtx[0]  = _body._rotation[0] 
     81    _mtx[1]  = _body._rotation[4] 
     82    _mtx[2]  = _body._rotation[8] 
     83    _mtx[3]  = 0.0 
     84    _mtx[4]  = _body._rotation[1] 
     85    _mtx[5]  = _body._rotation[5] 
     86    _mtx[6]  = _body._rotation[9] 
     87    _mtx[7]  = 0.0 
     88    _mtx[8]  = _body._rotation[2] 
     89    _mtx[9]  = _body._rotation[6] 
     90    _mtx[10] = _body._rotation[10] 
     91    _mtx[11] = 0.0 
     92    _mtx[12] = _body._position[0] 
     93    _mtx[13] = _body._position[1] 
     94    _mtx[14] = _body._position[2] 
     95    _mtx[15] = 1.0 
     96    gl.glMultMatrixf(_mtx) 
     97    # 
     98    ###################################### 
     99    # 
    66100    # Grab the shape's class 
    67101    _shapeclass = ode.dGeomGetClass(_body._shape._geomID) 
    68102    # 
    69     # Render the specific shape 
     103    ###################################### 
     104    # 
     105    # render the specific shape 
     106    # 
    70107    if _shapeclass == ode.dSphereClass : 
    71108      self._renderSphere(_body._shape) 
     
    76113    elif _shapeclass == ode.dRayClass : 
    77114      self._renderRay(_body._shape) 
     115    # 
     116    ###################################### 
     117    # 
     118    # restore previous matrix 
     119    # 
     120    gl.glPopMatrix() 
     121    # 
     122    ###################################### 
    78123 
    79124 
  • trunk/pysoy/src/scenes/Scene.pym

    r1274 r1279  
    142142    self._bodies._iterStart() 
    143143    for _i from 0 <= _i < self._bodies._current : 
    144       (<soy.bodies.Body> self._bodies._list[_i])._render() 
     144      if (<soy.bodies.Body> self._bodies._list[_i])._model is not None : 
     145        (<soy.models.Model> 
     146         (<soy.bodies.Body> self._bodies._list[_i])._model)._render( 
     147         (<soy.bodies.Body> self._bodies._list[_i])) 
    145148    self._bodies._iterDone() 
    146149    #