Get rid of btSolverBody and use btRigidBody directly. btSolverBody didn't improve performance after all, due to random-access

Tweak the BenchmarkDemo a bit: 

1) disable deactivation in graphical mode
2) add some settings that increase performance in the BenchmarkDemo2 (1000 stack) from 35ms to 15ms on this quad core (at the cost of a bit of quality)
This commit is contained in:
erwin.coumans
2010-02-11 20:30:56 +00:00
parent bb8d1b11df
commit d4c3633405
26 changed files with 348 additions and 805 deletions

View File

@@ -14,6 +14,7 @@ subject to the following restrictions:
*/
// Collision Radius
#define COLLISION_RADIUS 0.0f
@@ -281,7 +282,6 @@ void BenchmarkDemo::displayCallback(void)
void BenchmarkDemo::initPhysics()
{
@@ -316,7 +316,7 @@ void BenchmarkDemo::initPhysics()
///the default constraint solver. For parallel processing you can use a different solver (see Extras/BulletMultiThreaded)
#ifdef USE_PARALLEL_SOLVER_BENCHMARK
btSequentialImpulseConstraintSolver* sol = new btParallelConstraintSolver;
btConstraintSolver* sol = new btParallelConstraintSolver;
#else
btSequentialImpulseConstraintSolver* sol = new btSequentialImpulseConstraintSolver;
#endif //USE_PARALLEL_DISPATCHER_BENCHMARK
@@ -327,9 +327,11 @@ void BenchmarkDemo::initPhysics()
btDiscreteDynamicsWorld* dynamicsWorld;
m_dynamicsWorld = dynamicsWorld = new btDiscreteDynamicsWorld(m_dispatcher,m_overlappingPairCache,m_solver,m_collisionConfiguration);
///the following 3 lines increase the performance dramatically, with a little bit of loss of quality
m_dynamicsWorld->getSolverInfo().m_solverMode |=SOLVER_ENABLE_FRICTION_DIRECTION_CACHING; //don't recalculate friction values each frame
dynamicsWorld->getSolverInfo().m_numIterations = 4; //few solver iterations
m_defaultContactProcessingThreshold = 0.f;//used when creating bodies: body->setContactProcessingThreshold(...);
dynamicsWorld->getSolverInfo().m_numIterations = 4;
m_dynamicsWorld->setGravity(btVector3(0,-10,0));

View File

@@ -22,7 +22,7 @@ subject to the following restrictions:
#include "GlutStuff.h"
#include "GLDebugDrawer.h"
GLDebugDrawer gDebugDrawer;
#define benchmarkDemo benchmarkDemo1
#define benchmarkDemo benchmarkDemo2
#endif //USE_GRAPHICAL_BENCHMARK
@@ -50,6 +50,7 @@ int main(int argc,char** argv)
#ifdef USE_GRAPHICAL_BENCHMARK
benchmarkDemo.initPhysics();
benchmarkDemo.getDynamicsWorld()->setDebugDrawer(&gDebugDrawer);
benchmarkDemo.setDebugMode(benchmarkDemo.getDebugMode() | btIDebugDraw::DBG_NoDeactivation);
return glutmain(argc, argv,640,480,"Bullet Physics Demo. http://bulletphysics.com",&benchmarkDemo);
#else //USE_GRAPHICAL_BENCHMARK
int d;