added basic serialization for several constraints including btPoint2PointConstraint, btHingeConstraint, btSliderConstraint, btConeTwistConstraint, btGeneric6DofConstraint

(no motor support or advanced settings yet)
added btStaticPlaneShape serialization
Added toggle in cmake for BenchmarksDemo to enable/disable graphics rendering
This commit is contained in:
erwin.coumans
2010-01-27 02:13:56 +00:00
parent 7003823bed
commit 00f58e5a91
38 changed files with 1873 additions and 342 deletions

View File

@@ -17,9 +17,9 @@ subject to the following restrictions:
#define COLLISION_RADIUS 0.0f
#include "BenchmarkDemo.h"
#ifdef USE_GLUT_GRAPHICAL_BENCHMARK
#ifdef USE_GRAPHICAL_BENCHMARK
#include "GlutStuff.h"
#endif //USE_GLUT_GRAPHICAL_BENCHMARK
#endif //USE_GRAPHICAL_BENCHMARK
///btBulletDynamicsCommon.h is the main Bullet include file, contains most common include files.
#include "btBulletDynamicsCommon.h"
@@ -178,7 +178,7 @@ public:
void draw ()
{
#ifdef USE_GLUT_GRAPHICAL_BENCHMARK
#ifdef USE_GRAPHICAL_BENCHMARK
glDisable (GL_LIGHTING);
glColor3f (0.0, 1.0, 0.0);
glBegin (GL_LINES);
@@ -206,7 +206,7 @@ public:
}
glEnd ();
glEnable (GL_LIGHTING);
#endif //USE_GLUT_GRAPHICAL_BENCHMARK
#endif //USE_GRAPHICAL_BENCHMARK
}
};
@@ -217,9 +217,9 @@ static btRaycastBar2 raycastBar;
void BenchmarkDemo::clientMoveAndDisplay()
{
#ifdef USE_GLUT_GRAPHICAL_BENCHMARK
#ifdef USE_GRAPHICAL_BENCHMARK
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
#endif //USE_GLUT_GRAPHICAL_BENCHMARK
#endif //USE_GRAPHICAL_BENCHMARK
//simple dynamics world doesn't handle fixed-time-stepping
float ms = getDeltaTimeMicroseconds();
@@ -242,11 +242,11 @@ void BenchmarkDemo::clientMoveAndDisplay()
renderme();
#ifdef USE_GLUT_GRAPHICAL_BENCHMARK
#ifdef USE_GRAPHICAL_BENCHMARK
glFlush();
glutSwapBuffers();
#endif //USE_GLUT_GRAPHICAL_BENCHMARK
swapBuffers();
#endif //USE_GRAPHICAL_BENCHMARK
}
@@ -255,7 +255,7 @@ void BenchmarkDemo::clientMoveAndDisplay()
void BenchmarkDemo::displayCallback(void)
{
#ifdef USE_GLUT_GRAPHICAL_BENCHMARK
#ifdef USE_GRAPHICAL_BENCHMARK
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
renderme();
@@ -265,8 +265,8 @@ void BenchmarkDemo::displayCallback(void)
m_dynamicsWorld->debugDrawWorld();
glFlush();
glutSwapBuffers();
#endif //USE_GLUT_GRAPHICAL_BENCHMARK
swapBuffers();
#endif //USE_GRAPHICAL_BENCHMARK
}
@@ -1224,7 +1224,7 @@ void BenchmarkDemo::exitPhysics()
#ifndef USE_GLUT_GRAPHICAL_BENCHMARK
#ifndef USE_GRAPHICAL_BENCHMARK
btRigidBody* DemoApplication::localCreateRigidBody(float mass, const btTransform& startTransform,btCollisionShape* shape)
{
@@ -1246,5 +1246,5 @@ btRigidBody* DemoApplication::localCreateRigidBody(float mass, const btTransform
return body;
}
#endif //USE_GLUT_GRAPHICAL_BENCHMARK
#endif //USE_GRAPHICAL_BENCHMARK

View File

@@ -33,7 +33,7 @@ struct btCollisionAlgorithmCreateFunc;
class btDefaultCollisionConfiguration;
#ifndef USE_GLUT_GRAPHICAL_BENCHMARK
#ifndef USE_GRAPHICAL_BENCHMARK
///empty placeholder
class DemoApplication
{
@@ -59,13 +59,21 @@ public:
};
///BenchmarkDemo is provides several performance tests
class BenchmarkDemo : public DemoApplication
#define PlatformDemoApplication DemoApplication
#else //USE_GRAPHICAL_BENCHMARK
#ifdef _WINDOWS
#include "Win32DemoApplication.h"
#define PlatformDemoApplication Win32DemoApplication
#else
#include "GlutDemoApplication.h"
class BenchmarkDemo : public GlutDemoApplication
#define PlatformDemoApplication GlutDemoApplication
#endif
#endif //USE_GRAPHICAL_BENCHMARK
class BenchmarkDemo : public PlatformDemoApplication
{
//keep the collision shapes, for deletion/cleanup

View File

@@ -8,8 +8,8 @@
# You shouldn't have to modify anything below this line
########################################################
IF (USE_GLUT_GRAPHICAL_BENCHMARK)
IF (USE_GRAPHICAL_BENCHMARK)
IF (USE_GLUT)
INCLUDE_DIRECTORIES(
${BULLET_PHYSICS_SOURCE_DIR}/src
${BULLET_PHYSICS_SOURCE_DIR}/Demos/OpenGL
@@ -18,14 +18,31 @@ IF (USE_GLUT_GRAPHICAL_BENCHMARK)
LINK_LIBRARIES(
OpenGLSupport BulletDynamics BulletCollision LinearMath ${GLUT_glut_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY}
)
ADD_EXECUTABLE(AppBenchmarks
main.cpp
BenchmarkDemo.cpp
BenchmarkDemo.h
)
ELSE (USE_GLUT_GRAPHICAL_BENCHMARK)
ELSE (USE_GLUT)
INCLUDE_DIRECTORIES(
${BULLET_PHYSICS_SOURCE_DIR}/src
${BULLET_PHYSICS_SOURCE_DIR}/Demos/OpenGL
)
LINK_LIBRARIES(
OpenGLSupport BulletDynamics BulletCollision LinearMath ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY}
)
ADD_EXECUTABLE(AppBenchmarks
WIN32
../OpenGL/Win32AppMain.cpp
main.cpp
BenchmarkDemo.cpp
BenchmarkDemo.h
Win32BenchmarkDemo.cpp
)
ENDIF (USE_GLUT)
ELSE (USE_GRAPHICAL_BENCHMARK)
INCLUDE_DIRECTORIES(
${BULLET_PHYSICS_SOURCE_DIR}/src
@@ -41,4 +58,4 @@ ELSE (USE_GLUT_GRAPHICAL_BENCHMARK)
main.cpp
BenchmarkDemo.cpp
)
ENDIF (USE_GLUT_GRAPHICAL_BENCHMARK)
ENDIF (USE_GRAPHICAL_BENCHMARK)

View File

@@ -0,0 +1,25 @@
#ifdef _WINDOWS
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
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"
///The 'createDemo' function is called from Bullet/Demos/OpenGL/Win32AppMain.cpp to instantiate this particular demo
DemoApplication* createDemo()
{
return new BenchmarkDemo(1);
}
#endif