Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- RagdollDemo.h
- */
- #ifndef RAGDOLLDEMO_H
- #define RAGDOLLDEMO_H
- #include "GlutDemoApplication.h"
- #include "GLDebugDrawer.h"
- #include "btBulletCollisionCommon.h"
- #include "btBulletDynamicsCommon.h"
- int ConsoleWait(void);
- class RagdollDemo : public GlutDemoApplication
- {
- //keep the collision shapes, for deletion/cleanup
- btAlignedObjectArray<btCollisionShape*> m_collisionShapes;
- btBroadphaseInterface * m_broadphase;
- btCollisionDispatcher * m_dispatcher;
- btConstraintSolver * m_solver;
- btDefaultCollisionConfiguration * m_collisionConfiguration;
- // one main body,
- // 4x2 leg segments,
- // one north marker,
- // 4 ball elbows.
- btCollisionShape * geom[42];
- btHingeConstraint * joints[8];
- btFixedConstraint * welds[4];
- btCollisionObject * fixedGround;
- int IDs[45];
- bool oneStep;
- bool pause;
- double globaljointA;
- double currjointA[8];
- unsigned long int simtick;
- double touchsensor[4];
- public:
- btRigidBody * body[42];
- double weights[4][8];
- bool OPTdrawgraphics;
- bool OPTloadbestweights;
- char OPTbestweightsfile[80];
- int touches[43];
- btVector3 touchPoints[43];
- unsigned long int timeStep;
- int threadID;
- bool position_sane;
- public:
- void initPhysics();
- void exitPhysics();
- virtual ~RagdollDemo()
- {
- exitPhysics();
- }
- virtual void clientMoveAndDisplay();
- virtual void displayCallback();
- virtual void keyboardCallback(unsigned char key, int x, int y);
- static DemoApplication* Create()
- {
- RagdollDemo* demo = new RagdollDemo();
- demo->myinit();
- demo->initPhysics();
- return demo;
- }
- virtual void renderme() {
- extern GLDebugDrawer gDebugDrawer;
- // Call the parent method.
- GlutDemoApplication::renderme();
- }
- void CreateBox(
- int index,
- double x, double y, double z,
- double length, double width, double height );
- void CreateCylinder(
- int index,
- double x, double y, double z,
- double length, double width, double height,
- double xrot , double yrot , double zrot );
- void CreateSphere(
- int index,
- double x, double y, double z,
- double radius );
- void BuildWallofCans(void);
- void CreateHinge(int index,
- int body1, int body2,
- double x, double y, double z,
- double ax, double ay, double az);
- void CreateWeld(int index,
- int body1, int body2 );
- void DeleteObject( int index );
- void DestroyHinge( int index );
- void DestroyWeld( int index );
- void ActuateJoint( int jointIndex, double desiredAngle,
- double jointOffset, double timeStep);
- void ActuateJoint2( int jointIndex, double desiredAngle,
- double jointOffset, double timeStep);
- btVector3 PointWorldToLocal(int index, btVector3 &p);
- btVector3 AxisWorldToLocal( int index, btVector3 &a);
- double ConvertActuatorToJoint(int index, double actang);
- double RandomJoint(void);
- double RandomWeight(void);
- void ConsoleFloat(double cf);
- void ConsoleTouches(void);
- int GetFileWeights(char * GFWname );
- int SavePosition( btRigidBody * spbody, char * SPname );
- void WeightFileHandler(void);
- double Fitness(void);
- void AssignToCallback(void);
- bool SanityCheck(double maxbound);
- inline bool airborne(void);
- };
- inline bool RagdollDemo::airborne(void)
- {
- return( (touches[5]==0) && (touches[6]==0) && (touches[7]==0) &&(touches[8]==0) );
- }
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement