fix crash in BasicDemo

add small experiments to distribute points on a sphere
prepare for coordinate frame demo (incomplete)
fix/hack around gwen update of scroll bars and Focu
This commit is contained in:
erwin coumans
2014-12-16 14:27:38 -08:00
parent 122fabac87
commit 548fe5b04e
17 changed files with 922 additions and 196 deletions

View File

@@ -5,7 +5,7 @@
#include "Bullet3AppSupport/BulletDemoInterface.h"
#include "../bullet2/BasicDemo/BasicDemo.h"
#include "../bullet2/CoordinateFramesDemo/CoordinateFrameDemoPhysicsSetup.h"
#include "../bullet2/CoordinateFrameDemo/CoordinateFrameDemoPhysicsSetup.h"
#include "../bullet2/BasicDemo/HingeDemo.h"
#include "../bullet2/BasicDemo/HingeDemo.h"
@@ -31,7 +31,8 @@
#include "../bullet2/BasicConcepts/CoordinateSystemDemo.h"
#include "../../Demos3/FiniteElementMethod/FiniteElementDemo.h"
//#include "../../Demos3/bullet2/SoftDemo/SoftDemo.h"
#include "../Geometry/SphereCreation.h"
#include "../Geometry/DistributePoints.h"
#define MYCREATEFUNC(func) \
static BulletDemoInterface* func##CreateFunc(CommonGraphicsApp* app)\
@@ -83,8 +84,7 @@ static BulletDemoEntry allDemos[]=
{0,"Basic Concepts",0},
{1,"Basis Frame", &CoordinateSystemDemo::CreateFunc},
{1,"SupportFunc", &MySupportFuncDemo::CreateFunc},
{1,"Coordinate Frames", CoordinateFrameDemoPhysicsCreateFunc},
//{"emptydemo",EmptyBulletDemo::MyCreateFunc},
{0,"API Demos", 0},
{1,"BasicDemo",BasicDemo::MyCreateFunc},
@@ -102,6 +102,9 @@ static BulletDemoEntry allDemos[]=
{ 1, "COLLADA", MyImportColladaCreateFunc},
{0,"Experiments", 0},
{1, "Finite Element Demo", FiniteElementDemo::CreateFunc},
{1,"SphereCreation", &SphereCreation::CreateFunc},
{1,"DistributePoints", &DistributePoints::CreateFunc},
{1,"Coordinate Frames", CoordinateFrameDemoPhysicsCreateFunc},
// {0,"Soft Body", 0},
// {1,"Cloth1", SoftDemo::CreateFunc},

View File

@@ -25,6 +25,8 @@ SET(App_AllBullet2Demos_SRCS
../bullet2/MultiBodyDemo/MultiBodyVehicle.cpp
../bullet2/ConstraintDemo/ConstraintPhysicsSetup.cpp
../bullet2/ConstraintDemo/ConstraintPhysicsSetup.h
../bullet2/CoordinateFrameDemo/CoordinateFrameDemoPhysicsSetup.cpp
../bullet2/CoordinateFrameDemo/CoordinateFrameDemoPhysicsSetup.h
../bullet2/FeatherstoneMultiBodyDemo/BulletMultiBodyDemos.cpp
../bullet2/FeatherstoneMultiBodyDemo/BulletMultiBodyDemos.h
../bullet2/FeatherstoneMultiBodyDemo/MultiDofDemo.cpp

View File

@@ -207,7 +207,10 @@ static BulletDemoInterface* sCurrentDemo = 0;
static b3AlignedObjectArray<const char*> allNames;
bool drawGUI=true;
extern bool useShadowMap;
static bool wireframe=false;
static bool visualWireframe=false;
static bool renderVisualGeometry=true;
static bool renderGrid = true;
static bool pauseSimulation=false;//true;
int midiBaseIndex = 176;
@@ -243,15 +246,18 @@ void MyKeyboardCallback(int key, int state)
if (key=='w' && state)
{
wireframe=!wireframe;
if (wireframe)
{
glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
} else
{
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
}
visualWireframe=!visualWireframe;
}
if (key=='v' && state)
{
renderVisualGeometry = !renderVisualGeometry;
}
if (key=='g' && state)
{
renderGrid = !renderGrid;
}
if (key=='i' && state)
{
pauseSimulation = !pauseSimulation;
@@ -595,7 +601,7 @@ int main(int argc, char* argv[])
MyProfileWindow* profWindow = setupProfileWindow(gui->getInternalData());
profileWindowSetVisible(profWindow,false);
gui->setFocus();
#if 0
{
MyGraphInput input(gui->getInternalData());
@@ -720,6 +726,8 @@ int main(int argc, char* argv[])
BT_PROFILE("Update Camera");
s_instancingRenderer->updateCamera(dg.upAxis);
}
if (renderGrid)
{
BT_PROFILE("Draw Grid");
app->drawGrid(dg);
@@ -748,11 +756,18 @@ int main(int argc, char* argv[])
sCurrentDemo->stepSimulation(deltaTimeInSeconds);//1./60.f);
prevTimeInMicroseconds = curTimeInMicroseconds;
}
if (renderVisualGeometry)
{
if (visualWireframe)
{
glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
}
BT_PROFILE("Render Scene");
sCurrentDemo->renderScene();
}
{
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
sCurrentDemo->physicsDebugDraw();
}
}
@@ -785,7 +800,7 @@ int main(int argc, char* argv[])
app->swapBuffer();
}
gui->forceUpdateScrollBars();
} while (!s_window->requestedExit());
// selectDemo(0);

View File

@@ -46,6 +46,8 @@
"../bullet2/MultiBodyDemo/TestJointTorqueSetup.h",
"../bullet2/MultiBodyDemo/MultiBodyVehicle.cpp",
"../bullet2/MultiBodyDemo/MultiBodyVehicle.h",
"../bullet2/CoordinateFrameDemo/CoordinateFrameDemoPhysicsSetup.cpp",
"../bullet2/CoordinateFrameDemo/CoordinateFrameDemoPhysicsSetup.h",
-- "../DifferentialGearDemo/DifferentialGearSetup.cpp",
-- "../DifferentialGearDemo/DifferentialGearSetup.h",
"../FiniteElementMethod/FiniteElementDemo.cpp",