Added support for quads that are incorrectly oriented (clockwise instead
of counterclockwise): quads are now turned, but a warning message is printed (since the track exporter should not export this kind of quads). git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@4070 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
731add0e04
commit
5cd7fd2b45
@ -27,7 +27,19 @@
|
||||
Quad::Quad(const Vec3 &p0, const Vec3 &p1, const Vec3 &p2, const Vec3 &p3,
|
||||
bool invisible)
|
||||
{
|
||||
m_p[0]=p0; m_p[1]=p1; m_p[2]=p2; m_p[3]=p3;
|
||||
if(sideOfLine2D(p0, p2, p1)>0 ||
|
||||
sideOfLine2D(p0, p2, p3)<0)
|
||||
{
|
||||
printf("Warning: quad has wrong orientation: p0=%f %f %f p1=%f %f %f\n",
|
||||
p0.getX(), p0.getY(), p0.getZ(),p1.getX(), p1.getY(), p1.getZ());
|
||||
printf("The quad will be swapped, nevertheless test for correctness -\n");
|
||||
printf("quads must be counter-clockwise oriented.\n");
|
||||
m_p[0]=p1; m_p[1]=p0; m_p[2]=p3; m_p[3]=p2;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_p[0]=p0; m_p[1]=p1; m_p[2]=p2; m_p[3]=p3;
|
||||
}
|
||||
m_center = 0.25f*(p0+p1+p2+p3);
|
||||
m_min_height = std::min ( std::min(p0.getZ(), p1.getZ()),
|
||||
std::min(p0.getZ(), p1.getZ()) );
|
||||
|
Loading…
Reference in New Issue
Block a user