Author: JonNeal Date: 2008-07-19 02:34:56 -0400 (Sat, 19 Jul 2008) New Revision: 1344
Modified: trunk/pysoy/src/scenes/Landscape.pym Log: Ticket #929: * Fixed assert that checked the heightmap Modified: trunk/pysoy/src/scenes/Landscape.pym =================================================================== --- trunk/pysoy/src/scenes/Landscape.pym 2008-07-19 06:30:51 UTC (rev 1343) +++ trunk/pysoy/src/scenes/Landscape.pym 2008-07-19 06:34:56 UTC (rev 1344) @@ -36,8 +36,8 @@ detail = 1, width=1024, depth=1024, height=16, position=(0, 0, 0), *args, **kw) : - assert isinstance(heightmap, soy.textures.Texture) or heightmap._chans != 1, \ - "Heightmap must be of type soy.textures.Texture and 1 channel, not "+str(heightmap._chans) + assert isinstance(heightmap, soy.textures.Texture) or heightmap._chans == 1, \ + "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 @@ -238,12 +238,20 @@ _b = _offset-1 _c = _offset # subtract the vertices to get vectors - _v1[0] = self._vertArray[_b].px-self._vertArray[_c].px - _v2[0] = self._vertArray[_a].px-self._vertArray[_c].px - _v1[1] = self._vertArray[_b].py-self._vertArray[_c].py - _v2[1] = self._vertArray[_a].py-self._vertArray[_c].py - _v1[2] = self._vertArray[_b].pz-self._vertArray[_c].pz - _v2[2] = self._vertArray[_a].pz-self._vertArray[_c].pz + if _j != 0 and _i != 0 : + _v1[0] = self._vertArray[_b].px-self._vertArray[_c].px + _v2[0] = self._vertArray[_a].px-self._vertArray[_c].px + _v1[1] = self._vertArray[_b].py-self._vertArray[_c].py + _v2[1] = self._vertArray[_a].py-self._vertArray[_c].py + _v1[2] = self._vertArray[_b].pz-self._vertArray[_c].pz + _v2[2] = self._vertArray[_a].pz-self._vertArray[_c].pz + else: + _v1[0] = self._vertArray[_c].px + _v2[0] = self._vertArray[_a].px-self._vertArray[_c].px + _v1[1] = self._vertArray[_c].py + _v2[1] = self._vertArray[_a].py-self._vertArray[_c].py + _v1[2] = self._vertArray[_c].pz + _v2[2] = self._vertArray[_a].pz-self._vertArray[_c].pz # perform cross products on the two vectors _normal2[0] = _v1[1]*_v2[2]-_v1[2]*_v2[1] #Calculate the x component of the normal _normal2[1] = _v1[2]*_v2[0]-_v1[0]*_v2[2] #Calculate the y component of the normal _______________________________________________ PySoy-SVN mailing list PySoy-SVN@pysoy.org http://www.pysoy.org/mailman/listinfo/pysoy-svn