fixed some outstanding issues with Bullet soft bodies:
1) re-allocate a pool allocator, if one of the soft body collision algorithms is larger than max pool element size 2) manage child shapes properly, and call RemoveReferences on the m_sparsesdf
This commit is contained in:
@@ -25,6 +25,39 @@ class btDispatcher;
|
||||
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
|
||||
#include "BulletCollision/CollisionDispatch/btCollisionCreateFunc.h"
|
||||
class btSoftBody;
|
||||
class btCollisionShape;
|
||||
|
||||
#include "LinearMath/btHashMap.h"
|
||||
|
||||
#include "BulletCollision/BroadphaseCollision/btQuantizedBvh.h" //for definition of MAX_NUM_PARTS_IN_BITS
|
||||
|
||||
struct btTriIndex
|
||||
{
|
||||
int m_PartIdTriangleIndex;
|
||||
class btCollisionShape* m_childShape;
|
||||
|
||||
btTriIndex(int partId,int triangleIndex,btCollisionShape* shape)
|
||||
{
|
||||
m_PartIdTriangleIndex = (partId<<(31-MAX_NUM_PARTS_IN_BITS)) | triangleIndex;
|
||||
m_childShape = shape;
|
||||
}
|
||||
|
||||
int getTriangleIndex() const
|
||||
{
|
||||
// Get only the lower bits where the triangle index is stored
|
||||
return (m_PartIdTriangleIndex&~((~0)<<(31-MAX_NUM_PARTS_IN_BITS)));
|
||||
}
|
||||
int getPartId() const
|
||||
{
|
||||
// Get only the highest bits where the part index is stored
|
||||
return (m_PartIdTriangleIndex>>(31-MAX_NUM_PARTS_IN_BITS));
|
||||
}
|
||||
int getUid() const
|
||||
{
|
||||
return m_PartIdTriangleIndex;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
///For each triangle in the concave mesh that overlaps with the AABB of a soft body (m_softBody), processTriangle is called.
|
||||
class btSoftBodyTriangleCallback : public btTriangleCallback
|
||||
@@ -40,6 +73,8 @@ class btSoftBodyTriangleCallback : public btTriangleCallback
|
||||
btDispatcher* m_dispatcher;
|
||||
const btDispatcherInfo* m_dispatchInfoPtr;
|
||||
btScalar m_collisionMarginTriangle;
|
||||
|
||||
btHashMap<btHashKey<btTriIndex>,btTriIndex> m_shapeCache;
|
||||
|
||||
public:
|
||||
int m_triangleCount;
|
||||
|
||||
Reference in New Issue
Block a user