diff --git a/Demos/AllBulletDemos/DemoEntries.cpp b/Demos/AllBulletDemos/DemoEntries.cpp index 76cf02f83..ae9d9363e 100644 --- a/Demos/AllBulletDemos/DemoEntries.cpp +++ b/Demos/AllBulletDemos/DemoEntries.cpp @@ -22,6 +22,10 @@ subject to the following restrictions: #include "../ConvexDecompositionDemo/ConvexDecompositionDemo.h" #include "../RagdollDemo/RagdollDemo.h" #include "../GimpactTestDemo/GimpactTestDemo.h" +#include "../Raytracer/Raytracer.h" +#include "../GjkConvexCastDemo/LinearConvexCastDemo.h" +#include "../VehicleDemo/VehicleDemo.h" +#include "../ConstraintDemo/ConstraintDemo.h" btDemoEntry g_demoEntries[] = @@ -33,6 +37,12 @@ btDemoEntry g_demoEntries[] = {"BspDemo", BspDemo::Create}, {"ConcaveDemo",ConcaveDemo::Create}, {"Gimpact Test", GimpactConcaveDemo::Create}, + {"Raytracer Test",Raytracer::Create}, + {"GjkConvexCast",LinearConvexCastDemo::Create}, + {"VehicleDemo",VehicleDemo::Create}, + {"ConstraintDemo",ConstraintDemo::Create}, {0, 0} + + }; diff --git a/Demos/AllBulletDemos/Jamfile b/Demos/AllBulletDemos/Jamfile index 240bb9ad8..0dee27386 100644 --- a/Demos/AllBulletDemos/Jamfile +++ b/Demos/AllBulletDemos/Jamfile @@ -11,4 +11,8 @@ FrameWorkDemo AllBulletDemos : ../ConvexDecompositionDemo/ConvexDecompositionDemo.cpp ../RagdollDemo/RagdollDemo.cpp ../GimpactTestDemo/GimpactTestDemo.cpp + ../Raytracer/Raytracer.cpp + ../GjkConvexCastDemo/LinearConvexCastDemo.cpp + ../VehicleDemo/VehicleDemo.cpp + ../ConstraintDemo/ConstraintDemo.cpp ; diff --git a/Demos/AllBulletDemos/Main.cpp b/Demos/AllBulletDemos/Main.cpp index 37a925504..16038eda8 100644 --- a/Demos/AllBulletDemos/Main.cpp +++ b/Demos/AllBulletDemos/Main.cpp @@ -160,6 +160,8 @@ void MouseMotion(int x, int y) int main(int argc, char** argv) { + int bulletVersion = btGetVersion(); + printf("Bullet version %d\n",bulletVersion); glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE |GLUT_DEPTH); diff --git a/Demos/ConstraintDemo/ConstraintDemo.cpp b/Demos/ConstraintDemo/ConstraintDemo.cpp index fa8aa8b53..56de0223f 100644 --- a/Demos/ConstraintDemo/ConstraintDemo.cpp +++ b/Demos/ConstraintDemo/ConstraintDemo.cpp @@ -32,19 +32,7 @@ const int numObjects = 3; #define CUBE_HALF_EXTENTS 1.f -GLDebugDrawer debugDrawer; -int main(int argc,char** argv) -{ - - ConstraintDemo* constraintDemo = new ConstraintDemo(); - - constraintDemo->initPhysics(); - - constraintDemo->setCameraDistance(26.f); - - return glutmain(argc, argv,640,480,"Constraint Demo. http://www.continuousphysics.com/Bullet/phpBB2/",constraintDemo); -} btTransform sliderTransform; btVector3 lowerSliderLimit = btVector3(-10,0,0); @@ -88,7 +76,6 @@ void ConstraintDemo::initPhysics() //m_dynamicsWorld->setGravity(btVector3(0,0,0)); - m_dynamicsWorld->setDebugDrawer(&debugDrawer); btCollisionShape* shape = new btBoxShape(btVector3(CUBE_HALF_EXTENTS,CUBE_HALF_EXTENTS,CUBE_HALF_EXTENTS)); btTransform trans; diff --git a/Demos/ConstraintDemo/ConstraintDemo.h b/Demos/ConstraintDemo/ConstraintDemo.h index c1b6b79f9..bc103ec56 100644 --- a/Demos/ConstraintDemo/ConstraintDemo.h +++ b/Demos/ConstraintDemo/ConstraintDemo.h @@ -27,7 +27,14 @@ class ConstraintDemo : public DemoApplication virtual void clientMoveAndDisplay(); virtual void displayCallback(); - + + static DemoApplication* Create() + { + ConstraintDemo* demo = new ConstraintDemo(); + demo->myinit(); + demo->initPhysics(); + return demo; + } }; diff --git a/Demos/ConstraintDemo/main.cpp b/Demos/ConstraintDemo/main.cpp new file mode 100644 index 000000000..f02a61b8f --- /dev/null +++ b/Demos/ConstraintDemo/main.cpp @@ -0,0 +1,15 @@ +#include "ConstraintDemo.h" +#include "GlutStuff.h" + +int main(int argc,char** argv) +{ + + ConstraintDemo* constraintDemo = new ConstraintDemo(); + + constraintDemo->initPhysics(); + + constraintDemo->setCameraDistance(26.f); + + return glutmain(argc, argv,640,480,"Constraint Demo. http://www.continuousphysics.com/Bullet/phpBB2/",constraintDemo); +} + diff --git a/Demos/GimpactTestDemo/GimpactTestDemo.cpp b/Demos/GimpactTestDemo/GimpactTestDemo.cpp index b633e679b..408f1715e 100644 --- a/Demos/GimpactTestDemo/GimpactTestDemo.cpp +++ b/Demos/GimpactTestDemo/GimpactTestDemo.cpp @@ -383,6 +383,9 @@ btCollisionShape * GimpactConcaveDemo::createBunnyShape() //------------------------------------------------------------------------------ void GimpactConcaveDemo::initPhysics() { + gContactAddedCallback = CustomMaterialCombinerCallback; + + /// Init Bullet m_collisionConfiguration = new btDefaultCollisionConfiguration(); diff --git a/Demos/GimpactTestDemo/GimpactTestDemo.h b/Demos/GimpactTestDemo/GimpactTestDemo.h index 5493b709b..be6ab04d7 100644 --- a/Demos/GimpactTestDemo/GimpactTestDemo.h +++ b/Demos/GimpactTestDemo/GimpactTestDemo.h @@ -42,7 +42,7 @@ class btDefaultCollisionConfiguration; - +class btConstraintSolver; struct btCollisionAlgorithmCreateFunc; ///GimpactConcaveDemo shows usage of static concave triangle meshes @@ -67,6 +67,8 @@ public: virtual ~GimpactConcaveDemo() { + delete m_dynamicsWorld; + delete m_indexVertexArrays; delete m_trimeshShape; @@ -80,7 +82,6 @@ public: delete m_broadphase; delete m_constraintSolver; - delete m_dynamicsWorld; } void initGImpactCollision(); diff --git a/Demos/GimpactTestDemo/main.cpp b/Demos/GimpactTestDemo/main.cpp index 137943e8e..416d0c7f0 100644 --- a/Demos/GimpactTestDemo/main.cpp +++ b/Demos/GimpactTestDemo/main.cpp @@ -1,11 +1,10 @@ -#include "GimpactConcaveDemo.h" +#include "GimpactTestDemo.h" #include "GlutStuff.h" //################################## main ##################################### int main(int argc,char** argv) { - gContactAddedCallback = CustomMaterialCombinerCallback; GimpactConcaveDemo* concaveDemo = new GimpactConcaveDemo(); /// This will not be Deleted!!! concaveDemo->initPhysics(); diff --git a/Demos/GjkConvexCastDemo/LinearConvexCastDemo.cpp b/Demos/GjkConvexCastDemo/LinearConvexCastDemo.cpp index 88a4ab8f2..2c4969c01 100644 --- a/Demos/GjkConvexCastDemo/LinearConvexCastDemo.cpp +++ b/Demos/GjkConvexCastDemo/LinearConvexCastDemo.cpp @@ -44,31 +44,19 @@ #include "GlutStuff.h" -float yaw=0.f,pitch=0.f,roll=0.f; -const int maxNumObjects = 4; -const int numObjects = 2; +static float yaw=0.f,pitch=0.f,roll=0.f; +static const int maxNumObjects = 4; +static const int numObjects = 2; -btPolyhedralConvexShape* shapePtr[maxNumObjects]; +static btPolyhedralConvexShape* shapePtr[maxNumObjects]; -btTransform tr[numObjects]; -int screenWidth = 640; -int screenHeight = 480; +static btTransform tr[numObjects]; void DrawRasterizerLine(float const* , float const*, int) { } -int main(int argc,char** argv) -{ - - LinearConvexCastDemo* linearCastDemo = new LinearConvexCastDemo(); - - linearCastDemo->initPhysics(); - - - return glutmain(argc, argv,screenWidth,screenHeight,"Linear Convex Cast Demo",linearCastDemo); -} void LinearConvexCastDemo::initPhysics() { diff --git a/Demos/GjkConvexCastDemo/LinearConvexCastDemo.h b/Demos/GjkConvexCastDemo/LinearConvexCastDemo.h index 2dc220583..bf68706d5 100644 --- a/Demos/GjkConvexCastDemo/LinearConvexCastDemo.h +++ b/Demos/GjkConvexCastDemo/LinearConvexCastDemo.h @@ -27,7 +27,14 @@ class LinearConvexCastDemo : public DemoApplication virtual void clientMoveAndDisplay(); virtual void displayCallback(); - + + static DemoApplication* Create() + { + LinearConvexCastDemo* demo = new LinearConvexCastDemo(); + demo->myinit(); + demo->initPhysics(); + return demo; + } }; diff --git a/Demos/GjkConvexCastDemo/main.cpp b/Demos/GjkConvexCastDemo/main.cpp new file mode 100644 index 000000000..3c2748a7f --- /dev/null +++ b/Demos/GjkConvexCastDemo/main.cpp @@ -0,0 +1,17 @@ + +#include "LinearConvexCastDemo.h" +#include "GlutStuff.h" + +int screenWidth = 640; +int screenHeight = 480; + +int main(int argc,char** argv) +{ + + LinearConvexCastDemo* linearCastDemo = new LinearConvexCastDemo(); + + linearCastDemo->initPhysics(); + + + return glutmain(argc, argv,screenWidth,screenHeight,"Linear Convex Cast Demo",linearCastDemo); +} diff --git a/Demos/Raytracer/Raytracer.cpp b/Demos/Raytracer/Raytracer.cpp index b968f9b58..f24c22560 100644 --- a/Demos/Raytracer/Raytracer.cpp +++ b/Demos/Raytracer/Raytracer.cpp @@ -99,24 +99,24 @@ Very basic raytracer, rendering into a texture. -btVoronoiSimplexSolver simplexSolver; +static btVoronoiSimplexSolver simplexSolver; -float yaw=0.f,pitch=0.f,roll=0.f; -const int maxNumObjects = 4; -const int numObjects = 1; +static float yaw=0.f,pitch=0.f,roll=0.f; +static const int maxNumObjects = 4; +static const int numObjects = 1; /// simplex contains the vertices, and some extra code to draw and debug -GL_Simplex1to4 simplex; +static GL_Simplex1to4 simplex; -btCollisionShape* shapePtr[maxNumObjects]; -btTransform transforms[maxNumObjects]; +static btCollisionShape* shapePtr[maxNumObjects]; +static btTransform transforms[maxNumObjects]; renderTexture* raytracePicture = 0; //this applies to the raytracer virtual screen/image buffer -int screenWidth = 128; +static int screenWidth = 128; //float aspectRatio = (3.f/4.f); -int screenHeight = 128;//screenWidth * aspectRatio; +static int screenHeight = 128;//screenWidth * aspectRatio; GLuint glTextureId; btSphereShape mySphere(1); @@ -127,7 +127,6 @@ btCompoundShape compound; btMinkowskiSumShape myMink(&myCylinder,&myBox); -GLDebugDrawer debugDrawer; @@ -135,16 +134,6 @@ GLDebugDrawer debugDrawer; /// /// /// -int main(int argc,char** argv) -{ - Raytracer* raytraceDemo = new Raytracer(); - - raytraceDemo->initPhysics(); - - raytraceDemo->setCameraDistance(6.f); - - return glutmain(argc, argv,640,640,"Bullet GJK Implicit Shape Raytracer Demo",raytraceDemo); -} void Raytracer::initPhysics() { @@ -502,8 +491,6 @@ void Raytracer::displayCallback() { btVector3 aabbMin,aabbMax; shapePtr[i]->getAabb(transforms[i],aabbMin,aabbMax); - debugDrawer.setDebugMode(1); - debugDrawer.drawAabb(aabbMin,aabbMax,btVector3(255,0,0)); } } diff --git a/Demos/Raytracer/Raytracer.h b/Demos/Raytracer/Raytracer.h index c0286de32..864434746 100644 --- a/Demos/Raytracer/Raytracer.h +++ b/Demos/Raytracer/Raytracer.h @@ -27,8 +27,14 @@ class Raytracer : public DemoApplication virtual void clientMoveAndDisplay(); virtual void displayCallback(); - - + + static DemoApplication* Create() + { + Raytracer* demo = new Raytracer(); + demo->myinit(); + demo->initPhysics(); + return demo; + } }; #endif //RAYTRACER_H diff --git a/Demos/Raytracer/main.cpp b/Demos/Raytracer/main.cpp new file mode 100644 index 000000000..1ae1b52b8 --- /dev/null +++ b/Demos/Raytracer/main.cpp @@ -0,0 +1,16 @@ + +#include "Raytracer.h" +#include "GlutStuff.h" + + +int main(int argc,char** argv) +{ + Raytracer* raytraceDemo = new Raytracer(); + + raytraceDemo->initPhysics(); + + raytraceDemo->setCameraDistance(6.f); + + return glutmain(argc, argv,640,640,"Bullet GJK Implicit Shape Raytracer Demo",raytraceDemo); +} + diff --git a/Demos/VehicleDemo/VehicleDemo.cpp b/Demos/VehicleDemo/VehicleDemo.cpp index 065d05d97..67db2bd41 100644 --- a/Demos/VehicleDemo/VehicleDemo.cpp +++ b/Demos/VehicleDemo/VehicleDemo.cpp @@ -83,17 +83,6 @@ btScalar suspensionRestLength(0.6); -GLDebugDrawer debugDrawer; - -int main(int argc,char** argv) -{ - - VehicleDemo* vehicleDemo = new VehicleDemo; - - vehicleDemo->setupPhysics(); - - return glutmain(argc, argv,640,480,"Bullet Vehicle Demo. http://www.continuousphysics.com/Bullet/phpBB2/", vehicleDemo); -} VehicleDemo::VehicleDemo() : @@ -106,7 +95,7 @@ m_maxCameraDistance(10.f) m_cameraPosition = btVector3(30,30,30); } -void VehicleDemo::setupPhysics() +void VehicleDemo::initPhysics() { extern btScalar gJitterVelocityDampingFactor; @@ -128,7 +117,6 @@ void VehicleDemo::setupPhysics() #ifdef FORCE_ZAXIS_UP m_dynamicsWorld->setGravity(btVector3(0,0,-10)); #endif - m_dynamicsWorld->setDebugDrawer(&debugDrawer); //m_dynamicsWorld->setGravity(btVector3(0,0,0)); btTransform tr; @@ -361,7 +349,6 @@ void VehicleDemo::renderme() updateCamera(); - debugDrawer.setDebugMode(getDebugMode()); btScalar m[16]; int i; diff --git a/Demos/VehicleDemo/VehicleDemo.h b/Demos/VehicleDemo/VehicleDemo.h index e930de727..9845a816e 100644 --- a/Demos/VehicleDemo/VehicleDemo.h +++ b/Demos/VehicleDemo/VehicleDemo.h @@ -55,7 +55,15 @@ class VehicleDemo : public DemoApplication void renderme(); - void setupPhysics(); + void initPhysics(); + + static DemoApplication* Create() + { + VehicleDemo* demo = new VehicleDemo(); + demo->myinit(); + demo->initPhysics(); + return demo; + } }; #endif //VEHICLE_DEMO_H diff --git a/Demos/VehicleDemo/main.cpp b/Demos/VehicleDemo/main.cpp new file mode 100644 index 000000000..d5814a30c --- /dev/null +++ b/Demos/VehicleDemo/main.cpp @@ -0,0 +1,15 @@ + +#include "VehicleDemo.h" +#include "GlutStuff.h" + + +int main(int argc,char** argv) +{ + + VehicleDemo* vehicleDemo = new VehicleDemo; + + vehicleDemo->initPhysics(); + + return glutmain(argc, argv,640,480,"Bullet Vehicle Demo. http://www.continuousphysics.com/Bullet/phpBB2/", vehicleDemo); +} + diff --git a/src/LinearMath/btScalar.h b/src/LinearMath/btScalar.h index 0158b13b2..85dfaf3eb 100644 --- a/src/LinearMath/btScalar.h +++ b/src/LinearMath/btScalar.h @@ -24,7 +24,10 @@ subject to the following restrictions: #include - +inline int btGetVersion() +{ + return 264; +} #ifdef WIN32