Merge remote-tracking branch 'refs/remotes/origin/master' into culling
This commit is contained in:
@@ -1,40 +0,0 @@
|
||||
// Copyright (C) 2015 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Development Kit"
|
||||
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NDK_SYSTEMS_PHYSICSSYSTEM_HPP
|
||||
#define NDK_SYSTEMS_PHYSICSSYSTEM_HPP
|
||||
|
||||
#include <Nazara/Physics/PhysWorld.hpp>
|
||||
#include <NDK/EntityList.hpp>
|
||||
#include <NDK/System.hpp>
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
class NDK_API PhysicsSystem : public System<PhysicsSystem>
|
||||
{
|
||||
public:
|
||||
PhysicsSystem();
|
||||
PhysicsSystem(const PhysicsSystem& system);
|
||||
~PhysicsSystem() = default;
|
||||
|
||||
Nz::PhysWorld& GetWorld();
|
||||
const Nz::PhysWorld& GetWorld() const;
|
||||
|
||||
static SystemIndex systemIndex;
|
||||
|
||||
private:
|
||||
void OnEntityValidation(Entity* entity, bool justAdded) override;
|
||||
void OnUpdate(float elapsedTime) override;
|
||||
|
||||
EntityList m_dynamicObjects;
|
||||
EntityList m_staticObjects;
|
||||
Nz::PhysWorld m_world;
|
||||
};
|
||||
}
|
||||
|
||||
#include <NDK/Systems/PhysicsSystem.inl>
|
||||
|
||||
#endif // NDK_SYSTEMS_PHYSICSSYSTEM_HPP
|
||||
42
SDK/include/NDK/Systems/PhysicsSystem3D.hpp
Normal file
42
SDK/include/NDK/Systems/PhysicsSystem3D.hpp
Normal file
@@ -0,0 +1,42 @@
|
||||
// Copyright (C) 2015 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Development Kit"
|
||||
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NDK_SYSTEMS_PHYSICSSYSTEM3D_HPP
|
||||
#define NDK_SYSTEMS_PHYSICSSYSTEM3D_HPP
|
||||
|
||||
#include <Nazara/Physics3D/PhysWorld3D.hpp>
|
||||
#include <NDK/EntityList.hpp>
|
||||
#include <NDK/System.hpp>
|
||||
#include <memory>
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
class NDK_API PhysicsSystem3D : public System<PhysicsSystem3D>
|
||||
{
|
||||
public:
|
||||
PhysicsSystem3D();
|
||||
PhysicsSystem3D(const PhysicsSystem3D& system);
|
||||
~PhysicsSystem3D() = default;
|
||||
|
||||
Nz::PhysWorld3D& GetWorld();
|
||||
const Nz::PhysWorld3D& GetWorld() const;
|
||||
|
||||
static SystemIndex systemIndex;
|
||||
|
||||
private:
|
||||
void CreatePhysWorld() const;
|
||||
void OnEntityValidation(Entity* entity, bool justAdded) override;
|
||||
void OnUpdate(float elapsedTime) override;
|
||||
|
||||
EntityList m_dynamicObjects;
|
||||
EntityList m_staticObjects;
|
||||
mutable std::unique_ptr<Nz::PhysWorld3D> m_world; ///TODO: std::optional (Should I make a Nz::Optional class?)
|
||||
};
|
||||
}
|
||||
|
||||
#include <NDK/Systems/PhysicsSystem3D.inl>
|
||||
|
||||
#endif // NDK_SYSTEMS_PHYSICSSYSTEM3D_HPP
|
||||
@@ -9,9 +9,12 @@ namespace Ndk
|
||||
* \return A reference to the physical world
|
||||
*/
|
||||
|
||||
inline Nz::PhysWorld& PhysicsSystem::GetWorld()
|
||||
inline Nz::PhysWorld3D& PhysicsSystem3D::GetWorld()
|
||||
{
|
||||
return m_world;
|
||||
if (!m_world)
|
||||
CreatePhysWorld();
|
||||
|
||||
return *m_world;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -19,8 +22,11 @@ namespace Ndk
|
||||
* \return A constant reference to the physical world
|
||||
*/
|
||||
|
||||
inline const Nz::PhysWorld& PhysicsSystem::GetWorld() const
|
||||
inline const Nz::PhysWorld3D& PhysicsSystem3D::GetWorld() const
|
||||
{
|
||||
return m_world;
|
||||
if (!m_world)
|
||||
CreatePhysWorld();
|
||||
|
||||
return *m_world;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user