Author: ArcRiley
Date: 2008-02-25 17:09:11 -0500 (Mon, 25 Feb 2008)
New Revision: 984

Modified:
   trunk/pysoy/src/_datatypes/VertexList.pxi
Log:
Ticket #934 :
  * replaced broken _light_pos assignment with direct use of _light._position
  * did a bit of code formatting cleanup


Modified: trunk/pysoy/src/_datatypes/VertexList.pxi
===================================================================
--- trunk/pysoy/src/_datatypes/VertexList.pxi   2008-02-25 21:54:01 UTC (rev 
983)
+++ trunk/pysoy/src/_datatypes/VertexList.pxi   2008-02-25 22:09:11 UTC (rev 
984)
@@ -200,11 +200,10 @@
                             4 * self._bufferAlloc, self._fogArray)
     #stdlib.free( fog_coord_array)
 
-  cdef void _calculateTSLV(self, void* body):
+  cdef void _calculateTSLV(self, void* __body):
     cdef soy.bodies._bodies.Body _body
     cdef soy.scenes.Scene        _scene
     cdef soy.bodies.lights.Light _light
-    cdef ode.dVector3            _light_pos
     cdef float                   _inv_mm[16]
     cdef float                   _model_light_pos[3]
     cdef float                   _vert_light_pos[3]
@@ -212,33 +211,34 @@
     cdef float                   _lgt
     cdef int                     i
 
-    _body = <soy.bodies._bodies.Body> body
+    _body = <soy.bodies._bodies.Body> __body
     _scene = _body._scene
 
     if _scene._lights.current > 0:
       _light = <soy.bodies.lights.Light> _scene._lights.list[0]
-      _light_pos = &(<ode.dBodyID> _light._bodyID)._position
       _body._coreGetModelviewInv(_inv_mm)
 
       #vector by matrix multiplication by hand
-      _model_light_pos[0] = _inv_mm[0]  * (_light_pos[0] + _inv_mm[12]) + \
-                            _inv_mm[4]  * (_light_pos[1] + _inv_mm[13]) + \
-                            _inv_mm[8]  * (_light_pos[2] + _inv_mm[14]) 
+      _model_light_pos[0] = _inv_mm[0] * (_light._position[0] + _inv_mm[12]) \
+                          + _inv_mm[4] * (_light._position[1] + _inv_mm[13]) \
+                          + _inv_mm[8] * (_light._position[2] + _inv_mm[14]) 
 
-      _model_light_pos[1] = _inv_mm[1]  * (_light_pos[0] + _inv_mm[12]) + \
-                            _inv_mm[5]  * (_light_pos[1] + _inv_mm[13]) + \
-                            _inv_mm[9]  * (_light_pos[2] + _inv_mm[14]) 
+      _model_light_pos[1] = _inv_mm[1] * (_light._position[0] + _inv_mm[12]) \
+                          + _inv_mm[5] * (_light._position[1] + _inv_mm[13]) \
+                          + _inv_mm[9] * (_light._position[2] + _inv_mm[14]) 
 
-      _model_light_pos[2] = _inv_mm[2]  * (_light_pos[0] + _inv_mm[12]) + \
-                            _inv_mm[6]  * (_light_pos[1] + _inv_mm[13]) + \
-                            _inv_mm[10] * (_light_pos[2] + _inv_mm[14])
+      _model_light_pos[2] = _inv_mm[2] * (_light._position[0] + _inv_mm[12]) \
+                          + _inv_mm[6] * (_light._position[1] + _inv_mm[13]) \
+                          + _inv_mm[10]* (_light._position[2] + _inv_mm[14])
 
       for i from 0 <= i < self._arraySize:
         _vert_light_pos[0] = _model_light_pos[0] - self._array[i].px
         _vert_light_pos[1] = _model_light_pos[1] - self._array[i].py
         _vert_light_pos[2] = _model_light_pos[2] - self._array[i].pz
 
-        _lgt = stdlib.sqrtf( _vert_light_pos[0]*_vert_light_pos[0] + 
_vert_light_pos[1] * _vert_light_pos[1] + _vert_light_pos[2]*_vert_light_pos[2])
+        _lgt = stdlib.sqrtf( _vert_light_pos[0] * _vert_light_pos[0] \
+                            +_vert_light_pos[1] * _vert_light_pos[1] \
+                            +_vert_light_pos[2] * _vert_light_pos[2] )
 
         _vert_light_pos[0] = _vert_light_pos[0] / _lgt
         _vert_light_pos[1] = _vert_light_pos[1] / _lgt
@@ -253,17 +253,17 @@
         _binormal[2] = self._array[i].tan_x * self._array[i].ny - \
                        self._array[i].tan_y * self._array[i].nx
               
-        self._tslvArray[3*i + 0] = (_vert_light_pos[0] * self._array[i].tan_x 
+ \
-                                    _vert_light_pos[1] * self._array[i].tan_y 
+ \
-                                    _vert_light_pos[2] * self._array[i].tan_z)
+        self._tslvArray[3*i+0] = ( _vert_light_pos[0] * self._array[i].tan_x \
+                                  +_vert_light_pos[1] * self._array[i].tan_y \
+                                  +_vert_light_pos[2] * self._array[i].tan_z )
 
-        self._tslvArray[3*i + 1] = (_vert_light_pos[0] * _binormal[0] + \
-                                    _vert_light_pos[1] * _binormal[1] + \
-                                    _vert_light_pos[2] * _binormal[2])
+        self._tslvArray[3*i+1] = ( _vert_light_pos[0] * _binormal[0] \
+                                  +_vert_light_pos[1] * _binormal[1] \
+                                  +_vert_light_pos[2] * _binormal[2] )
 
-        self._tslvArray[3*i + 2] = (_vert_light_pos[0] * self._array[i].nx + \
-                                    _vert_light_pos[1] * self._array[i].ny + \
-                                    _vert_light_pos[2] * self._array[i].nz)
+        self._tslvArray[3*i+2] = ( _vert_light_pos[0] * self._array[i].nx \
+                                  +_vert_light_pos[1] * self._array[i].ny \
+                                  +_vert_light_pos[2] * self._array[i].nz )
               
         #self._tslvArray[3*i + 0] = 0
         #self._tslvArray[3*i + 1] = 0

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

Reply via email to