Danbias/Code/GamePhysics/Implementation/PhysicsAPI_Impl.h

62 lines
2.3 KiB
C
Raw Normal View History

#ifndef PHYSICS_API_IMPL_H
#define PHYSICS_API_IMPL_H
#include "../PhysicsAPI.h"
2013-11-28 17:59:12 +01:00
#include "Octree.h"
2014-02-09 21:24:09 +01:00
#include <btBulletDynamicsCommon.h>
namespace Oyster
{
namespace Physics
{
class API_Impl : public API
{
public:
API_Impl();
virtual ~API_Impl();
2014-02-09 21:24:09 +01:00
void Init();
bool IsInLimbo( const ICustomBody* objRef );
void MoveToLimbo( const ICustomBody* objRef );
void ReleaseFromLimbo( const ICustomBody* objRef );
2014-02-11 13:36:14 +01:00
void SetGravityPoint(::Oyster::Math::Float3 gravityPoint);
void SetGravity(float gravity);
2014-02-09 21:24:09 +01:00
// Bullet physics
ICustomBody* AddCollisionSphere(float radius, ::Oyster::Math::Float4 rotation, ::Oyster::Math::Float3 position, float mass, float restitution, float staticFriction, float dynamicFriction);
ICustomBody* AddCollisionBox(::Oyster::Math::Float3 halfSize, ::Oyster::Math::Float4 rotation, ::Oyster::Math::Float3 position, float mass, float restitution, float staticFriction, float dynamicFriction);
ICustomBody* AddCollisionCylinder(::Oyster::Math::Float3 halfSize, ::Oyster::Math::Float4 rotation, ::Oyster::Math::Float3 position, float mass, float restitution, float staticFriction, float dynamicFriction);
void SetTimeStep(float timeStep);
2014-02-09 21:24:09 +01:00
void UpdateWorld();
2014-01-15 10:44:31 +01:00
2014-01-28 10:18:26 +01:00
void ApplyEffect( const Oyster::Collision3D::ICollideable& collideable, void* args, void(hitAction)(ICustomBody*, void*) );
private:
2014-02-09 21:24:09 +01:00
btBroadphaseInterface* broadphase;
btDefaultCollisionConfiguration* collisionConfiguration;
btCollisionDispatcher* dispatcher;
btSequentialImpulseConstraintSolver* solver;
btDiscreteDynamicsWorld* dynamicsWorld;
std::vector<ICustomBody*> customBodies;
float timeStep;
2014-02-11 13:36:14 +01:00
::Oyster::Math::Float3 gravityPoint;
float gravity;
};
namespace Default
{
void EventAction_Destruction( ::Utility::DynamicMemory::UniquePointer<::Oyster::Physics::ICustomBody> proto );
::Oyster::Physics::ICustomBody::SubscriptMessage EventAction_BeforeCollisionResponse( const ::Oyster::Physics::ICustomBody *proto, const ::Oyster::Physics::ICustomBody *deuter );
void EventAction_AfterCollisionResponse( const ::Oyster::Physics::ICustomBody *proto, const ::Oyster::Physics::ICustomBody *deuter, ::Oyster::Math::Float kineticEnergyLoss );
void EventAction_Move( const ::Oyster::Physics::ICustomBody *object );
}
}
}
#endif