URDF import demo: add COLLADA .dae file support add FiniteElementMethod demo, extracted from the OpenTissue library (under the zlib license) don't crash if loading an invalid STL file add comparison with Assimp for COLLADA file loading (disabled by default, to avoid library dependency) Gwen: disable some flags that make the build incompatible
174 lines
5.0 KiB
C
174 lines
5.0 KiB
C
|
|
#ifndef BULLET_DEMO_ENTRIES_H
|
|
#define BULLET_DEMO_ENTRIES_H
|
|
|
|
#include "Bullet3AppSupport/BulletDemoInterface.h"
|
|
#include "../bullet2/BasicDemo/BasicDemo.h"
|
|
#include "../bullet2/BasicDemo/HingeDemo.h"
|
|
#include "../bullet2/BasicDemo/HingeDemo.h"
|
|
|
|
#include "../bullet2/FeatherstoneMultiBodyDemo/BulletMultiBodyDemos.h"
|
|
#include "../bullet2/FeatherstoneMultiBodyDemo/MultiDofDemo.h"
|
|
|
|
#include "../bullet2/RagdollDemo/RagdollDemo.h"
|
|
#include "../bullet2/LuaDemo/LuaPhysicsSetup.h"
|
|
#include "../bullet2/ChainDemo/ChainDemo.h"
|
|
#include "../../Demos/CcdPhysicsDemo/CcdPhysicsSetup.h"
|
|
#include "../bullet2/ConstraintDemo/ConstraintPhysicsSetup.h"
|
|
#include "../ImportURDFDemo/ImportURDFSetup.h"
|
|
#include "../ImportObjDemo/ImportObjSetup.h"
|
|
#include "../ImportSTLDemo/ImportSTLSetup.h"
|
|
#include "../ImportColladaDemo/ImportColladaSetup.h"
|
|
|
|
#include "../../Demos/SerializeDemo/SerializeSetup.h"
|
|
#include "../bullet2/MultiBodyDemo/TestJointTorqueSetup.h"
|
|
#include "../bullet2/CollisionDetection/SupportFuncDemo.h"
|
|
#include "../bullet2/BasicConcepts/CoordinateSystemDemo.h"
|
|
#include "../../Demos3/FiniteElementMethod/FiniteElementDemo.h"
|
|
|
|
static BulletDemoInterface* TestJointTorqueCreateFunc(CommonGraphicsApp* app)
|
|
{
|
|
CommonPhysicsSetup* physicsSetup = new TestJointTorqueSetup();
|
|
return new BasicDemo(app, physicsSetup);
|
|
}
|
|
|
|
static BulletDemoInterface* LuaDemoCreateFunc(CommonGraphicsApp* app)
|
|
{
|
|
CommonPhysicsSetup* physicsSetup = new LuaPhysicsSetup(app);
|
|
return new BasicDemo(app, physicsSetup);
|
|
}
|
|
|
|
static BulletDemoInterface* MyCcdPhysicsDemoCreateFunc(CommonGraphicsApp* app)
|
|
{
|
|
CommonPhysicsSetup* physicsSetup = new CcdPhysicsSetup();
|
|
return new BasicDemo(app, physicsSetup);
|
|
}
|
|
|
|
static BulletDemoInterface* MyKinematicObjectCreateFunc(CommonGraphicsApp* app)
|
|
{
|
|
CommonPhysicsSetup* physicsSetup = new KinematicObjectSetup();
|
|
return new BasicDemo(app, physicsSetup);
|
|
}
|
|
static BulletDemoInterface* MySerializeCreateFunc(CommonGraphicsApp* app)
|
|
{
|
|
CommonPhysicsSetup* physicsSetup = new SerializeSetup();
|
|
return new BasicDemo(app, physicsSetup);
|
|
}
|
|
static BulletDemoInterface* MyConstraintCreateFunc(CommonGraphicsApp* app)
|
|
{
|
|
CommonPhysicsSetup* physicsSetup = new ConstraintPhysicsSetup();
|
|
return new BasicDemo(app, physicsSetup);
|
|
}
|
|
|
|
static BulletDemoInterface* MyImportUrdfCreateFunc(CommonGraphicsApp* app)
|
|
{
|
|
CommonPhysicsSetup* physicsSetup = new ImportUrdfDemo();
|
|
return new BasicDemo(app, physicsSetup);
|
|
}
|
|
static BulletDemoInterface* MyImportObjCreateFunc(CommonGraphicsApp* app)
|
|
{
|
|
CommonPhysicsSetup* physicsSetup = new ImportObjDemo(app);
|
|
return new BasicDemo(app, physicsSetup);
|
|
}
|
|
static BulletDemoInterface* MyImportSTLCreateFunc(CommonGraphicsApp* app)
|
|
{
|
|
CommonPhysicsSetup* physicsSetup = new ImportSTLDemo(app);
|
|
return new BasicDemo(app, physicsSetup);
|
|
}
|
|
|
|
static BulletDemoInterface* MyImportColladaCreateFunc(CommonGraphicsApp* app)
|
|
{
|
|
CommonPhysicsSetup* physicsSetup = new ImportColladaSetup(app);
|
|
return new BasicDemo(app, physicsSetup);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct BulletDemoEntry
|
|
{
|
|
int m_menuLevel;
|
|
const char* m_name;
|
|
BulletDemoInterface::CreateFunc* m_createFunc;
|
|
};
|
|
|
|
|
|
static BulletDemoEntry allDemos[]=
|
|
{
|
|
|
|
{0,"Basic Concepts",0},
|
|
{1,"Basis Frame", &CoordinateSystemDemo::CreateFunc},
|
|
{1,"SupportFunc", &MySupportFuncDemo::CreateFunc},
|
|
//{"emptydemo",EmptyBulletDemo::MyCreateFunc},
|
|
{0,"API Demos", 0},
|
|
|
|
{1,"BasicDemo",BasicDemo::MyCreateFunc},
|
|
{ 1, "CcdDemo", MyCcdPhysicsDemoCreateFunc },
|
|
{ 1, "Kinematic", MyKinematicObjectCreateFunc },
|
|
{ 1, "Constraints", MyConstraintCreateFunc },
|
|
{ 1, "LuaDemo",LuaDemoCreateFunc},
|
|
|
|
{0,"File Formats", 0},
|
|
|
|
{ 1, ".bullet",MySerializeCreateFunc},
|
|
{ 1, "Wavefront Obj", MyImportObjCreateFunc},
|
|
{ 1, "URDF", MyImportUrdfCreateFunc },
|
|
{ 1, "STL", MyImportSTLCreateFunc},
|
|
{ 1, "COLLADA", MyImportColladaCreateFunc},
|
|
{0,"Finite Element Method", 0},
|
|
{1, "Finite Element Demo", FiniteElementDemo::CreateFunc},
|
|
/* {1,"ChainDemo",ChainDemo::MyCreateFunc},
|
|
// {0, "Stress tests", 0 },
|
|
|
|
{1,"SIHingeDemo",HingeDemo::SICreateFunc},
|
|
{1,"PGSHingeDemo",HingeDemo::PGSCreateFunc},
|
|
{1,"DantzigHingeDemo",HingeDemo::DantzigCreateFunc},
|
|
{1,"LemkeHingeDemo",HingeDemo::LemkeCreateFunc},
|
|
{1,"InertiaHingeDemo",HingeDemo::InertiaCreateFunc},
|
|
{1,"ABMHingeDemo",HingeDemo::FeatherstoneCreateFunc},
|
|
|
|
{1,"Ragdoll",RagDollDemo::MyCreateFunc},
|
|
*/
|
|
{ 0, "Multibody" ,0},
|
|
{1,"MultiBody1",FeatherstoneDemo1::MyCreateFunc},
|
|
// {"MultiBody2",FeatherstoneDemo2::MyCreateFunc},
|
|
{1,"MultiDofDemo",MultiDofDemo::MyCreateFunc},
|
|
{1,"TestJointTorque",TestJointTorqueCreateFunc},
|
|
|
|
|
|
};
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
static void saveCurrentDemoEntry(int currentEntry,const char* startFileName)
|
|
{
|
|
FILE* f = fopen(startFileName,"w");
|
|
if (f)
|
|
{
|
|
fprintf(f,"%d\n",currentEntry);
|
|
fclose(f);
|
|
}
|
|
};
|
|
|
|
static int loadCurrentDemoEntry(const char* startFileName)
|
|
{
|
|
int currentEntry= 0;
|
|
FILE* f = fopen(startFileName,"r");
|
|
if (f)
|
|
{
|
|
int result;
|
|
result = fscanf(f,"%d",¤tEntry);
|
|
if (result)
|
|
{
|
|
return currentEntry;
|
|
}
|
|
fclose(f);
|
|
}
|
|
return 0;
|
|
};
|
|
|
|
#endif//BULLET_DEMO_ENTRIES_H
|
|
|