Added performance benchmarks

This commit is contained in:
erwin.coumans
2008-03-20 09:34:11 +00:00
parent bb680f512d
commit bc5b56e99d
10 changed files with 86074 additions and 2 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,214 @@
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef BENCHMARK_DEMO_H
#define BENCHMARK_DEMO_H
#include "DemoApplication.h"
#include "LinearMath/btAlignedObjectArray.h"
#define NUMRAYS 200
class btBroadphaseInterface;
class btCollisionShape;
class btOverlappingPairCache;
class btCollisionDispatcher;
class btConstraintSolver;
struct btCollisionAlgorithmCreateFunc;
class btDefaultCollisionConfiguration;
///BenchmarkDemo is provides several performance tests
class BenchmarkDemo : public DemoApplication
{
//keep the collision shapes, for deletion/cleanup
btAlignedObjectArray<btCollisionShape*> m_collisionShapes;
btAlignedObjectArray<class RagDoll*> m_ragdolls;
btBroadphaseInterface* m_overlappingPairCache;
btCollisionDispatcher* m_dispatcher;
btConstraintSolver* m_solver;
btDefaultCollisionConfiguration* m_collisionConfiguration;
int m_benchmark;
void createTest1();
void createTest2();
void createTest3();
void createTest4();
void createTest5();
void createTest6();
void createTest7();
void createWall(const btVector3& offsetPosition,int stackSize,const btVector3& boxSize);
void createPyramid(const btVector3& offsetPosition,int stackSize,const btVector3& boxSize);
void createTowerCircle(const btVector3& offsetPosition,int stackSize,int rotSize,const btVector3& boxSize);
void createLargeMeshBody();
class SpuBatchRaycaster* m_batchRaycaster;
class btThreadSupportInterface* m_batchRaycasterThreadSupport;
void castRays();
void initRays();
public:
BenchmarkDemo(int benchmark)
:m_benchmark(benchmark)
{
}
virtual ~BenchmarkDemo()
{
exitPhysics();
}
void initPhysics();
void exitPhysics();
virtual void clientMoveAndDisplay();
virtual void displayCallback();
};
class BenchmarkDemo1 : public BenchmarkDemo
{
public:
BenchmarkDemo1()
:BenchmarkDemo(1)
{
}
static DemoApplication* Create()
{
BenchmarkDemo1* demo = new BenchmarkDemo1;
demo->myinit();
demo->initPhysics();
return demo;
}
};
class BenchmarkDemo2 : public BenchmarkDemo
{
public:
BenchmarkDemo2()
:BenchmarkDemo(2)
{
}
static DemoApplication* Create()
{
BenchmarkDemo2* demo = new BenchmarkDemo2;
demo->myinit();
demo->initPhysics();
return demo;
}
};
class BenchmarkDemo3 : public BenchmarkDemo
{
public:
BenchmarkDemo3()
:BenchmarkDemo(3)
{
}
static DemoApplication* Create()
{
BenchmarkDemo3* demo = new BenchmarkDemo3;
demo->myinit();
demo->initPhysics();
return demo;
}
};
class BenchmarkDemo4 : public BenchmarkDemo
{
public:
BenchmarkDemo4()
:BenchmarkDemo(4)
{
}
static DemoApplication* Create()
{
BenchmarkDemo4* demo = new BenchmarkDemo4;
demo->myinit();
demo->initPhysics();
return demo;
}
};
class BenchmarkDemo5 : public BenchmarkDemo
{
public:
BenchmarkDemo5()
:BenchmarkDemo(5)
{
}
static DemoApplication* Create()
{
BenchmarkDemo5* demo = new BenchmarkDemo5;
demo->myinit();
demo->initPhysics();
return demo;
}
};
class BenchmarkDemo6 : public BenchmarkDemo
{
public:
BenchmarkDemo6()
:BenchmarkDemo(6)
{
}
static DemoApplication* Create()
{
BenchmarkDemo6* demo = new BenchmarkDemo6;
demo->myinit();
demo->initPhysics();
return demo;
}
};
class BenchmarkDemo7 : public BenchmarkDemo
{
public:
BenchmarkDemo7()
:BenchmarkDemo(7)
{
}
static DemoApplication* Create()
{
BenchmarkDemo7* demo = new BenchmarkDemo7;
demo->myinit();
demo->initPhysics();
return demo;
}
};
#endif //BENCHMARK_DEMO_H

View File

@@ -0,0 +1,62 @@
# This is basically the overall name of the project in Visual Studio this is the name of the Solution File
# For every executable you have with a main method you should have an add_executable line below.
# For every add executable line you should list every .cpp and .h file you have associated with that executable.
# This is the variable for Windows. I use this to define the root of my directory structure.
SET(GLUT_ROOT ${BULLET_PHYSICS_SOURCE_DIR}/Glut)
# You shouldn't have to modify anything below this line
########################################################
# This is the shortcut to finding GLU, GLUT and OpenGL if they are properly installed on your system
# This should be the case.
INCLUDE (${CMAKE_ROOT}/Modules/FindGLU.cmake)
INCLUDE (${CMAKE_ROOT}/Modules/FindGLUT.cmake)
INCLUDE (${CMAKE_ROOT}/Modules/FindOpenGL.cmake)
IF (WIN32)
# This is the Windows code for which Opengl, and Glut are not properly installed
# since I can't install them I must cheat and copy libraries around
INCLUDE_DIRECTORIES(${GLUT_ROOT})
# LINK_DIRECTORIES(${GLUT_ROOT}\\lib)
IF (${GLUT_glut_LIBRARY} MATCHES "GLUT_glut_LIBRARY-NOTFOUND")
SET(GLUT_glut_LIBRARY ${BULLET_PHYSICS_SOURCE_DIR}/Glut/glut32.lib)
# LINK_LIBRARIES(${GLUT_ROOT}\\lib\\glut32 ${OPENGL_gl_LIBRARY} ${OPENGL_glU_LIBRARY})
# TARGET_LINK_LIBRARIES(table ${GLUT_ROOT}\\lib\\glut32)
#
# ADD_CUSTOM_COMMAND(TARGET table POST_BUILD COMMAND copy ${GLUT_ROOT}\\lib\\glut32.dll ${GLUT_ROOT}\\bin\\vs2005\\Debug
# COMMAND copy ${GLUT_ROOT}\\lib\\glut32.dll ${GLUT_ROOT}\\bin\\vs2003\\Debug
# COMMAND copy ${GLUT_ROOT}\\lib\\glut32.dll ${GLUT_ROOT}\\bin\\vs6\\Debug)
ELSE (${GLUT_glut_LIBRARY} MATCHES "GLUT_glut_LIBRARY-NOTFOUND")
# LINK_LIBRARIES(${GLUT_glut_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glU_LIBRARY})
# TARGET_LINK_LIBRARIES(table ${GLUT_glut_LIBRARY})
ENDIF(${GLUT_glut_LIBRARY} MATCHES "GLUT_glut_LIBRARY-NOTFOUND")
# TARGET_LINK_LIBRARIES(table ${OPENGL_gl_LIBRARY})
# TARGET_LINK_LIBRARIES(table ${OPENGL_glu_LIBRARY})
ELSE (WIN32)
# This is the lines for linux. This should always work if everything is installed and working fine.
# SET(CMAKE_BUILD_TYPE Debug)
# SET(CMAKE_CXX_FLAGS_DEBUG "-g")
INCLUDE_DIRECTORIES(/usr/include /usr/local/include ${GLUT_INCLUDE_DIR})
# TARGET_LINK_LIBRARIES(table ${GLUT_glut_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glU_LIBRARY})
# TARGET_LINK_LIBRARIES(checker ${GLUT_glut_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glU_LIBRARY})
ENDIF (WIN32)
INCLUDE_DIRECTORIES(
${BULLET_PHYSICS_SOURCE_DIR}/src ${BULLET_PHYSICS_SOURCE_DIR}/Demos/OpenGL }
)
LINK_LIBRARIES(
LibOpenGLSupport LibConvexHull LibBulletDynamics LibBulletCollision LibLinearMath ${GLUT_glut_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY}
)
ADD_EXECUTABLE(Benchmarks
main.cpp
BenchmarkDemo.cpp
)

