extend BVH and GImpact algorithms to accept meshes with UCHAR indices

This commit is contained in:
Stephen Gold
2020-04-28 00:00:07 -07:00
parent cd8cf7521c
commit 5ec86e9f9a
6 changed files with 51 additions and 11 deletions

View File

@@ -82,7 +82,13 @@ void CollisionShape2TriangleMesh(btCollisionShape* collisionShape, const btTrans
for (int j = 2; j >= 0; j--)
{
int graphicsindex = indicestype == PHY_SHORT ? ((unsigned short*)gfxbase)[j] : gfxbase[j];
int graphicsindex;
switch (indicestype) {
case PHY_INTEGER: graphicsindex = gfxbase[j]; break;
case PHY_SHORT: graphicsindex = ((unsigned short*)gfxbase)[j]; break;
case PHY_UCHAR: graphicsindex = ((unsigned char*)gfxbase)[j]; break;
default: btAssert(0);
}
if (type == PHY_FLOAT)
{
float* graphicsbase = (float*)(vertexbase + graphicsindex * stride);