diff options
author | Erwin Coumans <blender@erwincoumans.com> | 2008-09-27 03:20:31 +0400 |
---|---|---|
committer | Erwin Coumans <blender@erwincoumans.com> | 2008-09-27 03:20:31 +0400 |
commit | 1e0cfcfd3af917a12402f955e6c80ea1b4999321 (patch) | |
tree | c5886810ea9adc93bf639951e6d1cc55a168972c /extern/bullet2/src/BulletSoftBody/btSoftBodyConcaveCollisionAlgorithm.h | |
parent | 17d9f2eda9ac03fa54c5a5788643aabfcec34bc7 (diff) |
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
Diffstat (limited to 'extern/bullet2/src/BulletSoftBody/btSoftBodyConcaveCollisionAlgorithm.h')
-rw-r--r-- | extern/bullet2/src/BulletSoftBody/btSoftBodyConcaveCollisionAlgorithm.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/extern/bullet2/src/BulletSoftBody/btSoftBodyConcaveCollisionAlgorithm.h b/extern/bullet2/src/BulletSoftBody/btSoftBodyConcaveCollisionAlgorithm.h index adb91329a4c..08ac3f11e20 100644 --- a/extern/bullet2/src/BulletSoftBody/btSoftBodyConcaveCollisionAlgorithm.h +++ b/extern/bullet2/src/BulletSoftBody/btSoftBodyConcaveCollisionAlgorithm.h @@ -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; |