- begin
- lm := Add;
- ZeroPosition := LightMap[lm].FindZeroUV;
- // Construct the plane of the polygon
- Plane := glPlaneFromPoints(pTriangle.Vertex[0], pTriangle.Vertex[1], pTriangle.Vertex[2]);
- // Find the plane on which the polygon lies
- PolyPlane := glGetTriangleAlignement(pTriangle.Vertex);
- // Get the normalvector
- PolyNormal := glGetNormalVector(pTriangle.Vertex[0], pTriangle.Vertex[1], pTriangle.Vertex[2]);
- LightMap[lm].SetupUV(pTriangle);
- // get the edgevectors depending on the plane on which the poly lies
- PlaneNormal := glVertex(Plane.a, Plane.b, Plane.c);
- glNormalizeVector(PlaneNormal);