bullet3/demos3/BasicGpuDemo/b3GpuDynamicsWorld.h
erwincoumans 161c48d331 work-in-progress Bullet 3.x GPU raytest
work-in-progress P2P constraint for b3GpuDynamicsWorld
2013-06-17 13:47:35 -07:00

113 lines
2.6 KiB
C++

#ifndef B3_GPU_DYNAMICS_WORLD_H
#define B3_GPU_DYNAMICS_WORLD_H
#include "LinearMath/btVector3.h"
class btRigidBody;
class btCollisionObject;
struct b3GpuInternalData;//use this struct to avoid 'leaking' all OpenCL headers into clients code base
class CLPhysicsDemo;
class btActionInterface;
class btTypedConstraint;
#include "LinearMath/btAlignedObjectArray.h"
#include "BulletDynamics/Dynamics/btDynamicsWorld.h"
class b3GpuDynamicsWorld : public btDynamicsWorld
{
btAlignedObjectArray<const class btCollisionShape*> m_uniqueShapes;
btAlignedObjectArray<int> m_uniqueShapeMapping;
btAlignedObjectArray<btTypedConstraint*> m_constraints;
class b3GpuRigidBodyPipeline* m_rigidBodyPipeline;
class b3GpuNarrowPhase* m_np;
class b3GpuSapBroadphase* m_bp;
btVector3 m_gravity;
bool m_cpuGpuSync;
float m_localTime;
int findOrRegisterCollisionShape(const btCollisionShape* colShape);
public:
b3GpuDynamicsWorld(class b3GpuSapBroadphase* bp,class b3GpuNarrowPhase* np, class b3GpuRigidBodyPipeline* rigidBodyPipeline);
virtual ~b3GpuDynamicsWorld();
virtual int stepSimulation( btScalar timeStep,int maxSubSteps=1, btScalar fixedTimeStep=btScalar(1.)/btScalar(60.));
virtual void synchronizeMotionStates();
void debugDrawWorld() {}
void setGravity(const btVector3& gravity);
void addRigidBody(btRigidBody* body);
void removeCollisionObject(btCollisionObject* colObj);
virtual void removeRigidBody(btRigidBody* body);
virtual void addConstraint(btTypedConstraint* constraint, bool disableCollisionsBetweenLinkedBodies=false);
virtual void removeConstraint(btTypedConstraint* constraint);
void rayTest(const btVector3& rayFromWorld, const btVector3& rayToWorld, RayResultCallback& resultCallback) const;
btAlignedObjectArray<class btCollisionObject*>& getCollisionObjectArray();
const btAlignedObjectArray<class btCollisionObject*>& getCollisionObjectArray() const;
btVector3 getGravity () const
{
return m_gravity;
}
virtual void addRigidBody(btRigidBody* body, short group, short mask)
{
addRigidBody(body);
}
virtual void addAction(btActionInterface* action)
{
btAssert(0);
}
virtual void removeAction(btActionInterface* action)
{
btAssert(0);
}
virtual void setConstraintSolver(btConstraintSolver* solver)
{
btAssert(0);
}
virtual btConstraintSolver* getConstraintSolver()
{
btAssert(0);
return 0;
}
virtual void clearForces();
virtual btDynamicsWorldType getWorldType() const
{
return BT_GPU_DYNAMICS_WORLD;
}
///this can be useful to synchronize a single rigid body -> graphics object
void synchronizeSingleMotionState(btRigidBody* body);
};
#endif //B3_GPU_DYNAMICS_WORLD_H