I don't think that the ColladaConverter should be responsible to delete the triangle mesh though, because it requires a lot of "if dynamic_cast<btTriangleMeshShape*>(shape)" to check if the shape is a triangle mesh shape and then deleting the underlying triangle mesh and the shape together. This gets ugly.
I think a better solution would be to pass in a flag that allows the triangle mesh shape to own the mesh interface. This flag would ensure that the mesh interface gets deleted when the shape gets deleted.
So basically this line in ColladaConverter.cpp:
Code: Select all
rbOutput.m_colShape = new btBvhTriangleMeshShape(trimesh,useQuantizedAabbCompression);
Code: Select all
rbOutput.m_colShape = new btBvhTriangleMeshShape(trimesh,useQuantizedAabbCompression,true);
What do you think?