mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 08:34:40 +00:00
Fixes the drawUtil rendering of polyhedrons by correcting the index ordering to work with triangleStrip as opposed to Fan.
This commit is contained in:
parent
65f51a89d8
commit
8a7159c00e
2 changed files with 12 additions and 2 deletions
|
|
@ -1015,7 +1015,7 @@ void GFXDrawUtil::_drawSolidPolyhedron( const GFXStateBlockDesc &desc, const Any
|
||||||
|
|
||||||
// Allocate a temp buffer for the face indices.
|
// Allocate a temp buffer for the face indices.
|
||||||
|
|
||||||
const U32 numIndices = poly.getNumEdges() * 2;
|
const U32 numIndices = poly.getNumEdges() * 3;
|
||||||
const U32 numPlanes = poly.getNumPlanes();
|
const U32 numPlanes = poly.getNumPlanes();
|
||||||
|
|
||||||
GFXPrimitiveBufferHandle prims( mDevice, numIndices, 0, GFXBufferTypeVolatile );
|
GFXPrimitiveBufferHandle prims( mDevice, numIndices, 0, GFXBufferTypeVolatile );
|
||||||
|
|
|
||||||
|
|
@ -385,6 +385,8 @@ U32 PolyhedronImpl< Base >::extractFace( U32 plane, IndexType* outIndices, U32 m
|
||||||
// so it should be sufficiently fast to just loop over the original
|
// so it should be sufficiently fast to just loop over the original
|
||||||
// set.
|
// set.
|
||||||
|
|
||||||
|
U32 indexItr = 0;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
// Add the vertex for the current edge.
|
// Add the vertex for the current edge.
|
||||||
|
|
@ -392,7 +394,15 @@ U32 PolyhedronImpl< Base >::extractFace( U32 plane, IndexType* outIndices, U32 m
|
||||||
if( idx >= maxOutIndices )
|
if( idx >= maxOutIndices )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
outIndices[ idx ++ ] = currentVertex;
|
++indexItr;
|
||||||
|
|
||||||
|
if (indexItr >= 3)
|
||||||
|
{
|
||||||
|
outIndices[idx++] = firstEdge->vertex[0];
|
||||||
|
indexItr = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
outIndices[idx++] = currentVertex;
|
||||||
|
|
||||||
// Look for next edge.
|
// Look for next edge.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue