Author: JonNeal Date: 2008-08-24 19:28:22 -0400 (Sun, 24 Aug 2008) New Revision: 1347
Modified: trunk/pysoy/src/scenes/Landscape.pym Log: Ticket #958 : * First part of the delta map added Modified: trunk/pysoy/src/scenes/Landscape.pym =================================================================== --- trunk/pysoy/src/scenes/Landscape.pym 2008-08-10 05:39:57 UTC (rev 1346) +++ trunk/pysoy/src/scenes/Landscape.pym 2008-08-24 23:28:22 UTC (rev 1347) @@ -40,7 +40,6 @@ "Heightmap must be of type soy.textures.Texture and 1 channel" assert type(position[0]) == int or type(position[1]) == int or \ type(position[2]) == int, "The heightmap position must be an int" - #We need to make an array on the heap, and put the verts there self._width = width self._height = height self._depth = depth @@ -76,7 +75,7 @@ def __get__(self) : return (self._position[0], self._position[1], self._position[2]) def __set__(self, value) : - assert type(value) != tuple or type(value) != list, \ + assert type(value) == tuple or type(value) == list, \ "Must provide a tuple or list for landscape position!" assert len(value) == 3, "Must provide (x,y,z)" self._position[0] = value[0] @@ -92,6 +91,7 @@ cdef int _i, _j, _l, _offset cdef int _a, _b, _c, _d cdef float *_deltaCols, *_deltaRows + cdef float _maxDelta, _minDelta cdef double _v1[3], _v2[3], _normal[3], _normal2[3], _length, _u[3] self._heightfieldDataID = ode.dGeomHeightfieldDataCreate() # @@ -126,9 +126,9 @@ # # These are arrays for column and row edge deltas: # . . . . . . . . ._._._._._._._. - # | | | | | | | | + # | | | | | | | | < delta # . . . . . . . . ._._._._._._._. - # | | | | | | | | + # | | | | | | | | ^delta # . . . . . . . . ._._._._._._._. # _deltaCols _deltaRows # @@ -293,7 +293,7 @@ self._vertArray[_offset].uy = _u[1] self._vertArray[_offset].uz = _u[2] # - # and finally, set up the face array to make all of the quads + # set up the face array to make all of the quads _l = 0 # loop through all of the quads in the grid for _i from 0 <= _i < self._pyMap._height : @@ -310,6 +310,19 @@ self._faceArray[_l].d = _j + ( _i * (self._pyMap._width+1)) + 1 _l += 1 # + # Set a starting value for _maxDelta and _minDelta so it isn't blank + _maxDelta = _deltaRows[0] + _minDelta = _deltaRows[0] + # + # Loop through _deltaRows to figure out what can be merged + for _i from 0 <= _i < (self._pyMap._width + 1) * (self._pyMap._height + 1) : + if _deltaRows[_i] > _maxDelta : + _maxDelta = _deltaRows[_i] + if _deltaRows[_i] < _minDelta : + _minDelta = _deltaRows[_i] + + stdio.printf("_maxDelta: %f, _minDelta: %f", _maxDelta, _minDelta) + # # Free previously alloc'ed delta arrays py.PyMem_Free(_deltaCols) py.PyMem_Free(_deltaRows) _______________________________________________ PySoy-SVN mailing list PySoy-SVN@pysoy.org http://www.pysoy.org/mailman/listinfo/pysoy-svn