Make all component inherits of HandledObject (#185)

* Update

* Add: [Get/Set]AngularDaming for standardization

* Fix: Name error

* Add: [Get/Set][AngularDamping/MomentOfInertia] in PhysicsComponent2D

* Forgot in last commit

* Add: param coordSys in [PhysicsComponent2D/RigidBody2D]::SetMassCenter

* Add: Some forgotten inline

* Fix little error

* Fix: Indentation before case

* Move and Change GetCenterOfGravity

* Rename m_world into m_physWorld

* Rename GetWorld int GetPhysWorld

* Update: PhysicsSystem2D became an interface of PhysWorld2D

* Update Collison/PhysicsComponent because GetWorld was renamed

* Update tests

* Update: Make the interface usable with Entity instead of PhysicsComponent

* Update: Make GetPhysWorld private

* Update PhysicsSystem2D.hpp

* Update: indent

* Remove: useless blank line

* update order(?)

* Update PhysicsSystem2D.hpp

* Add calls to GetPhysWorld to attempt a nullptr value

* update include

* little fix

* add some missing inline

* Fix

* Make all component inherits of HandledObject

* fix: compilation error

* Add Handle alias for all Components

* forgot in last commit
This commit is contained in:
Faymoon 2018-09-08 10:28:25 +02:00 committed by Jérôme Leclercq
parent 5f2cec313a
commit 7c5b0df96c
17 changed files with 44 additions and 10 deletions

View File

@ -12,7 +12,7 @@
namespace Ndk
{
template<typename ComponentType>
class Component : public BaseComponent
class Component : public BaseComponent, public Nz::HandledObject<ComponentType>
{
public:
Component();

View File

@ -22,7 +22,7 @@ namespace Ndk
using CameraComponentHandle = Nz::ObjectHandle<CameraComponent>;
class NDK_API CameraComponent : public Component<CameraComponent>, public Nz::AbstractViewer, public Nz::HandledObject<CameraComponent>
class NDK_API CameraComponent : public Component<CameraComponent>, public Nz::AbstractViewer
{
public:
inline CameraComponent();

View File

@ -38,7 +38,6 @@ namespace Ndk
inline CameraComponent::CameraComponent(const CameraComponent& camera) :
Component(camera),
AbstractViewer(camera),
HandledObject(camera),
m_visibilityHash(camera.m_visibilityHash),
m_projectionType(camera.m_projectionType),
m_targetRegion(camera.m_targetRegion),

View File

@ -14,6 +14,10 @@
namespace Ndk
{
class CollisionComponent2D;
using CollisionComponent2DHandle = Nz::ObjectHandle<CollisionComponent2D>;
class NDK_API CollisionComponent2D : public Component<CollisionComponent2D>
{
friend class PhysicsSystem2D;

View File

@ -14,6 +14,10 @@
namespace Ndk
{
class CollisionComponent3D;
using CollisionComponent3DHandle = Nz::ObjectHandle<CollisionComponent3D>;
class NDK_API CollisionComponent3D : public Component<CollisionComponent3D>
{
friend class PhysicsSystem3D;

View File

@ -11,6 +11,10 @@
namespace Ndk
{
class ConstraintComponent2D;
using ConstraintComponent2DHandle = Nz::ObjectHandle<ConstraintComponent2D>;
class NDK_API ConstraintComponent2D : public Component<ConstraintComponent2D>
{
public:

View File

@ -40,6 +40,10 @@ namespace Ndk
constexpr DebugDrawFlags DebugDraw_None = 0;
class DebugComponent;
using DebugComponentHandle = Nz::ObjectHandle<DebugComponent>;
class NDK_API DebugComponent : public Component<DebugComponent>
{
friend class DebugSystem;

View File

@ -22,7 +22,7 @@ namespace Ndk
using GraphicsComponentCullingList = Nz::CullingList<GraphicsComponent>;
using GraphicsComponentHandle = Nz::ObjectHandle<GraphicsComponent>;
class NDK_API GraphicsComponent : public Component<GraphicsComponent>, public Nz::HandledObject<GraphicsComponent>
class NDK_API GraphicsComponent : public Component<GraphicsComponent>
{
friend class RenderSystem;

View File

@ -22,7 +22,6 @@ namespace Ndk
*/
inline GraphicsComponent::GraphicsComponent(const GraphicsComponent& graphicsComponent) :
Component(graphicsComponent),
HandledObject(graphicsComponent),
m_reflectiveMaterialCount(0),
m_aabb(graphicsComponent.m_aabb),
m_transformMatrix(graphicsComponent.m_transformMatrix),

View File

@ -1,4 +1,4 @@
// Copyright (C) 2017 Jérôme Leclercq
// Copyright (C) 2017 Jérôme Leclercq
// This file is part of the "Nazara Development Kit"
// For conditions of distribution and use, see copyright notice in Prerequisites.hpp
@ -13,6 +13,10 @@
namespace Ndk
{
class LightComponent;
using LightComponentHandle = Nz::ObjectHandle<LightComponent>;
class NDK_API LightComponent : public Component<LightComponent>, public Nz::Light
{
public:

View File

@ -12,6 +12,10 @@
namespace Ndk
{
class ListenerComponent;
using ListenerComponentHandle = Nz::ObjectHandle<ListenerComponent>;
class NDK_API ListenerComponent : public Component<ListenerComponent>
{
public:

View File

@ -17,7 +17,7 @@ namespace Ndk
using NodeComponentHandle = Nz::ObjectHandle<NodeComponent>;
class NDK_API NodeComponent : public Component<NodeComponent>, public Nz::Node, public Nz::HandledObject<NodeComponent>
class NDK_API NodeComponent : public Component<NodeComponent>, public Nz::Node
{
public:
NodeComponent() = default;

View File

@ -13,6 +13,10 @@
namespace Ndk
{
class ParticleEmitterComponent;
using ParticleEmitterComponentHandle = Nz::ObjectHandle<ParticleEmitterComponent>;
class NDK_API ParticleEmitterComponent : public Component<ParticleEmitterComponent>, public Nz::ParticleEmitter
{
public:

View File

@ -17,7 +17,7 @@ namespace Ndk
using ParticleGroupComponentHandle = Nz::ObjectHandle<ParticleGroupComponent>;
class NDK_API ParticleGroupComponent : public Component<ParticleGroupComponent>, public Nz::ParticleGroup, public Nz::HandledObject<ParticleGroupComponent>
class NDK_API ParticleGroupComponent : public Component<ParticleGroupComponent>, public Nz::ParticleGroup
{
public:
inline ParticleGroupComponent(unsigned int maxParticleCount, Nz::ParticleLayout layout);
@ -38,4 +38,4 @@ namespace Ndk
#include <NDK/Components/ParticleGroupComponent.inl>
#endif // NDK_COMPONENTS_PARTICLEGROUPCOMPONENT_HPP
#endif // NDK_SERVER
#endif // NDK_SERVER

View File

@ -13,6 +13,10 @@
namespace Ndk
{
class PhysicsComponent2D;
using PhysicsComponent2DHandle = Nz::ObjectHandle<PhysicsComponent2D>;
class NDK_API PhysicsComponent2D : public Component<PhysicsComponent2D>
{
friend class CollisionComponent2D;

View File

@ -13,6 +13,10 @@
namespace Ndk
{
class PhysicsComponent3D;
using PhysicsComponent3DHandle = Nz::ObjectHandle<PhysicsComponent3D>;
class NDK_API PhysicsComponent3D : public Component<PhysicsComponent3D>
{
friend class CollisionComponent3D;

View File

@ -16,7 +16,7 @@ namespace Ndk
using VelocityComponentHandle = Nz::ObjectHandle<VelocityComponent>;
class NDK_API VelocityComponent : public Component<VelocityComponent>, public Nz::HandledObject<VelocityComponent>
class NDK_API VelocityComponent : public Component<VelocityComponent>
{
public:
VelocityComponent(const Nz::Vector3f& velocity = Nz::Vector3f::Zero());