added btGetVersion(), return integer without the fraction: for example 2.64 returns 264.
moved more demos into AllBulletDemos
This commit is contained in:
@@ -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}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -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
|
||||
;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -28,6 +28,13 @@ class ConstraintDemo : public DemoApplication
|
||||
|
||||
virtual void displayCallback();
|
||||
|
||||
static DemoApplication* Create()
|
||||
{
|
||||
ConstraintDemo* demo = new ConstraintDemo();
|
||||
demo->myinit();
|
||||
demo->initPhysics();
|
||||
return demo;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
15
Demos/ConstraintDemo/main.cpp
Normal file
15
Demos/ConstraintDemo/main.cpp
Normal file
@@ -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);
|
||||
}
|
||||
|
||||
@@ -383,6 +383,9 @@ btCollisionShape * GimpactConcaveDemo::createBunnyShape()
|
||||
//------------------------------------------------------------------------------
|
||||
void GimpactConcaveDemo::initPhysics()
|
||||
{
|
||||
gContactAddedCallback = CustomMaterialCombinerCallback;
|
||||
|
||||
|
||||
/// Init Bullet
|
||||
m_collisionConfiguration = new btDefaultCollisionConfiguration();
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -28,6 +28,13 @@ class LinearConvexCastDemo : public DemoApplication
|
||||
|
||||
virtual void displayCallback();
|
||||
|
||||
static DemoApplication* Create()
|
||||
{
|
||||
LinearConvexCastDemo* demo = new LinearConvexCastDemo();
|
||||
demo->myinit();
|
||||
demo->initPhysics();
|
||||
return demo;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
17
Demos/GjkConvexCastDemo/main.cpp
Normal file
17
Demos/GjkConvexCastDemo/main.cpp
Normal file
@@ -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);
|
||||
}
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,13 @@ class Raytracer : public DemoApplication
|
||||
|
||||
virtual void displayCallback();
|
||||
|
||||
|
||||
static DemoApplication* Create()
|
||||
{
|
||||
Raytracer* demo = new Raytracer();
|
||||
demo->myinit();
|
||||
demo->initPhysics();
|
||||
return demo;
|
||||
}
|
||||
};
|
||||
|
||||
#endif //RAYTRACER_H
|
||||
|
||||
16
Demos/Raytracer/main.cpp
Normal file
16
Demos/Raytracer/main.cpp
Normal file
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
15
Demos/VehicleDemo/main.cpp
Normal file
15
Demos/VehicleDemo/main.cpp
Normal file
@@ -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);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,10 @@ subject to the following restrictions:
|
||||
#include <float.h>
|
||||
|
||||
|
||||
|
||||
inline int btGetVersion()
|
||||
{
|
||||
return 264;
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
|
||||
Reference in New Issue
Block a user