enable URDF loading throught the 'File/Open' menu
set a default camera targets for each demo. note that it is only reset when switching to a different demo, so you can restart at your chosen location. no OpenCL pairbench drawing in OpenGL2 (there is no VBO available etc)
This commit is contained in:
@@ -37,6 +37,14 @@ struct BasicExample : public CommonRigidBodyBase
|
|||||||
virtual ~BasicExample(){}
|
virtual ~BasicExample(){}
|
||||||
virtual void initPhysics();
|
virtual void initPhysics();
|
||||||
virtual void renderScene();
|
virtual void renderScene();
|
||||||
|
void resetCamera()
|
||||||
|
{
|
||||||
|
float dist = 41;
|
||||||
|
float pitch = 52;
|
||||||
|
float yaw = 35;
|
||||||
|
float targetPos[3]={0,0.46,0};
|
||||||
|
m_guiHelper->resetCamera(dist,pitch,yaw,targetPos[0],targetPos[1],targetPos[2]);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void BasicExample::initPhysics()
|
void BasicExample::initPhysics()
|
||||||
@@ -128,9 +136,11 @@ void BasicExample::renderScene()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
CommonExampleInterface* BasicExampleCreateFunc(PhysicsInterface* pint, GUIHelperInterface* helper, int option)
|
|
||||||
|
|
||||||
|
CommonExampleInterface* BasicExampleCreateFunc(CommonExampleOptions& options)
|
||||||
{
|
{
|
||||||
return new BasicExample(helper);
|
return new BasicExample(options.m_guiHelper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ subject to the following restrictions:
|
|||||||
#ifndef BASIC_EXAMPLE_H
|
#ifndef BASIC_EXAMPLE_H
|
||||||
#define BASIC_EXAMPLE_H
|
#define BASIC_EXAMPLE_H
|
||||||
|
|
||||||
class CommonExampleInterface* BasicExampleCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option);
|
class CommonExampleInterface* BasicExampleCreateFunc(struct CommonExampleOptions& options);
|
||||||
|
|
||||||
|
|
||||||
#endif //BASIC_DEMO_PHYSICS_SETUP_H
|
#endif //BASIC_DEMO_PHYSICS_SETUP_H
|
||||||
|
|||||||
@@ -28,9 +28,7 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
DummyGUIHelper noGfx;
|
DummyGUIHelper noGfx;
|
||||||
|
|
||||||
int option = 0;
|
CommonExampleInterface* example = BasicExampleCreateFunc(CommonExampleOptions(&noGfx));
|
||||||
|
|
||||||
CommonExampleInterface* example = BasicExampleCreateFunc(pint, &noGfx, option);
|
|
||||||
|
|
||||||
example->initPhysics();
|
example->initPhysics();
|
||||||
example->stepSimulation(1.f/60.f);
|
example->stepSimulation(1.f/60.f);
|
||||||
|
|||||||
@@ -1234,7 +1234,7 @@ void BenchmarkDemo::exitPhysics()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct CommonExampleInterface* BenchmarkCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option)
|
struct CommonExampleInterface* BenchmarkCreateFunc(struct CommonExampleOptions& options)
|
||||||
{
|
{
|
||||||
return new BenchmarkDemo(helper,option);
|
return new BenchmarkDemo(options.m_guiHelper,options.m_option);
|
||||||
}
|
}
|
||||||
@@ -15,7 +15,7 @@ subject to the following restrictions:
|
|||||||
#ifndef BENCHMARK_EXAMPLE_H
|
#ifndef BENCHMARK_EXAMPLE_H
|
||||||
#define BENCHMARK_EXAMPLE_H
|
#define BENCHMARK_EXAMPLE_H
|
||||||
|
|
||||||
class CommonExampleInterface* BenchmarkCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option);
|
class CommonExampleInterface* BenchmarkCreateFunc(struct CommonExampleOptions& options);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,23 +3,43 @@
|
|||||||
#ifndef COMMON_EXAMPLE_INTERFACE_H
|
#ifndef COMMON_EXAMPLE_INTERFACE_H
|
||||||
#define COMMON_EXAMPLE_INTERFACE_H
|
#define COMMON_EXAMPLE_INTERFACE_H
|
||||||
|
|
||||||
|
struct CommonExampleOptions
|
||||||
|
{
|
||||||
|
struct GUIHelperInterface* m_guiHelper;
|
||||||
|
|
||||||
|
//Those are optional, some examples will use them others don't. Each example should work with them being 0.
|
||||||
|
int m_option;
|
||||||
|
const char* m_fileName;
|
||||||
|
|
||||||
|
|
||||||
|
CommonExampleOptions(struct GUIHelperInterface* helper, int option=0)
|
||||||
|
:m_guiHelper(helper),
|
||||||
|
m_option(option),
|
||||||
|
m_fileName(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
class CommonExampleInterface
|
class CommonExampleInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef class CommonExampleInterface* (CreateFunc)(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option);
|
typedef class CommonExampleInterface* (CreateFunc)(CommonExampleOptions& options);
|
||||||
|
|
||||||
virtual ~CommonExampleInterface()
|
virtual ~CommonExampleInterface()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
virtual void initPhysics()=0;
|
virtual void initPhysics()=0;
|
||||||
virtual void exitPhysics()=0;
|
virtual void exitPhysics()=0;
|
||||||
virtual void stepSimulation(float deltaTime)=0;
|
virtual void stepSimulation(float deltaTime)=0;
|
||||||
virtual void renderScene()=0;
|
virtual void renderScene()=0;
|
||||||
virtual void physicsDebugDraw(int debugFlags)=0;//for now we reuse the flags in Bullet/src/LinearMath/btIDebugDraw.h
|
virtual void physicsDebugDraw(int debugFlags)=0;//for now we reuse the flags in Bullet/src/LinearMath/btIDebugDraw.h
|
||||||
|
//reset camera is only called when switching demo. this way you can restart (initPhysics) and watch in a specific location easier
|
||||||
|
virtual void resetCamera(){};
|
||||||
virtual bool mouseMoveCallback(float x,float y)=0;
|
virtual bool mouseMoveCallback(float x,float y)=0;
|
||||||
virtual bool mouseButtonCallback(int button, int state, float x, float y)=0;
|
virtual bool mouseButtonCallback(int button, int state, float x, float y)=0;
|
||||||
virtual bool keyboardCallback(int key, int state)=0;
|
virtual bool keyboardCallback(int key, int state)=0;
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ struct GUIHelperInterface
|
|||||||
|
|
||||||
virtual void setUpAxis(int axis)=0;
|
virtual void setUpAxis(int axis)=0;
|
||||||
|
|
||||||
|
virtual void resetCamera(float camDist, float pitch, float yaw, float camPosX,float camPosY, float camPosZ)=0;
|
||||||
|
|
||||||
virtual void autogenerateGraphicsObjects(btDiscreteDynamicsWorld* rbWorld) =0;
|
virtual void autogenerateGraphicsObjects(btDiscreteDynamicsWorld* rbWorld) =0;
|
||||||
|
|
||||||
virtual void drawText3D( const char* txt, float posX, float posZY, float posZ, float size)=0;
|
virtual void drawText3D( const char* txt, float posX, float posZY, float posZ, float size)=0;
|
||||||
@@ -97,6 +99,9 @@ struct DummyGUIHelper : public GUIHelperInterface
|
|||||||
virtual void setUpAxis(int axis)
|
virtual void setUpAxis(int axis)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
virtual void resetCamera(float camDist, float pitch, float yaw, float camPosX,float camPosY, float camPosZ)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
virtual void autogenerateGraphicsObjects(btDiscreteDynamicsWorld* rbWorld)
|
virtual void autogenerateGraphicsObjects(btDiscreteDynamicsWorld* rbWorld)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -51,6 +51,10 @@ struct CommonRenderInterface
|
|||||||
|
|
||||||
virtual void writeTransforms()=0;
|
virtual void writeTransforms()=0;
|
||||||
virtual void enableBlend(bool blend)=0;
|
virtual void enableBlend(bool blend)=0;
|
||||||
|
|
||||||
|
//This is internal access to OpenGL3+ features, mainly used for OpenCL-OpenGL interop
|
||||||
|
//Only the GLInstancingRenderer supports it, just return 0 otherwise.
|
||||||
|
virtual struct GLInstanceRendererInternalData* getInternalData()=0;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
|||||||
@@ -43,12 +43,19 @@ class AllConstraintDemo : public CommonRigidBodyBase
|
|||||||
|
|
||||||
virtual ~AllConstraintDemo();
|
virtual ~AllConstraintDemo();
|
||||||
|
|
||||||
void initPhysics();
|
virtual void initPhysics();
|
||||||
|
|
||||||
void exitPhysics();
|
virtual void exitPhysics();
|
||||||
|
|
||||||
|
virtual void resetCamera()
|
||||||
|
{
|
||||||
|
float dist = 27;
|
||||||
|
float pitch = 720;
|
||||||
|
float yaw = 30;
|
||||||
|
float targetPos[3]={2,0,-10};
|
||||||
|
m_guiHelper->resetCamera(dist,pitch,yaw,targetPos[0],targetPos[1],targetPos[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
virtual void keyboardCallback(unsigned char key, int x, int y);
|
virtual void keyboardCallback(unsigned char key, int x, int y);
|
||||||
|
|
||||||
// for cone-twist motor driving
|
// for cone-twist motor driving
|
||||||
@@ -872,7 +879,7 @@ void AllConstraintDemo::keyboardCallback(unsigned char key, int x, int y)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class CommonExampleInterface* AllConstraintCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option)
|
class CommonExampleInterface* AllConstraintCreateFunc(struct CommonExampleOptions& options)
|
||||||
{
|
{
|
||||||
return new AllConstraintDemo(helper);
|
return new AllConstraintDemo(options.m_guiHelper);
|
||||||
}
|
}
|
||||||
@@ -15,7 +15,7 @@ subject to the following restrictions:
|
|||||||
#ifndef ALL_CONSTRAINT_DEMO_H
|
#ifndef ALL_CONSTRAINT_DEMO_H
|
||||||
#define ALL_CONSTRAINT_DEMO_H
|
#define ALL_CONSTRAINT_DEMO_H
|
||||||
|
|
||||||
class CommonExampleInterface* AllConstraintCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option);
|
class CommonExampleInterface* AllConstraintCreateFunc(struct CommonExampleOptions& options);
|
||||||
|
|
||||||
|
|
||||||
#endif //ALL_CONSTRAINT_DEMO_H
|
#endif //ALL_CONSTRAINT_DEMO_H
|
||||||
|
|||||||
@@ -14,6 +14,17 @@ struct ConstraintPhysicsSetup : public CommonRigidBodyBase
|
|||||||
|
|
||||||
virtual void stepSimulation(float deltaTime);
|
virtual void stepSimulation(float deltaTime);
|
||||||
|
|
||||||
|
|
||||||
|
virtual void resetCamera()
|
||||||
|
{
|
||||||
|
float dist = 7;
|
||||||
|
float pitch = 721;
|
||||||
|
float yaw = 44;
|
||||||
|
float targetPos[3]={8,1,-11};
|
||||||
|
m_guiHelper->resetCamera(dist,pitch,yaw,targetPos[0],targetPos[1],targetPos[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ConstraintPhysicsSetup::ConstraintPhysicsSetup(struct GUIHelperInterface* helper)
|
ConstraintPhysicsSetup::ConstraintPhysicsSetup(struct GUIHelperInterface* helper)
|
||||||
@@ -144,7 +155,7 @@ void ConstraintPhysicsSetup::initPhysics()
|
|||||||
m_guiHelper->autogenerateGraphicsObjects(m_dynamicsWorld);
|
m_guiHelper->autogenerateGraphicsObjects(m_dynamicsWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
class CommonExampleInterface* ConstraintCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option)
|
class CommonExampleInterface* ConstraintCreateFunc(CommonExampleOptions& options)
|
||||||
{
|
{
|
||||||
return new ConstraintPhysicsSetup(helper);
|
return new ConstraintPhysicsSetup(options.m_guiHelper);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#ifndef CONSTAINT_PHYSICS_SETUP_H
|
#ifndef CONSTAINT_PHYSICS_SETUP_H
|
||||||
#define CONSTAINT_PHYSICS_SETUP_H
|
#define CONSTAINT_PHYSICS_SETUP_H
|
||||||
|
|
||||||
class CommonExampleInterface* ConstraintCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option);
|
class CommonExampleInterface* ConstraintCreateFunc(struct CommonExampleOptions& options);
|
||||||
|
|
||||||
#endif //CONSTAINT_PHYSICS_SETUP_H
|
#endif //CONSTAINT_PHYSICS_SETUP_H
|
||||||
|
|||||||
@@ -51,6 +51,15 @@ struct Dof6Spring2Setup : public CommonRigidBodyBase
|
|||||||
virtual void stepSimulation(float deltaTime);
|
virtual void stepSimulation(float deltaTime);
|
||||||
|
|
||||||
void animate();
|
void animate();
|
||||||
|
|
||||||
|
virtual void resetCamera()
|
||||||
|
{
|
||||||
|
float dist = 5;
|
||||||
|
float pitch = 722;
|
||||||
|
float yaw = 35;
|
||||||
|
float targetPos[3]={4,2,-11};
|
||||||
|
m_guiHelper->resetCamera(dist,pitch,yaw,targetPos[0],targetPos[1],targetPos[2]);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -475,7 +484,7 @@ void Dof6Spring2Setup::stepSimulation(float deltaTime)
|
|||||||
m_dynamicsWorld->stepSimulation(deltaTime);
|
m_dynamicsWorld->stepSimulation(deltaTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
class CommonExampleInterface* Dof6Spring2CreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option)
|
class CommonExampleInterface* Dof6Spring2CreateFunc( CommonExampleOptions& options)
|
||||||
{
|
{
|
||||||
return new Dof6Spring2Setup(helper);
|
return new Dof6Spring2Setup(options.m_guiHelper);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#ifndef GENERIC_6DOF_SPRING2_CONSTRAINT_DEMO_H
|
#ifndef GENERIC_6DOF_SPRING2_CONSTRAINT_DEMO_H
|
||||||
#define GENERIC_6DOF_SPRING2_CONSTRAINT_DEMO_H
|
#define GENERIC_6DOF_SPRING2_CONSTRAINT_DEMO_H
|
||||||
|
|
||||||
class CommonExampleInterface* Dof6Spring2CreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option);
|
class CommonExampleInterface* Dof6Spring2CreateFunc(struct CommonExampleOptions& options);
|
||||||
|
|
||||||
#endif //GENERIC_6DOF_SPRING2_CONSTRAINT_DEMO_H
|
#endif //GENERIC_6DOF_SPRING2_CONSTRAINT_DEMO_H
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ public:
|
|||||||
EmptyExample() {}
|
EmptyExample() {}
|
||||||
virtual ~EmptyExample(){}
|
virtual ~EmptyExample(){}
|
||||||
|
|
||||||
static CommonExampleInterface* CreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option)
|
static CommonExampleInterface* CreateFunc(struct CommonExampleOptions& /* unusedOptions*/)
|
||||||
{
|
{
|
||||||
return new EmptyExample;
|
return new EmptyExample;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,14 +61,14 @@ static ExampleEntry gDefaultExamples[]=
|
|||||||
ExampleEntry(1,"Gyroscopic", "Show the Dzhanibekov effect using various settings of the gyroscopic term. You can select the gyroscopic term computation using btRigidBody::setFlags, with arguments BT_ENABLE_GYROSCOPIC_FORCE_EXPLICIT (using explicit integration, which adds energy and can lead to explosions), BT_ENABLE_GYROSCOPIC_FORCE_IMPLICIT_WORLD, BT_ENABLE_GYROSCOPIC_FORCE_IMPLICIT_BODY. If you don't set any of these flags, there is no gyroscopic term used.", GyroscopicCreateFunc),
|
ExampleEntry(1,"Gyroscopic", "Show the Dzhanibekov effect using various settings of the gyroscopic term. You can select the gyroscopic term computation using btRigidBody::setFlags, with arguments BT_ENABLE_GYROSCOPIC_FORCE_EXPLICIT (using explicit integration, which adds energy and can lead to explosions), BT_ENABLE_GYROSCOPIC_FORCE_IMPLICIT_WORLD, BT_ENABLE_GYROSCOPIC_FORCE_IMPLICIT_BODY. If you don't set any of these flags, there is no gyroscopic term used.", GyroscopicCreateFunc),
|
||||||
|
|
||||||
ExampleEntry(1,"Planar 2D","Show the use of 2D collision shapes and rigid body simulation. The collision shape is wrapped into a btConvex2dShape. The rigid bodies are restricted in a plane using the 'setAngularFactor' and 'setLinearFactor' API call.",Planar2DCreateFunc),
|
ExampleEntry(1,"Planar 2D","Show the use of 2D collision shapes and rigid body simulation. The collision shape is wrapped into a btConvex2dShape. The rigid bodies are restricted in a plane using the 'setAngularFactor' and 'setLinearFactor' API call.",Planar2DCreateFunc),
|
||||||
ExampleEntry(1,"Constraints","Use of a btHingeConstraint. You can adjust the first slider to change the target velocity, and the second slider to adjust the maximum impulse applied to reach the target velocity. Note that the hinge angle can reach beyond -360 and 360 degrees.", ConstraintCreateFunc),
|
|
||||||
ExampleEntry(1,"6DofSpring2","Show the use of the btGeneric6DofSpring2Constraint.",
|
ExampleEntry(1,"6DofSpring2","Show the use of the btGeneric6DofSpring2Constraint.",
|
||||||
Dof6Spring2CreateFunc),
|
Dof6Spring2CreateFunc),
|
||||||
|
|
||||||
ExampleEntry(1,"Constraints","Show the use of the various constraints in Bullet.",
|
ExampleEntry(1,"Constraints","Show the use of the various constraints in Bullet.",
|
||||||
AllConstraintCreateFunc),
|
AllConstraintCreateFunc),
|
||||||
|
|
||||||
|
ExampleEntry(1,"Motorized Hinge","Use of a btHingeConstraint. You can adjust the first slider to change the target velocity, and the second slider to adjust the maximum impulse applied to reach the target velocity. Note that the hinge angle can reach beyond -360 and 360 degrees.", ConstraintCreateFunc),
|
||||||
|
|
||||||
ExampleEntry(0,"MultiBody"),
|
ExampleEntry(0,"MultiBody"),
|
||||||
ExampleEntry(1,"MultiDofCreateFunc","Create a basic btMultiBody with 3-DOF spherical joints (mobilizers). The demo uses a fixed base or a floating base at restart.", MultiDofCreateFunc),
|
ExampleEntry(1,"MultiDofCreateFunc","Create a basic btMultiBody with 3-DOF spherical joints (mobilizers). The demo uses a fixed base or a floating base at restart.", MultiDofCreateFunc),
|
||||||
ExampleEntry(1,"TestJointTorque","Apply a torque to a btMultiBody with 1-DOF joints (mobilizers).", TestJointTorqueCreateFunc),
|
ExampleEntry(1,"TestJointTorque","Apply a torque to a btMultiBody with 1-DOF joints (mobilizers).", TestJointTorqueCreateFunc),
|
||||||
@@ -164,16 +164,20 @@ static ExampleEntry gDefaultExamples[]=
|
|||||||
ExampleEntry(1,"Implicit Cloth", "Cloth simulation using implicit integration, by Stan Melax. The cloth is only attached at the corners. Note the stability using a large time step even with high stiffness.",
|
ExampleEntry(1,"Implicit Cloth", "Cloth simulation using implicit integration, by Stan Melax. The cloth is only attached at the corners. Note the stability using a large time step even with high stiffness.",
|
||||||
ImplicitClothCreateFunc),
|
ImplicitClothCreateFunc),
|
||||||
|
|
||||||
#ifdef B3_USE_CLEW
|
|
||||||
ExampleEntry(0,"OpenCL (experimental)"),
|
|
||||||
ExampleEntry(1,"Pair Bench", "Benchmark of overlapping pair search using OpenCL.", PairBenchOpenCLCreateFunc),
|
|
||||||
#endif //
|
|
||||||
ExampleEntry(0,"Rendering"),
|
ExampleEntry(0,"Rendering"),
|
||||||
ExampleEntry(1,"Instanced Rendering", "Simple example of fast instanced rendering, only active when using OpenGL3+.",RenderInstancingCreateFunc),
|
ExampleEntry(1,"Instanced Rendering", "Simple example of fast instanced rendering, only active when using OpenGL3+.",RenderInstancingCreateFunc),
|
||||||
ExampleEntry(1,"CoordinateSystemDemo","Show the axis and positive rotation direction around the axis.", CoordinateSystemCreateFunc),
|
ExampleEntry(1,"CoordinateSystemDemo","Show the axis and positive rotation direction around the axis.", CoordinateSystemCreateFunc),
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static ExampleEntry gOpenCLExamples[]=
|
||||||
|
{
|
||||||
|
#ifdef B3_USE_CLEW
|
||||||
|
ExampleEntry(0,"OpenCL (experimental)"),
|
||||||
|
ExampleEntry(1,"Pair Bench", "Benchmark of overlapping pair search using OpenCL.", PairBenchOpenCLCreateFunc),
|
||||||
|
#endif //
|
||||||
|
};
|
||||||
|
|
||||||
static btAlignedObjectArray<ExampleEntry> gAdditionalRegisteredExamples;
|
static btAlignedObjectArray<ExampleEntry> gAdditionalRegisteredExamples;
|
||||||
|
|
||||||
@@ -193,6 +197,15 @@ ExampleEntries::~ExampleEntries()
|
|||||||
delete m_data;
|
delete m_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ExampleEntries::initOpenCLExampleEntries()
|
||||||
|
{
|
||||||
|
int numDefaultEntries = sizeof(gOpenCLExamples)/sizeof(ExampleEntry);
|
||||||
|
for (int i=0;i<numDefaultEntries;i++)
|
||||||
|
{
|
||||||
|
m_data->m_allExamples.push_back(gOpenCLExamples[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ExampleEntries::initExampleEntries()
|
void ExampleEntries::initExampleEntries()
|
||||||
{
|
{
|
||||||
m_data->m_allExamples.clear();
|
m_data->m_allExamples.clear();
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ public:
|
|||||||
static void registerExampleEntry(int menuLevel, const char* name,const char* description, CommonExampleInterface::CreateFunc* createFunc, int option=0);
|
static void registerExampleEntry(int menuLevel, const char* name,const char* description, CommonExampleInterface::CreateFunc* createFunc, int option=0);
|
||||||
|
|
||||||
void initExampleEntries();
|
void initExampleEntries();
|
||||||
|
|
||||||
|
void initOpenCLExampleEntries();
|
||||||
|
|
||||||
int getNumRegisteredExamples();
|
int getNumRegisteredExamples();
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,9 @@
|
|||||||
#include "ExampleEntries.h"
|
#include "ExampleEntries.h"
|
||||||
#include "OpenGLGuiHelper.h"
|
#include "OpenGLGuiHelper.h"
|
||||||
#include "LinearMath/btIDebugDraw.h"
|
#include "LinearMath/btIDebugDraw.h"
|
||||||
|
//quick test for file import, @todo(erwincoumans) make it more general and add other file formats
|
||||||
|
#include "../Importers/ImportURDFDemo/ImportURDFSetup.h"
|
||||||
|
|
||||||
static CommonGraphicsApp* s_app=0;
|
static CommonGraphicsApp* s_app=0;
|
||||||
|
|
||||||
static CommonWindowInterface* s_window = 0;
|
static CommonWindowInterface* s_window = 0;
|
||||||
@@ -46,7 +49,7 @@ static MyProfileWindow* s_profWindow =0;
|
|||||||
const char* startFileName = "bulletDemo.txt";
|
const char* startFileName = "bulletDemo.txt";
|
||||||
|
|
||||||
static GwenUserInterface* gui = 0;
|
static GwenUserInterface* gui = 0;
|
||||||
static int sCurrentDemoIndex = 0;
|
static int sCurrentDemoIndex = -1;
|
||||||
static int sCurrentHightlighted = 0;
|
static int sCurrentHightlighted = 0;
|
||||||
static CommonExampleInterface* sCurrentDemo = 0;
|
static CommonExampleInterface* sCurrentDemo = 0;
|
||||||
static b3AlignedObjectArray<const char*> allNames;
|
static b3AlignedObjectArray<const char*> allNames;
|
||||||
@@ -190,38 +193,49 @@ static void MyMouseButtonCallback(int button, int state, float x, float y)
|
|||||||
|
|
||||||
void openURDFDemo(const char* filename)
|
void openURDFDemo(const char* filename)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
if (sCurrentDemo)
|
if (sCurrentDemo)
|
||||||
{
|
{
|
||||||
sCurrentDemo->exitPhysics();
|
sCurrentDemo->exitPhysics();
|
||||||
s_instancingRenderer->removeAllInstances();
|
s_instancingRenderer->removeAllInstances();
|
||||||
delete sCurrentDemo;
|
delete sCurrentDemo;
|
||||||
sCurrentDemo=0;
|
sCurrentDemo=0;
|
||||||
|
delete s_guiHelper;
|
||||||
|
s_guiHelper = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s_guiHelper= new OpenGLGuiHelper(s_app, sUseOpenGL2);
|
||||||
s_parameterInterface->removeAllParameters();
|
s_parameterInterface->removeAllParameters();
|
||||||
|
|
||||||
ImportUrdfSetup* physicsSetup = new ImportUrdfSetup();
|
|
||||||
physicsSetup->setFileName(filename);
|
|
||||||
|
|
||||||
sCurrentDemo = new BasicDemo(s_app, physicsSetup);
|
CommonExampleOptions options(s_guiHelper,0);
|
||||||
s_app->setUpAxis(2);
|
options.m_fileName = filename;
|
||||||
|
|
||||||
|
sCurrentDemo = ImportURDFCreateFunc(options);
|
||||||
|
|
||||||
|
//physicsSetup->setFileName(filename);
|
||||||
|
|
||||||
|
|
||||||
if (sCurrentDemo)
|
if (sCurrentDemo)
|
||||||
{
|
{
|
||||||
sCurrentDemo->initPhysics();
|
sCurrentDemo->initPhysics();
|
||||||
|
sCurrentDemo->resetCamera();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void selectDemo(int demoIndex)
|
void selectDemo(int demoIndex)
|
||||||
{
|
{
|
||||||
|
bool resetCamera = (sCurrentDemoIndex != demoIndex);
|
||||||
sCurrentDemoIndex = demoIndex;
|
sCurrentDemoIndex = demoIndex;
|
||||||
sCurrentHightlighted = demoIndex;
|
sCurrentHightlighted = demoIndex;
|
||||||
int numDemos = gAllExamples->getNumRegisteredExamples();
|
int numDemos = gAllExamples->getNumRegisteredExamples();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (demoIndex>numDemos)
|
if (demoIndex>numDemos)
|
||||||
{
|
{
|
||||||
demoIndex = 0;
|
demoIndex = 0;
|
||||||
@@ -241,7 +255,7 @@ void selectDemo(int demoIndex)
|
|||||||
s_parameterInterface->removeAllParameters();
|
s_parameterInterface->removeAllParameters();
|
||||||
int option = gAllExamples->getExampleOption(demoIndex);
|
int option = gAllExamples->getExampleOption(demoIndex);
|
||||||
s_guiHelper= new OpenGLGuiHelper(s_app, sUseOpenGL2);
|
s_guiHelper= new OpenGLGuiHelper(s_app, sUseOpenGL2);
|
||||||
sCurrentDemo = (*func)(0,s_guiHelper, option);
|
sCurrentDemo = (*func)(CommonExampleOptions(s_guiHelper, option));
|
||||||
if (sCurrentDemo)
|
if (sCurrentDemo)
|
||||||
{
|
{
|
||||||
if (gui)
|
if (gui)
|
||||||
@@ -251,7 +265,12 @@ void selectDemo(int demoIndex)
|
|||||||
}
|
}
|
||||||
b3Printf("Selected demo: %s",gAllExamples->getExampleName(demoIndex));
|
b3Printf("Selected demo: %s",gAllExamples->getExampleName(demoIndex));
|
||||||
gui->setExampleDescription(gAllExamples->getExampleDescription(demoIndex));
|
gui->setExampleDescription(gAllExamples->getExampleDescription(demoIndex));
|
||||||
|
|
||||||
sCurrentDemo->initPhysics();
|
sCurrentDemo->initPhysics();
|
||||||
|
if(resetCamera)
|
||||||
|
{
|
||||||
|
sCurrentDemo->resetCamera();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -544,14 +563,24 @@ bool OpenGLExampleBrowser::init(int argc, char* argv[])
|
|||||||
SimpleOpenGL3App* simpleApp=0;
|
SimpleOpenGL3App* simpleApp=0;
|
||||||
sUseOpenGL2 =args.CheckCmdLineFlag("opengl2");
|
sUseOpenGL2 =args.CheckCmdLineFlag("opengl2");
|
||||||
|
|
||||||
|
const char* appTitle = "Bullet Physics ExampleBrowser";
|
||||||
|
#if defined (_DEBUG) || defined (DEBUG)
|
||||||
|
const char* optMode = "Debug build (slow)";
|
||||||
|
#else
|
||||||
|
const char* optMode = "Release build";
|
||||||
|
#endif
|
||||||
|
|
||||||
if (sUseOpenGL2 )
|
if (sUseOpenGL2 )
|
||||||
{
|
{
|
||||||
|
char title[1024];
|
||||||
s_app = new SimpleOpenGL2App("AllBullet2Demos",width,height);
|
sprintf(title,"%s using OpenGL2 fallback. %s", appTitle,optMode);
|
||||||
|
s_app = new SimpleOpenGL2App(title,width,height);
|
||||||
s_app->m_renderer = new SimpleOpenGL2Renderer(width,height);
|
s_app->m_renderer = new SimpleOpenGL2Renderer(width,height);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
simpleApp = new SimpleOpenGL3App("AllBullet2Demos",width,height);
|
char title[1024];
|
||||||
|
sprintf(title,"%s using OpenGL3+. %s", appTitle,optMode);
|
||||||
|
simpleApp = new SimpleOpenGL3App(title,width,height);
|
||||||
s_app = simpleApp;
|
s_app = simpleApp;
|
||||||
}
|
}
|
||||||
char* gVideoFileName = 0;
|
char* gVideoFileName = 0;
|
||||||
@@ -692,6 +721,7 @@ bool OpenGLExampleBrowser::init(int argc, char* argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
gui->registerFileOpenCallback(fileOpenCallback);
|
gui->registerFileOpenCallback(fileOpenCallback);
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -775,6 +805,22 @@ void OpenGLExampleBrowser::update(float deltaTime)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
if (s_guiHelper && s_guiHelper->getRenderInterface() && s_guiHelper->getRenderInterface()->getActiveCamera())
|
||||||
|
{
|
||||||
|
char msg[1024];
|
||||||
|
float camDist = s_guiHelper->getRenderInterface()->getActiveCamera()->getCameraDistance();
|
||||||
|
float pitch = s_guiHelper->getRenderInterface()->getActiveCamera()->getCameraPitch();
|
||||||
|
float yaw = s_guiHelper->getRenderInterface()->getActiveCamera()->getCameraYaw();
|
||||||
|
float camTarget[3];
|
||||||
|
s_guiHelper->getRenderInterface()->getActiveCamera()->getCameraTargetPosition(camTarget);
|
||||||
|
sprintf(msg,"dist=%f, pitch=%f, yaw=%f,target=%f,%f,%f", camDist,pitch,yaw,camTarget[0],camTarget[1],camTarget[2]);
|
||||||
|
gui->setStatusBarMessage(msg, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
static int toggle = 1;
|
static int toggle = 1;
|
||||||
if (1)
|
if (1)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ public:
|
|||||||
static btVector4 sColors[4] =
|
static btVector4 sColors[4] =
|
||||||
{
|
{
|
||||||
btVector4(0.3,0.3,1,1),
|
btVector4(0.3,0.3,1,1),
|
||||||
btVector4(1,0,0,1),
|
btVector4(0.6,0.6,1,1),
|
||||||
btVector4(0,1,0,1),
|
btVector4(0,1,0,1),
|
||||||
btVector4(0,1,1,1),
|
btVector4(0,1,1,1),
|
||||||
//btVector4(1,1,0,1),
|
//btVector4(1,1,0,1),
|
||||||
@@ -128,7 +128,6 @@ struct OpenGLGuiHelperInternalData
|
|||||||
{
|
{
|
||||||
struct CommonGraphicsApp* m_glApp;
|
struct CommonGraphicsApp* m_glApp;
|
||||||
class MyDebugDrawer* m_debugDraw;
|
class MyDebugDrawer* m_debugDraw;
|
||||||
int m_curColor;
|
|
||||||
GL_ShapeDrawer* m_gl2ShapeDrawer;
|
GL_ShapeDrawer* m_gl2ShapeDrawer;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -139,7 +138,7 @@ OpenGLGuiHelper::OpenGLGuiHelper(CommonGraphicsApp* glApp, bool useOpenGL2)
|
|||||||
m_data = new OpenGLGuiHelperInternalData;
|
m_data = new OpenGLGuiHelperInternalData;
|
||||||
m_data->m_glApp = glApp;
|
m_data->m_glApp = glApp;
|
||||||
m_data->m_debugDraw = 0;
|
m_data->m_debugDraw = 0;
|
||||||
m_data->m_curColor = 0;
|
|
||||||
m_data->m_gl2ShapeDrawer = 0;
|
m_data->m_gl2ShapeDrawer = 0;
|
||||||
|
|
||||||
if (useOpenGL2)
|
if (useOpenGL2)
|
||||||
@@ -487,15 +486,20 @@ void OpenGLGuiHelper::setUpAxis(int axis)
|
|||||||
m_data->m_glApp->setUpAxis(axis);
|
m_data->m_glApp->setUpAxis(axis);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OpenGLGuiHelper::resetCamera(float camDist, float pitch, float yaw, float camPosX,float camPosY, float camPosZ)
|
||||||
btVector3 OpenGLGuiHelper::selectColor()
|
|
||||||
{
|
{
|
||||||
btVector4 color = sColors[m_data->m_curColor];
|
if (getRenderInterface() && getRenderInterface()->getActiveCamera())
|
||||||
m_data->m_curColor++;
|
{
|
||||||
m_data->m_curColor&=3;
|
getRenderInterface()->getActiveCamera()->setCameraDistance(camDist);
|
||||||
return color;
|
getRenderInterface()->getActiveCamera()->setCameraPitch(pitch);
|
||||||
|
getRenderInterface()->getActiveCamera()->setCameraYaw(yaw);
|
||||||
|
getRenderInterface()->getActiveCamera()->setCameraTargetPosition(camPosX,camPosY,camPosZ);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct MyConvertPointerSizeT
|
struct MyConvertPointerSizeT
|
||||||
{
|
{
|
||||||
union
|
union
|
||||||
@@ -530,7 +534,9 @@ void OpenGLGuiHelper::autogenerateGraphicsObjects(btDiscreteDynamicsWorld* rbWor
|
|||||||
//btRigidBody* body = btRigidBody::upcast(colObj);
|
//btRigidBody* body = btRigidBody::upcast(colObj);
|
||||||
//does this also work for btMultiBody/btMultiBodyLinkCollider?
|
//does this also work for btMultiBody/btMultiBodyLinkCollider?
|
||||||
createCollisionShapeGraphicsObject(colObj->getCollisionShape());
|
createCollisionShapeGraphicsObject(colObj->getCollisionShape());
|
||||||
btVector3 color= selectColor();
|
int colorIndex = colObj->getBroadphaseHandle()->getUid() & 3;
|
||||||
|
|
||||||
|
btVector3 color= sColors[colorIndex];
|
||||||
createCollisionObjectGraphicsObject(colObj,color);
|
createCollisionObjectGraphicsObject(colObj,color);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -546,3 +552,4 @@ struct CommonGraphicsApp* OpenGLGuiHelper::getAppInterface()
|
|||||||
{
|
{
|
||||||
return m_data->m_glApp;
|
return m_data->m_glApp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ struct OpenGLGuiHelper : public GUIHelperInterface
|
|||||||
virtual void syncPhysicsToGraphics(const btDiscreteDynamicsWorld* rbWorld);
|
virtual void syncPhysicsToGraphics(const btDiscreteDynamicsWorld* rbWorld);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
virtual void render(const btDiscreteDynamicsWorld* rbWorld);
|
virtual void render(const btDiscreteDynamicsWorld* rbWorld);
|
||||||
|
|
||||||
virtual void createPhysicsDebugDrawer(btDiscreteDynamicsWorld* rbWorld);
|
virtual void createPhysicsDebugDrawer(btDiscreteDynamicsWorld* rbWorld);
|
||||||
@@ -42,10 +41,9 @@ struct OpenGLGuiHelper : public GUIHelperInterface
|
|||||||
|
|
||||||
virtual struct CommonGraphicsApp* getAppInterface();
|
virtual struct CommonGraphicsApp* getAppInterface();
|
||||||
|
|
||||||
|
|
||||||
virtual void setUpAxis(int axis);
|
virtual void setUpAxis(int axis);
|
||||||
|
|
||||||
btVector3 selectColor();
|
virtual void resetCamera(float camDist, float pitch, float yaw, float camPosX,float camPosY, float camPosZ);
|
||||||
|
|
||||||
virtual void autogenerateGraphicsObjects(btDiscreteDynamicsWorld* rbWorld) ;
|
virtual void autogenerateGraphicsObjects(btDiscreteDynamicsWorld* rbWorld) ;
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
ExampleEntries examples;
|
ExampleEntries examples;
|
||||||
examples.initExampleEntries();
|
examples.initExampleEntries();
|
||||||
|
examples.initOpenCLExampleEntries();
|
||||||
|
|
||||||
ExampleBrowserInterface* exampleBrowser = new DefaultBrowser(&examples);
|
ExampleBrowserInterface* exampleBrowser = new DefaultBrowser(&examples);
|
||||||
bool init = exampleBrowser->init(argc,argv);
|
bool init = exampleBrowser->init(argc,argv);
|
||||||
|
|||||||
@@ -56,6 +56,14 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void resetCamera()
|
||||||
|
{
|
||||||
|
float dist = 10;
|
||||||
|
float pitch = 62;
|
||||||
|
float yaw = 33;
|
||||||
|
float targetPos[3]={-3,2.4,-3.6};
|
||||||
|
m_guiHelper->resetCamera(dist,pitch,yaw,targetPos[0],targetPos[1],targetPos[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -64,6 +72,7 @@ public:
|
|||||||
void ImplicitClothExample::initPhysics()
|
void ImplicitClothExample::initPhysics()
|
||||||
{
|
{
|
||||||
float size=10;
|
float size=10;
|
||||||
|
m_guiHelper->setUpAxis(1);
|
||||||
m_cloth = ClothCreate(numX,numY,size);
|
m_cloth = ClothCreate(numX,numY,size);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -114,7 +123,7 @@ void ImplicitClothExample::physicsDebugDraw(int debugFlags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class CommonExampleInterface* ImplicitClothCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option)
|
class CommonExampleInterface* ImplicitClothCreateFunc(struct CommonExampleOptions& options)
|
||||||
{
|
{
|
||||||
return new ImplicitClothExample(helper, option);
|
return new ImplicitClothExample(options.m_guiHelper, options.m_option);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef IMPLICIT_CLOTH_EXAMPLE_H
|
#ifndef IMPLICIT_CLOTH_EXAMPLE_H
|
||||||
#define IMPLICIT_CLOTH_EXAMPLE_H
|
#define IMPLICIT_CLOTH_EXAMPLE_H
|
||||||
|
|
||||||
class CommonExampleInterface* ImplicitClothCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option);
|
class CommonExampleInterface* ImplicitClothCreateFunc(struct CommonExampleOptions& options);
|
||||||
|
|
||||||
|
|
||||||
#endif //IMPLICIT_CLOTH_EXAMPLE_H
|
#endif //IMPLICIT_CLOTH_EXAMPLE_H
|
||||||
|
|||||||
@@ -141,6 +141,15 @@ class ForkLiftDemo : public CommonExampleInterface
|
|||||||
void initPhysics();
|
void initPhysics();
|
||||||
void exitPhysics();
|
void exitPhysics();
|
||||||
|
|
||||||
|
virtual void resetCamera()
|
||||||
|
{
|
||||||
|
float dist = 8;
|
||||||
|
float pitch = -45;
|
||||||
|
float yaw = 32;
|
||||||
|
float targetPos[3]={-0.33,-0.72,4.5};
|
||||||
|
m_guiHelper->resetCamera(dist,pitch,yaw,targetPos[0],targetPos[1],targetPos[2]);
|
||||||
|
}
|
||||||
|
|
||||||
/*static DemoApplication* Create()
|
/*static DemoApplication* Create()
|
||||||
{
|
{
|
||||||
ForkLiftDemo* demo = new ForkLiftDemo();
|
ForkLiftDemo* demo = new ForkLiftDemo();
|
||||||
@@ -1200,7 +1209,7 @@ btRigidBody* ForkLiftDemo::localCreateRigidBody(btScalar mass, const btTransform
|
|||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommonExampleInterface* ForkLiftCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option)
|
CommonExampleInterface* ForkLiftCreateFunc(struct CommonExampleOptions& options)
|
||||||
{
|
{
|
||||||
return new ForkLiftDemo(helper);
|
return new ForkLiftDemo(options.m_guiHelper);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ subject to the following restrictions:
|
|||||||
#ifndef FORKLIFT_DEMO_H
|
#ifndef FORKLIFT_DEMO_H
|
||||||
#define FORKLIFT_DEMO_H
|
#define FORKLIFT_DEMO_H
|
||||||
|
|
||||||
class CommonExampleInterface* ForkLiftCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option);
|
class CommonExampleInterface* ForkLiftCreateFunc(struct CommonExampleOptions& options);
|
||||||
|
|
||||||
#endif // FORKLIFT_DEMO_H
|
#endif // FORKLIFT_DEMO_H
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,15 @@ struct GyroscopicSetup : public CommonRigidBodyBase
|
|||||||
|
|
||||||
virtual void physicsDebugDraw(int debugFlags);
|
virtual void physicsDebugDraw(int debugFlags);
|
||||||
|
|
||||||
|
void resetCamera()
|
||||||
|
{
|
||||||
|
float dist = 20;
|
||||||
|
float pitch = 180;
|
||||||
|
float yaw = 16;
|
||||||
|
float targetPos[3]={-2.4,0.4,-0.24};
|
||||||
|
m_guiHelper->resetCamera(dist,pitch,yaw,targetPos[0],targetPos[1],targetPos[2]);
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -123,7 +132,7 @@ void GyroscopicSetup::physicsDebugDraw(int debugFlags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class CommonExampleInterface* GyroscopicCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option)
|
class CommonExampleInterface* GyroscopicCreateFunc(CommonExampleOptions& options)
|
||||||
{
|
{
|
||||||
return new GyroscopicSetup(helper);
|
return new GyroscopicSetup(options.m_guiHelper);
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,6 @@
|
|||||||
#ifndef GYROSCOPIC_SETUP_H
|
#ifndef GYROSCOPIC_SETUP_H
|
||||||
#define GYROSCOPIC_SETUP_H
|
#define GYROSCOPIC_SETUP_H
|
||||||
|
|
||||||
class CommonExampleInterface* GyroscopicCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option);
|
class CommonExampleInterface* GyroscopicCreateFunc(struct CommonExampleOptions& options);
|
||||||
|
|
||||||
#endif //GYROSCOPIC_SETUP_H
|
#endif //GYROSCOPIC_SETUP_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
project "AppHelloWorld"
|
project "App_HelloWorld"
|
||||||
|
|
||||||
if _OPTIONS["ios"] then
|
if _OPTIONS["ios"] then
|
||||||
kind "WindowedApp"
|
kind "WindowedApp"
|
||||||
|
|||||||
@@ -64,6 +64,14 @@ class BspDemo : public CommonRigidBodyBase
|
|||||||
|
|
||||||
void initPhysics(const char* bspfilename);
|
void initPhysics(const char* bspfilename);
|
||||||
|
|
||||||
|
virtual void resetCamera()
|
||||||
|
{
|
||||||
|
float dist = 43;
|
||||||
|
float pitch = -175;
|
||||||
|
float yaw = 12;
|
||||||
|
float targetPos[3]={4,-25,-6};
|
||||||
|
m_guiHelper->resetCamera(dist,pitch,yaw,targetPos[0],targetPos[1],targetPos[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -277,9 +285,9 @@ char* makeExeToBspFilename(const char* lpCmdLine)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct CommonExampleInterface* ImportBspCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option)
|
struct CommonExampleInterface* ImportBspCreateFunc(struct CommonExampleOptions& options)
|
||||||
{
|
{
|
||||||
BspDemo* demo = new BspDemo(helper);
|
BspDemo* demo = new BspDemo(options.m_guiHelper);
|
||||||
|
|
||||||
demo->initPhysics("BspDemo.bsp");
|
demo->initPhysics("BspDemo.bsp");
|
||||||
return demo;
|
return demo;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ subject to the following restrictions:
|
|||||||
#ifndef BSP_DEMO_H
|
#ifndef BSP_DEMO_H
|
||||||
#define BSP_DEMO_H
|
#define BSP_DEMO_H
|
||||||
|
|
||||||
class CommonExampleInterface* ImportBspCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option);
|
class CommonExampleInterface* ImportBspCreateFunc(struct CommonExampleOptions& options);
|
||||||
|
|
||||||
|
|
||||||
#endif //BSP_DEMO_H
|
#endif //BSP_DEMO_H
|
||||||
|
|||||||
@@ -12,6 +12,16 @@ public:
|
|||||||
|
|
||||||
virtual void initPhysics();
|
virtual void initPhysics();
|
||||||
virtual void stepSimulation(float deltaTime);
|
virtual void stepSimulation(float deltaTime);
|
||||||
|
|
||||||
|
virtual void resetCamera()
|
||||||
|
{
|
||||||
|
float dist = 9.5;
|
||||||
|
float pitch = -2.8;
|
||||||
|
float yaw = 20;
|
||||||
|
float targetPos[3]={-0.2,-1.4,3.5};
|
||||||
|
m_guiHelper->resetCamera(dist,pitch,yaw,targetPos[0],targetPos[1],targetPos[2]);
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -89,7 +99,7 @@ void SerializeSetup::stepSimulation(float deltaTime)
|
|||||||
CommonRigidBodyBase::stepSimulation(deltaTime);
|
CommonRigidBodyBase::stepSimulation(deltaTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
class CommonExampleInterface* SerializeBulletCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option)
|
class CommonExampleInterface* SerializeBulletCreateFunc(struct CommonExampleOptions& options)
|
||||||
{
|
{
|
||||||
return new SerializeSetup(helper);
|
return new SerializeSetup(options.m_guiHelper);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef SERIALIZE_SETUP_H
|
#ifndef SERIALIZE_SETUP_H
|
||||||
#define SERIALIZE_SETUP_H
|
#define SERIALIZE_SETUP_H
|
||||||
|
|
||||||
class CommonExampleInterface* SerializeBulletCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option);
|
class CommonExampleInterface* SerializeBulletCreateFunc(struct CommonExampleOptions& options);
|
||||||
|
|
||||||
|
|
||||||
#endif //SERIALIZE_SETUP_H
|
#endif //SERIALIZE_SETUP_H
|
||||||
|
|||||||
@@ -37,6 +37,15 @@ public:
|
|||||||
virtual ~ImportColladaSetup();
|
virtual ~ImportColladaSetup();
|
||||||
|
|
||||||
virtual void initPhysics();
|
virtual void initPhysics();
|
||||||
|
virtual void resetCamera()
|
||||||
|
{
|
||||||
|
float dist = 16;
|
||||||
|
float pitch = -140;
|
||||||
|
float yaw = 28;
|
||||||
|
float targetPos[3]={-4,-3,-3};
|
||||||
|
m_guiHelper->resetCamera(dist,pitch,yaw,targetPos[0],targetPos[1],targetPos[2]);
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ImportColladaSetup::ImportColladaSetup(struct GUIHelperInterface* helper)
|
ImportColladaSetup::ImportColladaSetup(struct GUIHelperInterface* helper)
|
||||||
@@ -197,7 +206,7 @@ void ImportColladaSetup::initPhysics()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class CommonExampleInterface* ImportColladaCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option)
|
class CommonExampleInterface* ImportColladaCreateFunc(struct CommonExampleOptions& options)
|
||||||
{
|
{
|
||||||
return new ImportColladaSetup(helper);
|
return new ImportColladaSetup(options.m_guiHelper);
|
||||||
}
|
}
|
||||||
@@ -19,7 +19,7 @@ subject to the following restrictions:
|
|||||||
#ifndef IMPORT_COLLADA_SETUP_H
|
#ifndef IMPORT_COLLADA_SETUP_H
|
||||||
#define IMPORT_COLLADA_SETUP_H
|
#define IMPORT_COLLADA_SETUP_H
|
||||||
|
|
||||||
class CommonExampleInterface* ImportColladaCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option);
|
class CommonExampleInterface* ImportColladaCreateFunc(struct CommonExampleOptions& options);
|
||||||
|
|
||||||
|
|
||||||
#endif //IMPORT_COLLADA_SETUP_H
|
#endif //IMPORT_COLLADA_SETUP_H
|
||||||
|
|||||||
@@ -19,6 +19,16 @@ public:
|
|||||||
virtual ~ImportObjSetup();
|
virtual ~ImportObjSetup();
|
||||||
|
|
||||||
virtual void initPhysics();
|
virtual void initPhysics();
|
||||||
|
|
||||||
|
virtual void resetCamera()
|
||||||
|
{
|
||||||
|
float dist = 50;
|
||||||
|
float pitch = 61;
|
||||||
|
float yaw = 18;
|
||||||
|
float targetPos[3]={-15,-15,47};
|
||||||
|
m_guiHelper->resetCamera(dist,pitch,yaw,targetPos[0],targetPos[1],targetPos[2]);
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ImportObjSetup::ImportObjSetup(struct GUIHelperInterface* helper)
|
ImportObjSetup::ImportObjSetup(struct GUIHelperInterface* helper)
|
||||||
@@ -99,7 +109,7 @@ void ImportObjSetup::initPhysics()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CommonExampleInterface* ImportObjCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option)
|
CommonExampleInterface* ImportObjCreateFunc(struct CommonExampleOptions& options)
|
||||||
{
|
{
|
||||||
return new ImportObjSetup(helper);
|
return new ImportObjSetup(options.m_guiHelper);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef IMPORT_OBJ_EXAMPLE_H
|
#ifndef IMPORT_OBJ_EXAMPLE_H
|
||||||
#define IMPORT_OBJ_EXAMPLE_H
|
#define IMPORT_OBJ_EXAMPLE_H
|
||||||
|
|
||||||
class CommonExampleInterface* ImportObjCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option);
|
class CommonExampleInterface* ImportObjCreateFunc(struct CommonExampleOptions& options);
|
||||||
|
|
||||||
|
|
||||||
#endif //IMPORT_OBJ_EXAMPLE_H
|
#endif //IMPORT_OBJ_EXAMPLE_H
|
||||||
|
|||||||
@@ -18,6 +18,15 @@ public:
|
|||||||
virtual ~ImportSTLSetup();
|
virtual ~ImportSTLSetup();
|
||||||
|
|
||||||
virtual void initPhysics();
|
virtual void initPhysics();
|
||||||
|
virtual void resetCamera()
|
||||||
|
{
|
||||||
|
float dist = 3.5;
|
||||||
|
float pitch = -136;
|
||||||
|
float yaw = 28;
|
||||||
|
float targetPos[3]={0.47,0,-0.64};
|
||||||
|
m_guiHelper->resetCamera(dist,pitch,yaw,targetPos[0],targetPos[1],targetPos[2]);
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -92,7 +101,7 @@ void ImportSTLSetup::initPhysics()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class CommonExampleInterface* ImportSTLCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option)
|
class CommonExampleInterface* ImportSTLCreateFunc(struct CommonExampleOptions& options)
|
||||||
{
|
{
|
||||||
return new ImportSTLSetup(helper);
|
return new ImportSTLSetup(options.m_guiHelper);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#ifndef IMPORT_STL_SETUP_H
|
#ifndef IMPORT_STL_SETUP_H
|
||||||
#define IMPORT_STL_SETUP_H
|
#define IMPORT_STL_SETUP_H
|
||||||
|
|
||||||
class CommonExampleInterface* ImportSTLCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option);
|
class CommonExampleInterface* ImportSTLCreateFunc(struct CommonExampleOptions& options);
|
||||||
|
|
||||||
#endif //IMPORT_OBJ_SETUP_H
|
#endif //IMPORT_OBJ_SETUP_H
|
||||||
|
|||||||
@@ -34,13 +34,22 @@ class ImportUrdfSetup : public CommonMultiBodyBase
|
|||||||
bool m_useMultiBody;
|
bool m_useMultiBody;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ImportUrdfSetup(struct GUIHelperInterface* helper, int option);
|
ImportUrdfSetup(struct GUIHelperInterface* helper, int option, const char* fileName);
|
||||||
virtual ~ImportUrdfSetup();
|
virtual ~ImportUrdfSetup();
|
||||||
|
|
||||||
virtual void initPhysics();
|
virtual void initPhysics();
|
||||||
virtual void stepSimulation(float deltaTime);
|
virtual void stepSimulation(float deltaTime);
|
||||||
|
|
||||||
void setFileName(const char* urdfFileName);
|
void setFileName(const char* urdfFileName);
|
||||||
|
|
||||||
|
virtual void resetCamera()
|
||||||
|
{
|
||||||
|
float dist = 3.5;
|
||||||
|
float pitch = -136;
|
||||||
|
float yaw = 28;
|
||||||
|
float targetPos[3]={0.47,0,-0.64};
|
||||||
|
m_guiHelper->resetCamera(dist,pitch,yaw,targetPos[0],targetPos[1],targetPos[2]);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -62,9 +71,11 @@ struct ImportUrdfInternalData
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ImportUrdfSetup::ImportUrdfSetup(struct GUIHelperInterface* helper, int option)
|
ImportUrdfSetup::ImportUrdfSetup(struct GUIHelperInterface* helper, int option, const char* fileName)
|
||||||
:CommonMultiBodyBase(helper)
|
:CommonMultiBodyBase(helper)
|
||||||
{
|
{
|
||||||
|
m_data = new ImportUrdfInternalData;
|
||||||
|
|
||||||
if (option==1)
|
if (option==1)
|
||||||
{
|
{
|
||||||
m_useMultiBody = true;
|
m_useMultiBody = true;
|
||||||
@@ -74,38 +85,44 @@ ImportUrdfSetup::ImportUrdfSetup(struct GUIHelperInterface* helper, int option)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int count = 0;
|
static int count = 0;
|
||||||
gFileNameArray.clear();
|
if (fileName)
|
||||||
gFileNameArray.push_back("r2d2.urdf");
|
|
||||||
|
|
||||||
m_data = new ImportUrdfInternalData;
|
|
||||||
|
|
||||||
//load additional urdf file names from file
|
|
||||||
|
|
||||||
FILE* f = fopen("urdf_files.txt","r");
|
|
||||||
if (f)
|
|
||||||
{
|
|
||||||
int result;
|
|
||||||
//warning: we don't avoid string buffer overflow in this basic example in fscanf
|
|
||||||
char fileName[1024];
|
|
||||||
do
|
|
||||||
{
|
|
||||||
result = fscanf(f,"%s",fileName);
|
|
||||||
if (result==1)
|
|
||||||
{
|
|
||||||
gFileNameArray.push_back(fileName);
|
|
||||||
}
|
|
||||||
} while (result==1);
|
|
||||||
|
|
||||||
fclose(f);
|
|
||||||
}
|
|
||||||
|
|
||||||
int numFileNames = gFileNameArray.size();
|
|
||||||
|
|
||||||
if (count>=numFileNames)
|
|
||||||
{
|
{
|
||||||
count=0;
|
setFileName(fileName);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
gFileNameArray.clear();
|
||||||
|
gFileNameArray.push_back("r2d2.urdf");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//load additional urdf file names from file
|
||||||
|
|
||||||
|
FILE* f = fopen("urdf_files.txt","r");
|
||||||
|
if (f)
|
||||||
|
{
|
||||||
|
int result;
|
||||||
|
//warning: we don't avoid string buffer overflow in this basic example in fscanf
|
||||||
|
char fileName[1024];
|
||||||
|
do
|
||||||
|
{
|
||||||
|
result = fscanf(f,"%s",fileName);
|
||||||
|
if (result==1)
|
||||||
|
{
|
||||||
|
gFileNameArray.push_back(fileName);
|
||||||
|
}
|
||||||
|
} while (result==1);
|
||||||
|
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
int numFileNames = gFileNameArray.size();
|
||||||
|
|
||||||
|
if (count>=numFileNames)
|
||||||
|
{
|
||||||
|
count=0;
|
||||||
|
}
|
||||||
|
sprintf(m_fileName,gFileNameArray[count++].c_str());
|
||||||
}
|
}
|
||||||
sprintf(m_fileName,gFileNameArray[count++].c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ImportUrdfSetup::~ImportUrdfSetup()
|
ImportUrdfSetup::~ImportUrdfSetup()
|
||||||
@@ -270,8 +287,8 @@ void ImportUrdfSetup::stepSimulation(float deltaTime)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class CommonExampleInterface* ImportURDFCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option)
|
class CommonExampleInterface* ImportURDFCreateFunc(struct CommonExampleOptions& options)
|
||||||
{
|
{
|
||||||
|
|
||||||
return new ImportUrdfSetup(helper, option);
|
return new ImportUrdfSetup(options.m_guiHelper, options.m_option,options.m_fileName);
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
#define IMPORT_URDF_SETUP_H
|
#define IMPORT_URDF_SETUP_H
|
||||||
|
|
||||||
|
|
||||||
class CommonExampleInterface* ImportURDFCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option);
|
class CommonExampleInterface* ImportURDFCreateFunc(struct CommonExampleOptions& options);
|
||||||
|
|
||||||
|
|
||||||
#endif //IMPORT_URDF_SETUP_H
|
#endif //IMPORT_URDF_SETUP_H
|
||||||
|
|||||||
@@ -29,6 +29,15 @@ public:
|
|||||||
|
|
||||||
virtual void stepSimulation(float deltaTime);
|
virtual void stepSimulation(float deltaTime);
|
||||||
|
|
||||||
|
virtual void resetCamera()
|
||||||
|
{
|
||||||
|
float dist = 1;
|
||||||
|
float pitch = 50;
|
||||||
|
float yaw = 35;
|
||||||
|
float targetPos[3]={-3,2.8,-2.5};
|
||||||
|
m_guiHelper->resetCamera(dist,pitch,yaw,targetPos[0],targetPos[1],targetPos[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
btMultiBody* createFeatherstoneMultiBody_testMultiDof(class btMultiBodyDynamicsWorld* world, int numLinks, const btVector3& basePosition, const btVector3 &baseHalfExtents, const btVector3 &linkHalfExtents, bool spherical = false, bool floating = false);
|
btMultiBody* createFeatherstoneMultiBody_testMultiDof(class btMultiBodyDynamicsWorld* world, int numLinks, const btVector3& basePosition, const btVector3 &baseHalfExtents, const btVector3 &linkHalfExtents, bool spherical = false, bool floating = false);
|
||||||
void addColliders_testMultiDof(btMultiBody *pMultiBody, btMultiBodyDynamicsWorld *pWorld, const btVector3 &baseHalfExtents, const btVector3 &linkHalfExtents);
|
void addColliders_testMultiDof(btMultiBody *pMultiBody, btMultiBodyDynamicsWorld *pWorld, const btVector3 &baseHalfExtents, const btVector3 &linkHalfExtents);
|
||||||
@@ -76,6 +85,7 @@ void MultiDofDemo::stepSimulation(float deltaTime)
|
|||||||
void MultiDofDemo::initPhysics()
|
void MultiDofDemo::initPhysics()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
m_guiHelper->setUpAxis(1);
|
m_guiHelper->setUpAxis(1);
|
||||||
|
|
||||||
if(g_firstInit)
|
if(g_firstInit)
|
||||||
@@ -100,7 +110,7 @@ void MultiDofDemo::initPhysics()
|
|||||||
btMultiBodyDynamicsWorld* world = new btMultiBodyDynamicsWorld(m_dispatcher,m_broadphase,sol,m_collisionConfiguration);
|
btMultiBodyDynamicsWorld* world = new btMultiBodyDynamicsWorld(m_dispatcher,m_broadphase,sol,m_collisionConfiguration);
|
||||||
m_dynamicsWorld = world;
|
m_dynamicsWorld = world;
|
||||||
// m_dynamicsWorld->setDebugDrawer(&gDebugDraw);
|
// m_dynamicsWorld->setDebugDrawer(&gDebugDraw);
|
||||||
|
m_guiHelper->createPhysicsDebugDrawer(m_dynamicsWorld);
|
||||||
m_dynamicsWorld->setGravity(btVector3(0,-10,0));
|
m_dynamicsWorld->setGravity(btVector3(0,-10,0));
|
||||||
|
|
||||||
///create a few basic rigid bodies
|
///create a few basic rigid bodies
|
||||||
@@ -418,7 +428,7 @@ void MultiDofDemo::addBoxes_testMultiDof()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class CommonExampleInterface* MultiDofCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option)
|
class CommonExampleInterface* MultiDofCreateFunc(struct CommonExampleOptions& options)
|
||||||
{
|
{
|
||||||
return new MultiDofDemo(helper);
|
return new MultiDofDemo(options.m_guiHelper);
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
#ifndef MULTI_DOF_DEMO_H
|
#ifndef MULTI_DOF_DEMO_H
|
||||||
#define MULTI_DOF_DEMO_H
|
#define MULTI_DOF_DEMO_H
|
||||||
|
|
||||||
class CommonExampleInterface* MultiDofCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option);
|
class CommonExampleInterface* MultiDofCreateFunc(struct CommonExampleOptions& options);
|
||||||
|
|
||||||
#endif //MULTI_DOF_DEMO_H
|
#endif //MULTI_DOF_DEMO_H
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,16 @@ public:
|
|||||||
|
|
||||||
virtual void stepSimulation(float deltaTime);
|
virtual void stepSimulation(float deltaTime);
|
||||||
|
|
||||||
|
virtual void resetCamera()
|
||||||
|
{
|
||||||
|
float dist = 5;
|
||||||
|
float pitch = 270;
|
||||||
|
float yaw = 21;
|
||||||
|
float targetPos[3]={-1.34,3.4,-0.44};
|
||||||
|
m_guiHelper->resetCamera(dist,pitch,yaw,targetPos[0],targetPos[1],targetPos[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
TestJointTorqueSetup::TestJointTorqueSetup(struct GUIHelperInterface* helper)
|
TestJointTorqueSetup::TestJointTorqueSetup(struct GUIHelperInterface* helper)
|
||||||
@@ -270,7 +280,7 @@ void TestJointTorqueSetup::stepSimulation(float deltaTime)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class CommonExampleInterface* TestJointTorqueCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option)
|
class CommonExampleInterface* TestJointTorqueCreateFunc(struct CommonExampleOptions& options)
|
||||||
{
|
{
|
||||||
return new TestJointTorqueSetup(helper);
|
return new TestJointTorqueSetup(options.m_guiHelper);
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef TEST_JOINT_TORQUE_SETUP_H
|
#ifndef TEST_JOINT_TORQUE_SETUP_H
|
||||||
#define TEST_JOINT_TORQUE_SETUP_H
|
#define TEST_JOINT_TORQUE_SETUP_H
|
||||||
|
|
||||||
class CommonExampleInterface* TestJointTorqueCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option);
|
class CommonExampleInterface* TestJointTorqueCreateFunc(struct CommonExampleOptions& options);
|
||||||
|
|
||||||
#endif //TEST_JOINT_TORQUE_SETUP_H
|
#endif //TEST_JOINT_TORQUE_SETUP_H
|
||||||
|
|
||||||
|
|||||||
@@ -32,14 +32,13 @@
|
|||||||
#include "../OpenGLWindow/GLInstanceRendererInternalData.h"
|
#include "../OpenGLWindow/GLInstanceRendererInternalData.h"
|
||||||
|
|
||||||
|
|
||||||
|
char* gPairBenchFileName = 0;
|
||||||
|
|
||||||
class PairBench : public CommonOpenCLBase
|
class PairBench : public CommonOpenCLBase
|
||||||
{
|
{
|
||||||
|
|
||||||
struct PairBenchInternalData* m_data;
|
struct PairBenchInternalData* m_data;
|
||||||
|
|
||||||
GLInstancingRenderer* m_instancingRenderer;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
PairBench(GUIHelperInterface* helper);
|
PairBench(GUIHelperInterface* helper);
|
||||||
@@ -56,6 +55,24 @@ public:
|
|||||||
virtual void stepSimulation(float deltaTime);
|
virtual void stepSimulation(float deltaTime);
|
||||||
|
|
||||||
virtual void renderScene();
|
virtual void renderScene();
|
||||||
|
|
||||||
|
virtual void resetCamera()
|
||||||
|
{
|
||||||
|
float dist = 10;
|
||||||
|
|
||||||
|
if (gPairBenchFileName)
|
||||||
|
{
|
||||||
|
dist = 830;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
dist = 130;
|
||||||
|
}
|
||||||
|
|
||||||
|
float pitch = 62;
|
||||||
|
float yaw = 33;
|
||||||
|
float targetPos[4]={15.5,12.5,15.5,0};
|
||||||
|
m_guiHelper->resetCamera(dist,pitch,yaw,targetPos[0],targetPos[1],targetPos[2]);
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -67,7 +84,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
char* gPairBenchFileName = 0;
|
|
||||||
extern bool useShadowMap;
|
extern bool useShadowMap;
|
||||||
float maxExtents = -1e30f;
|
float maxExtents = -1e30f;
|
||||||
int largeCount = 0;
|
int largeCount = 0;
|
||||||
@@ -143,7 +160,8 @@ PairBench::PairBench(GUIHelperInterface* helper)
|
|||||||
:CommonOpenCLBase(helper)
|
:CommonOpenCLBase(helper)
|
||||||
{
|
{
|
||||||
m_data = new PairBenchInternalData;
|
m_data = new PairBenchInternalData;
|
||||||
m_instancingRenderer = (GLInstancingRenderer*) helper->getRenderInterface();
|
|
||||||
|
|
||||||
m_data->m_validationBroadphase = 0;
|
m_data->m_validationBroadphase = 0;
|
||||||
}
|
}
|
||||||
PairBench::~PairBench()
|
PairBench::~PairBench()
|
||||||
@@ -182,7 +200,7 @@ void PairBench::initPhysics()
|
|||||||
dimensions[1] = 10;
|
dimensions[1] = 10;
|
||||||
dimensions[2] = 10;
|
dimensions[2] = 10;
|
||||||
|
|
||||||
//m_instancingRenderer = ci.m_instancingRenderer;
|
//m_guiHelper->getRenderInterface() = ci.m_guiHelper->getRenderInterface();
|
||||||
sPairDemo = this;
|
sPairDemo = this;
|
||||||
useShadowMap = false;
|
useShadowMap = false;
|
||||||
|
|
||||||
@@ -228,7 +246,7 @@ void PairBench::createBroadphase(int arraySizeX, int arraySizeY, int arraySizeZ)
|
|||||||
int strideInBytes = 9*sizeof(float);
|
int strideInBytes = 9*sizeof(float);
|
||||||
int numVertices = sizeof(cube_vertices)/strideInBytes;
|
int numVertices = sizeof(cube_vertices)/strideInBytes;
|
||||||
int numIndices = sizeof(cube_vertices)/sizeof(int);
|
int numIndices = sizeof(cube_vertices)/sizeof(int);
|
||||||
int shapeId = m_instancingRenderer->registerShape(&cube_vertices[0],numVertices,cube_indices,numIndices);
|
int shapeId = m_guiHelper->getRenderInterface()->registerShape(&cube_vertices[0],numVertices,cube_indices,numIndices);
|
||||||
int group=1;
|
int group=1;
|
||||||
int mask=1;
|
int mask=1;
|
||||||
int index=TEST_INDEX_OFFSET;
|
int index=TEST_INDEX_OFFSET;
|
||||||
@@ -316,12 +334,12 @@ void PairBench::createBroadphase(int arraySizeX, int arraySizeY, int arraySizeZ)
|
|||||||
if (l>500)
|
if (l>500)
|
||||||
{
|
{
|
||||||
b3Vector4 color=b3MakeVector4(0,1,0,0.1);
|
b3Vector4 color=b3MakeVector4(0,1,0,0.1);
|
||||||
int id = m_instancingRenderer->registerGraphicsInstance(shapeId,position,orn,color,scaling);
|
int id = m_guiHelper->getRenderInterface()->registerGraphicsInstance(shapeId,position,orn,color,scaling);
|
||||||
m_data->m_broadphaseGPU->createLargeProxy(aabbMin,aabbMax,index,group,mask);
|
m_data->m_broadphaseGPU->createLargeProxy(aabbMin,aabbMax,index,group,mask);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
b3Vector4 color=b3MakeVector4(1,0,0,1);
|
b3Vector4 color=b3MakeVector4(1,0,0,1);
|
||||||
int id = m_instancingRenderer->registerGraphicsInstance(shapeId,position,orn,color,scaling);
|
int id = m_guiHelper->getRenderInterface()->registerGraphicsInstance(shapeId,position,orn,color,scaling);
|
||||||
m_data->m_broadphaseGPU->createProxy(aabbMin,aabbMax,index,group,mask);
|
m_data->m_broadphaseGPU->createProxy(aabbMin,aabbMax,index,group,mask);
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
@@ -384,7 +402,7 @@ void PairBench::createBroadphase(int arraySizeX, int arraySizeY, int arraySizeZ)
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
|
||||||
int id = m_instancingRenderer->registerGraphicsInstance(shapeId,position,orn,color,scaling);
|
int id = m_guiHelper->getRenderInterface()->registerGraphicsInstance(shapeId,position,orn,color,scaling);
|
||||||
|
|
||||||
|
|
||||||
b3Vector3 aabbMin = position-scaling;
|
b3Vector3 aabbMin = position-scaling;
|
||||||
@@ -404,21 +422,13 @@ void PairBench::createBroadphase(int arraySizeX, int arraySizeY, int arraySizeZ)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float camPos[4]={15.5,12.5,15.5,0};
|
|
||||||
m_instancingRenderer->getActiveCamera()->setCameraTargetPosition(camPos[0],camPos[1],camPos[2]);
|
|
||||||
if (gPairBenchFileName)
|
|
||||||
{
|
|
||||||
m_instancingRenderer->getActiveCamera()->setCameraDistance(830);
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
m_instancingRenderer->getActiveCamera()->setCameraDistance(130);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_instancingRenderer->writeTransforms();
|
m_guiHelper->getRenderInterface()->writeTransforms();
|
||||||
m_data->m_broadphaseGPU->writeAabbsToGpu();
|
m_data->m_broadphaseGPU->writeAabbsToGpu();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PairBench::deleteBroadphase()
|
void PairBench::deleteBroadphase()
|
||||||
{
|
{
|
||||||
delete m_data->m_broadphaseGPU;
|
delete m_data->m_broadphaseGPU;
|
||||||
@@ -429,11 +439,13 @@ void PairBench::deleteBroadphase()
|
|||||||
m_data->m_bodyTimes = 0;
|
m_data->m_bodyTimes = 0;
|
||||||
|
|
||||||
m_data->m_broadphaseGPU = 0;
|
m_data->m_broadphaseGPU = 0;
|
||||||
m_instancingRenderer->removeAllInstances();
|
m_guiHelper->getRenderInterface()->removeAllInstances();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PairBench::exitPhysics()
|
void PairBench::exitPhysics()
|
||||||
{
|
{
|
||||||
|
//reset the state to 'on'
|
||||||
|
useShadowMap = true;
|
||||||
if(m_data->m_validationBroadphase)
|
if(m_data->m_validationBroadphase)
|
||||||
{
|
{
|
||||||
delete m_data->m_validationBroadphase;
|
delete m_data->m_validationBroadphase;
|
||||||
@@ -449,7 +461,7 @@ void PairBench::exitPhysics()
|
|||||||
|
|
||||||
void PairBench::renderScene()
|
void PairBench::renderScene()
|
||||||
{
|
{
|
||||||
m_instancingRenderer->renderScene();
|
m_guiHelper->getRenderInterface()->renderScene();
|
||||||
}
|
}
|
||||||
|
|
||||||
struct OverlappingPairSortPredicate
|
struct OverlappingPairSortPredicate
|
||||||
@@ -467,17 +479,23 @@ void PairBench::stepSimulation(float deltaTime)
|
|||||||
{
|
{
|
||||||
//color all objects blue
|
//color all objects blue
|
||||||
|
|
||||||
|
GLInstanceRendererInternalData* internalData = m_guiHelper->getRenderInterface()->getInternalData();
|
||||||
|
|
||||||
|
if (internalData==0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
bool animate=true;
|
bool animate=true;
|
||||||
int numObjects= 0;
|
int numObjects= 0;
|
||||||
{
|
{
|
||||||
B3_PROFILE("Num Objects");
|
B3_PROFILE("Num Objects");
|
||||||
numObjects = m_instancingRenderer->getInternalData()->m_totalNumInstances;
|
numObjects = internalData->m_totalNumInstances;
|
||||||
}
|
}
|
||||||
b3Vector4* positions = 0;
|
b3Vector4* positions = 0;
|
||||||
if (numObjects)
|
if (numObjects)
|
||||||
{
|
{
|
||||||
B3_PROFILE("Sync");
|
B3_PROFILE("Sync");
|
||||||
GLuint vbo = m_instancingRenderer->getInternalData()->m_vbo;
|
GLuint vbo = internalData->m_vbo;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -488,7 +506,7 @@ void PairBench::stepSimulation(float deltaTime)
|
|||||||
char* hostPtr= 0;
|
char* hostPtr= 0;
|
||||||
{
|
{
|
||||||
B3_PROFILE("glMapBufferRange");
|
B3_PROFILE("glMapBufferRange");
|
||||||
hostPtr = (char*)glMapBufferRange( GL_ARRAY_BUFFER,m_instancingRenderer->getMaxShapeCapacity(),arraySizeInBytes, GL_MAP_WRITE_BIT|GL_MAP_READ_BIT );//GL_READ_WRITE);//GL_WRITE_ONLY
|
hostPtr = (char*)glMapBufferRange( GL_ARRAY_BUFFER,internalData->m_maxShapeCapacityInBytes,arraySizeInBytes, GL_MAP_WRITE_BIT|GL_MAP_READ_BIT );//GL_READ_WRITE);//GL_WRITE_ONLY
|
||||||
}
|
}
|
||||||
GLint err = glGetError();
|
GLint err = glGetError();
|
||||||
assert(err==GL_NO_ERROR);
|
assert(err==GL_NO_ERROR);
|
||||||
@@ -767,7 +785,7 @@ void PairBench::stepSimulation(float deltaTime)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class CommonExampleInterface* PairBenchOpenCLCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option)
|
class CommonExampleInterface* PairBenchOpenCLCreateFunc(struct CommonExampleOptions& options)
|
||||||
{
|
{
|
||||||
return new PairBench(helper);
|
return new PairBench(options.m_guiHelper);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef PAIR_BENCH_H
|
#ifndef PAIR_BENCH_H
|
||||||
#define PAIR_BENCH_H
|
#define PAIR_BENCH_H
|
||||||
|
|
||||||
class CommonExampleInterface* PairBenchOpenCLCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option);
|
class CommonExampleInterface* PairBenchOpenCLCreateFunc(struct CommonExampleOptions& options);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ struct GLInstanceRendererInternalData
|
|||||||
int m_vboSize;
|
int m_vboSize;
|
||||||
GLuint m_vbo;
|
GLuint m_vbo;
|
||||||
int m_totalNumInstances;
|
int m_totalNumInstances;
|
||||||
|
int m_maxNumObjectCapacity;
|
||||||
|
int m_maxShapeCapacityInBytes;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //GL_INSTANCE_RENDERER_INTERNAL_DATA_H
|
#endif //GL_INSTANCE_RENDERER_INTERNAL_DATA_H
|
||||||
|
|||||||
@@ -152,6 +152,7 @@ struct InternalDataRenderer : public GLInstanceRendererInternalData
|
|||||||
GLRenderToTexture* m_shadowMap;
|
GLRenderToTexture* m_shadowMap;
|
||||||
GLuint m_shadowTexture;
|
GLuint m_shadowTexture;
|
||||||
|
|
||||||
|
|
||||||
InternalDataRenderer() :
|
InternalDataRenderer() :
|
||||||
m_shadowMap(0),
|
m_shadowMap(0),
|
||||||
m_shadowTexture(0)
|
m_shadowTexture(0)
|
||||||
@@ -223,8 +224,7 @@ static GLint ProjectionMatrixPointSprite=0;
|
|||||||
|
|
||||||
|
|
||||||
GLInstancingRenderer::GLInstancingRenderer(int maxNumObjectCapacity, int maxShapeCapacityInBytes)
|
GLInstancingRenderer::GLInstancingRenderer(int maxNumObjectCapacity, int maxShapeCapacityInBytes)
|
||||||
:m_maxNumObjectCapacity(maxNumObjectCapacity),
|
:
|
||||||
m_maxShapeCapacityInBytes(maxShapeCapacityInBytes),
|
|
||||||
m_textureenabled(true),
|
m_textureenabled(true),
|
||||||
m_textureinitialized(false),
|
m_textureinitialized(false),
|
||||||
m_screenWidth(0),
|
m_screenWidth(0),
|
||||||
@@ -234,14 +234,17 @@ GLInstancingRenderer::GLInstancingRenderer(int maxNumObjectCapacity, int maxShap
|
|||||||
{
|
{
|
||||||
|
|
||||||
m_data = new InternalDataRenderer;
|
m_data = new InternalDataRenderer;
|
||||||
|
m_data->m_maxNumObjectCapacity = maxNumObjectCapacity;
|
||||||
|
m_data->m_maxShapeCapacityInBytes=maxShapeCapacityInBytes;
|
||||||
|
|
||||||
m_data->m_totalNumInstances = 0;
|
m_data->m_totalNumInstances = 0;
|
||||||
|
|
||||||
sData2 = m_data;
|
sData2 = m_data;
|
||||||
|
|
||||||
m_data->m_instance_positions_ptr.resize(m_maxNumObjectCapacity*4);
|
m_data->m_instance_positions_ptr.resize(m_data->m_maxNumObjectCapacity*4);
|
||||||
m_data->m_instance_quaternion_ptr.resize(m_maxNumObjectCapacity*4);
|
m_data->m_instance_quaternion_ptr.resize(m_data->m_maxNumObjectCapacity*4);
|
||||||
m_data->m_instance_colors_ptr.resize(m_maxNumObjectCapacity*4);
|
m_data->m_instance_colors_ptr.resize(m_data->m_maxNumObjectCapacity*4);
|
||||||
m_data->m_instance_scale_ptr.resize(m_maxNumObjectCapacity*3);
|
m_data->m_instance_scale_ptr.resize(m_data->m_maxNumObjectCapacity*3);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -346,8 +349,8 @@ void GLInstancingRenderer::writeSingleInstanceTransformToGPU(float* position, fl
|
|||||||
|
|
||||||
char* base = orgBase;
|
char* base = orgBase;
|
||||||
|
|
||||||
float* positions = (float*)(base+m_maxShapeCapacityInBytes);
|
float* positions = (float*)(base+m_data->m_maxShapeCapacityInBytes);
|
||||||
float* orientations = (float*)(base+m_maxShapeCapacityInBytes + POSITION_BUFFER_SIZE);
|
float* orientations = (float*)(base+m_data->m_maxShapeCapacityInBytes + POSITION_BUFFER_SIZE);
|
||||||
|
|
||||||
|
|
||||||
positions[objectIndex*4] = position[0];
|
positions[objectIndex*4] = position[0];
|
||||||
@@ -406,10 +409,10 @@ void GLInstancingRenderer::writeTransforms()
|
|||||||
|
|
||||||
char* base = orgBase;
|
char* base = orgBase;
|
||||||
|
|
||||||
float* positions = (float*)(base+m_maxShapeCapacityInBytes);
|
float* positions = (float*)(base+m_data->m_maxShapeCapacityInBytes);
|
||||||
float* orientations = (float*)(base+m_maxShapeCapacityInBytes + POSITION_BUFFER_SIZE);
|
float* orientations = (float*)(base+m_data->m_maxShapeCapacityInBytes + POSITION_BUFFER_SIZE);
|
||||||
float* colors= (float*)(base+m_maxShapeCapacityInBytes + POSITION_BUFFER_SIZE+ORIENTATION_BUFFER_SIZE);
|
float* colors= (float*)(base+m_data->m_maxShapeCapacityInBytes + POSITION_BUFFER_SIZE+ORIENTATION_BUFFER_SIZE);
|
||||||
float* scaling= (float*)(base+m_maxShapeCapacityInBytes + POSITION_BUFFER_SIZE+ORIENTATION_BUFFER_SIZE+COLOR_BUFFER_SIZE);
|
float* scaling= (float*)(base+m_data->m_maxShapeCapacityInBytes + POSITION_BUFFER_SIZE+ORIENTATION_BUFFER_SIZE+COLOR_BUFFER_SIZE);
|
||||||
|
|
||||||
//static int offset=0;
|
//static int offset=0;
|
||||||
//offset++;
|
//offset++;
|
||||||
@@ -470,7 +473,7 @@ int GLInstancingRenderer::registerGraphicsInstance(int shapeIndex, const double*
|
|||||||
int GLInstancingRenderer::registerGraphicsInstance(int shapeIndex, const float* position, const float* quaternion, const float* color, const float* scaling)
|
int GLInstancingRenderer::registerGraphicsInstance(int shapeIndex, const float* position, const float* quaternion, const float* color, const float* scaling)
|
||||||
{
|
{
|
||||||
b3Assert(shapeIndex == (m_graphicsInstances.size()-1));
|
b3Assert(shapeIndex == (m_graphicsInstances.size()-1));
|
||||||
b3Assert(m_graphicsInstances.size()<m_maxNumObjectCapacity-1);
|
b3Assert(m_graphicsInstances.size()<m_data->m_maxNumObjectCapacity-1);
|
||||||
|
|
||||||
b3GraphicsInstance* gfxObj = m_graphicsInstances[shapeIndex];
|
b3GraphicsInstance* gfxObj = m_graphicsInstances[shapeIndex];
|
||||||
|
|
||||||
@@ -579,7 +582,7 @@ int GLInstancingRenderer::registerShape(const float* vertices, int numvertices,
|
|||||||
int sz = numvertices*vertexStrideInBytes;
|
int sz = numvertices*vertexStrideInBytes;
|
||||||
#ifdef B3_DEBUG
|
#ifdef B3_DEBUG
|
||||||
int totalUsed = vertexStrideInBytes*gfxObj->m_vertexArrayOffset+sz;
|
int totalUsed = vertexStrideInBytes*gfxObj->m_vertexArrayOffset+sz;
|
||||||
b3Assert(totalUsed<this->m_maxShapeCapacityInBytes);
|
b3Assert(totalUsed<m_data->m_maxShapeCapacityInBytes);
|
||||||
#endif//B3_DEBUG
|
#endif//B3_DEBUG
|
||||||
|
|
||||||
memcpy(dest+vertexStrideInBytes*gfxObj->m_vertexArrayOffset,vertices,sz);
|
memcpy(dest+vertexStrideInBytes*gfxObj->m_vertexArrayOffset,vertices,sz);
|
||||||
@@ -611,10 +614,10 @@ int GLInstancingRenderer::registerShape(const float* vertices, int numvertices,
|
|||||||
void GLInstancingRenderer::InitShaders()
|
void GLInstancingRenderer::InitShaders()
|
||||||
{
|
{
|
||||||
|
|
||||||
int POSITION_BUFFER_SIZE = (m_maxNumObjectCapacity*sizeof(float)*4);
|
int POSITION_BUFFER_SIZE = (m_data->m_maxNumObjectCapacity*sizeof(float)*4);
|
||||||
int ORIENTATION_BUFFER_SIZE = (m_maxNumObjectCapacity*sizeof(float)*4);
|
int ORIENTATION_BUFFER_SIZE = (m_data->m_maxNumObjectCapacity*sizeof(float)*4);
|
||||||
int COLOR_BUFFER_SIZE = (m_maxNumObjectCapacity*sizeof(float)*4);
|
int COLOR_BUFFER_SIZE = (m_data->m_maxNumObjectCapacity*sizeof(float)*4);
|
||||||
int SCALE_BUFFER_SIZE = (m_maxNumObjectCapacity*sizeof(float)*3);
|
int SCALE_BUFFER_SIZE = (m_data->m_maxNumObjectCapacity*sizeof(float)*3);
|
||||||
|
|
||||||
linesShader = gltLoadShaderPair(linesVertexShader,linesFragmentShader);
|
linesShader = gltLoadShaderPair(linesVertexShader,linesFragmentShader);
|
||||||
lines_ModelViewMatrix = glGetUniformLocation(linesShader, "ModelViewMatrix");
|
lines_ModelViewMatrix = glGetUniformLocation(linesShader, "ModelViewMatrix");
|
||||||
@@ -702,7 +705,7 @@ void GLInstancingRenderer::InitShaders()
|
|||||||
glBindBuffer(GL_ARRAY_BUFFER, m_data->m_vbo);
|
glBindBuffer(GL_ARRAY_BUFFER, m_data->m_vbo);
|
||||||
|
|
||||||
|
|
||||||
int size = m_maxShapeCapacityInBytes + POSITION_BUFFER_SIZE+ORIENTATION_BUFFER_SIZE+COLOR_BUFFER_SIZE+SCALE_BUFFER_SIZE;
|
int size = m_data->m_maxShapeCapacityInBytes + POSITION_BUFFER_SIZE+ORIENTATION_BUFFER_SIZE+COLOR_BUFFER_SIZE+SCALE_BUFFER_SIZE;
|
||||||
m_data->m_vboSize = size;
|
m_data->m_vboSize = size;
|
||||||
|
|
||||||
glBufferData(GL_ARRAY_BUFFER, size, 0, GL_DYNAMIC_DRAW);//GL_STATIC_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, size, 0, GL_DYNAMIC_DRAW);//GL_STATIC_DRAW);
|
||||||
@@ -1460,8 +1463,8 @@ b3Assert(glGetError() ==GL_NO_ERROR);
|
|||||||
|
|
||||||
|
|
||||||
glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 9*sizeof(float), vertex.m_pointer);
|
glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 9*sizeof(float), vertex.m_pointer);
|
||||||
glVertexAttribPointer(1, 4, GL_FLOAT, GL_FALSE, 0, (GLvoid *)(curOffset*4*sizeof(float)+m_maxShapeCapacityInBytes));
|
glVertexAttribPointer(1, 4, GL_FLOAT, GL_FALSE, 0, (GLvoid *)(curOffset*4*sizeof(float)+m_data->m_maxShapeCapacityInBytes));
|
||||||
glVertexAttribPointer(2, 4, GL_FLOAT, GL_FALSE, 0, (GLvoid *)(curOffset*4*sizeof(float)+m_maxShapeCapacityInBytes+POSITION_BUFFER_SIZE));
|
glVertexAttribPointer(2, 4, GL_FLOAT, GL_FALSE, 0, (GLvoid *)(curOffset*4*sizeof(float)+m_data->m_maxShapeCapacityInBytes+POSITION_BUFFER_SIZE));
|
||||||
|
|
||||||
PointerCaster uv;
|
PointerCaster uv;
|
||||||
uv.m_baseIndex = 7*sizeof(float)+vertex.m_baseIndex;
|
uv.m_baseIndex = 7*sizeof(float)+vertex.m_baseIndex;
|
||||||
@@ -1471,8 +1474,8 @@ b3Assert(glGetError() ==GL_NO_ERROR);
|
|||||||
|
|
||||||
glVertexAttribPointer(3, 2, GL_FLOAT, GL_FALSE, 9*sizeof(float), uv.m_pointer);
|
glVertexAttribPointer(3, 2, GL_FLOAT, GL_FALSE, 9*sizeof(float), uv.m_pointer);
|
||||||
glVertexAttribPointer(4, 3, GL_FLOAT, GL_FALSE, 9*sizeof(float), normal.m_pointer);
|
glVertexAttribPointer(4, 3, GL_FLOAT, GL_FALSE, 9*sizeof(float), normal.m_pointer);
|
||||||
glVertexAttribPointer(5, 4, GL_FLOAT, GL_FALSE, 0, (GLvoid *)(curOffset*4*sizeof(float)+m_maxShapeCapacityInBytes+POSITION_BUFFER_SIZE+ORIENTATION_BUFFER_SIZE));
|
glVertexAttribPointer(5, 4, GL_FLOAT, GL_FALSE, 0, (GLvoid *)(curOffset*4*sizeof(float)+m_data->m_maxShapeCapacityInBytes+POSITION_BUFFER_SIZE+ORIENTATION_BUFFER_SIZE));
|
||||||
glVertexAttribPointer(6, 3, GL_FLOAT, GL_FALSE, 0, (GLvoid *)(curOffset*3*sizeof(float)+m_maxShapeCapacityInBytes+POSITION_BUFFER_SIZE+ORIENTATION_BUFFER_SIZE+COLOR_BUFFER_SIZE));
|
glVertexAttribPointer(6, 3, GL_FLOAT, GL_FALSE, 0, (GLvoid *)(curOffset*3*sizeof(float)+m_data->m_maxShapeCapacityInBytes+POSITION_BUFFER_SIZE+ORIENTATION_BUFFER_SIZE+COLOR_BUFFER_SIZE));
|
||||||
|
|
||||||
glEnableVertexAttribArray(0);
|
glEnableVertexAttribArray(0);
|
||||||
glEnableVertexAttribArray(1);
|
glEnableVertexAttribArray(1);
|
||||||
@@ -1630,3 +1633,11 @@ void GLInstancingRenderer::enableShadowMap()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GLInstancingRenderer::getMaxShapeCapacity() const
|
||||||
|
{
|
||||||
|
return m_data->m_maxShapeCapacityInBytes;
|
||||||
|
}
|
||||||
|
int GLInstancingRenderer::getInstanceCapacity() const
|
||||||
|
{
|
||||||
|
return m_data->m_maxNumObjectCapacity;
|
||||||
|
}
|
||||||
|
|||||||
@@ -29,8 +29,7 @@ class GLInstancingRenderer : public CommonRenderInterface
|
|||||||
|
|
||||||
b3AlignedObjectArray<struct b3GraphicsInstance*> m_graphicsInstances;
|
b3AlignedObjectArray<struct b3GraphicsInstance*> m_graphicsInstances;
|
||||||
|
|
||||||
int m_maxNumObjectCapacity;
|
|
||||||
int m_maxShapeCapacityInBytes;
|
|
||||||
struct InternalDataRenderer* m_data;
|
struct InternalDataRenderer* m_data;
|
||||||
|
|
||||||
bool m_textureenabled;
|
bool m_textureenabled;
|
||||||
@@ -94,7 +93,7 @@ public:
|
|||||||
virtual void writeSingleInstanceColorToCPU(double* color, int srcIndex);
|
virtual void writeSingleInstanceColorToCPU(double* color, int srcIndex);
|
||||||
|
|
||||||
|
|
||||||
struct GLInstanceRendererInternalData* getInternalData();
|
virtual struct GLInstanceRendererInternalData* getInternalData();
|
||||||
|
|
||||||
virtual void drawLine(const float from[4], const float to[4], const float color[4], float lineWidth=1);
|
virtual void drawLine(const float from[4], const float to[4], const float color[4], float lineWidth=1);
|
||||||
virtual void drawLine(const double from[4], const double to[4], const double color[4], double lineWidth=1);
|
virtual void drawLine(const double from[4], const double to[4], const double color[4], double lineWidth=1);
|
||||||
@@ -119,14 +118,10 @@ public:
|
|||||||
return m_screenHeight;
|
return m_screenHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int getMaxShapeCapacity() const
|
virtual int getMaxShapeCapacity() const;
|
||||||
{
|
|
||||||
return m_maxShapeCapacityInBytes;
|
virtual int getInstanceCapacity() const;
|
||||||
}
|
|
||||||
virtual int getInstanceCapacity() const
|
|
||||||
{
|
|
||||||
return m_maxNumObjectCapacity;
|
|
||||||
}
|
|
||||||
virtual void enableShadowMap();
|
virtual void enableShadowMap();
|
||||||
virtual void enableBlend(bool blend)
|
virtual void enableBlend(bool blend)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -71,6 +71,11 @@ struct SimpleOpenGL2Renderer : public CommonRenderInterface
|
|||||||
virtual void updateShape(int shapeIndex, const float* vertices);
|
virtual void updateShape(int shapeIndex, const float* vertices);
|
||||||
|
|
||||||
virtual void enableBlend(bool blend);
|
virtual void enableBlend(bool blend);
|
||||||
|
|
||||||
|
virtual struct GLInstanceRendererInternalData* getInternalData()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif //SIMPLE_OPENGL2_RENDERER_H
|
#endif //SIMPLE_OPENGL2_RENDERER_H
|
||||||
|
|||||||
@@ -93,7 +93,14 @@ class Planar2D : public CommonRigidBodyBase
|
|||||||
|
|
||||||
void exitPhysics();
|
void exitPhysics();
|
||||||
|
|
||||||
|
void resetCamera()
|
||||||
|
{
|
||||||
|
float dist = 9;
|
||||||
|
float pitch = 539;
|
||||||
|
float yaw = 11;
|
||||||
|
float targetPos[3]={8.6,10.5,-20.6};
|
||||||
|
m_guiHelper->resetCamera(dist,pitch,yaw,targetPos[0],targetPos[1],targetPos[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -325,7 +332,7 @@ void Planar2D::exitPhysics()
|
|||||||
m_box2dbox2dAlgo = 0;
|
m_box2dbox2dAlgo = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommonExampleInterface* Planar2DCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option)
|
CommonExampleInterface* Planar2DCreateFunc(struct CommonExampleOptions& options)
|
||||||
{
|
{
|
||||||
return new Planar2D(helper);
|
return new Planar2D(options.m_guiHelper);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ subject to the following restrictions:
|
|||||||
#ifndef PLANAR2D_H
|
#ifndef PLANAR2D_H
|
||||||
#define PLANAR2D_H
|
#define PLANAR2D_H
|
||||||
|
|
||||||
class CommonExampleInterface* Planar2DCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option);
|
class CommonExampleInterface* Planar2DCreateFunc(struct CommonExampleOptions& options);
|
||||||
|
|
||||||
#endif //BOX2D_DEMO_H
|
#endif //BOX2D_DEMO_H
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,14 @@ public:
|
|||||||
|
|
||||||
virtual void stepSimulation(float deltaTime);
|
virtual void stepSimulation(float deltaTime);
|
||||||
|
|
||||||
|
virtual void resetCamera()
|
||||||
|
{
|
||||||
|
float dist = 18;
|
||||||
|
float pitch = 129;
|
||||||
|
float yaw = 30;
|
||||||
|
float targetPos[3]={-4.6,-4.7,-5.75};
|
||||||
|
m_guiHelper->resetCamera(dist,pitch,yaw,targetPos[0],targetPos[1],targetPos[2]);
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -147,6 +154,7 @@ void RaytestDemo::castRays()
|
|||||||
|
|
||||||
void RaytestDemo::initPhysics()
|
void RaytestDemo::initPhysics()
|
||||||
{
|
{
|
||||||
|
m_guiHelper->setUpAxis(1);
|
||||||
|
|
||||||
///collision configuration contains default setup for memory, collision setup
|
///collision configuration contains default setup for memory, collision setup
|
||||||
m_collisionConfiguration = new btDefaultCollisionConfiguration();
|
m_collisionConfiguration = new btDefaultCollisionConfiguration();
|
||||||
@@ -318,9 +326,9 @@ void RaytestDemo::exitPhysics()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class CommonExampleInterface* RaytestCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option)
|
class CommonExampleInterface* RaytestCreateFunc(struct CommonExampleOptions& options)
|
||||||
{
|
{
|
||||||
return new RaytestDemo(helper);
|
return new RaytestDemo(options.m_guiHelper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ subject to the following restrictions:
|
|||||||
#ifndef BT_RAYTEST_DEMO_H
|
#ifndef BT_RAYTEST_DEMO_H
|
||||||
#define BT_RAYTEST_DEMO_H
|
#define BT_RAYTEST_DEMO_H
|
||||||
|
|
||||||
class CommonExampleInterface* RaytestCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option);
|
class CommonExampleInterface* RaytestCreateFunc(struct CommonExampleOptions& options);
|
||||||
|
|
||||||
|
|
||||||
#endif //BT_RAYTEST_DEMO_H
|
#endif //BT_RAYTEST_DEMO_H
|
||||||
|
|||||||
@@ -138,11 +138,26 @@ public:
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
virtual void resetCamera()
|
||||||
|
{
|
||||||
|
float dist = 3.5;
|
||||||
|
float pitch = 136;
|
||||||
|
float yaw = 32;
|
||||||
|
float targetPos[3]={0,0,0};
|
||||||
|
if (m_app->m_renderer && m_app->m_renderer->getActiveCamera())
|
||||||
|
{
|
||||||
|
m_app->m_renderer->getActiveCamera()->setCameraDistance(dist);
|
||||||
|
m_app->m_renderer->getActiveCamera()->setCameraPitch(pitch);
|
||||||
|
m_app->m_renderer->getActiveCamera()->setCameraYaw(yaw);
|
||||||
|
m_app->m_renderer->getActiveCamera()->setCameraTargetPosition(targetPos[0],targetPos[1],targetPos[2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CommonExampleInterface* CoordinateSystemCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option)
|
struct CommonExampleInterface* CoordinateSystemCreateFunc(struct CommonExampleOptions& options)
|
||||||
{
|
{
|
||||||
return new CoordinateSystemDemo(helper->getAppInterface());
|
return new CoordinateSystemDemo(options.m_guiHelper->getAppInterface());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef COORDINATE_SYSTEM_DEMO_H
|
#ifndef COORDINATE_SYSTEM_DEMO_H
|
||||||
#define COORDINATE_SYSTEM_DEMO_H
|
#define COORDINATE_SYSTEM_DEMO_H
|
||||||
|
|
||||||
class CommonExampleInterface* CoordinateSystemCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option);
|
class CommonExampleInterface* CoordinateSystemCreateFunc(struct CommonExampleOptions& options);
|
||||||
|
|
||||||
|
|
||||||
#endif //COORDINATE_SYSTEM_DEMO_H
|
#endif //COORDINATE_SYSTEM_DEMO_H
|
||||||
|
|||||||
@@ -378,7 +378,7 @@ void RaytracerPhysicsSetup::syncPhysicsToGraphics(GraphicsPhysicsBridge& gfxBrid
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CommonExampleInterface* RayTracerCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option)
|
CommonExampleInterface* RayTracerCreateFunc(struct CommonExampleOptions& options)
|
||||||
{
|
{
|
||||||
return new RaytracerPhysicsSetup(helper->getAppInterface());
|
return new RaytracerPhysicsSetup(options.m_guiHelper->getAppInterface());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#ifndef RAYTRACER_SETUP_H
|
#ifndef RAYTRACER_SETUP_H
|
||||||
#define RAYTRACER_SETUP_H
|
#define RAYTRACER_SETUP_H
|
||||||
|
|
||||||
class CommonExampleInterface* RayTracerCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option);
|
class CommonExampleInterface* RayTracerCreateFunc(struct CommonExampleOptions& options);
|
||||||
|
|
||||||
#endif //RAYTRACER_SETUP_H
|
#endif //RAYTRACER_SETUP_H
|
||||||
|
|||||||
@@ -125,12 +125,27 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void resetCamera()
|
||||||
|
{
|
||||||
|
float dist = 13;
|
||||||
|
float pitch = 50;
|
||||||
|
float yaw = 13;
|
||||||
|
float targetPos[3]={-1,0,-0.3};
|
||||||
|
if (m_app->m_renderer && m_app->m_renderer->getActiveCamera())
|
||||||
|
{
|
||||||
|
m_app->m_renderer->getActiveCamera()->setCameraDistance(dist);
|
||||||
|
m_app->m_renderer->getActiveCamera()->setCameraPitch(pitch);
|
||||||
|
m_app->m_renderer->getActiveCamera()->setCameraYaw(yaw);
|
||||||
|
m_app->m_renderer->getActiveCamera()->setCameraTargetPosition(targetPos[0],targetPos[1],targetPos[2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class CommonExampleInterface* RenderInstancingCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option)
|
class CommonExampleInterface* RenderInstancingCreateFunc(struct CommonExampleOptions& options)
|
||||||
{
|
{
|
||||||
return new RenderInstancingDemo(helper->getAppInterface());
|
return new RenderInstancingDemo(options.m_guiHelper->getAppInterface());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //RENDER_INSTANCING_DEMO_H
|
#endif //RENDER_INSTANCING_DEMO_H
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#ifndef RENDER_INSTANCING_DEMO_H
|
#ifndef RENDER_INSTANCING_DEMO_H
|
||||||
#define RENDER_INSTANCING_DEMO_H
|
#define RENDER_INSTANCING_DEMO_H
|
||||||
|
|
||||||
class CommonExampleInterface* RenderInstancingCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option);
|
class CommonExampleInterface* RenderInstancingCreateFunc(struct CommonExampleOptions& options);
|
||||||
|
|
||||||
#endif //RENDER_INSTANCING_DEMO_H
|
#endif //RENDER_INSTANCING_DEMO_H
|
||||||
|
|||||||
@@ -103,6 +103,16 @@ public:
|
|||||||
|
|
||||||
void exitPhysics();
|
void exitPhysics();
|
||||||
|
|
||||||
|
virtual void resetCamera()
|
||||||
|
{
|
||||||
|
//@todo depends on current_demo?
|
||||||
|
float dist = 45;
|
||||||
|
float pitch = 27;
|
||||||
|
float yaw = 31;
|
||||||
|
float targetPos[3]={10-1,0};
|
||||||
|
m_guiHelper->resetCamera(dist,pitch,yaw,targetPos[0],targetPos[1],targetPos[2]);
|
||||||
|
}
|
||||||
|
|
||||||
SoftDemo(struct GUIHelperInterface* helper)
|
SoftDemo(struct GUIHelperInterface* helper)
|
||||||
: CommonRigidBodyBase(helper),
|
: CommonRigidBodyBase(helper),
|
||||||
m_drag(false)
|
m_drag(false)
|
||||||
@@ -2322,10 +2332,10 @@ void SoftDemo::exitPhysics()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class CommonExampleInterface* SoftDemoCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option)
|
class CommonExampleInterface* SoftDemoCreateFunc(struct CommonExampleOptions& options)
|
||||||
{
|
{
|
||||||
current_demo = option;
|
current_demo = options.m_option;
|
||||||
return new SoftDemo(helper);
|
return new SoftDemo(options.m_guiHelper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ subject to the following restrictions:
|
|||||||
#ifndef SOFT_DEMO_H
|
#ifndef SOFT_DEMO_H
|
||||||
#define SOFT_DEMO_H
|
#define SOFT_DEMO_H
|
||||||
|
|
||||||
class CommonExampleInterface* SoftDemoCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option);
|
class CommonExampleInterface* SoftDemoCreateFunc(struct CommonExampleOptions& options);
|
||||||
|
|
||||||
|
|
||||||
#endif //CCD_PHYSICS_DEMO_H
|
#endif //CCD_PHYSICS_DEMO_H
|
||||||
|
|||||||
@@ -118,6 +118,15 @@ class Hinge2Vehicle : public CommonRigidBodyBase
|
|||||||
void initPhysics();
|
void initPhysics();
|
||||||
void exitPhysics();
|
void exitPhysics();
|
||||||
|
|
||||||
|
virtual void resetCamera()
|
||||||
|
{
|
||||||
|
float dist = 8;
|
||||||
|
float pitch = -45;
|
||||||
|
float yaw = 32;
|
||||||
|
float targetPos[3]={-0.33,-0.72,4.5};
|
||||||
|
m_guiHelper->resetCamera(dist,pitch,yaw,targetPos[0],targetPos[1],targetPos[2]);
|
||||||
|
}
|
||||||
|
|
||||||
/*static DemoApplication* Create()
|
/*static DemoApplication* Create()
|
||||||
{
|
{
|
||||||
Hinge2Vehicle* demo = new Hinge2Vehicle();
|
Hinge2Vehicle* demo = new Hinge2Vehicle();
|
||||||
@@ -1170,7 +1179,7 @@ btRigidBody* Hinge2Vehicle::localCreateRigidBody(btScalar mass, const btTransfor
|
|||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommonExampleInterface* Hinge2VehicleCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option)
|
CommonExampleInterface* Hinge2VehicleCreateFunc(struct CommonExampleOptions& options)
|
||||||
{
|
{
|
||||||
return new Hinge2Vehicle(helper);
|
return new Hinge2Vehicle(options.m_guiHelper);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ subject to the following restrictions:
|
|||||||
#ifndef HINGE2_VEHICLE_H
|
#ifndef HINGE2_VEHICLE_H
|
||||||
#define HINGE2_VEHICLE_H
|
#define HINGE2_VEHICLE_H
|
||||||
|
|
||||||
class CommonExampleInterface* Hinge2VehicleCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option);
|
class CommonExampleInterface* Hinge2VehicleCreateFunc(struct CommonExampleOptions& options);
|
||||||
|
|
||||||
#endif // HINGE2_VEHICLE_H
|
#endif // HINGE2_VEHICLE_H
|
||||||
|
|
||||||
|
|||||||
@@ -105,7 +105,14 @@ class VoronoiFractureDemo : public CommonRigidBodyBase
|
|||||||
|
|
||||||
void attachFixedConstraints();
|
void attachFixedConstraints();
|
||||||
|
|
||||||
|
virtual void resetCamera()
|
||||||
|
{
|
||||||
|
float dist = 18;
|
||||||
|
float pitch = 129;
|
||||||
|
float yaw = 30;
|
||||||
|
float targetPos[3]={-1.5,4.7,-2};
|
||||||
|
m_guiHelper->resetCamera(dist,pitch,yaw,targetPos[0],targetPos[1],targetPos[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -817,7 +824,7 @@ static DemoApplication* Create()
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CommonExampleInterface* VoronoiFractureCreateFunc(PhysicsInterface* pint, GUIHelperInterface* helper, int option)
|
CommonExampleInterface* VoronoiFractureCreateFunc(struct CommonExampleOptions& options)
|
||||||
{
|
{
|
||||||
return new VoronoiFractureDemo(helper);
|
return new VoronoiFractureDemo(options.m_guiHelper);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ subject to the following restrictions:
|
|||||||
#ifndef VORONOI_FRACTURE_DEMO_H
|
#ifndef VORONOI_FRACTURE_DEMO_H
|
||||||
#define VORONOI_FRACTURE_DEMO_H
|
#define VORONOI_FRACTURE_DEMO_H
|
||||||
|
|
||||||
class CommonExampleInterface* VoronoiFractureCreateFunc(struct PhysicsInterface* pint, struct GUIHelperInterface* helper, int option);
|
class CommonExampleInterface* VoronoiFractureCreateFunc(struct CommonExampleOptions& options);
|
||||||
|
|
||||||
#endif //VORONOI_FRACTURE_DEMO_H
|
#endif //VORONOI_FRACTURE_DEMO_H
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user