3
Demos/Benchmarks/Jamfile Normal file
View File

@@ -0,0 +1,3 @@
SubDir TOP Demos Benchmarks ;
BulletDemo Benchmarks : [ Wildcard *.h *.cpp ] ;

188
Demos/Benchmarks/Taru.mdl Normal file
View File

@@ -0,0 +1,188 @@
#define TaruVtxCount 43
#define TaruIdxCount 132
float TaruVtx[] = {
1.08664f,-1.99237f,0.0f,
0.768369f,-1.99237f,-0.768369f,
1.28852f,1.34412e-007f,-1.28852f,
1.82224f,1.90735e-007f,0.0f,
0.0f,-1.99237f,-1.08664f,
0.0f,0.0f,-1.82224f,
0.0f,-1.99237f,-1.08664f,
-0.768369f,-1.99237f,-0.768369f,
-1.28852f,1.34412e-007f,-1.28852f,
0.0f,0.0f,-1.82224f,
-1.08664f,-1.99237f,1.82086e-007f,
-1.82224f,1.90735e-007f,1.59305e-007f,
-0.768369f,-1.99237f,0.76837f,
-1.28852f,2.47058e-007f,1.28852f,
1.42495e-007f,-1.99237f,1.08664f,
2.38958e-007f,2.70388e-007f,1.82224f,
0.768369f,-1.99237f,0.768369f,
1.28852f,2.47058e-007f,1.28852f,
0.768369f,1.99237f,-0.768369f,
1.08664f,1.99237f,0.0f,
0.0f,1.99237f,-1.08664f,
-0.768369f,1.99237f,-0.768369f,
0.0f,1.99237f,-1.08664f,
-1.08664f,1.99237f,0.0f,
-0.768369f,1.99237f,0.768369f,
1.42495e-007f,1.99237f,1.08664f,
0.768369f,1.99237f,0.768369f,
1.42495e-007f,-1.99237f,1.08664f,
-0.768369f,-1.99237f,0.76837f,
-1.08664f,-1.99237f,1.82086e-007f,
-0.768369f,-1.99237f,-0.768369f,
0.0f,-1.99237f,-1.08664f,
0.768369f,-1.99237f,-0.768369f,
1.08664f,-1.99237f,0.0f,
0.768369f,-1.99237f,0.768369f,
0.768369f,1.99237f,-0.768369f,
0.0f,1.99237f,-1.08664f,
-0.768369f,1.99237f,-0.768369f,
-1.08664f,1.99237f,0.0f,
-0.768369f,1.99237f,0.768369f,
1.42495e-007f,1.99237f,1.08664f,
0.768369f,1.99237f,0.768369f,
1.08664f,1.99237f,0.0f,
};
float TaruNml[] = {
0.938103f,-0.346356f,0.0f,
0.663339f,-0.346356f,-0.663339f,
0.707107f,0.0f,-0.707107f,
1.0f,0.0f,0.0f,
0.0f,-0.346356f,-0.938103f,
0.0f,0.0f,-1.0f,
0.0f,-0.346356f,-0.938103f,
-0.663339f,-0.346356f,-0.663339f,
-0.707107f,0.0f,-0.707107f,
0.0f,0.0f,-1.0f,
-0.938103f,-0.346356f,0.0f,
-1.0f,0.0f,0.0f,
-0.663339f,-0.346356f,0.663339f,
-0.707107f,0.0f,0.707107f,
0.0f,-0.346356f,0.938103f,
1.21445e-007f,0.0f,1.0f,
0.663339f,-0.346356f,0.663339f,
0.707107f,0.0f,0.707107f,
0.663339f,0.346356f,-0.663339f,
0.938103f,0.346356f,0.0f,
0.0f,0.346356f,-0.938103f,
-0.663339f,0.346356f,-0.663339f,
0.0f,0.346356f,-0.938103f,
-0.938103f,0.346356f,0.0f,
-0.663339f,0.346356f,0.663339f,
1.2508e-007f,0.346356f,0.938103f,
0.663339f,0.346356f,0.663339f,
0.0f,-1.0f,0.0f,
0.0f,-1.0f,0.0f,
0.0f,-1.0f,0.0f,
0.0f,-1.0f,0.0f,
0.0f,-1.0f,0.0f,
0.0f,-1.0f,0.0f,
0.0f,-1.0f,0.0f,
0.0f,-1.0f,0.0f,
0.0f,1.0f,0.0f,
0.0f,1.0f,0.0f,
0.0f,1.0f,0.0f,
0.0f,1.0f,0.0f,
0.0f,1.0f,0.0f,
0.0f,1.0f,0.0f,
0.0f,1.0f,0.0f,
0.0f,1.0f,0.0f,
};
float TaruTex[] = {
0.75f,0.0f,
0.875f,0.0f,
0.875f,0.5f,
0.75f,0.5f,
1.0f,0.0f,
1.0f,0.5f,
0.0f,0.0f,
0.125f,0.0f,
0.125f,0.5f,
0.0f,0.5f,
0.25f,0.0f,
0.25f,0.5f,
0.375f,0.0f,
0.375f,0.5f,
0.5f,0.0f,
0.5f,0.5f,
0.625f,0.0f,
0.625f,0.5f,
0.875f,1.0f,
0.75f,1.0f,
1.0f,1.0f,
0.125f,1.0f,
0.0f,1.0f,
0.25f,1.0f,
0.375f,1.0f,
0.5f,1.0f,
0.625f,1.0f,
1.0f,0.5f,
0.853553f,0.146447f,
0.5f,0.0f,
0.146447f,0.146447f,
0.0f,0.5f,
0.146447f,0.853553f,
0.5f,1.0f,
0.853553f,0.853553f,
0.146447f,0.853553f,
0.0f,0.5f,
0.146447f,0.146447f,
0.5f,0.0f,
0.853553f,0.146447f,
1.0f,0.5f,
0.853553f,0.853553f,
0.5f,1.0f,
};
unsigned short TaruIdx[] = {
0,1,2,
2,3,0,
1,4,5,
5,2,1,
6,7,8,
8,9,6,
7,10,11,
11,8,7,
10,12,13,
13,11,10,
12,14,15,
15,13,12,
14,16,17,
17,15,14,
16,0,3,
3,17,16,
3,2,18,
18,19,3,
2,5,20,
20,18,2,
9,8,21,
21,22,9,
8,11,23,
23,21,8,
11,13,24,
24,23,11,
13,15,25,
25,24,13,
15,17,26,
26,25,15,
17,3,19,
19,26,17,
27,28,29,
29,30,31,
31,32,33,
29,31,33,
27,29,33,
34,27,33,
35,36,37,
37,38,39,
39,40,41,
37,39,41,
35,37,41,
42,35,41,
};

84368
Demos/Benchmarks/landscape.mdl Normal file

File diff suppressed because it is too large Load Diff

45
Demos/Benchmarks/main.cpp Normal file
View File

@@ -0,0 +1,45 @@
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2007 Erwin Coumans http://continuousphysics.com/Bullet/
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "BenchmarkDemo.h"
#include "GlutStuff.h"
#include "GLDebugDrawer.h"
#include "btBulletDynamicsCommon.h"
#include "LinearMath/btHashMap.h"
int main(int argc,char** argv)
{
GLDebugDrawer gDebugDrawer;
// BenchmarkDemo1 benchmarkDemo;
// BenchmarkDemo2 benchmarkDemo;
// BenchmarkDemo3 benchmarkDemo;
// BenchmarkDemo4 benchmarkDemo;
// BenchmarkDemo5 benchmarkDemo;
// BenchmarkDemo6 benchmarkDemo;
BenchmarkDemo7 benchmarkDemo;
benchmarkDemo.initPhysics();
benchmarkDemo.getDynamicsWorld()->setDebugDrawer(&gDebugDrawer);
return glutmain(argc, argv,640,480,"Bullet Physics Demo. http://bulletphysics.com",&benchmarkDemo);
//default glut doesn't return from mainloop
return 0;
}