Author: JonNeal Date: 2008-07-15 23:11:40 -0400 (Tue, 15 Jul 2008) New Revision: 1322
Modified: trunk/pysoy/src/scenes/Landscape.pym Log: Ticket #929 : * Normals working, kapace enabled lights. Heightmap is now shaded! Modified: trunk/pysoy/src/scenes/Landscape.pym =================================================================== --- trunk/pysoy/src/scenes/Landscape.pym 2008-07-16 02:44:27 UTC (rev 1321) +++ trunk/pysoy/src/scenes/Landscape.pym 2008-07-16 03:11:40 UTC (rev 1322) @@ -176,7 +176,7 @@ _normal[0] /= _length _normal[1] /= _length _normal[2] /= _length - stdio.printf("vert %d {nx: %f, ny: %f, nz: %f}\n", _offset, _normal[0], _normal[1], _normal[2]); + #stdio.printf("vert %d {nx: %f, ny: %f, nz: %f}\n", _offset, _normal[0], _normal[1], _normal[2]); self._vertArray[_offset].nx = _normal[0] self._vertArray[_offset].ny = _normal[1] self._vertArray[_offset].nz = _normal[2] @@ -231,6 +231,21 @@ gl.GLdouble _znear, gl.GLdouble _zfar) : # # Setup projection matrix + cdef int _i + stdio.printf("_render\n"); + gl.glEnable(gl.GL_DEPTH_TEST) + gl.glEnable(gl.GL_LIGHTING) + gl.glLightModelfv(gl.GL_LIGHT_MODEL_AMBIENT, self._ambient._rgba) + # + # Turn on each light, keep it's iteration locked against mod until done + self._lights._iterStart() + stdio.printf("_render1a\n"); + for _i from 0 <= _i < self._lights._current : + stdio.printf("_render1b Index: %d\n",_i); + + # This is a quick hack (gl.GL_LIGHT0 + _i) + (<soy.bodies.Light> self._lights._list[_i])._on(gl.GL_LIGHT0 + _i) + stdio.printf("_render1c\n"); gl.glMatrixMode(gl.GL_PROJECTION) gl.glLoadIdentity() gl.gluPerspective(_fovy, _aspect, _znear, 1000.0) @@ -245,9 +260,9 @@ gl.glBindBufferARB(gl.GL_ELEMENT_ARRAY_BUFFER_ARB, self._elementbuffer) else: 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.glVertexPointer (3, gl.GL_FLOAT, sizeof(Vert),(<char *>NULL + (0))) #px py pz + gl.glNormalPointer ( gl.GL_FLOAT, sizeof(Vert),(<char *>NULL + (12))) # nx ny nz + 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, @@ -258,11 +273,17 @@ # # Render the rest of the scene normally gl.glPopMatrix() + for _i from 0 <= _i < self._lights._current : + # This is a quick hack (gl.GL_LIGHT0 + _i) + (<soy.bodies.Light> self._lights._list[_i])._off(gl.GL_LIGHT0 + _i) + self._lights._iterDone() + gl.glDisable(gl.GL_LIGHTING) + gl.glDisable(gl.GL_DEPTH_TEST) Scene._render(self, _fovy, _aspect, _znear, _zfar) """ TODO : LOD -- First Get it to render | 3/4 there :P +- First Get it to render | Done! - Divide data in to sectors | - get Sectors middle point | - Relative to the sector distance to camera, calculate LOD value @@ -289,3 +310,4 @@ example er, sorry, the steepest would be A """ + _______________________________________________ PySoy-SVN mailing list PySoy-SVN@pysoy.org http://www.pysoy.org/mailman/listinfo/pysoy-svn