Refactoring to enable multi SAP broadphase.

This was already planned, and Pierre Terdiman recent thread motivated me to decouple the paircache from the sweep and prune.
http://continuousphysics.com/Bullet/phpBB2/viewtopic.php?t=1329
This commit is contained in:
ejcoumans
2007-08-02 23:48:46 +00:00
parent 5279f9e129
commit 1f7646f72a
29 changed files with 212 additions and 85 deletions

View File

@@ -37,7 +37,8 @@ subject to the following restrictions:
#include "BulletCollision/BroadphaseCollision/btSimpleBroadphase.h"
btCollisionWorld::btCollisionWorld(btDispatcher* dispatcher,btOverlappingPairCache* pairCache, int stackSize)
btCollisionWorld::btCollisionWorld(btDispatcher* dispatcher,btBroadphaseInterface* pairCache, int stackSize)
:m_dispatcher1(dispatcher),
m_broadphasePairCache(pairCache),
m_ownsDispatcher(false),
@@ -65,7 +66,7 @@ btCollisionWorld::~btCollisionWorld()
//
// only clear the cached algorithms
//
getBroadphase()->cleanProxyFromPairs(bp);
getBroadphase()->getOverlappingPairCache()->cleanProxyFromPairs(bp);
getBroadphase()->destroyProxy(bp);
}
}
@@ -136,8 +137,7 @@ void btCollisionWorld::performDiscreteCollisionDetection()
m_broadphasePairCache->setAabb(m_collisionObjects[i]->getBroadphaseHandle(),aabbMin,aabbMax);
}
m_broadphasePairCache->refreshOverlappingPairs();
m_broadphasePairCache->calculateOverlappingPairs();
END_PROFILE("perform Broadphase Collision Detection");
@@ -145,7 +145,7 @@ void btCollisionWorld::performDiscreteCollisionDetection()
btDispatcher* dispatcher = getDispatcher();
if (dispatcher)
dispatcher->dispatchAllCollisionPairs(m_broadphasePairCache,dispatchInfo);
dispatcher->dispatchAllCollisionPairs(m_broadphasePairCache->getOverlappingPairCache(),dispatchInfo);
END_PROFILE("performDiscreteCollisionDetection");
@@ -166,7 +166,7 @@ void btCollisionWorld::removeCollisionObject(btCollisionObject* collisionObject)
//
// only clear the cached algorithms
//
getBroadphase()->cleanProxyFromPairs(bp);
getBroadphase()->getOverlappingPairCache()->cleanProxyFromPairs(bp);
getBroadphase()->destroyProxy(bp);
collisionObject->setBroadphaseHandle(0);
}