minor tweak to BenchmarkDemo to enable toggling between console/graphical output
Disable island manager for 3000 falling boxes: we need to add some batching rather then running thousands of single-body islands
This commit is contained in:
@@ -10,12 +10,15 @@ ENDIF (NOT CMAKE_BUILD_TYPE)
|
|||||||
|
|
||||||
|
|
||||||
OPTION(USE_DOUBLE_PRECISION "Use double precision" OFF)
|
OPTION(USE_DOUBLE_PRECISION "Use double precision" OFF)
|
||||||
|
OPTION(USE_GLUT_GRAPHICAL_BENCHMARK "Use Graphical Benchmark" ON)
|
||||||
|
|
||||||
IF (USE_DOUBLE_PRECISION)
|
IF (USE_DOUBLE_PRECISION)
|
||||||
ADD_DEFINITIONS( -DBT_USE_DOUBLE_PRECISION)
|
ADD_DEFINITIONS( -DBT_USE_DOUBLE_PRECISION)
|
||||||
ENDIF (USE_DOUBLE_PRECISION)
|
ENDIF (USE_DOUBLE_PRECISION)
|
||||||
|
|
||||||
|
IF(USE_GLUT_GRAPHICAL_BENCHMARK)
|
||||||
|
ADD_DEFINITIONS( -DUSE_GLUT_GRAPHICAL_BENCHMARK)
|
||||||
|
ENDIF (USE_GLUT_GRAPHICAL_BENCHMARK)
|
||||||
|
|
||||||
IF (WIN32)
|
IF (WIN32)
|
||||||
OPTION(USE_GLUT "Use Glut" OFF)
|
OPTION(USE_GLUT "Use Glut" OFF)
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ subject to the following restrictions:
|
|||||||
#define COLLISION_RADIUS 0.0f
|
#define COLLISION_RADIUS 0.0f
|
||||||
|
|
||||||
#include "BenchmarkDemo.h"
|
#include "BenchmarkDemo.h"
|
||||||
#ifdef USE_GLUT_DEMO_APPLICATION
|
#ifdef USE_GLUT_GRAPHICAL_BENCHMARK
|
||||||
#include "GlutStuff.h"
|
#include "GlutStuff.h"
|
||||||
#endif //USE_GLUT_DEMO_APPLICATION
|
#endif //USE_GLUT_GRAPHICAL_BENCHMARK
|
||||||
|
|
||||||
///btBulletDynamicsCommon.h is the main Bullet include file, contains most common include files.
|
///btBulletDynamicsCommon.h is the main Bullet include file, contains most common include files.
|
||||||
#include "btBulletDynamicsCommon.h"
|
#include "btBulletDynamicsCommon.h"
|
||||||
@@ -178,7 +178,7 @@ public:
|
|||||||
|
|
||||||
void draw ()
|
void draw ()
|
||||||
{
|
{
|
||||||
#ifdef USE_GLUT_DEMO_APPLICATION
|
#ifdef USE_GLUT_GRAPHICAL_BENCHMARK
|
||||||
glDisable (GL_LIGHTING);
|
glDisable (GL_LIGHTING);
|
||||||
glColor3f (0.0, 1.0, 0.0);
|
glColor3f (0.0, 1.0, 0.0);
|
||||||
glBegin (GL_LINES);
|
glBegin (GL_LINES);
|
||||||
@@ -206,7 +206,7 @@ public:
|
|||||||
}
|
}
|
||||||
glEnd ();
|
glEnd ();
|
||||||
glEnable (GL_LIGHTING);
|
glEnable (GL_LIGHTING);
|
||||||
#endif //USE_GLUT_DEMO_APPLICATION
|
#endif //USE_GLUT_GRAPHICAL_BENCHMARK
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -217,9 +217,9 @@ static btRaycastBar2 raycastBar;
|
|||||||
|
|
||||||
void BenchmarkDemo::clientMoveAndDisplay()
|
void BenchmarkDemo::clientMoveAndDisplay()
|
||||||
{
|
{
|
||||||
#ifdef USE_GLUT_DEMO_APPLICATION
|
#ifdef USE_GLUT_GRAPHICAL_BENCHMARK
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
#endif //USE_GLUT_DEMO_APPLICATION
|
#endif //USE_GLUT_GRAPHICAL_BENCHMARK
|
||||||
|
|
||||||
//simple dynamics world doesn't handle fixed-time-stepping
|
//simple dynamics world doesn't handle fixed-time-stepping
|
||||||
float ms = getDeltaTimeMicroseconds();
|
float ms = getDeltaTimeMicroseconds();
|
||||||
@@ -242,11 +242,11 @@ void BenchmarkDemo::clientMoveAndDisplay()
|
|||||||
|
|
||||||
renderme();
|
renderme();
|
||||||
|
|
||||||
#ifdef USE_GLUT_DEMO_APPLICATION
|
#ifdef USE_GLUT_GRAPHICAL_BENCHMARK
|
||||||
glFlush();
|
glFlush();
|
||||||
|
|
||||||
glutSwapBuffers();
|
glutSwapBuffers();
|
||||||
#endif //USE_GLUT_DEMO_APPLICATION
|
#endif //USE_GLUT_GRAPHICAL_BENCHMARK
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,7 +255,7 @@ void BenchmarkDemo::clientMoveAndDisplay()
|
|||||||
void BenchmarkDemo::displayCallback(void)
|
void BenchmarkDemo::displayCallback(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef USE_GLUT_DEMO_APPLICATION
|
#ifdef USE_GLUT_GRAPHICAL_BENCHMARK
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
renderme();
|
renderme();
|
||||||
@@ -266,7 +266,7 @@ void BenchmarkDemo::displayCallback(void)
|
|||||||
|
|
||||||
glFlush();
|
glFlush();
|
||||||
glutSwapBuffers();
|
glutSwapBuffers();
|
||||||
#endif //USE_GLUT_DEMO_APPLICATION
|
#endif //USE_GLUT_GRAPHICAL_BENCHMARK
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -313,7 +313,7 @@ void BenchmarkDemo::initPhysics()
|
|||||||
|
|
||||||
btDiscreteDynamicsWorld* dynamicsWorld;
|
btDiscreteDynamicsWorld* dynamicsWorld;
|
||||||
m_dynamicsWorld = dynamicsWorld = new btDiscreteDynamicsWorld(m_dispatcher,m_overlappingPairCache,m_solver,m_collisionConfiguration);
|
m_dynamicsWorld = dynamicsWorld = new btDiscreteDynamicsWorld(m_dispatcher,m_overlappingPairCache,m_solver,m_collisionConfiguration);
|
||||||
//dynamicsWorld->getSimulationIslandManager()->setSplitIslands(false);
|
dynamicsWorld->getSimulationIslandManager()->setSplitIslands(false);
|
||||||
dynamicsWorld->getDispatchInfo().m_useConvexConservativeDistanceUtil = true;
|
dynamicsWorld->getDispatchInfo().m_useConvexConservativeDistanceUtil = true;
|
||||||
dynamicsWorld->getDispatchInfo().m_convexConservativeDistanceThreshold = btScalar(0.01);
|
dynamicsWorld->getDispatchInfo().m_convexConservativeDistanceThreshold = btScalar(0.01);
|
||||||
|
|
||||||
@@ -1224,7 +1224,8 @@ void BenchmarkDemo::exitPhysics()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef USE_GLUT_DEMO_APPLICATION
|
#ifndef USE_GLUT_GRAPHICAL_BENCHMARK
|
||||||
|
|
||||||
btRigidBody* DemoApplication::localCreateRigidBody(float mass, const btTransform& startTransform,btCollisionShape* shape)
|
btRigidBody* DemoApplication::localCreateRigidBody(float mass, const btTransform& startTransform,btCollisionShape* shape)
|
||||||
{
|
{
|
||||||
btAssert((!shape || shape->getShapeType() != INVALID_SHAPE_PROXYTYPE));
|
btAssert((!shape || shape->getShapeType() != INVALID_SHAPE_PROXYTYPE));
|
||||||
@@ -1245,5 +1246,5 @@ btRigidBody* DemoApplication::localCreateRigidBody(float mass, const btTransform
|
|||||||
|
|
||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
#endif //USE_GLUT_DEMO_APPLICATION
|
#endif //USE_GLUT_GRAPHICAL_BENCHMARK
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,8 @@ class btConstraintSolver;
|
|||||||
struct btCollisionAlgorithmCreateFunc;
|
struct btCollisionAlgorithmCreateFunc;
|
||||||
class btDefaultCollisionConfiguration;
|
class btDefaultCollisionConfiguration;
|
||||||
|
|
||||||
#ifndef USE_GLUT_DEMO_APPLICATION
|
|
||||||
|
#ifndef USE_GLUT_GRAPHICAL_BENCHMARK
|
||||||
///empty placeholder
|
///empty placeholder
|
||||||
class DemoApplication
|
class DemoApplication
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,18 +8,37 @@
|
|||||||
# You shouldn't have to modify anything below this line
|
# You shouldn't have to modify anything below this line
|
||||||
########################################################
|
########################################################
|
||||||
|
|
||||||
|
IF (USE_GLUT_GRAPHICAL_BENCHMARK)
|
||||||
|
|
||||||
|
INCLUDE_DIRECTORIES(
|
||||||
|
${BULLET_PHYSICS_SOURCE_DIR}/src
|
||||||
|
${BULLET_PHYSICS_SOURCE_DIR}/Demos/OpenGL
|
||||||
|
)
|
||||||
|
|
||||||
|
LINK_LIBRARIES(
|
||||||
|
OpenGLSupport BulletDynamics BulletCollision LinearMath ${GLUT_glut_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(
|
ADD_EXECUTABLE(AppBenchmarks
|
||||||
${BULLET_PHYSICS_SOURCE_DIR}/src ${BULLET_PHYSICS_SOURCE_DIR}/Demos/OpenGL
|
|
||||||
)
|
|
||||||
|
|
||||||
LINK_LIBRARIES(
|
|
||||||
BulletDynamics BulletCollision LinearMath
|
|
||||||
)
|
|
||||||
|
|
||||||
ADD_EXECUTABLE(AppBenchmarks
|
|
||||||
main.cpp
|
main.cpp
|
||||||
BenchmarkDemo.cpp
|
BenchmarkDemo.cpp
|
||||||
)
|
BenchmarkDemo.h
|
||||||
|
)
|
||||||
|
ELSE (USE_GLUT_GRAPHICAL_BENCHMARK)
|
||||||
|
|
||||||
|
INCLUDE_DIRECTORIES(
|
||||||
|
${BULLET_PHYSICS_SOURCE_DIR}/src
|
||||||
|
${BULLET_PHYSICS_SOURCE_DIR}/Demos/OpenGL
|
||||||
|
)
|
||||||
|
|
||||||
|
LINK_LIBRARIES(
|
||||||
|
BulletDynamics BulletCollision LinearMath
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
ADD_EXECUTABLE(AppBenchmarks
|
||||||
|
main.cpp
|
||||||
|
BenchmarkDemo.cpp
|
||||||
|
)
|
||||||
|
ENDIF (USE_GLUT_GRAPHICAL_BENCHMARK)
|
||||||
@@ -18,11 +18,12 @@ subject to the following restrictions:
|
|||||||
#include "LinearMath/btHashMap.h"
|
#include "LinearMath/btHashMap.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#ifdef USE_GLUT_DEMO_APPLICATION
|
#ifdef USE_GLUT_GRAPHICAL_BENCHMARK
|
||||||
#include "GlutStuff.h"
|
#include "GlutStuff.h"
|
||||||
#include "GLDebugDrawer.h"
|
#include "GLDebugDrawer.h"
|
||||||
GLDebugDrawer gDebugDrawer;
|
GLDebugDrawer gDebugDrawer;
|
||||||
#endif //USE_GLUT_DEMO_APPLICATION
|
#define benchmarkDemo benchmarkDemo1
|
||||||
|
#endif //USE_GLUT_GRAPHICAL_BENCHMARK
|
||||||
|
|
||||||
|
|
||||||
#define NUM_DEMOS 7
|
#define NUM_DEMOS 7
|
||||||
@@ -46,10 +47,11 @@ int main(int argc,char** argv)
|
|||||||
char* demoNames[NUM_DEMOS] = {"3000 fall", "1000 stack", "136 ragdolls","1000 convex", "prim-trimesh", "convex-trimesh","raytests"};
|
char* demoNames[NUM_DEMOS] = {"3000 fall", "1000 stack", "136 ragdolls","1000 convex", "prim-trimesh", "convex-trimesh","raytests"};
|
||||||
float totalTime[NUM_DEMOS] = {0.f,0.f,0.f,0.f,0.f,0.f,0.f};
|
float totalTime[NUM_DEMOS] = {0.f,0.f,0.f,0.f,0.f,0.f,0.f};
|
||||||
|
|
||||||
#ifdef USE_GLUT_DEMO_APPLICATION
|
#ifdef USE_GLUT_GRAPHICAL_BENCHMARK
|
||||||
|
benchmarkDemo.initPhysics();
|
||||||
benchmarkDemo.getDynamicsWorld()->setDebugDrawer(&gDebugDrawer);
|
benchmarkDemo.getDynamicsWorld()->setDebugDrawer(&gDebugDrawer);
|
||||||
return glutmain(argc, argv,640,480,"Bullet Physics Demo. http://bulletphysics.com",&benchmarkDemo);
|
return glutmain(argc, argv,640,480,"Bullet Physics Demo. http://bulletphysics.com",&benchmarkDemo);
|
||||||
#else
|
#else //USE_GLUT_GRAPHICAL_BENCHMARK
|
||||||
int d;
|
int d;
|
||||||
|
|
||||||
for (d=0;d<NUM_DEMOS;d++)
|
for (d=0;d<NUM_DEMOS;d++)
|
||||||
@@ -78,7 +80,7 @@ int main(int argc,char** argv)
|
|||||||
printf("\nResults for %s: %f",demoNames[d],totalTime[d]*(1.f/NUM_TESTS));
|
printf("\nResults for %s: %f",demoNames[d],totalTime[d]*(1.f/NUM_TESTS));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif //USE_GLUT_GRAPHICAL_BENCHMARK
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user