diff options
Diffstat (limited to 'extern/bullet2/src/BulletCollision/BroadphaseCollision')
3 files changed, 29 insertions, 4 deletions
diff --git a/extern/bullet2/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.cpp b/extern/bullet2/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.cpp index 4187a8f2970..60f0a41a9d7 100644 --- a/extern/bullet2/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.cpp +++ b/extern/bullet2/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.cpp @@ -24,7 +24,8 @@ subject to the following restrictions: int gOverlappingPairs = 0; btOverlappingPairCache::btOverlappingPairCache(): -m_blockedForChanges(false) +m_blockedForChanges(false), +m_overlapFilterCallback(0) //m_NumOverlapBroadphasePair(0) { } diff --git a/extern/bullet2/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.h b/extern/bullet2/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.h index e3442212171..a81fe3264df 100644 --- a/extern/bullet2/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.h +++ b/extern/bullet2/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.h @@ -26,13 +26,20 @@ subject to the following restrictions: struct btOverlapCallback { -virtual ~btOverlapCallback() -{ -} + virtual ~btOverlapCallback() + {} //return true for deletion of the pair virtual bool processOverlap(btBroadphasePair& pair) = 0; }; +struct btOverlapFilterCallback +{ + virtual ~btOverlapFilterCallback() + {} + // return true when pairs need collision + virtual bool needBroadphaseCollision(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1) const = 0; +}; + ///btOverlappingPairCache maintains the objects with overlapping AABB ///Typically managed by the Broadphase, Axis3Sweep or btSimpleBroadphase class btOverlappingPairCache : public btBroadphaseInterface @@ -44,6 +51,8 @@ class btOverlappingPairCache : public btBroadphaseInterface //during the dispatch, check that user doesn't destroy/create proxy bool m_blockedForChanges; + //if set, use the callback instead of the built in filter in needBroadphaseCollision + btOverlapFilterCallback* m_overlapFilterCallback; public: btOverlappingPairCache(); @@ -67,6 +76,9 @@ class btOverlappingPairCache : public btBroadphaseInterface inline bool needsBroadphaseCollision(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1) const { + if (m_overlapFilterCallback) + return m_overlapFilterCallback->needBroadphaseCollision(proxy0,proxy1); + bool collides = (proxy0->m_collisionFilterGroup & proxy1->m_collisionFilterMask) != 0; collides = collides && (proxy1->m_collisionFilterGroup & proxy0->m_collisionFilterMask); @@ -92,7 +104,17 @@ class btOverlappingPairCache : public btBroadphaseInterface return m_overlappingPairArray.size(); } + btOverlapFilterCallback* getOverlapFilterCallback() + { + return m_overlapFilterCallback; + } + + void setOverlapFilterCallback(btOverlapFilterCallback* callback) + { + m_overlapFilterCallback = callback; + } }; #endif //OVERLAPPING_PAIR_CACHE_H + diff --git a/extern/bullet2/src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.h b/extern/bullet2/src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.h index 1f265f3dd6b..fb155e7047c 100644 --- a/extern/bullet2/src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.h +++ b/extern/bullet2/src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.h @@ -41,6 +41,8 @@ struct btSimpleBroadphaseProxy : public btBroadphaseProxy class btSimpleBroadphase : public btOverlappingPairCache { +protected: + btSimpleBroadphaseProxy* m_proxies; int* m_freeProxies; int m_firstFreeProxy; |