Author: DavidCzech Date: 2008-07-17 18:12:53 -0400 (Thu, 17 Jul 2008) New Revision: 1327
Modified: trunk/pysoy/examples/LandScape.py trunk/pysoy/include/soy.scenes.pxd trunk/pysoy/src/scenes/Landscape.pym Log: Ticket 929: * Added basic material to LandScape * Its green! It must be getting angry we're taking so long to finish it! Modified: trunk/pysoy/examples/LandScape.py =================================================================== --- trunk/pysoy/examples/LandScape.py 2008-07-17 19:00:48 UTC (rev 1326) +++ trunk/pysoy/examples/LandScape.py 2008-07-17 22:12:53 UTC (rev 1327) @@ -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=16) +heightScene = soy.scenes.Landscape(heightTex,soy.materials.aventurine,height=32) #heightScene = soy.scenes.Scene();# with normal scene, everything is peachy ### Start PySoy Code (Excerpt from pysoy-primer.py) # Initialize a window Modified: trunk/pysoy/include/soy.scenes.pxd =================================================================== --- trunk/pysoy/include/soy.scenes.pxd 2008-07-17 19:00:48 UTC (rev 1326) +++ trunk/pysoy/include/soy.scenes.pxd 2008-07-17 22:12:53 UTC (rev 1327) @@ -84,6 +84,7 @@ cdef ode.dGeomID _heightmap cdef double _width cdef double _depth + cdef soy.materials.Material _material cdef double _height cdef soy.textures.Texture _heightmapTex cdef gl.GLuint _buffer Modified: trunk/pysoy/src/scenes/Landscape.pym =================================================================== --- trunk/pysoy/src/scenes/Landscape.pym 2008-07-17 19:00:48 UTC (rev 1326) +++ trunk/pysoy/src/scenes/Landscape.pym 2008-07-17 22:12:53 UTC (rev 1327) @@ -47,6 +47,7 @@ self._depth = depth self._height = height self.position = position + 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) @@ -191,9 +192,9 @@ self._vertArray[_offset].ny = _normal[1] self._vertArray[_offset].nz = _normal[2] # q = 90 degrees in the x direction - # y' = y*cos q - z*sin q - # z' = y*sin q + z*cos q - # x' = x + # uy' = y*cos q - z*sin q + # uz' = y*sin q + z*cos q + # ux' = x #Rotate the whole normal, returns tangent _u[0] = self._vertArray[_offset].nx @@ -250,7 +251,8 @@ gl.GLdouble _znear, gl.GLdouble _zfar) : # # Setup projection matrix - cdef int _i + cdef int _i, _pass + _pass = 0 gl.glEnable(gl.GL_DEPTH_TEST) gl.glEnable(gl.GL_LIGHTING) gl.glLightModelfv(gl.GL_LIGHT_MODEL_AMBIENT, self._ambient._rgba) @@ -279,10 +281,12 @@ gl.glTexCoordPointer(3, gl.GL_FLOAT, sizeof(Vert), (<char *> NULL + (24))) # tx ty tz #gl.glDrawArrays(gl.GL_TRIANGLES, 0, self._verts) #stdio.printf("%s","glDrawElements\n") - gl.glDrawElements (gl.GL_TRIANGLES, + while self._material._render(_pass,<float *>24,<float *>0): + gl.glDrawElements (gl.GL_TRIANGLES, (self._heightmapTex._width-1) * \ (self._heightmapTex._height-1) * 2 * 3, gl.GL_UNSIGNED_SHORT, <Face*> 0) + _pass+=1 gl.glBindBufferARB(gl.GL_ARRAY_BUFFER_ARB, 0) # # Render the rest of the scene normally @@ -304,6 +308,7 @@ - Apply LOD algo using value -elementsArray has to be reduced using LOD value -verticies will still be in VRAM, but we're not gonna draw them, so its still optimized. + Texture Mipmaps.. IRC excerpt, LOD algo basis yea the size of the number of triangles times three _______________________________________________ PySoy-SVN mailing list PySoy-SVN@pysoy.org http://www.pysoy.org/mailman/listinfo/pysoy-svn