Changeset 1357

Show
Ignore:
Timestamp:
09/08/08 19:45:36 (2 months ago)
Author:
ArcRiley
Message:

Ticket #962 :

  • added proper matrix translation code
  • still doesn't work
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/pysoy/src/models/Liquid.pym

    r1356 r1357  
    8585    cdef ode.dReal*         _pos 
    8686    cdef float              _halfSize[3] 
     87    cdef gl.GLfloat         _mtx[16] 
     88    # 
     89    ###################################### 
     90    # 
     91    # set model's matrix 
     92    # 
     93    _mtx[0]  = _body._rotation[0] 
     94    _mtx[1]  = _body._rotation[4] 
     95    _mtx[2]  = _body._rotation[8] 
     96    _mtx[3]  = 0.0 
     97    _mtx[4]  = _body._rotation[1] 
     98    _mtx[5]  = _body._rotation[5] 
     99    _mtx[6]  = _body._rotation[9] 
     100    _mtx[7]  = 0.0 
     101    _mtx[8]  = _body._rotation[2] 
     102    _mtx[9]  = _body._rotation[6] 
     103    _mtx[10] = _body._rotation[10] 
     104    _mtx[11] = 0.0 
     105    _mtx[12] = _body._position[0] 
     106    _mtx[13] = _body._position[1] 
     107    _mtx[14] = _body._position[2] 
     108    _mtx[15] = 1.0 
     109    # 
     110    ###################################### 
     111    # 
     112    # save current matix before setting it 
     113    # 
     114    gl.glPushMatrix() 
     115    gl.glMultMatrixf(_mtx) 
     116    # 
     117    ###################################### 
     118    # 
     119    # render liquid surface and bottom 
     120    # 
    87121    _pos = _body._position 
    88122    _halfSize[0] = self._size[0]/2.0 
     
    101135    gl.glEnable(gl.GL_DEPTH_TEST) 
    102136    # 
    103     #RENDER BODIES 
     137    ###################################### 
     138    # 
     139    # return to camera matrix 
     140    # 
     141    gl.glPopMatrix() 
     142    # 
     143    ###################################### 
     144    # 
     145    # render each body inside the liquid 
     146    # 
    104147    gl.glEnable(gl.GL_FOG) 
    105148    gl.glEnableClientState(gl.GL_FOG_COORDINATE_ARRAY_EXT) 
     
    110153    gl.glHint(gl.GL_FOG_HINT, gl.GL_NICEST) 
    111154    gl.glFogi(gl.GL_FOG_COORDINATE_SOURCE_EXT, gl.GL_FOG_COORDINATE_EXT) 
    112     gl.glPushMatrix() 
    113     gl.glTranslatef(-pos[0],-pos[1], -pos[2]) 
    114155    # 
    115156    # We need not _iterStart here since _bodies is already iterating via Scene 
     
    124165         _body._scene._bodies._list[_i])._model._render( 
    125166          (<soy.bodies.Body> _body._scene._bodies._list[_i])) 
    126     gl.glPopMatrix() 
    127167    gl.glDisableClientState(gl.GL_FOG_COORDINATE_ARRAY_EXT) 
    128168    gl.glDisable(gl.GL_FOG) 
    129169    # 
    130     #RENDER SURFACE 
     170    ###################################### 
     171    # 
     172    # save current matix before setting it 
     173    # 
     174    gl.glPushMatrix() 
     175    gl.glMultMatrixf(_mtx) 
    131176    self._material._coreBind() 
    132177    self._renderSurf() 
    133178    self._material._coreUnBind() 
    134179    gl.glDisable(gl.GL_STENCIL_TEST) 
     180    # 
     181    ###################################### 
     182    # 
     183    # return to camera matrix 
     184    # 
     185    gl.glPopMatrix() 
     186    # 
     187    ###################################### 
    135188 
    136189