16#ifndef BT_OVERLAPPING_PAIR_CACHE_H
17#define BT_OVERLAPPING_PAIR_CACHE_H
110 if (m_overlapFilterCallback)
123 if (!needsBroadphaseCollision(proxy0, proxy1))
126 return internalAddPair(proxy0, proxy1);
137 return &m_overlappingPairArray[0];
142 return &m_overlappingPairArray[0];
147 return m_overlappingPairArray;
152 return m_overlappingPairArray;
164 return m_overlapFilterCallback;
169 m_overlapFilterCallback = callback;
174 return m_overlappingPairArray.
size();
205 unsigned int key = proxyId1 | (proxyId2 << 16);
219 int proxyId1 = proxy0->
getUid();
220 int proxyId2 = proxy1->
getUid();
222 if (proxyId1 > proxyId2)
223 btSwap(proxyId1, proxyId2);
226 int index = m_hashTable[hash];
228 while (index !=
BT_NULL_PAIR && equalsPair(m_overlappingPairArray[index], proxyId1, proxyId2) ==
false)
230 index = m_next[index];
240 return &m_overlappingPairArray[index];
250 m_ghostPairCallback = ghostPairCallback;
253 virtual void sortOverlappingPairs(
btDispatcher * dispatcher);
btAlignedObjectArray< btBroadphasePair > btBroadphasePairArray
#define ATTRIBUTE_ALIGNED16(a)
#define SIMD_FORCE_INLINE
int size() const
return the number of elements in the array
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,...
const btBroadphasePair * getOverlappingPairArrayPtr() const
btAlignedObjectArray< int > m_next
btBroadphasePairArray m_overlappingPairArray
btOverlapFilterCallback * m_overlapFilterCallback
btBroadphasePair * internalFindPair(btBroadphaseProxy *proxy0, btBroadphaseProxy *proxy1, int hash)
virtual btBroadphasePair * addOverlappingPair(btBroadphaseProxy *proxy0, btBroadphaseProxy *proxy1)
virtual bool hasDeferredRemoval()
const btBroadphasePairArray & getOverlappingPairArray() const
virtual btBroadphasePair * getOverlappingPairArrayPtr()
bool equalsPair(const btBroadphasePair &pair, int proxyId1, int proxyId2)
void setOverlapFilterCallback(btOverlapFilterCallback *callback)
virtual void setInternalGhostPairCallback(btOverlappingPairCallback *ghostPairCallback)
unsigned int getHash(unsigned int proxyId1, unsigned int proxyId2)
btAlignedObjectArray< int > m_hashTable
btOverlapFilterCallback * getOverlapFilterCallback()
btOverlappingPairCallback * m_ghostPairCallback
BT_DECLARE_ALIGNED_ALLOCATOR()
btBroadphasePairArray & getOverlappingPairArray()
bool needsBroadphaseCollision(btBroadphaseProxy *proxy0, btBroadphaseProxy *proxy1) const
int getNumOverlappingPairs() const
btNullPairCache skips add/removal of overlapping pairs. Userful for benchmarking and unit testing.
btOverlapFilterCallback * getOverlapFilterCallback()
virtual void sortOverlappingPairs(btDispatcher *dispatcher)
virtual void cleanOverlappingPair(btBroadphasePair &, btDispatcher *)
virtual void processAllOverlappingPairs(btOverlapCallback *, btDispatcher *)
btBroadphasePairArray m_overlappingPairArray
bool needsBroadphaseCollision(btBroadphaseProxy *, btBroadphaseProxy *) const
virtual void setOverlapFilterCallback(btOverlapFilterCallback *)
virtual void setInternalGhostPairCallback(btOverlappingPairCallback *)
virtual btBroadphasePair * findPair(btBroadphaseProxy *, btBroadphaseProxy *)
virtual int getNumOverlappingPairs() const
virtual void * removeOverlappingPair(btBroadphaseProxy *, btBroadphaseProxy *, btDispatcher *)
virtual void removeOverlappingPairsContainingProxy(btBroadphaseProxy *, btDispatcher *)
virtual bool hasDeferredRemoval()
btBroadphasePairArray & getOverlappingPairArray()
virtual btBroadphasePair * getOverlappingPairArrayPtr()
virtual void cleanProxyFromPairs(btBroadphaseProxy *, btDispatcher *)
virtual btBroadphasePair * addOverlappingPair(btBroadphaseProxy *, btBroadphaseProxy *)
const btBroadphasePair * getOverlappingPairArrayPtr() const
The btOverlappingPairCache provides an interface for overlapping pair management (add,...
virtual btBroadphasePairArray & getOverlappingPairArray()=0
virtual int getNumOverlappingPairs() const =0
virtual void cleanProxyFromPairs(btBroadphaseProxy *proxy, btDispatcher *dispatcher)=0
virtual void setOverlapFilterCallback(btOverlapFilterCallback *callback)=0
virtual btBroadphasePair * getOverlappingPairArrayPtr()=0
virtual void processAllOverlappingPairs(btOverlapCallback *, btDispatcher *dispatcher)=0
virtual btBroadphasePair * findPair(btBroadphaseProxy *proxy0, btBroadphaseProxy *proxy1)=0
virtual void cleanOverlappingPair(btBroadphasePair &pair, btDispatcher *dispatcher)=0
virtual void sortOverlappingPairs(btDispatcher *dispatcher)=0
virtual bool needsBroadphaseCollision(btBroadphaseProxy *proxy0, btBroadphaseProxy *proxy1) const =0
virtual const btBroadphasePair * getOverlappingPairArrayPtr() const =0
virtual ~btOverlappingPairCache()
virtual btOverlapFilterCallback * getOverlapFilterCallback()=0
virtual void setInternalGhostPairCallback(btOverlappingPairCallback *ghostPairCallback)=0
virtual bool hasDeferredRemoval()=0
virtual void processAllOverlappingPairs(btOverlapCallback *callback, btDispatcher *dispatcher, const struct btDispatcherInfo &)
The btOverlappingPairCallback class is an additional optional broadphase user callback for adding/rem...
btSortedOverlappingPairCache maintains the objects with overlapping AABB Typically managed by the Bro...
virtual void processAllOverlappingPairs(btOverlapCallback *, btDispatcher *dispatcher)
virtual void setInternalGhostPairCallback(btOverlappingPairCallback *ghostPairCallback)
btOverlapFilterCallback * getOverlapFilterCallback()
btSortedOverlappingPairCache()
btBroadphasePair * addOverlappingPair(btBroadphaseProxy *proxy0, btBroadphaseProxy *proxy1)
btBroadphasePair * getOverlappingPairArrayPtr()
virtual ~btSortedOverlappingPairCache()
virtual bool hasDeferredRemoval()
btOverlapFilterCallback * m_overlapFilterCallback
btBroadphasePair * findPair(btBroadphaseProxy *proxy0, btBroadphaseProxy *proxy1)
this findPair becomes really slow.
bool needsBroadphaseCollision(btBroadphaseProxy *proxy0, btBroadphaseProxy *proxy1) const
void removeOverlappingPairsContainingProxy(btBroadphaseProxy *proxy, btDispatcher *dispatcher)
btOverlappingPairCallback * m_ghostPairCallback
int getNumOverlappingPairs() const
const btBroadphasePair * getOverlappingPairArrayPtr() const
btBroadphasePairArray & getOverlappingPairArray()
void setOverlapFilterCallback(btOverlapFilterCallback *callback)
void cleanOverlappingPair(btBroadphasePair &pair, btDispatcher *dispatcher)
void * removeOverlappingPair(btBroadphaseProxy *proxy0, btBroadphaseProxy *proxy1, btDispatcher *dispatcher)
bool m_hasDeferredRemoval
by default, do the removal during the pair traversal
btBroadphasePairArray m_overlappingPairArray
void cleanProxyFromPairs(btBroadphaseProxy *proxy, btDispatcher *dispatcher)
virtual void sortOverlappingPairs(btDispatcher *dispatcher)
const btBroadphasePairArray & getOverlappingPairArray() const
The btBroadphasePair class contains a pair of aabb-overlapping objects.
btBroadphaseProxy * m_pProxy1
btBroadphaseProxy * m_pProxy0
The btBroadphaseProxy is the main class that can be used with the Bullet broadphases.
int m_collisionFilterMask
int m_collisionFilterGroup
virtual bool processOverlap(btBroadphasePair &pair)=0
virtual ~btOverlapCallback()
virtual bool needBroadphaseCollision(btBroadphaseProxy *proxy0, btBroadphaseProxy *proxy1) const =0
virtual ~btOverlapFilterCallback()