Added Physics module

Former-commit-id: acc3ffe119ebfae9c0199eb878a621325c28844a
This commit is contained in:
Lynix
2013-05-23 23:16:36 +02:00
parent 50e8ce3658
commit 8014f67eb8
14 changed files with 926 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
// Copyright (C) 2013 Jérôme Leclercq
// This file is part of the "Nazara Engine - Physics module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Physics/PhysWorld.hpp>
#include <Newton/Newton.h>
#include <Nazara/Physics/Debug.hpp>
NzPhysWorld::NzPhysWorld()
{
m_world = NewtonCreate();
NewtonWorldSetUserData(m_world, this);
}
NzPhysWorld::~NzPhysWorld()
{
NewtonDestroy(m_world);
}
NzVector3f NzPhysWorld::GetGravity() const
{
return m_gravity;
}
NewtonWorld* NzPhysWorld::GetHandle() const
{
return m_world;
}
void NzPhysWorld::SetGravity(const NzVector3f& gravity)
{
m_gravity = gravity;
}
void NzPhysWorld::SetSize(const NzCubef& cube)
{
NewtonSetWorldSize(m_world, cube.GetPosition(), cube.GetPosition()+cube.GetSize());
}
void NzPhysWorld::SetSize(const NzVector3f& min, const NzVector3f& max)
{
NewtonSetWorldSize(m_world, min, max);
}
void NzPhysWorld::SetSolverModel(unsigned int model)
{
NewtonSetSolverModel(m_world, model);
}
void NzPhysWorld::Update(float timestep)
{
NewtonUpdate(m_world, timestep);
}