Author: JonNeal
Date: 2008-07-18 22:37:30 -0400 (Fri, 18 Jul 2008)
New Revision: 1333

Modified:
   trunk/pysoy/examples/LandScape.py
   trunk/pysoy/include/soy.scenes.pxd
   trunk/pysoy/src/scenes/Landscape.pym
Log:
Ticket #958 :
  * Added the vars for delta map which are needed for LOD
  * Changed a global call in the Landscape example


Modified: trunk/pysoy/examples/LandScape.py
===================================================================
--- trunk/pysoy/examples/LandScape.py   2008-07-18 06:44:08 UTC (rev 1332)
+++ trunk/pysoy/examples/LandScape.py   2008-07-19 02:37:30 UTC (rev 1333)
@@ -31,19 +31,14 @@
 heightScene.gravity = (0,-1,0)
 
 def addx() :
-  global camera
   camera.position[0] += 1
 def addy() :
-  global camera
   camera.position[1] += 1
 def addz():
-  global camera
   camera.position[2] += 1
 def subz():
-  global camera
   camera.position[2] -= 1
 def subx() :
-  global camera
   camera.position[0] -= 1
 def suby():
   camera.position[1] -= 1

Modified: trunk/pysoy/include/soy.scenes.pxd
===================================================================
--- trunk/pysoy/include/soy.scenes.pxd  2008-07-18 06:44:08 UTC (rev 1332)
+++ trunk/pysoy/include/soy.scenes.pxd  2008-07-19 02:37:30 UTC (rev 1333)
@@ -92,6 +92,8 @@
   cdef double                     _position[3]
   cdef Vert*                      _vertArray
   cdef Face*                      _elementArray
+  cdef int*                       _deltaCols
+  cdef int*                       _deltaRows
   cdef void                       _createBuffer   ( self )
   cdef void                       _createArrays   ( self )
   

Modified: trunk/pysoy/src/scenes/Landscape.pym
===================================================================
--- trunk/pysoy/src/scenes/Landscape.pym        2008-07-18 06:44:08 UTC (rev 
1332)
+++ trunk/pysoy/src/scenes/Landscape.pym        2008-07-19 02:37:30 UTC (rev 
1333)
@@ -50,7 +50,9 @@
     self._material = mat
     self._heightmapID = ode.dGeomHeightfieldDataCreate()
     self._vertArray = <Vert *> 
py.PyMem_Malloc(heightmap._width*heightmap._height*16*4) 
-    self._elementArray =  <Face *> 
py.PyMem_Malloc(sizeof(Face)*(heightmap._width-1)*(heightmap._height-1)*2) 
+    self._elementArray =  <Face *> 
py.PyMem_Malloc(sizeof(Face)*(heightmap._width-1)*(heightmap._height-1)*2)
+    self._deltaRows = <int *> 
py.PyMem_Malloc(sizeof(int)*heightmap._width*heightmap._height)
+    self._deltaCols = <int *> 
py.PyMem_Malloc(sizeof(int)*heightmap._width*heightmap._height)
     ode.dGeomHeightfieldDataBuildByte(self._heightmapID,
                                       <unsigned char*> heightmap._texels,
                                       0,                             # copy?
@@ -99,8 +101,7 @@
   cdef void _createArrays(self) :
     cdef int _i, _j, _currentLoop, _offset
     cdef unsigned short _a, _b, _c, _d
-    cdef double _v1[3], _v2[3], _normal[3], _normal2[3], _length
-    cdef double _u[3]
+    cdef double _v1[3], _v2[3], _normal[3], _normal2[3], _length, _u[3]
     #
     # Calculate positions and texcoords first
     for _i from 0 <= _i < self._heightmapTex._height :
@@ -147,6 +148,10 @@
           _v2[1] = self._vertArray[_c].py-self._vertArray[_a].py
           _v1[2] = self._vertArray[_c].pz-self._vertArray[_b].pz
           _v2[2] = self._vertArray[_c].pz-self._vertArray[_a].pz
+          
+          # While we are in this loop, calculate the delta map for LOD
+          self._deltaRows[_offset] = 
self._vertArray[_offset].py-self._vertArray[_offset+1].py
+          stdio.printf("%d : %d\n", _offset, self._deltaRows[_offset]);
         else :
           # subtract the vertices to get vectors
           _v1[0] = self._vertArray[_c].px

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

Reply via email to