16 #ifndef BT_OVERLAPPING_PAIR_CACHE_H 17 #define BT_OVERLAPPING_PAIR_CACHE_H 69 virtual int getNumOverlappingPairs()
const = 0;
79 processAllOverlappingPairs(callback, dispatcher);
83 virtual bool hasDeferredRemoval() = 0;
87 virtual void sortOverlappingPairs(
btDispatcher* dispatcher) = 0;
119 if (m_overlapFilterCallback)
132 if (!needsBroadphaseCollision(proxy0,proxy1))
135 return internalAddPair(proxy0,proxy1);
149 return &m_overlappingPairArray[0];
154 return &m_overlappingPairArray[0];
159 return m_overlappingPairArray;
164 return m_overlappingPairArray;
178 return m_overlapFilterCallback;
183 m_overlapFilterCallback = callback;
188 return m_overlappingPairArray.
size();
220 unsigned int key = proxyId1 | (proxyId2 << 16);
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()
virtual void processAllOverlappingPairs(btOverlapCallback *callback, btDispatcher *dispatcher, const struct btDispatcherInfo &dispatchInfo)
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...
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()
int m_collisionFilterMask
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()
btBroadphasePairArray & getOverlappingPairArray()
virtual ~btOverlapFilterCallback()
btOverlapFilterCallback * getOverlapFilterCallback()
int getNumOverlappingPairs() const
virtual void removeOverlappingPairsContainingProxy(btBroadphaseProxy *, btDispatcher *)
int m_collisionFilterGroup
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
#define ATTRIBUTE_ALIGNED16(a)
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 *)
#define BT_DECLARE_ALIGNED_ALLOCATOR()
virtual void setOverlapFilterCallback(btOverlapFilterCallback *)
virtual void setInternalGhostPairCallback(btOverlappingPairCallback *ghostPairCallback)
btBroadphasePairArray m_overlappingPairArray
bool m_hasDeferredRemoval
by default, do the removal during the pair traversal
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()