Added specialKeyboardUp handler to GLUI (why was it missing?)
Some cleanup for ForkLiftDemo Enable textures for ConcavePhysicsDemo, Added scaling to BasicDemo to show small objects (20 centimeter) Removed demos from 'AllBulletDemos': less (clutter) = more
This commit is contained in:
@@ -102,49 +102,52 @@ public:
|
||||
|
||||
btDemoEntry g_demoEntries[] =
|
||||
{
|
||||
|
||||
{"SoftBody Cloth",SoftDemo0::Create},
|
||||
{"SoftBody Pressure",SoftDemo1::Create},
|
||||
{"SoftBody Volume",SoftDemo2::Create},
|
||||
{"SoftBody Ropes",SoftDemo3::Create},
|
||||
|
||||
|
||||
{"ForkLiftDemo",ForkLiftDemo::Create},
|
||||
{"RagdollDemo",RagdollDemo::Create},
|
||||
{"BasicDemo", BasicDemo::Create},
|
||||
{"ConvexDecomposition",ConvexDecompositionDemo::Create},
|
||||
{"Concave Moving", GimpactConcaveDemo::Create},
|
||||
{"DynamicControlDemo",MotorDemo::Create},
|
||||
{"ConcaveDemo",ConcaveDemo::Create},
|
||||
// {"SoftBody Cloth",SoftDemo0::Create},
|
||||
// {"SoftBody Pressure",SoftDemo1::Create},
|
||||
{"SoftBody Ropes Attach",SoftDemo4::Create},
|
||||
{"SoftBody Cloth Attach",SoftDemo5::Create},
|
||||
{"SoftBody Sticks",SoftDemo6::Create},
|
||||
{"SoftBody Collide",SoftDemo7::Create},
|
||||
{"SoftBody Collide2",SoftDemo8::Create},
|
||||
{"SoftBody Collide3",SoftDemo9::Create},
|
||||
{"SoftBody Impact",SoftDemo10::Create},
|
||||
{"SoftBody Aero",SoftDemo11::Create},
|
||||
{"SoftBody Friction",SoftDemo12::Create},
|
||||
{"SoftBody Torus",SoftDemo13::Create},
|
||||
{"SoftBody Torus Match",SoftDemo14::Create},
|
||||
{"SoftBody Bunny",SoftDemo15::Create},
|
||||
{"SoftBody Bunny Match",SoftDemo16::Create},
|
||||
{"SoftBody Init Cutting",SoftDemo17::Create},
|
||||
{"SoftBody Cluster Deform",SoftDemo18::Create},
|
||||
{"SoftBody Cluster Collide1",SoftDemo19::Create},
|
||||
{"SoftBody Cluster Collide2",SoftDemo20::Create},
|
||||
{"SoftBody Cluster Socket",SoftDemo21::Create},
|
||||
{"SoftBody Cluster Hinge",SoftDemo22::Create},
|
||||
{"SoftBody Cluster Combine",SoftDemo23::Create},
|
||||
{"SoftBody Volume",SoftDemo2::Create},
|
||||
{"SoftBody Cluster Car",SoftDemo24::Create},
|
||||
{"SoftBody Cluster Robot",SoftDemo25::Create},
|
||||
{"SoftBody Cluster Stack Soft",SoftDemo26::Create},
|
||||
// {"SoftBody Ropes",SoftDemo3::Create},
|
||||
{"SoftBody Sticks",SoftDemo6::Create},
|
||||
// {"SoftBody Collide",SoftDemo7::Create},
|
||||
// {"SoftBody Collide2",SoftDemo8::Create},
|
||||
// {"SoftBody Collide3",SoftDemo9::Create},
|
||||
// {"SoftBody Impact",SoftDemo10::Create},
|
||||
{"SoftBody Aero",SoftDemo11::Create},
|
||||
// {"SoftBody Friction",SoftDemo12::Create},
|
||||
// {"SoftBody Torus",SoftDemo13::Create},
|
||||
// {"SoftBody Torus Match",SoftDemo14::Create},
|
||||
// {"SoftBody Bunny",SoftDemo15::Create},
|
||||
// {"SoftBody Bunny Match",SoftDemo16::Create},
|
||||
{"SoftBody Init Cutting",SoftDemo17::Create},
|
||||
// {"SoftBody Cluster Deform",SoftDemo18::Create},
|
||||
|
||||
// {"SoftBody Cluster Collide2",SoftDemo20::Create},
|
||||
// {"SoftBody Cluster Socket",SoftDemo21::Create},
|
||||
// {"SoftBody Cluster Hinge",SoftDemo22::Create},
|
||||
// {"SoftBody Cluster Combine",SoftDemo23::Create},
|
||||
// {"SoftBody Cluster Stack Soft",SoftDemo26::Create},
|
||||
{"SoftBody Cluster Stack Mixed",SoftDemo27::Create},
|
||||
{"DynamicControlDemo",MotorDemo::Create},
|
||||
{"RagdollDemo",RagdollDemo::Create},
|
||||
{"SliderConstraint",SliderConstraintDemo::Create},
|
||||
{"BasicDemo", BasicDemo::Create},
|
||||
{"CcdPhysicsDemo", CcdPhysicsDemo::Create},
|
||||
{"ConcaveDemo",ConcaveDemo::Create},
|
||||
{"ConcaveRaycastDemo",ConcaveRaycastDemo::Create},
|
||||
{"ConcaveConvexcastDemo",ConcaveConvexcastDemo::Create},
|
||||
{"ConvexDecomposition",ConvexDecompositionDemo::Create},
|
||||
{"BspDemo", BspDemo::Create},
|
||||
{"Gimpact Test", GimpactConcaveDemo::Create},
|
||||
{"Raytracer Test",Raytracer::Create},
|
||||
{"GjkConvexCast",LinearConvexCastDemo::Create},
|
||||
{"ForkLiftDemo",ForkLiftDemo::Create},
|
||||
|
||||
// {"SliderConstraint",SliderConstraintDemo::Create},
|
||||
// {"CcdPhysicsDemo", CcdPhysicsDemo::Create},
|
||||
// {"ConcaveRaycastDemo",ConcaveRaycastDemo::Create},
|
||||
// {"ConcaveConvexcastDemo",ConcaveConvexcastDemo::Create},
|
||||
//{"BspDemo", BspDemo::Create},
|
||||
// {"Raytracer Test",Raytracer::Create},
|
||||
// {"GjkConvexCast",LinearConvexCastDemo::Create},
|
||||
{"Benchmark 3000 FALL",BenchmarkDemo1::Create},
|
||||
{"Benchmark 1000 STACK",BenchmarkDemo2::Create},
|
||||
{"Benchmark 136 RAGDOLLS",BenchmarkDemo3::Create},
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
|
||||
namespace
|
||||
{
|
||||
int testIndex=0;
|
||||
int testSelection=24;
|
||||
int testIndex=1;
|
||||
int testSelection=0;
|
||||
btDemoEntry* entry;
|
||||
DemoApplication* demo;
|
||||
int iterationCount;
|
||||
@@ -66,14 +66,15 @@ namespace
|
||||
}
|
||||
|
||||
|
||||
|
||||
void setDefaultSettings()
|
||||
{
|
||||
viewX = 0.0f;
|
||||
viewY = 0.0f;
|
||||
framePeriod = 16;//todo: test if this value should be 0
|
||||
framePeriod = 16;//16;//todo: test if this value should be 0
|
||||
|
||||
width = 640;
|
||||
height = 480;
|
||||
width = 800;//640;
|
||||
height = 600;//1024;//480;
|
||||
iterationCount = 10;
|
||||
gDrawAabb=0;
|
||||
gWireFrame=0;
|
||||
@@ -87,7 +88,7 @@ void setDefaultSettings()
|
||||
gUseWarmstarting = 1;
|
||||
gRandomizeConstraints = 1;
|
||||
gErp = 0.2f;
|
||||
gSlop=0.0f;
|
||||
gSlop=0.01f;
|
||||
gErp2 = 0.1f;
|
||||
gWarmStartingParameter = 0.85f;
|
||||
|
||||
@@ -317,6 +318,18 @@ void Keyboard(unsigned char key, int x, int y)
|
||||
}
|
||||
}
|
||||
|
||||
void KeyboardSpecialUp(int key, int x, int y)
|
||||
{
|
||||
if (demo)
|
||||
{
|
||||
demo->specialKeyboardUp(key,x,y);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void KeyboardSpecial(int key, int x, int y)
|
||||
{
|
||||
|
||||
@@ -380,6 +393,7 @@ int main(int argc, char** argv)
|
||||
GLUI_Master.set_glutReshapeFunc(Resize);
|
||||
GLUI_Master.set_glutKeyboardFunc(Keyboard);
|
||||
GLUI_Master.set_glutSpecialFunc(KeyboardSpecial);
|
||||
GLUI_Master.set_glutSpecialUpFunc(KeyboardSpecialUp);
|
||||
GLUI_Master.set_glutMouseFunc(Mouse);
|
||||
glutMotionFunc(MouseMotion);
|
||||
|
||||
@@ -410,14 +424,13 @@ int main(int argc, char** argv)
|
||||
GLUI_Spinner* spinner = 0;
|
||||
|
||||
spinner = glui->add_spinner("ERP", GLUI_SPINNER_FLOAT, &gErp);
|
||||
spinner->set_float_limits(0.f,1.f);
|
||||
spinner = glui->add_spinner("ERP2", GLUI_SPINNER_FLOAT, &gErp2);
|
||||
// spinner->set_float_limits(0.f,1.f);
|
||||
// spinner = glui->add_spinner("ERP2", GLUI_SPINNER_FLOAT, &gErp2);
|
||||
spinner->set_float_limits(0.f,1.f);
|
||||
spinner = glui->add_spinner("Slop", GLUI_SPINNER_FLOAT, &gSlop);
|
||||
spinner->set_float_limits(0.f,1.f);
|
||||
|
||||
spinner = glui->add_spinner("WSP", GLUI_SPINNER_FLOAT,&gWarmStartingParameter);
|
||||
spinner->set_float_limits (0.f,1.0);
|
||||
// spinner = glui->add_spinner("WSP", GLUI_SPINNER_FLOAT,&gWarmStartingParameter);
|
||||
// spinner->set_float_limits (0.f,1.0);
|
||||
glui->add_checkbox("Warmstarting", &gUseWarmstarting);
|
||||
glui->add_checkbox("Randomize Constraints", &gRandomizeConstraints);
|
||||
|
||||
@@ -434,14 +447,6 @@ int main(int argc, char** argv)
|
||||
glui->add_checkbox_to_panel(drawPanel, "Shadows", &gDrawShadows);
|
||||
glui->add_checkbox_to_panel(drawPanel, "Clusters", &gDrawClusters);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// glui->add_checkbox_to_panel(drawPanel, "Impulses", &settings.drawImpulses);
|
||||
// glui->add_checkbox_to_panel(drawPanel, "Statistics", &settings.drawStats);
|
||||
|
||||
|
||||
int testCount = 0;
|
||||
btDemoEntry* e = g_demoEntries;
|
||||
while (e->createFcn)
|
||||
@@ -456,12 +461,12 @@ int main(int argc, char** argv)
|
||||
glui->add_button("Toggle Pause", 0,(GLUI_Update_CB)TogglePause);
|
||||
|
||||
glui->add_button("Single Step", 0,(GLUI_Update_CB)SingleSimulationStep);
|
||||
glui->add_button("Reset Scene", 0,(GLUI_Update_CB)ResetScene);
|
||||
// glui->add_button("Reset Scene", 0,(GLUI_Update_CB)ResetScene);
|
||||
glui->add_button("Restart Scene", 0,(GLUI_Update_CB)RestartScene);
|
||||
|
||||
glui->add_separator();
|
||||
|
||||
glui->add_button("Exit", 0,(GLUI_Update_CB)exit);
|
||||
// glui->add_button("Exit", 0,(GLUI_Update_CB)exit);
|
||||
|
||||
glui->set_main_gfx_window( mainWindow );
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@ subject to the following restrictions:
|
||||
//maximum number of objects (and allow user to shoot additional boxes)
|
||||
#define MAX_PROXIES (ARRAY_SIZE_X*ARRAY_SIZE_Y*ARRAY_SIZE_Z + 1024)
|
||||
|
||||
///scaling of the objects (0.1 = 20 centimeter boxes )
|
||||
#define SCALING 0.1
|
||||
#define START_POS_X -5
|
||||
#define START_POS_Y -5
|
||||
#define START_POS_Z -3
|
||||
@@ -80,7 +82,7 @@ void BasicDemo::initPhysics()
|
||||
setTexturing(true);
|
||||
setShadows(true);
|
||||
|
||||
setCameraDistance(btScalar(50.));
|
||||
setCameraDistance(btScalar(SCALING*50.));
|
||||
|
||||
///collision configuration contains default setup for memory, collision setup
|
||||
m_collisionConfiguration = new btDefaultCollisionConfiguration();
|
||||
@@ -106,7 +108,7 @@ void BasicDemo::initPhysics()
|
||||
|
||||
btTransform groundTransform;
|
||||
groundTransform.setIdentity();
|
||||
groundTransform.setOrigin(btVector3(0,-56,0));
|
||||
groundTransform.setOrigin(btVector3(0,-50,0));
|
||||
|
||||
//We can also use DemoApplication::localCreateRigidBody, but for clarity it is provided here:
|
||||
{
|
||||
@@ -133,7 +135,7 @@ void BasicDemo::initPhysics()
|
||||
//create a few dynamic rigidbodies
|
||||
// Re-using the same collision is better for memory usage and performance
|
||||
|
||||
btCollisionShape* colShape = new btBoxShape(btVector3(1,1,1));
|
||||
btCollisionShape* colShape = new btBoxShape(btVector3(SCALING*1,SCALING*1,SCALING*1));
|
||||
//btCollisionShape* colShape = new btSphereShape(btScalar(1.));
|
||||
m_collisionShapes.push_back(colShape);
|
||||
|
||||
@@ -160,9 +162,9 @@ void BasicDemo::initPhysics()
|
||||
{
|
||||
for(int j = 0;j<ARRAY_SIZE_Z;j++)
|
||||
{
|
||||
startTransform.setOrigin(btVector3(
|
||||
startTransform.setOrigin(SCALING*btVector3(
|
||||
2.0*i + start_x,
|
||||
10+2.0*k + start_y,
|
||||
20+2.0*k + start_y,
|
||||
2.0*j + start_z));
|
||||
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ void ConcaveDemo::initPhysics()
|
||||
{
|
||||
|
||||
setTexturing(true);
|
||||
setShadows(false);
|
||||
setShadows(true);
|
||||
|
||||
#define TRISIZE 10.f
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ const int maxOverlap = 65535;
|
||||
float gEngineForce = 0.f;
|
||||
|
||||
float defaultBreakingForce = 10.f;
|
||||
float gBreakingForce = 10.f;
|
||||
float gBreakingForce = 100.f;
|
||||
|
||||
float maxEngineForce = 1000.f;//this should be engine/velocity dependent
|
||||
float maxBreakingForce = 100.f;
|
||||
@@ -116,6 +116,9 @@ m_vertices(0)
|
||||
m_vehicle = 0;
|
||||
m_cameraPosition = btVector3(30,30,30);
|
||||
m_useDefaultCamera = false;
|
||||
setTexturing(true);
|
||||
setShadows(true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -131,9 +134,19 @@ void ForkLiftDemo::termPhysics()
|
||||
btRigidBody* body = btRigidBody::upcast(obj);
|
||||
if (body && body->getMotionState())
|
||||
{
|
||||
|
||||
while (body->getNumConstraintRefs())
|
||||
{
|
||||
btTypedConstraint* constraint = body->getConstraintRef(0);
|
||||
m_dynamicsWorld->removeConstraint(constraint);
|
||||
delete constraint;
|
||||
}
|
||||
delete body->getMotionState();
|
||||
m_dynamicsWorld->removeRigidBody(body);
|
||||
} else
|
||||
{
|
||||
m_dynamicsWorld->removeCollisionObject( obj );
|
||||
}
|
||||
m_dynamicsWorld->removeCollisionObject( obj );
|
||||
delete obj;
|
||||
}
|
||||
|
||||
@@ -348,7 +361,6 @@ const float TRIANGLE_SIZE=20.f;
|
||||
|
||||
{
|
||||
btCollisionShape* suppShape = new btBoxShape(btVector3(0.5f,0.1f,0.5f));
|
||||
m_collisionShapes.push_back(chassisShape);
|
||||
btTransform suppLocalTrans;
|
||||
suppLocalTrans.setIdentity();
|
||||
//localTrans effectively shifts the center of mass with respect to the chassis
|
||||
@@ -666,6 +678,9 @@ void ForkLiftDemo::displayCallback(void)
|
||||
void ForkLiftDemo::clientResetScene()
|
||||
{
|
||||
gVehicleSteering = 0.f;
|
||||
gBreakingForce = defaultBreakingForce;
|
||||
gEngineForce = 0.f;
|
||||
|
||||
m_carChassis->setCenterOfMassTransform(btTransform::getIdentity());
|
||||
m_carChassis->setLinearVelocity(btVector3(0,0,0));
|
||||
m_carChassis->setAngularVelocity(btVector3(0,0,0));
|
||||
|
||||
Reference in New Issue
Block a user