#ifndef PHYSICS_WORLD_H
#define PHYSICS_WORLD_H

#include <vector>

#define dDOUBLE
#include <ode/ode.h>

class PhysicsObject;

class PhysicsWorld
{
public:
	PhysicsWorld();
	~PhysicsWorld();

	void Create();
	void Destroy();

	void Update(float deltaTime);
	void DebugDraw();

	dWorldID GetWorld();
	dSpaceID GetSpace();

	void AddObject(PhysicsObject* object);
	void RemoveObject(PhysicsObject* object);

	void SetGravity(const Vec3& gravityVector);
	Vec3 GetGravity();

	void NearCollisionCallback(dGeomID id1, dGeomID id2);

private:
	std::vector<PhysicsObject*> m_objects;

	dWorldID m_dynamicsWorld;
	dSpaceID m_space;
};

extern PhysicsWorld* g_PhysicsWorld;

void PhysicsInit();
void PhysicsShutdown();

#endif // !PHYSICS_WORLD_H
