add support for btScaledBvhTriangleMeshShape serialization (export and import through btBulletWorldImporter)
This commit is contained in:
@@ -342,6 +342,19 @@ btCollisionShape* btBulletWorldImporter::convertCollisionShape( btCollisionShap
|
||||
shape = createPlaneShape(planeNormal,planeData->m_planeConstant);
|
||||
shape->setLocalScaling(localScaling);
|
||||
|
||||
break;
|
||||
}
|
||||
case SCALED_TRIANGLE_MESH_SHAPE_PROXYTYPE:
|
||||
{
|
||||
btScaledTriangleMeshShapeData* scaledMesh = (btScaledTriangleMeshShapeData*) shapeData;
|
||||
btCollisionShapeData* colShapeData = (btCollisionShapeData*) &scaledMesh->m_trimeshShapeData;
|
||||
colShapeData->m_shapeType = TRIANGLE_MESH_SHAPE_PROXYTYPE;
|
||||
btCollisionShape* childShape = convertCollisionShape(colShapeData);
|
||||
btBvhTriangleMeshShape* meshShape = (btBvhTriangleMeshShape*)childShape;
|
||||
btVector3 localScaling;
|
||||
localScaling.deSerializeFloat(scaledMesh->m_localScaling);
|
||||
|
||||
shape = createScaledTrangleMeshShape(meshShape, localScaling);
|
||||
break;
|
||||
}
|
||||
case GIMPACT_SHAPE_PROXYTYPE:
|
||||
@@ -1283,6 +1296,15 @@ btCompoundShape* btBulletWorldImporter::createCompoundShape()
|
||||
return shape;
|
||||
}
|
||||
|
||||
|
||||
btScaledBvhTriangleMeshShape* btBulletWorldImporter::createScaledTrangleMeshShape(btBvhTriangleMeshShape* meshShape,const btVector3& localScaling)
|
||||
{
|
||||
btScaledBvhTriangleMeshShape* shape = new btScaledBvhTriangleMeshShape(meshShape,localScaling);
|
||||
m_allocatedCollisionShapes.push_back(shape);
|
||||
return shape;
|
||||
}
|
||||
|
||||
|
||||
btRigidBody& btBulletWorldImporter::getFixedBody()
|
||||
{
|
||||
static btRigidBody s_fixed(0, 0,0);
|
||||
|
||||
Reference in New Issue
Block a user