more tutorial work

add fixed_timestep command-line parameter, 0 means disabled (variable timestep)
This commit is contained in:
erwincoumans
2015-08-07 14:18:57 -07:00
parent 89c2a729ce
commit de4dcdbb18
6 changed files with 555 additions and 3 deletions

View File

@@ -29,6 +29,8 @@ SET(App_ExampleBrowser_SRCS
../ForkLift/ForkLiftDemo.h
../Tutorial/Tutorial.cpp
../Tutorial/Tutorial.h
../Tutorial/Dof6ConstraintTutorial.cpp
../Tutorial/Dof6ConstraintTutorial.h
../GyroscopicDemo/GyroscopicSetup.cpp
../GyroscopicDemo/GyroscopicSetup.h
../Planar2D/Planar2D.cpp

View File

@@ -39,6 +39,7 @@
#include "../Constraints/TestHingeTorque.h"
#include "../RenderingExamples/TimeSeriesExample.h"
#include "../Tutorial/Tutorial.h"
#include "../Tutorial/Dof6ConstraintTutorial.h"
#ifdef ENABLE_LUA
#include "../LuaDemo/LuaPhysicsSetup.h"
@@ -110,7 +111,7 @@ static ExampleEntry gDefaultExamples[]=
ExampleEntry(0,"Tutorial"),
ExampleEntry(1,"Free Rigid Body","(Preliminary work in progress) Free moving rigid body, without external or constraint forces", TutorialCreateFunc,0),
ExampleEntry(1,"Spring constraint","A rigid body with a spring constraint attached", Dof6ConstraintTutorialCreateFunc,0),
#ifdef INCLUDE_CLOTH_DEMOS
ExampleEntry(0,"Soft Body"),

View File

@@ -58,6 +58,7 @@ static int sCurrentDemoIndex = -1;
static int sCurrentHightlighted = 0;
static CommonExampleInterface* sCurrentDemo = 0;
static b3AlignedObjectArray<const char*> allNames;
static float gFixedTimeStep = 0;
static class ExampleEntries* gAllExamples=0;
bool sUseOpenGL2 = false;
@@ -358,6 +359,8 @@ static void saveCurrentSettings(int currentEntry,const char* startFileName)
fprintf(f,"--background_color_red= %f\n", red);
fprintf(f,"--background_color_green= %f\n", green);
fprintf(f,"--background_color_blue= %f\n", blue);
fprintf(f,"--fixed_timestep= %f\n", gFixedTimeStep);
if (enable_experimental_opencl)
{
@@ -663,6 +666,7 @@ bool OpenGLExampleBrowser::init(int argc, char* argv[])
loadCurrentSettings(startFileName, args);
args.GetCmdLineArgument("fixed_timestep",gFixedTimeStep);
///The OpenCL rigid body pipeline is experimental and
///most OpenCL drivers and OpenCL compilers have issues with our kernels.
@@ -984,7 +988,13 @@ void OpenGLExampleBrowser::update(float deltaTime)
}
sCurrentDemo->stepSimulation(deltaTime);//1./60.f);
if (gFixedTimeStep>0)
{
sCurrentDemo->stepSimulation(gFixedTimeStep);
} else
{
sCurrentDemo->stepSimulation(deltaTime);//1./60.f);
}
}
if (renderVisualGeometry && ((gDebugDrawFlags&btIDebugDraw::DBG_DrawWireframe)==0))