Author: JonNeal Date: 2008-07-17 21:36:57 -0400 (Thu, 17 Jul 2008) New Revision: 1328
Modified: trunk/pysoy/src/scenes/Landscape.pym Log: Ticket #929 : * No more white edges due to my laziness :p Modified: trunk/pysoy/src/scenes/Landscape.pym =================================================================== --- trunk/pysoy/src/scenes/Landscape.pym 2008-07-17 22:12:53 UTC (rev 1327) +++ trunk/pysoy/src/scenes/Landscape.pym 2008-07-18 01:36:57 UTC (rev 1328) @@ -128,7 +128,7 @@ # # for code cleanlyness, get the four verticies first as: # - # c-b Note CCW winding order. + # c-b c = current vert # |\| vector1 (b) = cb # a vector2 (a) = ca # @@ -145,32 +145,38 @@ _v2[1] = self._vertArray[_c].py-self._vertArray[_a].py _v1[2] = self._vertArray[_c].pz-self._vertArray[_b].pz _v2[2] = self._vertArray[_c].pz-self._vertArray[_a].pz - # perform cross products on the two vectors - _normal[0] = _v1[1]*_v2[2]-_v1[2]*_v2[1] #Calculate the x component of the normal - _normal[1] = _v1[2]*_v2[0]-_v1[0]*_v2[2] #Calculate the y component of the normal - _normal[2] = _v1[0]*_v2[1]-_v1[1]*_v2[0] #Calculate the z component of the normal - - # check if we are at either of two sides which only have 3 verts to calc - if _j == 0 or _i == 0 : - # a - # |\| vector1 (b) = cb - # b c vector2 (a) = ca - # - _a = _offset-self._heightmapTex._width - _b = _offset-1 - _c = _offset + else : # 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 - # 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 - _normal2[2] = _v1[0]*_v2[1]-_v1[1]*_v2[0] #Calculate the z component of the normal + _v1[0] = self._vertArray[_c].px + _v2[0] = self._vertArray[_c].px-self._vertArray[_a].px + _v1[1] = self._vertArray[_c].py + _v2[1] = self._vertArray[_c].py-self._vertArray[_a].py + _v1[2] = self._vertArray[_c].pz + _v2[2] = self._vertArray[_c].pz-self._vertArray[_a].pz + # perform cross products on the two vectors + _normal[0] = _v1[1]*_v2[2]-_v1[2]*_v2[1] #Calculate the x component of the normal + _normal[1] = _v1[2]*_v2[0]-_v1[0]*_v2[2] #Calculate the y component of the normal + _normal[2] = _v1[0]*_v2[1]-_v1[1]*_v2[0] #Calculate the z component of the normal + # a + # |\| vector1 (b) = cb + # b c vector2 (a) = ca + # + _a = _offset-self._heightmapTex._width + _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 + # 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 + _normal2[2] = _v1[0]*_v2[1]-_v1[1]*_v2[0] #Calculate the z component of the normal + # last thing of all, average the two together and set them as the normals! if _normal[0] == 0 and _normal[1] == 0 and _normal[2] == 0 : _normal[0] = _normal2[0] @@ -328,4 +334,4 @@ in each group give the most radical angles the highest priority - so a steep angled triangle would be D in the above example er, sorry, the steepest would be A -""" \ No newline at end of file +""" _______________________________________________ PySoy-SVN mailing list PySoy-SVN@pysoy.org http://www.pysoy.org/mailman/listinfo/pysoy-svn