16 #ifndef BT_OVERLAPPING_PAIR_CACHE_H 17 #define BT_OVERLAPPING_PAIR_CACHE_H 73 virtual int getNumOverlappingPairs()
const = 0;
83 virtual bool hasDeferredRemoval() = 0;
87 virtual void sortOverlappingPairs(
btDispatcher* dispatcher) = 0;
116 if (m_overlapFilterCallback)
131 if (!needsBroadphaseCollision(proxy0,proxy1))
134 return internalAddPair(proxy0,proxy1);
146 return &m_overlappingPairArray[0];
151 return &m_overlappingPairArray[0];
156 return m_overlappingPairArray;
161 return m_overlappingPairArray;
175 return m_overlapFilterCallback;
180 m_overlapFilterCallback = callback;
185 return m_overlappingPairArray.
size();
218 int key =
static_cast<int>(((
unsigned int)proxyId1) | (((
unsigned int)proxyId2) <<16));
227 return static_cast<unsigned int>(key);
236 int proxyId1 = proxy0->
getUid();
237 int proxyId2 = proxy1->
getUid();
238 #if 0 // wrong, 'equalsPair' use unsorted uids, copy-past devil striked again. Nat. 239 if (proxyId1 > proxyId2)
240 btSwap(proxyId1, proxyId2);
243 int index = m_hashTable[hash];
245 while( index !=
BT_NULL_PAIR && equalsPair(m_overlappingPairArray[index], proxyId1, proxyId2) ==
false)
247 index = m_next[index];
257 return &m_overlappingPairArray[index];
267 m_ghostPairCallback = ghostPairCallback;
270 virtual void sortOverlappingPairs(
btDispatcher* dispatcher);
321 if (m_overlapFilterCallback)
332 return m_overlappingPairArray;
337 return m_overlappingPairArray;
345 return &m_overlappingPairArray[0];
350 return &m_overlappingPairArray[0];
355 return m_overlappingPairArray.
size();
360 return m_overlapFilterCallback;
365 m_overlapFilterCallback = callback;
370 return m_hasDeferredRemoval;
375 m_ghostPairCallback = ghostPairCallback;
378 virtual void sortOverlappingPairs(
btDispatcher* dispatcher);
395 return &m_overlappingPairArray[0];
399 return &m_overlappingPairArray[0];
403 return m_overlappingPairArray;
467 #endif //BT_OVERLAPPING_PAIR_CACHE_H virtual bool hasDeferredRemoval()
btOverlapFilterCallback * getOverlapFilterCallback()
int getNumOverlappingPairs() const
int getNumOverlappingPairs() const
btOverlapFilterCallback * m_overlapFilterCallback
btNullPairCache skips add/removal of overlapping pairs. Userful for benchmarking and unit testing...
short int m_collisionFilterGroup
btBroadphasePair * internalFindPair(btBroadphaseProxy *proxy0, btBroadphaseProxy *proxy1, int hash)
virtual int getNumOverlappingPairs() const
btAlignedObjectArray< int > m_hashTable
virtual bool hasDeferredRemoval()
btBroadphasePairArray & getOverlappingPairArray()
btOverlappingPairCallback * m_ghostPairCallback
#define SIMD_FORCE_INLINE
btBroadphasePairArray m_overlappingPairArray
bool equalsPair(const btBroadphasePair &pair, int proxyId1, int proxyId2)
const btBroadphasePair * getOverlappingPairArrayPtr() const
const btBroadphasePairArray & getOverlappingPairArray() const
btOverlappingPairCallback * m_ghostPairCallback
btOverlapFilterCallback * m_overlapFilterCallback
bool needsBroadphaseCollision(btBroadphaseProxy *proxy0, btBroadphaseProxy *proxy1) const
virtual void cleanProxyFromPairs(btBroadphaseProxy *, btDispatcher *)
virtual btBroadphasePair * getOverlappingPairArrayPtr()
void setOverlapFilterCallback(btOverlapFilterCallback *callback)
virtual btBroadphasePair * getOverlappingPairArrayPtr()
virtual void processAllOverlappingPairs(btOverlapCallback *, btDispatcher *)
The btOverlappingPairCache provides an interface for overlapping pair management (add, remove, storage), used by the btBroadphaseInterface broadphases.
virtual bool hasDeferredRemoval()
unsigned int getHash(unsigned int proxyId1, unsigned int proxyId2)
virtual ~btOverlapCallback()
const btBroadphasePair * getOverlappingPairArrayPtr() const
btBroadphasePairArray & getOverlappingPairArray()
virtual ~btOverlapFilterCallback()
btOverlapFilterCallback * getOverlapFilterCallback()
bool needsBroadphaseCollision(btBroadphaseProxy *proxy0, btBroadphaseProxy *proxy1) const
virtual void removeOverlappingPairsContainingProxy(btBroadphaseProxy *, btDispatcher *)
const btBroadphasePairArray & getOverlappingPairArray() const
btSortedOverlappingPairCache maintains the objects with overlapping AABB Typically managed by the Bro...
void setOverlapFilterCallback(btOverlapFilterCallback *callback)
virtual bool needBroadphaseCollision(btBroadphaseProxy *proxy0, btBroadphaseProxy *proxy1) const =0
virtual bool processOverlap(btBroadphasePair &pair)=0
btAlignedObjectArray< int > m_next
virtual ~btOverlappingPairCache()
The btBroadphaseProxy is the main class that can be used with the Bullet broadphases.
btBroadphaseProxy * m_pProxy1
const btBroadphasePair * getOverlappingPairArrayPtr() const
int size() const
return the number of elements in the array
btBroadphasePairArray m_overlappingPairArray
btBroadphaseProxy * m_pProxy0
virtual void cleanOverlappingPair(btBroadphasePair &, btDispatcher *)
virtual void setInternalGhostPairCallback(btOverlappingPairCallback *ghostPairCallback)
btAlignedObjectArray< btBroadphasePair > btBroadphasePairArray
virtual void setInternalGhostPairCallback(btOverlappingPairCallback *)
virtual void setOverlapFilterCallback(btOverlapFilterCallback *)
virtual void setInternalGhostPairCallback(btOverlappingPairCallback *ghostPairCallback)
btBroadphasePairArray m_overlappingPairArray
bool m_hasDeferredRemoval
by default, do the removal during the pair traversal
short int m_collisionFilterMask
virtual void sortOverlappingPairs(btDispatcher *dispatcher)
virtual btBroadphasePair * addOverlappingPair(btBroadphaseProxy *proxy0, btBroadphaseProxy *proxy1)
virtual btBroadphasePair * findPair(btBroadphaseProxy *, btBroadphaseProxy *)
btBroadphasePairArray & getOverlappingPairArray()
The btDispatcher interface class can be used in combination with broadphase to dispatch calculations ...
Hash-space based Pair Cache, thanks to Erin Catto, Box2D, http://www.box2d.org, and Pierre Terdiman...
virtual void * removeOverlappingPair(btBroadphaseProxy *, btBroadphaseProxy *, btDispatcher *)
The btOverlappingPairCallback class is an additional optional broadphase user callback for adding/rem...
virtual btBroadphasePair * addOverlappingPair(btBroadphaseProxy *, btBroadphaseProxy *)
The btBroadphasePair class contains a pair of aabb-overlapping objects.
btBroadphasePair * getOverlappingPairArrayPtr()