1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-06 11:11:35 +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; 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)); 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); return new btBoxShape(*boxshape);
}
if (shape->getShapeType() == TERRAIN_SHAPE_PROXYTYPE) if (shape->getShapeType() == TERRAIN_SHAPE_PROXYTYPE)
return new btHeightfieldTerrainShape(static_cast<const btHeightfieldTerrainShape&>(*shape)); return new btHeightfieldTerrainShape(static_cast<const btHeightfieldTerrainShape&>(*shape));