aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsschirm <[email protected]>2017-01-09 17:55:01 +0100
committersschirm <[email protected]>2017-01-09 17:55:01 +0100
commitbb5e11008bb1824b16197e020ff3db3faa4d3d3f (patch)
tree00d925bd9a6297249e4d2eec7d5ddf5f70ecf784
parentPhysX 3.4, APEX 1.4 release candidate update: @21542069 (diff)
downloadphysx-3.4-bb5e11008bb1824b16197e020ff3db3faa4d3d3f.tar.xz
physx-3.4-bb5e11008bb1824b16197e020ff3db3faa4d3d3f.zip
PhysX 3.4, APEX 1.4 release candidate update: @21549663
-rw-r--r--PhysX_3.4/Source/PhysXCooking/src/mesh/TriangleMeshBuilder.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/PhysX_3.4/Source/PhysXCooking/src/mesh/TriangleMeshBuilder.cpp b/PhysX_3.4/Source/PhysXCooking/src/mesh/TriangleMeshBuilder.cpp
index de44e439..7b856d6a 100644
--- a/PhysX_3.4/Source/PhysXCooking/src/mesh/TriangleMeshBuilder.cpp
+++ b/PhysX_3.4/Source/PhysXCooking/src/mesh/TriangleMeshBuilder.cpp
@@ -1154,17 +1154,25 @@ void TriangleMeshBuilder::checkMeshIndicesSize()
{
const PxU32 numTriangles = m.mNbTriangles;
PxU32* PX_RESTRICT indices32 = reinterpret_cast<PxU32*> (m.mTriangles);
+ PxU32* PX_RESTRICT grbIndices32 = reinterpret_cast<PxU32*>(m.mGRB_triIndices);
m.mTriangles = 0; // force a realloc
- m.allocateTriangles(numTriangles, false);
+ m.allocateTriangles(numTriangles, false, grbIndices32 != NULL ? 1u : 0u);
PX_ASSERT(m.has16BitIndices()); // realloc'ing without the force32bit flag changed it.
PxU16* PX_RESTRICT indices16 = reinterpret_cast<PxU16*> (m.mTriangles);
- for (PxU32 i = 0; i < numTriangles*3; i++)
+ for (PxU32 i = 0; i < numTriangles * 3; i++)
indices16[i] = Ps::to16(indices32[i]);
PX_FREE(indices32);
+ if (grbIndices32)
+ {
+ PxU16* PX_RESTRICT grbIndices16 = reinterpret_cast<PxU16*> (m.mGRB_triIndices);
+ for (PxU32 i = 0; i < numTriangles * 3; i++)
+ grbIndices16[i] = Ps::to16(grbIndices32[i]);
+ }
+
onMeshIndexFormatChange();
}
}