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;
117 if (m_overlapFilterCallback)
132 if (!needsBroadphaseCollision(proxy0,proxy1))
135 return internalAddPair(proxy0,proxy1);
147 return &m_overlappingPairArray[0];
152 return &m_overlappingPairArray[0];
157 return m_overlappingPairArray;
162 return m_overlappingPairArray;
176 return m_overlapFilterCallback;
181 m_overlapFilterCallback = callback;
186 return m_overlappingPairArray.
size();
219 int key =
static_cast<int>(((
unsigned int)proxyId1) | (((
unsigned int)proxyId2) <<16));
228 return static_cast<unsigned int>(key);
237 int proxyId1 = proxy0->
getUid();
238 int proxyId2 = proxy1->
getUid();
239 #if 0 // wrong, 'equalsPair' use unsorted uids, copy-past devil striked again. Nat. 240 if (proxyId1 > proxyId2)
241 btSwap(proxyId1, proxyId2);
244 int index = m_hashTable[hash];
246 while( index !=
BT_NULL_PAIR && equalsPair(m_overlappingPairArray[index], proxyId1, proxyId2) ==
false)
248 index = m_next[index];
258 return &m_overlappingPairArray[index];
268 m_ghostPairCallback = ghostPairCallback;
271 virtual void sortOverlappingPairs(
btDispatcher* dispatcher);
322 if (m_overlapFilterCallback)
333 return m_overlappingPairArray;
338 return m_overlappingPairArray;
346 return &m_overlappingPairArray[0];
351 return &m_overlappingPairArray[0];
356 return m_overlappingPairArray.
size();
361 return m_overlapFilterCallback;
366 m_overlapFilterCallback = callback;
371 return m_hasDeferredRemoval;
376 m_ghostPairCallback = ghostPairCallback;
379 virtual void sortOverlappingPairs(
btDispatcher* dispatcher);
396 return &m_overlappingPairArray[0];
400 return &m_overlappingPairArray[0];
404 return m_overlappingPairArray;
468 #endif //BT_OVERLAPPING_PAIR_CACHE_H virtual bool hasDeferredRemoval()
const btBroadphasePair * getOverlappingPairArrayPtr() const
btOverlapFilterCallback * getOverlapFilterCallback()
bool needsBroadphaseCollision(btBroadphaseProxy *proxy0, btBroadphaseProxy *proxy1) 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)
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)
bool needsBroadphaseCollision(btBroadphaseProxy *proxy0, btBroadphaseProxy *proxy1) const
btOverlappingPairCallback * m_ghostPairCallback
btOverlapFilterCallback * m_overlapFilterCallback
virtual void cleanProxyFromPairs(btBroadphaseProxy *, btDispatcher *)
const btBroadphasePair * getOverlappingPairArrayPtr() const
virtual btBroadphasePair * getOverlappingPairArrayPtr()
void setOverlapFilterCallback(btOverlapFilterCallback *callback)
virtual btBroadphasePair * getOverlappingPairArrayPtr()
const btBroadphasePairArray & getOverlappingPairArray() const
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 int getNumOverlappingPairs() const
int size() const
return the number of elements in the array
virtual ~btOverlapCallback()
virtual bool needBroadphaseCollision(btBroadphaseProxy *proxy0, btBroadphaseProxy *proxy1) const =0
btBroadphasePairArray & getOverlappingPairArray()
virtual ~btOverlapFilterCallback()
btOverlapFilterCallback * getOverlapFilterCallback()
int getNumOverlappingPairs() const
virtual void removeOverlappingPairsContainingProxy(btBroadphaseProxy *, btDispatcher *)
btSortedOverlappingPairCache maintains the objects with overlapping AABB Typically managed by the Bro...
void setOverlapFilterCallback(btOverlapFilterCallback *callback)
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
btBroadphasePairArray m_overlappingPairArray
btBroadphaseProxy * m_pProxy0
virtual void cleanOverlappingPair(btBroadphasePair &, btDispatcher *)
virtual void setInternalGhostPairCallback(btOverlappingPairCallback *ghostPairCallback)
btAlignedObjectArray< btBroadphasePair > btBroadphasePairArray
const btBroadphasePairArray & getOverlappingPairArray() const
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
const btBroadphasePair * getOverlappingPairArrayPtr() const
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()