backup commit
This commit is contained in:
marauder2k7 2024-05-20 12:21:37 +01:00
parent 2d2d3c7560
commit 25d6ee5372
2 changed files with 30 additions and 7 deletions

View file

@ -299,10 +299,8 @@ void GroundPlane::buildConvex( const Box3F& box, Convex* convex )
{
Point3F queryCenter = box.getCenter();
planeConvex->mCenter = Point3F( queryCenter.x, queryCenter.y, 0 );
planeConvex->mSize = Point3F( box.getExtents().x,
box.getExtents().y,
0 );
planeConvex->mCenter = Point3F( queryCenter.x, queryCenter.y, 0 );
planeConvex->mSize = Point3F( box.getExtents().x, box.getExtents().y, 0 );
}
}

View file

@ -150,13 +150,13 @@ void ConcretePolyList::render()
GFXStateBlockRef sb = GFX->createStateBlock( solidZDisable );
GFX->setStateBlock( sb );
PrimBuild::color3i( 255, 0, 255 );
Poly *p;
Point3F *pnt;
for ( p = mPolyList.begin(); p < mPolyList.end(); p++ )
{
PrimBuild::color3i(255, 0, 255);
PrimBuild::begin( GFXLineStrip, p->vertexCount + 1 );
for ( U32 i = 0; i < p->vertexCount; i++ )
@ -169,6 +169,31 @@ void ConcretePolyList::render()
PrimBuild::vertex3fv( pnt );
PrimBuild::end();
// Calculate the center of the polygon
Point3F centroid(0, 0, 0);
for (U32 i = 0; i < p->vertexCount; i++)
{
pnt = &mVertexList[mIndexList[p->vertexStart + i]];
centroid += *pnt;
}
centroid /= p->vertexCount;
// Calculate the end point of the normal line
Point3F norm = p->plane.getNormal();
U8 red = static_cast<U8>((norm.x + 1.0f) * 0.5f * 255);
U8 green = static_cast<U8>((norm.y + 1.0f) * 0.5f * 255);
U8 blue = static_cast<U8>((norm.z + 1.0f) * 0.5f * 255);
PrimBuild::color3i(red, green, blue);
Point3F normalEnd = centroid + norm;
// Draw the normal line
PrimBuild::begin(GFXLineList, 2);
PrimBuild::vertex3fv(centroid);
PrimBuild::vertex3fv(normalEnd);
PrimBuild::end();
}
}
@ -220,4 +245,4 @@ void ConcretePolyList::triangulate()
mPolyList = polyList;
mIndexList = indexList;
}
}