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:
erwincoumans
2015-05-01 11:42:14 -07:00
parent 3dd41b84a8
commit 218e9f9bf9
66 changed files with 562 additions and 217 deletions

View File

@@ -43,12 +43,19 @@ class AllConstraintDemo : public CommonRigidBodyBase
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);
// 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);
}

View File

@@ -15,7 +15,7 @@ subject to the following restrictions:
#ifndef 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

View File

@@ -14,6 +14,17 @@ struct ConstraintPhysicsSetup : public CommonRigidBodyBase
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)
@@ -144,7 +155,7 @@ void ConstraintPhysicsSetup::initPhysics()
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);
}

View File

@@ -1,6 +1,6 @@
#ifndef 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

View File

@@ -51,6 +51,15 @@ struct Dof6Spring2Setup : public CommonRigidBodyBase
virtual void stepSimulation(float deltaTime);
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);
}
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);
}

View File

@@ -1,6 +1,6 @@
#ifndef 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