From be44a89a858b72fb2ea352d47ccd1219e838c55d Mon Sep 17 00:00:00 2001 From: Lynix Date: Thu, 13 Oct 2016 08:23:25 +0200 Subject: [PATCH] Sdk: Rename [Collision|Physics]Component to [Collision|Physics]Component3D --- SDK/include/NDK/Components.hpp | 4 +- ...Component.hpp => CollisionComponent3D.hpp} | 16 +++--- ...Component.inl => CollisionComponent3D.inl} | 20 +++---- ...csComponent.hpp => PhysicsComponent3D.hpp} | 20 +++---- ...csComponent.inl => PhysicsComponent3D.inl} | 52 +++++++++---------- SDK/include/NDK/Systems.hpp | 2 +- ...{PhysicsSystem.hpp => PhysicsSystem3D.hpp} | 16 +++--- ...{PhysicsSystem.inl => PhysicsSystem3D.inl} | 4 +- ...Component.cpp => CollisionComponent3D.cpp} | 38 +++++++------- ...csComponent.cpp => PhysicsComponent3D.cpp} | 32 ++++++------ SDK/src/NDK/Sdk.cpp | 12 ++--- ...{PhysicsSystem.cpp => PhysicsSystem3D.cpp} | 30 +++++------ SDK/src/NDK/Systems/VelocitySystem.cpp | 6 +-- SDK/src/NDK/World.cpp | 4 +- src/Nazara/Physics3D/Collider3D.cpp | 2 +- src/Nazara/Physics3D/PhysWorld3D.cpp | 2 +- src/Nazara/Physics3D/RigidBody3D.cpp | 2 +- ...{PhysicsSystem.cpp => PhysicsSystem3D.cpp} | 10 ++-- 18 files changed, 136 insertions(+), 136 deletions(-) rename SDK/include/NDK/Components/{CollisionComponent.hpp => CollisionComponent3D.hpp} (69%) rename SDK/include/NDK/Components/{CollisionComponent.inl => CollisionComponent3D.inl} (57%) rename SDK/include/NDK/Components/{PhysicsComponent.hpp => PhysicsComponent3D.hpp} (79%) rename SDK/include/NDK/Components/{PhysicsComponent.inl => PhysicsComponent3D.inl} (79%) rename SDK/include/NDK/Systems/{PhysicsSystem.hpp => PhysicsSystem3D.hpp} (69%) rename SDK/include/NDK/Systems/{PhysicsSystem.inl => PhysicsSystem3D.inl} (78%) rename SDK/src/NDK/Components/{CollisionComponent.cpp => CollisionComponent3D.cpp} (66%) rename SDK/src/NDK/Components/{PhysicsComponent.cpp => PhysicsComponent3D.cpp} (63%) rename SDK/src/NDK/Systems/{PhysicsSystem.cpp => PhysicsSystem3D.cpp} (77%) rename tests/SDK/NDK/Systems/{PhysicsSystem.cpp => PhysicsSystem3D.cpp} (73%) diff --git a/SDK/include/NDK/Components.hpp b/SDK/include/NDK/Components.hpp index 79bc196f7..afa25ade8 100644 --- a/SDK/include/NDK/Components.hpp +++ b/SDK/include/NDK/Components.hpp @@ -6,14 +6,14 @@ #define NDK_COMPONENTS_GLOBAL_HPP #include -#include +#include #include #include #include #include #include #include -#include +#include #include #endif // NDK_COMPONENTS_GLOBAL_HPP diff --git a/SDK/include/NDK/Components/CollisionComponent.hpp b/SDK/include/NDK/Components/CollisionComponent3D.hpp similarity index 69% rename from SDK/include/NDK/Components/CollisionComponent.hpp rename to SDK/include/NDK/Components/CollisionComponent3D.hpp index 565a60871..f6a07ede6 100644 --- a/SDK/include/NDK/Components/CollisionComponent.hpp +++ b/SDK/include/NDK/Components/CollisionComponent3D.hpp @@ -20,22 +20,22 @@ namespace Ndk { class Entity; - class NDK_API CollisionComponent : public Component + class NDK_API CollisionComponent3D : public Component { - friend class PhysicsSystem; + friend class PhysicsSystem3D; friend class StaticCollisionSystem; public: - CollisionComponent(Nz::Collider3DRef geom = Nz::Collider3DRef()); - CollisionComponent(const CollisionComponent& collision); - ~CollisionComponent() = default; + CollisionComponent3D(Nz::Collider3DRef geom = Nz::Collider3DRef()); + CollisionComponent3D(const CollisionComponent3D& collision); + ~CollisionComponent3D() = default; const Nz::Collider3DRef& GetGeom() const; void SetGeom(Nz::Collider3DRef geom); - CollisionComponent& operator=(Nz::Collider3DRef geom); - CollisionComponent& operator=(CollisionComponent&& collision) = default; + CollisionComponent3D& operator=(Nz::Collider3DRef geom); + CollisionComponent3D& operator=(CollisionComponent3D&& collision) = default; static ComponentIndex componentIndex; @@ -54,6 +54,6 @@ namespace Ndk }; } -#include +#include #endif // NDK_COMPONENTS_COLLISIONCOMPONENT_HPP diff --git a/SDK/include/NDK/Components/CollisionComponent.inl b/SDK/include/NDK/Components/CollisionComponent3D.inl similarity index 57% rename from SDK/include/NDK/Components/CollisionComponent.inl rename to SDK/include/NDK/Components/CollisionComponent3D.inl index 7243996fb..d5dfeaacc 100644 --- a/SDK/include/NDK/Components/CollisionComponent.inl +++ b/SDK/include/NDK/Components/CollisionComponent3D.inl @@ -4,30 +4,30 @@ #include #include -#include -#include +#include +#include namespace Ndk { /*! - * \brief Constructs a CollisionComponent object with a geometry + * \brief Constructs a CollisionComponent3D object with a geometry * * \param geom Reference to a geometry symbolizing the entity */ - inline CollisionComponent::CollisionComponent(Nz::Collider3DRef geom) : + inline CollisionComponent3D::CollisionComponent3D(Nz::Collider3DRef geom) : m_geom(std::move(geom)), m_bodyUpdated(false) { } /*! - * \brief Constructs a CollisionComponent object by copy semantic + * \brief Constructs a CollisionComponent3D object by copy semantic * - * \param collision CollisionComponent to copy + * \param collision CollisionComponent3D to copy */ - inline CollisionComponent::CollisionComponent(const CollisionComponent& collision) : + inline CollisionComponent3D::CollisionComponent3D(const CollisionComponent3D& collision) : m_geom(collision.m_geom), m_bodyUpdated(false) { @@ -38,7 +38,7 @@ namespace Ndk * \return A constant reference to the physics geometry */ - inline const Nz::Collider3DRef& CollisionComponent::GetGeom() const + inline const Nz::Collider3DRef& CollisionComponent3D::GetGeom() const { return m_geom; } @@ -50,7 +50,7 @@ namespace Ndk * \param geom Reference to a geometry symbolizing the entity */ - inline CollisionComponent& CollisionComponent::operator=(Nz::Collider3DRef geom) + inline CollisionComponent3D& CollisionComponent3D::operator=(Nz::Collider3DRef geom) { SetGeom(geom); @@ -62,7 +62,7 @@ namespace Ndk * \return A pointer to the entity */ - inline Nz::RigidBody3D* CollisionComponent::GetStaticBody() + inline Nz::RigidBody3D* CollisionComponent3D::GetStaticBody() { return m_staticBody.get(); } diff --git a/SDK/include/NDK/Components/PhysicsComponent.hpp b/SDK/include/NDK/Components/PhysicsComponent3D.hpp similarity index 79% rename from SDK/include/NDK/Components/PhysicsComponent.hpp rename to SDK/include/NDK/Components/PhysicsComponent3D.hpp index c426d71bb..fc1367d84 100644 --- a/SDK/include/NDK/Components/PhysicsComponent.hpp +++ b/SDK/include/NDK/Components/PhysicsComponent3D.hpp @@ -4,8 +4,8 @@ #pragma once -#ifndef NDK_COMPONENTS_PHYSICSCOMPONENT_HPP -#define NDK_COMPONENTS_PHYSICSCOMPONENT_HPP +#ifndef NDK_COMPONENTS_PHYSICSCOMPONENT3D_HPP +#define NDK_COMPONENTS_PHYSICSCOMPONENT3D_HPP #include #include @@ -15,15 +15,15 @@ namespace Ndk { class Entity; - class NDK_API PhysicsComponent : public Component + class NDK_API PhysicsComponent3D : public Component { - friend class CollisionComponent; - friend class PhysicsSystem; + friend class CollisionComponent3D; + friend class PhysicsSystem3D; public: - PhysicsComponent() = default; - PhysicsComponent(const PhysicsComponent& physics); - ~PhysicsComponent() = default; + PhysicsComponent3D() = default; + PhysicsComponent3D(const PhysicsComponent3D& physics); + ~PhysicsComponent3D() = default; void AddForce(const Nz::Vector3f& force, Nz::CoordSys coordSys = Nz::CoordSys_Global); void AddForce(const Nz::Vector3f& force, const Nz::Vector3f& point, Nz::CoordSys coordSys = Nz::CoordSys_Global); @@ -67,6 +67,6 @@ namespace Ndk }; } -#include +#include -#endif // NDK_COMPONENTS_PHYSICSCOMPONENT_HPP +#endif // NDK_COMPONENTS_PHYSICSCOMPONENT3D_HPP diff --git a/SDK/include/NDK/Components/PhysicsComponent.inl b/SDK/include/NDK/Components/PhysicsComponent3D.inl similarity index 79% rename from SDK/include/NDK/Components/PhysicsComponent.inl rename to SDK/include/NDK/Components/PhysicsComponent3D.inl index 009d62ba5..84bc36db7 100644 --- a/SDK/include/NDK/Components/PhysicsComponent.inl +++ b/SDK/include/NDK/Components/PhysicsComponent3D.inl @@ -7,12 +7,12 @@ namespace Ndk { /*! - * \brief Constructs a PhysicsComponent object by copy semantic + * \brief Constructs a PhysicsComponent3D object by copy semantic * - * \param physics PhysicsComponent to copy + * \param physics PhysicsComponent3D to copy */ - inline PhysicsComponent::PhysicsComponent(const PhysicsComponent& physics) + inline PhysicsComponent3D::PhysicsComponent3D(const PhysicsComponent3D& physics) { // No copy of physical object (because we only create it when attached to an entity) NazaraUnused(physics); @@ -27,7 +27,7 @@ namespace Ndk * \remark Produces a NazaraAssert if the physics object is invalid */ - inline void PhysicsComponent::AddForce(const Nz::Vector3f& force, Nz::CoordSys coordSys) + inline void PhysicsComponent3D::AddForce(const Nz::Vector3f& force, Nz::CoordSys coordSys) { NazaraAssert(m_object, "Invalid physics object"); @@ -44,7 +44,7 @@ namespace Ndk * \remark Produces a NazaraAssert if the physics object is invalid */ - inline void PhysicsComponent::AddForce(const Nz::Vector3f& force, const Nz::Vector3f& point, Nz::CoordSys coordSys) + inline void PhysicsComponent3D::AddForce(const Nz::Vector3f& force, const Nz::Vector3f& point, Nz::CoordSys coordSys) { NazaraAssert(m_object, "Invalid physics object"); @@ -60,7 +60,7 @@ namespace Ndk * \remark Produces a NazaraAssert if the physics object is invalid */ - inline void PhysicsComponent::AddTorque(const Nz::Vector3f& torque, Nz::CoordSys coordSys) + inline void PhysicsComponent3D::AddTorque(const Nz::Vector3f& torque, Nz::CoordSys coordSys) { NazaraAssert(m_object, "Invalid physics object"); @@ -75,7 +75,7 @@ namespace Ndk * \remark Produces a NazaraAssert if the physics object is invalid */ - inline void PhysicsComponent::EnableAutoSleep(bool autoSleep) + inline void PhysicsComponent3D::EnableAutoSleep(bool autoSleep) { NazaraAssert(m_object, "Invalid physics object"); @@ -89,7 +89,7 @@ namespace Ndk * \remark Produces a NazaraAssert if the physics object is invalid */ - inline Nz::Boxf PhysicsComponent::GetAABB() const + inline Nz::Boxf PhysicsComponent3D::GetAABB() const { NazaraAssert(m_object, "Invalid physics object"); @@ -103,7 +103,7 @@ namespace Ndk * \remark Produces a NazaraAssert if the physics object is invalid */ - inline Nz::Vector3f PhysicsComponent::GetAngularVelocity() const + inline Nz::Vector3f PhysicsComponent3D::GetAngularVelocity() const { NazaraAssert(m_object, "Invalid physics object"); @@ -117,7 +117,7 @@ namespace Ndk * \remark Produces a NazaraAssert if the physics object is invalid */ - inline float PhysicsComponent::GetGravityFactor() const + inline float PhysicsComponent3D::GetGravityFactor() const { NazaraAssert(m_object, "Invalid physics object"); @@ -131,7 +131,7 @@ namespace Ndk * \remark Produces a NazaraAssert if the physics object is invalid */ - inline float PhysicsComponent::GetMass() const + inline float PhysicsComponent3D::GetMass() const { NazaraAssert(m_object, "Invalid physics object"); @@ -147,7 +147,7 @@ namespace Ndk * \remark Produces a NazaraAssert if the physics object is invalid */ - inline Nz::Vector3f PhysicsComponent::GetMassCenter(Nz::CoordSys coordSys) const + inline Nz::Vector3f PhysicsComponent3D::GetMassCenter(Nz::CoordSys coordSys) const { NazaraAssert(m_object, "Invalid physics object"); @@ -161,7 +161,7 @@ namespace Ndk * \remark Produces a NazaraAssert if the physics object is invalid */ - inline const Nz::Matrix4f& PhysicsComponent::GetMatrix() const + inline const Nz::Matrix4f& PhysicsComponent3D::GetMatrix() const { NazaraAssert(m_object, "Invalid physics object"); @@ -175,7 +175,7 @@ namespace Ndk * \remark Produces a NazaraAssert if the physics object is invalid */ - inline Nz::Vector3f PhysicsComponent::GetPosition() const + inline Nz::Vector3f PhysicsComponent3D::GetPosition() const { NazaraAssert(m_object, "Invalid physics object"); @@ -189,7 +189,7 @@ namespace Ndk * \remark Produces a NazaraAssert if the physics object is invalid */ - inline Nz::Quaternionf PhysicsComponent::GetRotation() const + inline Nz::Quaternionf PhysicsComponent3D::GetRotation() const { NazaraAssert(m_object, "Invalid physics object"); @@ -203,7 +203,7 @@ namespace Ndk * \remark Produces a NazaraAssert if the physics object is invalid */ - inline Nz::Vector3f PhysicsComponent::GetVelocity() const + inline Nz::Vector3f PhysicsComponent3D::GetVelocity() const { NazaraAssert(m_object, "Invalid physics object"); @@ -217,7 +217,7 @@ namespace Ndk * \remark Produces a NazaraAssert if the physics object is invalid */ - inline bool PhysicsComponent::IsAutoSleepEnabled() const + inline bool PhysicsComponent3D::IsAutoSleepEnabled() const { NazaraAssert(m_object, "Invalid physics object"); @@ -231,7 +231,7 @@ namespace Ndk * \remark Produces a NazaraAssert if the physics object is invalid */ - inline bool PhysicsComponent::IsSleeping() const + inline bool PhysicsComponent3D::IsSleeping() const { NazaraAssert(m_object, "Invalid physics object"); @@ -246,7 +246,7 @@ namespace Ndk * \remark Produces a NazaraAssert if the physics object is invalid */ - inline void PhysicsComponent::SetAngularVelocity(const Nz::Vector3f& angularVelocity) + inline void PhysicsComponent3D::SetAngularVelocity(const Nz::Vector3f& angularVelocity) { NazaraAssert(m_object, "Invalid physics object"); @@ -261,7 +261,7 @@ namespace Ndk * \remark Produces a NazaraAssert if the physics object is invalid */ - inline void PhysicsComponent::SetGravityFactor(float gravityFactor) + inline void PhysicsComponent3D::SetGravityFactor(float gravityFactor) { NazaraAssert(m_object, "Invalid physics object"); @@ -277,7 +277,7 @@ namespace Ndk * \remark Produces a NazaraAssert if the mass is negative */ - inline void PhysicsComponent::SetMass(float mass) + inline void PhysicsComponent3D::SetMass(float mass) { NazaraAssert(m_object, "Invalid physics object"); NazaraAssert(mass > 0.f, "Mass should be positive"); @@ -293,7 +293,7 @@ namespace Ndk * \remark Produces a NazaraAssert if the physics object is invalid */ - inline void PhysicsComponent::SetMassCenter(const Nz::Vector3f& center) + inline void PhysicsComponent3D::SetMassCenter(const Nz::Vector3f& center) { NazaraAssert(m_object, "Invalid physics object"); @@ -308,7 +308,7 @@ namespace Ndk * \remark Produces a NazaraAssert if the physics object is invalid */ - inline void PhysicsComponent::SetPosition(const Nz::Vector3f& position) + inline void PhysicsComponent3D::SetPosition(const Nz::Vector3f& position) { NazaraAssert(m_object, "Invalid physics object"); @@ -323,7 +323,7 @@ namespace Ndk * \remark Produces a NazaraAssert if the physics object is invalid */ - inline void PhysicsComponent::SetRotation(const Nz::Quaternionf& rotation) + inline void PhysicsComponent3D::SetRotation(const Nz::Quaternionf& rotation) { NazaraAssert(m_object, "Invalid physics object"); @@ -338,7 +338,7 @@ namespace Ndk * \remark Produces a NazaraAssert if the physics object is invalid */ - inline void PhysicsComponent::SetVelocity(const Nz::Vector3f& velocity) + inline void PhysicsComponent3D::SetVelocity(const Nz::Vector3f& velocity) { NazaraAssert(m_object, "Invalid physics object"); @@ -350,7 +350,7 @@ namespace Ndk * \return A reference to the physics object */ - inline Nz::RigidBody3D& PhysicsComponent::GetPhysObject() + inline Nz::RigidBody3D& PhysicsComponent3D::GetPhysObject() { return *m_object.get(); } diff --git a/SDK/include/NDK/Systems.hpp b/SDK/include/NDK/Systems.hpp index 269bead6f..287a2d61a 100644 --- a/SDK/include/NDK/Systems.hpp +++ b/SDK/include/NDK/Systems.hpp @@ -7,7 +7,7 @@ #include #include -#include +#include #include #include diff --git a/SDK/include/NDK/Systems/PhysicsSystem.hpp b/SDK/include/NDK/Systems/PhysicsSystem3D.hpp similarity index 69% rename from SDK/include/NDK/Systems/PhysicsSystem.hpp rename to SDK/include/NDK/Systems/PhysicsSystem3D.hpp index 1e5400e82..86ee0aa65 100644 --- a/SDK/include/NDK/Systems/PhysicsSystem.hpp +++ b/SDK/include/NDK/Systems/PhysicsSystem3D.hpp @@ -4,8 +4,8 @@ #pragma once -#ifndef NDK_SYSTEMS_PHYSICSSYSTEM_HPP -#define NDK_SYSTEMS_PHYSICSSYSTEM_HPP +#ifndef NDK_SYSTEMS_PHYSICSSYSTEM3D_HPP +#define NDK_SYSTEMS_PHYSICSSYSTEM3D_HPP #include #include @@ -14,12 +14,12 @@ namespace Ndk { - class NDK_API PhysicsSystem : public System + class NDK_API PhysicsSystem3D : public System { public: - PhysicsSystem(); - PhysicsSystem(const PhysicsSystem& system); - ~PhysicsSystem() = default; + PhysicsSystem3D(); + PhysicsSystem3D(const PhysicsSystem3D& system); + ~PhysicsSystem3D() = default; Nz::PhysWorld3D& GetWorld(); const Nz::PhysWorld3D& GetWorld() const; @@ -36,6 +36,6 @@ namespace Ndk }; } -#include +#include -#endif // NDK_SYSTEMS_PHYSICSSYSTEM_HPP +#endif // NDK_SYSTEMS_PHYSICSSYSTEM3D_HPP diff --git a/SDK/include/NDK/Systems/PhysicsSystem.inl b/SDK/include/NDK/Systems/PhysicsSystem3D.inl similarity index 78% rename from SDK/include/NDK/Systems/PhysicsSystem.inl rename to SDK/include/NDK/Systems/PhysicsSystem3D.inl index 4ec400fe7..9a8d3ba8c 100644 --- a/SDK/include/NDK/Systems/PhysicsSystem.inl +++ b/SDK/include/NDK/Systems/PhysicsSystem3D.inl @@ -9,7 +9,7 @@ namespace Ndk * \return A reference to the physical world */ - inline Nz::PhysWorld3D& PhysicsSystem::GetWorld() + inline Nz::PhysWorld3D& PhysicsSystem3D::GetWorld() { return *m_world; } @@ -19,7 +19,7 @@ namespace Ndk * \return A constant reference to the physical world */ - inline const Nz::PhysWorld3D& PhysicsSystem::GetWorld() const + inline const Nz::PhysWorld3D& PhysicsSystem3D::GetWorld() const { return *m_world; } diff --git a/SDK/src/NDK/Components/CollisionComponent.cpp b/SDK/src/NDK/Components/CollisionComponent3D.cpp similarity index 66% rename from SDK/src/NDK/Components/CollisionComponent.cpp rename to SDK/src/NDK/Components/CollisionComponent3D.cpp index 6806701f2..423b06cb4 100644 --- a/SDK/src/NDK/Components/CollisionComponent.cpp +++ b/SDK/src/NDK/Components/CollisionComponent3D.cpp @@ -2,18 +2,18 @@ // This file is part of the "Nazara Development Kit" // For conditions of distribution and use, see copyright notice in Prerequesites.hpp -#include +#include #include #include #include -#include -#include +#include +#include namespace Ndk { /*! * \ingroup NDK - * \class Ndk::CollisionComponent + * \class Ndk::CollisionComponent3D * \brief NDK class that represents the component for collision (meant for static objects) */ @@ -25,14 +25,14 @@ namespace Ndk * \remark Produces a NazaraAssert if the entity has no physics component and has no static body */ - void CollisionComponent::SetGeom(Nz::Collider3DRef geom) + void CollisionComponent3D::SetGeom(Nz::Collider3DRef geom) { m_geom = std::move(geom); - if (m_entity->HasComponent()) + if (m_entity->HasComponent()) { - // We update the geometry of the PhysiscsObject linked to the PhysicsComponent - PhysicsComponent& physComponent = m_entity->GetComponent(); + // We update the geometry of the PhysiscsObject linked to the PhysicsComponent3D + PhysicsComponent3D& physComponent = m_entity->GetComponent(); physComponent.GetPhysObject().SetGeom(m_geom); } else @@ -49,14 +49,14 @@ namespace Ndk * \remark Produces a NazaraAssert if entity is not linked to a world, or the world has no physics system */ - void CollisionComponent::InitializeStaticBody() + void CollisionComponent3D::InitializeStaticBody() { NazaraAssert(m_entity, "Invalid entity"); World* entityWorld = m_entity->GetWorld(); NazaraAssert(entityWorld, "Entity must have world"); - NazaraAssert(entityWorld->HasSystem(), "World must have a physics system"); - Nz::PhysWorld3D& physWorld = entityWorld->GetSystem().GetWorld(); + NazaraAssert(entityWorld->HasSystem(), "World must have a physics system"); + Nz::PhysWorld3D& physWorld = entityWorld->GetSystem().GetWorld(); m_staticBody.reset(new Nz::RigidBody3D(&physWorld, m_geom)); m_staticBody->EnableAutoSleep(false); @@ -66,9 +66,9 @@ namespace Ndk * \brief Operation to perform when component is attached to an entity */ - void CollisionComponent::OnAttached() + void CollisionComponent3D::OnAttached() { - if (!m_entity->HasComponent()) + if (!m_entity->HasComponent()) InitializeStaticBody(); } @@ -78,9 +78,9 @@ namespace Ndk * \param component Component being attached */ - void CollisionComponent::OnComponentAttached(BaseComponent& component) + void CollisionComponent3D::OnComponentAttached(BaseComponent& component) { - if (IsComponent(component)) + if (IsComponent(component)) m_staticBody.reset(); } @@ -90,9 +90,9 @@ namespace Ndk * \param component Component being detached */ - void CollisionComponent::OnComponentDetached(BaseComponent& component) + void CollisionComponent3D::OnComponentDetached(BaseComponent& component) { - if (IsComponent(component)) + if (IsComponent(component)) InitializeStaticBody(); } @@ -100,10 +100,10 @@ namespace Ndk * \brief Operation to perform when component is detached from an entity */ - void CollisionComponent::OnDetached() + void CollisionComponent3D::OnDetached() { m_staticBody.reset(); } - ComponentIndex CollisionComponent::componentIndex; + ComponentIndex CollisionComponent3D::componentIndex; } diff --git a/SDK/src/NDK/Components/PhysicsComponent.cpp b/SDK/src/NDK/Components/PhysicsComponent3D.cpp similarity index 63% rename from SDK/src/NDK/Components/PhysicsComponent.cpp rename to SDK/src/NDK/Components/PhysicsComponent3D.cpp index ec9620541..7dfffab85 100644 --- a/SDK/src/NDK/Components/PhysicsComponent.cpp +++ b/SDK/src/NDK/Components/PhysicsComponent3D.cpp @@ -2,19 +2,19 @@ // This file is part of the "Nazara Development Kit" // For conditions of distribution and use, see copyright notice in Prerequesites.hpp -#include +#include #include #include #include -#include +#include #include -#include +#include namespace Ndk { /*! * \ingroup NDK - * \class Ndk::PhysicsComponent + * \class Ndk::PhysicsComponent3D * \brief NDK class that represents the component for physics (meant for dynamic objects) */ @@ -24,16 +24,16 @@ namespace Ndk * \remark Produces a NazaraAssert if the world does not have a physics system */ - void PhysicsComponent::OnAttached() + void PhysicsComponent3D::OnAttached() { World* entityWorld = m_entity->GetWorld(); - NazaraAssert(entityWorld->HasSystem(), "World must have a physics system"); + NazaraAssert(entityWorld->HasSystem(), "World must have a physics system"); - Nz::PhysWorld3D& world = entityWorld->GetSystem().GetWorld(); + Nz::PhysWorld3D& world = entityWorld->GetSystem().GetWorld(); Nz::Collider3DRef geom; - if (m_entity->HasComponent()) - geom = m_entity->GetComponent().GetGeom(); + if (m_entity->HasComponent()) + geom = m_entity->GetComponent().GetGeom(); Nz::Matrix4f matrix; if (m_entity->HasComponent()) @@ -53,12 +53,12 @@ namespace Ndk * \remark Produces a NazaraAssert if physical object is invalid */ - void PhysicsComponent::OnComponentAttached(BaseComponent& component) + void PhysicsComponent3D::OnComponentAttached(BaseComponent& component) { - if (IsComponent(component)) + if (IsComponent(component)) { NazaraAssert(m_object, "Invalid object"); - m_object->SetGeom(static_cast(component).GetGeom()); + m_object->SetGeom(static_cast(component).GetGeom()); } } @@ -70,9 +70,9 @@ namespace Ndk * \remark Produces a NazaraAssert if physical object is invalid */ - void PhysicsComponent::OnComponentDetached(BaseComponent& component) + void PhysicsComponent3D::OnComponentDetached(BaseComponent& component) { - if (IsComponent(component)) + if (IsComponent(component)) { NazaraAssert(m_object, "Invalid object"); m_object->SetGeom(Nz::NullCollider3D::New()); @@ -83,10 +83,10 @@ namespace Ndk * \brief Operation to perform when component is detached from an entity */ - void PhysicsComponent::OnDetached() + void PhysicsComponent3D::OnDetached() { m_object.reset(); } - ComponentIndex PhysicsComponent::componentIndex; + ComponentIndex PhysicsComponent3D::componentIndex; } diff --git a/SDK/src/NDK/Sdk.cpp b/SDK/src/NDK/Sdk.cpp index 895adf178..36283ada3 100644 --- a/SDK/src/NDK/Sdk.cpp +++ b/SDK/src/NDK/Sdk.cpp @@ -13,11 +13,11 @@ #include #include #include -#include +#include #include -#include +#include #include -#include +#include #include #ifndef NDK_SERVER @@ -83,9 +83,9 @@ namespace Ndk BaseComponent::Initialize(); // Shared components - InitializeComponent("NdkColli"); + InitializeComponent("NdkColli"); InitializeComponent("NdkNode"); - InitializeComponent("NdkPhys"); + InitializeComponent("NdkPhys"); InitializeComponent("NdkVeloc"); #ifndef NDK_SERVER @@ -103,7 +103,7 @@ namespace Ndk BaseSystem::Initialize(); // Shared systems - InitializeSystem(); + InitializeSystem(); InitializeSystem(); #ifndef NDK_SERVER diff --git a/SDK/src/NDK/Systems/PhysicsSystem.cpp b/SDK/src/NDK/Systems/PhysicsSystem3D.cpp similarity index 77% rename from SDK/src/NDK/Systems/PhysicsSystem.cpp rename to SDK/src/NDK/Systems/PhysicsSystem3D.cpp index e30dd7abc..7f41d02c8 100644 --- a/SDK/src/NDK/Systems/PhysicsSystem.cpp +++ b/SDK/src/NDK/Systems/PhysicsSystem3D.cpp @@ -2,11 +2,11 @@ // This file is part of the "Nazara Development Kit" // For conditions of distribution and use, see copyright notice in Prerequesites.hpp -#include +#include #include -#include +#include #include -#include +#include namespace Ndk { @@ -15,7 +15,7 @@ namespace Ndk * \class Ndk::PhysicsSystem * \brief NDK class that represents the physics system * - * \remark This system is enabled if the entity has the trait: NodeComponent and any of these two: CollisionComponent or PhysicsComponent + * \remark This system is enabled if the entity has the trait: NodeComponent and any of these two: CollisionComponent3D or PhysicsComponent3D * \remark Static objects do not have a velocity specified by the physical engine */ @@ -23,10 +23,10 @@ namespace Ndk * \brief Constructs an PhysicsSystem object by default */ - PhysicsSystem::PhysicsSystem() + PhysicsSystem3D::PhysicsSystem3D() { Requires(); - RequiresAny(); + RequiresAny(); } /*! @@ -35,7 +35,7 @@ namespace Ndk * \param system PhysicsSystem to copy */ - PhysicsSystem::PhysicsSystem(const PhysicsSystem& system) : + PhysicsSystem3D::PhysicsSystem3D(const PhysicsSystem3D& system) : System(system), m_world() { @@ -48,17 +48,17 @@ namespace Ndk * \param justAdded Is the entity newly added */ - void PhysicsSystem::OnEntityValidation(Entity* entity, bool justAdded) + void PhysicsSystem3D::OnEntityValidation(Entity* entity, bool justAdded) { - // It's possible our entity got revalidated because of the addition/removal of a PhysicsComponent + // It's possible our entity got revalidated because of the addition/removal of a PhysicsComponent3D if (!justAdded) { // We take the opposite array from which the entity should belong to - auto& entities = (entity->HasComponent()) ? m_staticObjects : m_dynamicObjects; + auto& entities = (entity->HasComponent()) ? m_staticObjects : m_dynamicObjects; entities.Remove(entity); } - auto& entities = (entity->HasComponent()) ? m_dynamicObjects : m_staticObjects; + auto& entities = (entity->HasComponent()) ? m_dynamicObjects : m_staticObjects; entities.Insert(entity); if (!m_world) @@ -71,7 +71,7 @@ namespace Ndk * \param elapsedTime Delta time used for the update */ - void PhysicsSystem::OnUpdate(float elapsedTime) + void PhysicsSystem3D::OnUpdate(float elapsedTime) { if (!m_world) return; @@ -81,7 +81,7 @@ namespace Ndk for (const Ndk::EntityHandle& entity : m_dynamicObjects) { NodeComponent& node = entity->GetComponent(); - PhysicsComponent& phys = entity->GetComponent(); + PhysicsComponent3D& phys = entity->GetComponent(); Nz::RigidBody3D& physObj = phys.GetPhysObject(); node.SetRotation(physObj.GetRotation(), Nz::CoordSys_Global); @@ -91,7 +91,7 @@ namespace Ndk float invElapsedTime = 1.f / elapsedTime; for (const Ndk::EntityHandle& entity : m_staticObjects) { - CollisionComponent& collision = entity->GetComponent(); + CollisionComponent3D& collision = entity->GetComponent(); NodeComponent& node = entity->GetComponent(); Nz::RigidBody3D* physObj = collision.GetStaticBody(); @@ -127,5 +127,5 @@ namespace Ndk } } - SystemIndex PhysicsSystem::systemIndex; + SystemIndex PhysicsSystem3D::systemIndex; } diff --git a/SDK/src/NDK/Systems/VelocitySystem.cpp b/SDK/src/NDK/Systems/VelocitySystem.cpp index e8cfe2f23..c1298bde3 100644 --- a/SDK/src/NDK/Systems/VelocitySystem.cpp +++ b/SDK/src/NDK/Systems/VelocitySystem.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include namespace Ndk @@ -15,7 +15,7 @@ namespace Ndk * \brief NDK class that represents the velocity system * * \remark This system is enabled if the entity owns the trait: NodeComponent and VelocityComponent - * but it's disabled with the trait: PhysicsComponent + * but it's disabled with the trait: PhysicsComponent3D */ /*! @@ -25,7 +25,7 @@ namespace Ndk VelocitySystem::VelocitySystem() { Requires(); - Excludes(); + Excludes(); } /*! diff --git a/SDK/src/NDK/World.cpp b/SDK/src/NDK/World.cpp index 938722feb..6ba110aee 100644 --- a/SDK/src/NDK/World.cpp +++ b/SDK/src/NDK/World.cpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #ifndef NDK_SERVER @@ -40,7 +40,7 @@ namespace Ndk void World::AddDefaultSystems() { - AddSystem(); + AddSystem(); AddSystem(); #ifndef NDK_SERVER diff --git a/src/Nazara/Physics3D/Collider3D.cpp b/src/Nazara/Physics3D/Collider3D.cpp index 9afcdd80d..451686530 100644 --- a/src/Nazara/Physics3D/Collider3D.cpp +++ b/src/Nazara/Physics3D/Collider3D.cpp @@ -3,7 +3,7 @@ // For conditions of distribution and use, see copyright notice in Config.hpp #include -#include +#include #include #include #include diff --git a/src/Nazara/Physics3D/PhysWorld3D.cpp b/src/Nazara/Physics3D/PhysWorld3D.cpp index 8499071cd..c6990f635 100644 --- a/src/Nazara/Physics3D/PhysWorld3D.cpp +++ b/src/Nazara/Physics3D/PhysWorld3D.cpp @@ -2,7 +2,7 @@ // This file is part of the "Nazara Engine - Physics 3D module" // For conditions of distribution and use, see copyright notice in Config.hpp -#include +#include #include #include diff --git a/src/Nazara/Physics3D/RigidBody3D.cpp b/src/Nazara/Physics3D/RigidBody3D.cpp index 86e78f100..5051fa143 100644 --- a/src/Nazara/Physics3D/RigidBody3D.cpp +++ b/src/Nazara/Physics3D/RigidBody3D.cpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/tests/SDK/NDK/Systems/PhysicsSystem.cpp b/tests/SDK/NDK/Systems/PhysicsSystem3D.cpp similarity index 73% rename from tests/SDK/NDK/Systems/PhysicsSystem.cpp rename to tests/SDK/NDK/Systems/PhysicsSystem3D.cpp index 2aa3c313e..3cb0d6bdb 100644 --- a/tests/SDK/NDK/Systems/PhysicsSystem.cpp +++ b/tests/SDK/NDK/Systems/PhysicsSystem3D.cpp @@ -1,8 +1,8 @@ -#include +#include #include -#include +#include #include -#include +#include #include SCENARIO("PhysicsSystem", "[NDK][PHYSICSSYSTEM]") @@ -11,12 +11,12 @@ SCENARIO("PhysicsSystem", "[NDK][PHYSICSSYSTEM]") { Ndk::World world; const Ndk::EntityHandle& staticEntity = world.CreateEntity(); - Ndk::CollisionComponent& collisionComponentStatic = staticEntity->AddComponent(); + Ndk::CollisionComponent3D& collisionComponentStatic = staticEntity->AddComponent(); Ndk::NodeComponent& nodeComponentStatic = staticEntity->AddComponent(); const Ndk::EntityHandle& dynamicEntity = world.CreateEntity(); Ndk::NodeComponent& nodeComponentDynamic = dynamicEntity->AddComponent(); - Ndk::PhysicsComponent& physicsComponentDynamic = dynamicEntity->AddComponent(); + Ndk::PhysicsComponent3D& physicsComponentDynamic = dynamicEntity->AddComponent(); WHEN("We make collide these two entities") {