Author: JonNeal Date: 2008-03-22 02:03:25 -0400 (Sat, 22 Mar 2008) New Revision: 1198
Modified: trunk/pysoy/src/scenes/Landscape.pxi trunk/pysoy/src/scenes/soy.scenes.pxd Log: Ticket #929: More work, started vbo stuff. Modified: trunk/pysoy/src/scenes/Landscape.pxi =================================================================== --- trunk/pysoy/src/scenes/Landscape.pxi 2008-03-22 03:15:03 UTC (rev 1197) +++ trunk/pysoy/src/scenes/Landscape.pxi 2008-03-22 06:03:25 UTC (rev 1198) @@ -21,20 +21,22 @@ cdef class Landscape (Scene) : ''' Landscape Scene - This is a scene based on a heightmap facing up in - the direction of gravity. + This is a scene based on a heightmap. + Accepts a heightmap and the width, depth, and heigth of it. ''' - def __cinit__(self, heightmap, *args, **kw) : + def __cinit__(self, heightmap, scale, width=1024, depth=1024, *args, **kw) : if not isinstance(soy.textures.Texture, heightmap) or heightmap._chans != 1 : raise TypeError('heightmap must be of type soy.textures.Texture and 1 channel.') - + self._width = width + self._depth = depth self._heightmapID = ode.dGeomHeightfieldDataCreate() ode.dGeomHeightfieldDataBuildByte(self._heightmapID, - <unsigned char*> heightmap._texels,0, heightmap._width, - heightmap._depth, heightmap._width, - heightmap._depth, 1, 0, 1, - 0) - self._heightmap = ode.dCreateHeightfield(self._spaceID, self._heightmapID, 0) + <unsigned char*> heightmap._texels, 0, + heightmap._width, heightmap._depth, + self._width/heightmap._width, + self._depth/heightmap._depth, + 1, 0, 1, 0) + self._heightmap = ode.dCreateHeightfield(self._spaceID, self._heightmapID, 1) def __delalloc__(self) : @@ -43,3 +45,10 @@ cdef void _render(self) : pass + + + cdef void _createBuffer(self) : + gl.glGenBuffersARB(1, &self._buffer) + gl.glBindBufferARB(gl.GL_ARRAY_BUFFER_ARB, self._buffer) + gl.glBufferDataARB(gl.GL_ARRAY_BUFFER_ARB, (sizeof(Vert)+4+12)*self._bufferAlloc, + self._heightmap, gl.GL_STATIC_DRAW_ARB) Modified: trunk/pysoy/src/scenes/soy.scenes.pxd =================================================================== --- trunk/pysoy/src/scenes/soy.scenes.pxd 2008-03-22 03:15:03 UTC (rev 1197) +++ trunk/pysoy/src/scenes/soy.scenes.pxd 2008-03-22 06:03:25 UTC (rev 1198) @@ -75,6 +75,10 @@ cdef class Landscape (Scene) : cdef ode.dHeightfieldDataID _heightmapID cdef ode.dGeomID _heightmap + cdef int _width + cdef int _height + cdef gl.GLuint _buffer + cdef void _createBuffer ( self ) cdef class Planar (Scene) : cdef ode.dGeomID _planeID _______________________________________________ PySoy-SVN mailing list PySoy-SVN@pysoy.org http://www.pysoy.org/mailman/listinfo/pysoy-svn