Author: JonNeal
Date: 2008-07-15 02:04:29 -0400 (Tue, 15 Jul 2008)
New Revision: 1311

Modified:
   trunk/pysoy/examples/LandScape.py
   trunk/pysoy/src/scenes/Landscape.pym
Log:
Ticket #929: Some small bug fixes


Modified: trunk/pysoy/examples/LandScape.py
===================================================================
--- trunk/pysoy/examples/LandScape.py   2008-07-15 05:40:39 UTC (rev 1310)
+++ trunk/pysoy/examples/LandScape.py   2008-07-15 06:04:29 UTC (rev 1311)
@@ -6,7 +6,7 @@
 ### Start Heightmap Code
 heightTex = soy.transports.File('media/Heightmap.soy')['gimp']
 sleep(2) # HACK: this will wait while transportloop does his stuff
-heightScene = 
soy.scenes.Landscape(heightTex,soy.materials.Material(),height=100)
+heightScene = 
soy.scenes.Landscape(heightTex,soy.materials.Material(),height=100, 
width=heightTex.size[0], depth=heightTex.size[1])
 #heightScene = soy.scenes.Scene();# with normal scene, everything is peachy
 ### Start PySoy Code (Excerpt from pysoy-primer.py)
 # Initialize a window 

Modified: trunk/pysoy/src/scenes/Landscape.pym
===================================================================
--- trunk/pysoy/src/scenes/Landscape.pym        2008-07-15 05:40:39 UTC (rev 
1310)
+++ trunk/pysoy/src/scenes/Landscape.pym        2008-07-15 06:04:29 UTC (rev 
1311)
@@ -48,18 +48,18 @@
     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,
-                                      self._width/heightmap._width,
-                                      self._depth/heightmap._depth, 
+                                      self._width, self._width,
+                                      self._width,
+                                      self._depth, 
                                       1, 0, 1, 0)
     self._heightmap = ode.dCreateHeightfield(self._spaceID, self._heightmapID, 
1) #the ode heightmap
     self._heightmapTex = heightmap
     self._createArrays()
     
   def __dealloc__(self) :
-    pass
-    #ode.dGeomHeightfieldDataDestroy(self._heightmapID)
-    #gl.glDeleteBuffersARB(1, &self._buffer);
+    #pass
+    ode.dGeomHeightfieldDataDestroy(self._heightmapID)
+    gl.glDeleteBuffersARB(1, &self._buffer);
 
 
   ############################################################################
@@ -151,7 +151,9 @@
           gl.GL_STATIC_DRAW_ARB)
     gl.glGenBuffersARB(1, &self._elementbuffer)
     gl.glBindBufferARB(gl.GL_ELEMENT_ARRAY_BUFFER_ARB, self._elementbuffer)  # 
Create the elements buffers
-    gl.glBufferDataARB(gl.GL_ELEMENT_ARRAY_BUFFER_ARB, 
sizeof(Face)*(self._heightmapTex._width-1)*(self._heightmapTex._height-1)*2, 
self._elementArray, gl.GL_STATIC_DRAW_ARB)
+    gl.glBufferDataARB(gl.GL_ELEMENT_ARRAY_BUFFER_ARB, 
+         
sizeof(Face)*(self._heightmapTex._width-1)*(self._heightmapTex._height-1)*2, 
+         self._elementArray, gl.GL_STATIC_DRAW_ARB)
 
 
   cdef void _render(self) :
@@ -190,14 +192,17 @@
 its one big block to you since a landscape will have *one* material
  Z texcoord can be used to change the terrain type (3d texture)
 this means that you can use the face array for LOD more easily(elementsArray.. 
after this i get confused) 
- see basically you can "shift up" the array, adding one to both the offset and 
length, such that the "base" face array is the lowest resolution and each time 
you shift up one it removes one triangle and replaces it with two
+ see basically you can "shift up" the array, adding one to both the offset and 
length, such that the "base" 
+ face array is the lowest resolution and each time you shift up one it removes 
one triangle and replaces it with two
  is, if your array has four triangles in the low resolution, ABCD
  and the second step is A split = EF, B=GH, C=IJ, D=KL, then it's arranged as:
  ABCDEFGHIJKL
 if you're rendering the whole thing as step 1, then its offset 0 length 4 
(ABCD)
  if you want 50% of step2 then its offset 2, length 6, = CDEFGH
- and then it's a matter of grouping these into geographic boundaries such that 
depending on where your camera is within the terrain it can render them in 
groups like this
+ and then it's a matter of grouping these into geographic boundaries such that 
depending on 
+ where your camera is within the terrain it can render them in groups like this
  if you try to do this on a one polygon basis you'll end up rendering too 
many. its easier to group them
- in each group give the most radical angles the highest priority - so a steep 
angled triangle would be D in the above example
+ in each group give the most radical angles the highest priority - so a steep 
angled triangle would be D in the above 
+ example
  er, sorry, the steepest would be A
 """

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

Reply via email to