Author: ArcRiley
Date: 2008-07-15 01:15:40 -0400 (Tue, 15 Jul 2008)
New Revision: 1309

Modified:
   trunk/pysoy/src/scenes/Landscape.pym
Log:
Ticket #929 :
  * minor fixes on the element array loop


Modified: trunk/pysoy/src/scenes/Landscape.pym
===================================================================
--- trunk/pysoy/src/scenes/Landscape.pym        2008-07-15 01:51:02 UTC (rev 
1308)
+++ trunk/pysoy/src/scenes/Landscape.pym        2008-07-15 05:15:40 UTC (rev 
1309)
@@ -45,7 +45,7 @@
     self.position = position
     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) 
     ode.dGeomHeightfieldDataBuildByte(self._heightmapID,
                                       <unsigned char*> heightmap._texels, 0,
                                       heightmap._width, heightmap._depth,
@@ -119,14 +119,15 @@
       for _j from 0 <= _j < self._heightmapTex._width-1 :
         #create the upper left tri in the quad
         #verts are in counter clockwise direction
-        self._elementArray[_currentLoop*2].a = _j + 1 + _i * 
self._heightmapTex._width
-        self._elementArray[_currentLoop*2].b = _j + _i * 
self._heightmapTex._width
-        self._elementArray[_currentLoop*2].c = _j + (_i+1) * 
self._heightmapTex._width
+        self._elementArray[_currentLoop].a = _j + 1 + _i * 
self._heightmapTex._width
+        self._elementArray[_currentLoop].b = _j + _i * 
self._heightmapTex._width
+        self._elementArray[_currentLoop].c = _j + (_i+1) * 
self._heightmapTex._width
+        _currentLoop += 1
         #now the bottom right!
-        self._elementArray[_currentLoop*2+1].a = _j + 1 + _i * 
self._heightmapTex._width
-        self._elementArray[_currentLoop*2+1].b =  _j + (_i+1) * 
self._heightmapTex._width
-        self._elementArray[_currentLoop*2+1].c =  _j + 1 + (_i+1) * 
self._heightmapTex._width
-        _currentLoop = _currentLoop + 1
+        self._elementArray[_currentLoop].a = _j + 1 + _i * 
self._heightmapTex._width
+        self._elementArray[_currentLoop].b = _j + (_i+1) * 
self._heightmapTex._width
+        self._elementArray[_currentLoop].c = _j + 1 + (_i+1) * 
self._heightmapTex._width
+        _currentLoop += 1
 
 
   cdef void _createBuffer(self) :
@@ -152,11 +153,11 @@
       self._createBuffer()
     gl.glVertexPointer  (3,  gl.GL_FLOAT, sizeof(Vert), <float*>  0) #px py pz
     gl.glNormalPointer  (    gl.GL_FLOAT, sizeof(Vert), <float*> 12)  # nx ny 
nz
-    gl.glTexCoordPointer(3, gl.GL_FLOAT, sizeof(Vert), <float*> 24) # tx ty tz
+    gl.glTexCoordPointer(3, gl.GL_FLOAT, sizeof(Vert), <float*> 24) # tx ty tz
     #gl.glDrawArrays(gl.GL_TRIANGLES, 0, self._verts);
     #stdio.printf("%s","glDrawElements\n")
     gl.glDrawElements (gl.GL_TRIANGLES, 
(self._heightmapTex._width-1)*(self._heightmapTex._height-1)*2,
-                    gl.GL_UNSIGNED_SHORT, <Face*> 3)
+                    gl.GL_UNSIGNED_SHORT, <Face*> 3)
     gl.glBindBufferARB(gl.GL_ARRAY_BUFFER_ARB, 0);
     
     Scene._render(self)

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

Reply via email to