41 :m_overlappingPairs(pairCache),
42 m_optimizedAabbTree(0),
43 m_ownsPairCache(false),
55 virtual ~btMultiSapOverlapFilterCallback()
70 void* mem =
btAlignedAlloc(
sizeof(btMultiSapOverlapFilterCallback),16);
116 setAabb(proxy,aabbMin,aabbMax,dispatcher);
190 :m_multiSap(multiSap),
191 m_multiProxy(multiProxy),
192 m_dispatcher(dispatcher)
197 virtual void processNode(
int ,
int broadphaseIndex)
201 int containingBroadphaseIndex = -1;
203 for (
int i=0;i<m_multiProxy->m_bridgeProxies.size();i++)
206 if (m_multiProxy->m_bridgeProxies[i]->m_childBroadphase == childBroadphase)
208 containingBroadphaseIndex = i;
212 if (containingBroadphaseIndex<0)
215 btBroadphaseProxy* childProxy = childBroadphase->
createProxy(m_multiProxy->m_aabbMin,m_multiProxy->m_aabbMax,m_multiProxy->m_shapeType,m_multiProxy->m_clientObject,m_multiProxy->m_collisionFilterGroup,m_multiProxy->m_collisionFilterMask, m_dispatcher,m_multiProxy);
216 m_multiSap->addToChildBroadphase(m_multiProxy,childProxy,childBroadphase);
222 MyNodeOverlapCallback myNodeCallback(
this,multiProxy,dispatcher);
235 multiProxy->
m_bridgeProxies[i]->m_childBroadphase->getBroadphaseAabb(worldAabbMin,worldAabbMax);
237 if (!overlapsBroadphase)
351 return aProxy0 > bProxy0 ||
352 (aProxy0 == bProxy0 && aProxy1 > bProxy1) ||
388 for (i=0;i<overlappingPairArray.
size();i++)
398 bool isDuplicate = (aProxy0 == bProxy0) && (aProxy1 == bProxy1);
402 bool needsRemoval =
false;
410 needsRemoval =
false;
438 #define CLEAN_INVALID_PAIRS 1
439 #ifdef CLEAN_INVALID_PAIRS
447 #endif//CLEAN_INVALID_PAIRS
462 multiSapProxy1->m_aabbMin,multiSapProxy1->m_aabbMax);
int m_escapeIndexOrTriangleIndex
void * m_multiSapParentProxy
QuantizedNodeArray & getLeafNodeArray()
void push_back(const T &_Val)
void setQuantizationValues(const btVector3 &bvhAabbMin, const btVector3 &bvhAabbMax, btScalar quantizationMargin=btScalar(1.0))
***************************************** expert/internal use only ************************* ...
virtual void cleanOverlappingPair(btBroadphasePair &pair, btDispatcher *dispatcher)=0
int gOverlappingPairs
btSapBroadphaseArray m_sapBroadphases;
class btQuantizedBvh * m_optimizedAabbTree
btOverlappingPairCache * m_overlappingPairs
void buildInternal()
buildInternal is expert use only: assumes that setQuantizationValues and LeafNodeArray are initialize...
short int m_collisionFilterGroup
The btMultiSapBroadphase is a research project, not recommended to use in production.
virtual void setOverlapFilterCallback(btOverlapFilterCallback *callback)=0
virtual ~btMultiSapBroadphase()
bool TestAabbAgainstAabb2(const btVector3 &aabbMin1, const btVector3 &aabbMax1, const btVector3 &aabbMin2, const btVector3 &aabbMax2)
conservative test for overlap between two aabbs
const btScalar & getZ() const
Return the z value.
The btOverlappingPairCache provides an interface for overlapping pair management (add, remove, storage), used by the btBroadphaseInterface broadphases.
btBroadphaseProxy * m_childProxy
#define MAX_NUM_PARTS_IN_BITS
int size() const
return the number of elements in the array
virtual btBroadphasePairArray & getOverlappingPairArray()=0
virtual void printStats()
virtual void resetPool(btDispatcher *dispatcher)
reset broadphase internal structures, to ensure determinism/reproducability
btOverlapFilterCallback * m_filterCallback
bool testAabbOverlap(btBroadphaseProxy *proxy0, btBroadphaseProxy *proxy1)
virtual btBroadphaseProxy * createProxy(const btVector3 &aabbMin, const btVector3 &aabbMax, int shapeType, void *userPtr, short int collisionFilterGroup, short int collisionFilterMask, btDispatcher *dispatcher, void *multiSapProxy)=0
const btScalar & getY() const
Return the y value.
#define btAlignedFree(ptr)
const btScalar & getX() const
Return the x value.
void addToChildBroadphase(btMultiSapProxy *parentMultiSapProxy, btBroadphaseProxy *childProxy, btBroadphaseInterface *childBroadphase)
btSortedOverlappingPairCache maintains the objects with overlapping AABB Typically managed by the Bro...
virtual btOverlappingPairCache * getOverlappingPairCache()
void quantize(unsigned short *out, const btVector3 &point, int isMax) const
virtual btBroadphaseProxy * createProxy(const btVector3 &aabbMin, const btVector3 &aabbMax, int shapeType, void *userPtr, short int collisionFilterGroup, short int collisionFilterMask, btDispatcher *dispatcher, void *multiSapProxy)
btMultiSapBroadphase(int maxProxies=16384, btOverlappingPairCache *pairCache=0)
The btBroadphaseInterface class provides an interface to detect aabb-overlapping object pairs...
btQuantizedBvhNode is a compressed aabb node, 16 bytes.
virtual ~btOverlappingPairCache()
The btBroadphaseProxy is the main class that can be used with the Bullet broadphases.
btBroadphaseProxy * m_pProxy1
btCollisionAlgorithm * m_algorithm
btVector3 can be used to represent 3D points and vectors.
virtual bool process(const btBroadphaseProxy *proxy)=0
btBroadphaseProxy * m_pProxy0
btSapBroadphaseArray m_sapBroadphases
btAlignedObjectArray< btMultiSapProxy * > m_multiSapProxies
btBroadphaseInterface * m_childBroadphase
void resize(int newsize, const T &fillData=T())
btAlignedObjectArray< btBridgeProxy * > m_bridgeProxies
array with all the entries that this proxy belongs to
virtual void getAabb(btBroadphaseProxy *proxy, btVector3 &aabbMin, btVector3 &aabbMax) const
The btQuantizedBvh class stores an AABB tree that can be quickly traversed on CPU and Cell SPU...
unsigned short int m_quantizedAabbMin[3]
bool boxIsContainedWithinBox(const btVector3 &amin, const btVector3 &amax, const btVector3 &bmin, const btVector3 &bmax)
virtual void setAabb(btBroadphaseProxy *proxy, const btVector3 &aabbMin, const btVector3 &aabbMax, btDispatcher *dispatcher)
virtual void setAabb(btBroadphaseProxy *proxy, const btVector3 &aabbMin, const btVector3 &aabbMax, btDispatcher *dispatcher)=0
#define btAlignedAlloc(size, alignment)
short int m_collisionFilterMask
bool operator()(const btBroadphasePair &a1, const btBroadphasePair &b1) const
unsigned short int m_quantizedAabbMax[3]
virtual void destroyProxy(btBroadphaseProxy *proxy, btDispatcher *dispatcher)
virtual void rayTest(const btVector3 &rayFrom, const btVector3 &rayTo, btBroadphaseRayCallback &rayCallback, const btVector3 &aabbMin=btVector3(0, 0, 0), const btVector3 &aabbMax=btVector3(0, 0, 0))
The btDispatcher interface class can be used in combination with broadphase to dispatch calculations ...
void buildTree(const btVector3 &bvhAabbMin, const btVector3 &bvhAabbMax)
void reportAabbOverlappingNodex(btNodeOverlapCallback *nodeCallback, const btVector3 &aabbMin, const btVector3 &aabbMax) const
***************************************** expert/internal use only ************************* ...
virtual void destroyProxy(btBroadphaseProxy *proxy, btDispatcher *dispatcher)=0
virtual void calculateOverlappingPairs(btDispatcher *dispatcher)
calculateOverlappingPairs is optional: incremental algorithms (sweep and prune) might do it during th...
void quickSort(const L &CompareFunc)
The btBroadphasePair class contains a pair of aabb-overlapping objects.