diff options
author | Erwin Coumans <blender@erwincoumans.com> | 2007-07-06 07:12:31 +0400 |
---|---|---|
committer | Erwin Coumans <blender@erwincoumans.com> | 2007-07-06 07:12:31 +0400 |
commit | 376be529bb932f867b01466592c33899ee5ec2c8 (patch) | |
tree | e89c72da658f04ed4aa816ada6adabfb5d938b74 /extern/bullet2/src/BulletCollision/BroadphaseCollision | |
parent | cff039bc58fe2ed54d4dad0828f5dede0b26a206 (diff) |
synchronized to latest version of Bullet. added btConeTwistConstraint (useful for ragdolls etc)
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; |