- added quickSort to btAlignedObjectArray (has generally better performance then heapSort)
- replaced all usage of heapSort by quickSort - finished btMultiSapBroadphase. Still some work to be done to increase performance (faster add/remove from child broadphases. uses currently AABB tree to locate child broadphase (should use grid), and sorted array takes too much time.
This commit is contained in:
@@ -28,8 +28,9 @@ subject to the following restrictions:
|
||||
|
||||
int gNumManifold = 0;
|
||||
|
||||
#ifdef BT_DEBUG
|
||||
#include <stdio.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
btCollisionDispatcher::btCollisionDispatcher (btCollisionConfiguration* collisionConfiguration):
|
||||
|
||||
@@ -104,7 +104,7 @@ void btCollisionWorld::addCollisionObject(btCollisionObject* collisionObject,sho
|
||||
collisionObject,
|
||||
collisionFilterGroup,
|
||||
collisionFilterMask,
|
||||
m_dispatcher1
|
||||
m_dispatcher1,0
|
||||
)) ;
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ subject to the following restrictions:
|
||||
|
||||
#include "btConvexConvexAlgorithm.h"
|
||||
|
||||
#include <stdio.h>
|
||||
//#include <stdio.h>
|
||||
#include "BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h"
|
||||
#include "BulletCollision/BroadphaseCollision/btBroadphaseInterface.h"
|
||||
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
|
||||
#include "BulletCollision/CollisionDispatch/btCollisionWorld.h"
|
||||
|
||||
#include <stdio.h>
|
||||
//#include <stdio.h>
|
||||
#include "LinearMath/btQuickprof.h"
|
||||
|
||||
btSimulationIslandManager::btSimulationIslandManager()
|
||||
@@ -138,7 +138,7 @@ class btPersistentManifoldSortPredicate
|
||||
void btSimulationIslandManager::buildAndProcessIslands(btDispatcher* dispatcher,btCollisionObjectArray& collisionObjects, IslandCallback* callback)
|
||||
{
|
||||
|
||||
BT_PROFILE("islandUnionFindAndHeapSort");
|
||||
BT_PROFILE("islandUnionFindAndQuickSort");
|
||||
|
||||
//we are going to sort the unionfind array, and store the element id in the size
|
||||
//afterwards, we clean unionfind, to make sure no-one uses it anymore
|
||||
@@ -170,7 +170,7 @@ void btSimulationIslandManager::buildAndProcessIslands(btDispatcher* dispatcher,
|
||||
btCollisionObject* colObj0 = collisionObjects[i];
|
||||
if ((colObj0->getIslandTag() != islandId) && (colObj0->getIslandTag() != -1))
|
||||
{
|
||||
printf("error in island management\n");
|
||||
// printf("error in island management\n");
|
||||
}
|
||||
|
||||
assert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1));
|
||||
@@ -197,7 +197,7 @@ void btSimulationIslandManager::buildAndProcessIslands(btDispatcher* dispatcher,
|
||||
btCollisionObject* colObj0 = collisionObjects[i];
|
||||
if ((colObj0->getIslandTag() != islandId) && (colObj0->getIslandTag() != -1))
|
||||
{
|
||||
printf("error in island management\n");
|
||||
// printf("error in island management\n");
|
||||
}
|
||||
|
||||
assert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1));
|
||||
@@ -218,7 +218,7 @@ void btSimulationIslandManager::buildAndProcessIslands(btDispatcher* dispatcher,
|
||||
btCollisionObject* colObj0 = collisionObjects[i];
|
||||
if ((colObj0->getIslandTag() != islandId) && (colObj0->getIslandTag() != -1))
|
||||
{
|
||||
printf("error in island management\n");
|
||||
// printf("error in island management\n");
|
||||
}
|
||||
|
||||
assert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1));
|
||||
@@ -286,7 +286,7 @@ void btSimulationIslandManager::buildAndProcessIslands(btDispatcher* dispatcher,
|
||||
int numManifolds = int (m_islandmanifold.size());
|
||||
|
||||
//we should do radix sort, it it much faster (O(n) instead of O (n log2(n))
|
||||
m_islandmanifold.heapSort(btPersistentManifoldSortPredicate());
|
||||
m_islandmanifold.quickSort(btPersistentManifoldSortPredicate());
|
||||
|
||||
//now process all active islands (sets of manifolds for now)
|
||||
|
||||
|
||||
@@ -77,8 +77,7 @@ void btUnionFind::sortIslands()
|
||||
|
||||
// Sort the vector using predicate and std::sort
|
||||
//std::sort(m_elements.begin(), m_elements.end(), btUnionFindElementSortPredicate);
|
||||
//perhaps use radix sort?
|
||||
m_elements.heapSort(btUnionFindElementSortPredicate());
|
||||
m_elements.quickSort(btUnionFindElementSortPredicate());
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user