-
Notifications
You must be signed in to change notification settings - Fork 0
/
NPhysicsEngine.cpp
42 lines (36 loc) · 1.38 KB
/
NPhysicsEngine.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// NPhysics.cpp : Define las funciones de la biblioteca estática.
//
#include "pch.h"
#include "NPhysicsEngine.h"
#include "source/InstantiableObject.h"
#include "source/bvh/boundingVolumes/SphereBoundingVolume.h"
#include "source/bvh/boundingVolumes/BoxBoundingVolume.h"
namespace NPhysics
{
NPhysicsEngine::NPhysicsEngine()
{
InstantiableObject::RegisterBoundingVolume<SphereBoundingVolume>();
InstantiableObject::RegisterBoundingVolume<BoxBoundingVolume>();
}
void NPhysicsEngine::AddParticle(std::shared_ptr<Particle> particle)
{
mParticlePhysicsEngine.AddParticle(particle);
}
void NPhysicsEngine::RegisterParticleForceGenerator(std::shared_ptr<Particle> particle, std::shared_ptr<IForceGenerator<Particle>> forceGenerator)
{
mParticlePhysicsEngine.RegisterForceGenerator(particle, forceGenerator);
}
void NPhysicsEngine::Update(real duration)
{
mParticlePhysicsEngine.Update(duration);
mRigidBodyPhysicsEngine.Update(duration);
}
void NPhysicsEngine::AddRigidBody(std::shared_ptr<RigidBody> body, std::shared_ptr<IBoundingVolume> volume)
{
mRigidBodyPhysicsEngine.AddRigidBody(body, volume);
}
void NPhysicsEngine::RegisterRigidBodyForceGenerator(std::shared_ptr<RigidBody> body, std::shared_ptr<IBoundingVolume> volume, std::shared_ptr<IForceGenerator<RigidBody>> forceGenerator)
{
mRigidBodyPhysicsEngine.RegisterForceGenerator(body, volume, forceGenerator);
}
}