1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-04-17 11:43:25 +00:00

Avoid dynamic cast in duplicateCollisionShape

This commit is contained in:
elsid 2021-10-30 03:04:54 +02:00
parent ca8584f6f6
commit 80e3623d9a
No known key found for this signature in database
GPG Key ID: B845CB9FEE18AB40

View File

@ -32,11 +32,17 @@ namespace
return newShape;
}
if (const btBvhTriangleMeshShape* trishape = dynamic_cast<const btBvhTriangleMeshShape*>(shape))
if (shape->getShapeType() == TRIANGLE_MESH_SHAPE_PROXYTYPE)
{
const btBvhTriangleMeshShape* trishape = static_cast<const btBvhTriangleMeshShape*>(shape);
return new btScaledBvhTriangleMeshShape(const_cast<btBvhTriangleMeshShape*>(trishape), btVector3(1.f, 1.f, 1.f));
}
if (const btBoxShape* boxshape = dynamic_cast<const btBoxShape*>(shape))
if (shape->getShapeType() == BOX_SHAPE_PROXYTYPE)
{
const btBoxShape* boxshape = static_cast<const btBoxShape*>(shape);
return new btBoxShape(*boxshape);
}
if (shape->getShapeType() == TERRAIN_SHAPE_PROXYTYPE)
return new btHeightfieldTerrainShape(static_cast<const btHeightfieldTerrainShape&>(*shape));