Merge remote-tracking branch 'refs/remotes/origin/master' into gui
Former-commit-id: 79463d2933cbd8bc6f0b9de5021a83ef7b5aa29b [formerly 3292aa8d849c9c569315d342fdcb17002547593e] [formerly bbb62690f0e47f3248ed524657fb3e01abaf1dcd [formerly e327e6aad9af55fcf96cea232148729cb73a78d4]] Former-commit-id: cae74a258a54f3b0dc8962d02a39bc2d5d0b6fb2 [formerly 2c3dc59631a1d6923c52216498d97c7b08151520] Former-commit-id: 289eb5a199a6d775b4e0c5dc905aedc518d67e67
This commit is contained in:
@@ -33,6 +33,10 @@ namespace Ndk
|
||||
|
||||
bool Run();
|
||||
|
||||
#ifndef NDK_SERVER
|
||||
inline void MakeExitOnLastWindowClosed(bool exitOnClosedWindows);
|
||||
#endif
|
||||
|
||||
inline void Quit();
|
||||
|
||||
Application& operator=(const Application&) = delete;
|
||||
|
||||
@@ -61,6 +61,13 @@ namespace Ndk
|
||||
return m_updateTime;
|
||||
}
|
||||
|
||||
#ifndef NDK_SERVER
|
||||
inline void Application::MakeExitOnLastWindowClosed(bool exitOnClosedWindows)
|
||||
{
|
||||
m_exitOnClosedWindows = exitOnClosedWindows;
|
||||
}
|
||||
#endif
|
||||
|
||||
inline void Application::Quit()
|
||||
{
|
||||
m_shouldQuit = true;
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Ndk
|
||||
inline ComponentIndex BaseComponent::RegisterComponent(ComponentId id, Factory factoryFunc)
|
||||
{
|
||||
// Nous allons rajouter notre composant à la fin
|
||||
ComponentIndex index = s_entries.size();
|
||||
ComponentIndex index = static_cast<ComponentIndex>(s_entries.size());
|
||||
s_entries.resize(index + 1);
|
||||
|
||||
// On récupère et on affecte
|
||||
|
||||
@@ -28,13 +28,11 @@ namespace Ndk
|
||||
template<typename ComponentType>
|
||||
ComponentIndex Component<ComponentType>::RegisterComponent(ComponentId id)
|
||||
{
|
||||
// Il faut que notre composant possède un constructeur par défaut (pour la factory)
|
||||
static_assert(std::is_default_constructible<ComponentType>::value, "ComponentType must be default-constructible");
|
||||
|
||||
// On utilise les lambda pour créer une fonction factory
|
||||
auto factory = []() -> BaseComponent*
|
||||
{
|
||||
return new ComponentType;
|
||||
return nullptr; //< Temporary workaround to allow non-default-constructed components, will be updated for serialization
|
||||
//return new ComponentType;
|
||||
};
|
||||
|
||||
return BaseComponent::RegisterComponent(id, factory);
|
||||
|
||||
@@ -1,20 +1,19 @@
|
||||
// This file was automatically generated on 03 Mar 2016 at 14:09:12
|
||||
// This file was automatically generated on 30 Jul 2016 at 15:29:16
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NDK_COMPONENTS_GLOBAL_HPP
|
||||
#define NDK_COMPONENTS_GLOBAL_HPP
|
||||
|
||||
#include <NDK/Components/CollisionComponent.hpp>
|
||||
#include <NDK/Components/NodeComponent.hpp>
|
||||
#include <NDK/Components/PhysicsComponent.hpp>
|
||||
#include <NDK/Components/VelocityComponent.hpp>
|
||||
|
||||
#ifndef NDK_SERVER
|
||||
#include <NDK/Components/CameraComponent.hpp>
|
||||
#include <NDK/Components/CollisionComponent.hpp>
|
||||
#include <NDK/Components/GraphicsComponent.hpp>
|
||||
#include <NDK/Components/LightComponent.hpp>
|
||||
#include <NDK/Components/ListenerComponent.hpp>
|
||||
#endif
|
||||
#include <NDK/Components/NodeComponent.hpp>
|
||||
#include <NDK/Components/ParticleEmitterComponent.hpp>
|
||||
#include <NDK/Components/ParticleGroupComponent.hpp>
|
||||
#include <NDK/Components/PhysicsComponent.hpp>
|
||||
#include <NDK/Components/VelocityComponent.hpp>
|
||||
|
||||
#endif // NDK_COMPONENTS_GLOBAL_HPP
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NDK_SERVER
|
||||
#ifndef NDK_COMPONENTS_CAMERACOMPONENT_HPP
|
||||
#define NDK_COMPONENTS_CAMERACOMPONENT_HPP
|
||||
|
||||
@@ -108,3 +109,4 @@ namespace Ndk
|
||||
#include <NDK/Components/CameraComponent.inl>
|
||||
|
||||
#endif // NDK_COMPONENTS_CAMERACOMPONENT_HPP
|
||||
#endif // NDK_SERVER
|
||||
|
||||
@@ -2,17 +2,17 @@
|
||||
// This file is part of the "Nazara Development Kit"
|
||||
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp
|
||||
|
||||
#include <NDK/Components/CameraComponent.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Math/Algorithm.hpp>
|
||||
#include "CameraComponent.hpp"
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
inline CameraComponent::CameraComponent() :
|
||||
m_projectionType(Nz::ProjectionType_Perspective),
|
||||
m_targetRegion(0.f, 0.f, 1.f, 1.f),
|
||||
m_size(0.f),
|
||||
m_target(nullptr),
|
||||
m_size(0.f),
|
||||
m_frustumUpdated(false),
|
||||
m_projectionMatrixUpdated(false),
|
||||
m_viewMatrixUpdated(false),
|
||||
@@ -30,8 +30,8 @@ namespace Ndk
|
||||
AbstractViewer(camera),
|
||||
m_projectionType(camera.m_projectionType),
|
||||
m_targetRegion(camera.m_targetRegion),
|
||||
m_size(camera.m_size),
|
||||
m_target(nullptr),
|
||||
m_size(camera.m_size),
|
||||
m_frustumUpdated(false),
|
||||
m_projectionMatrixUpdated(false),
|
||||
m_viewMatrixUpdated(false),
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NDK_SERVER
|
||||
#ifndef NDK_COMPONENTS_GRAPHICSCOMPONENT_HPP
|
||||
#define NDK_COMPONENTS_GRAPHICSCOMPONENT_HPP
|
||||
|
||||
@@ -22,6 +23,8 @@ namespace Ndk
|
||||
friend class RenderSystem;
|
||||
|
||||
public:
|
||||
using RenderableList = std::vector<Nz::InstancedRenderableRef>;
|
||||
|
||||
GraphicsComponent() = default;
|
||||
inline GraphicsComponent(const GraphicsComponent& graphicsComponent);
|
||||
~GraphicsComponent() = default;
|
||||
@@ -30,16 +33,23 @@ namespace Ndk
|
||||
|
||||
inline void Attach(Nz::InstancedRenderableRef renderable, int renderOrder = 0);
|
||||
|
||||
inline void Clear();
|
||||
|
||||
inline void Detach(const Nz::InstancedRenderableRef& renderable);
|
||||
|
||||
inline void EnsureBoundingVolumeUpdate() const;
|
||||
inline void EnsureTransformMatrixUpdate() const;
|
||||
|
||||
inline void GetAttachedRenderables(RenderableList* renderables) const;
|
||||
inline std::size_t GetAttachedRenderableCount() const;
|
||||
|
||||
inline const Nz::BoundingVolumef& GetBoundingVolume() const;
|
||||
|
||||
static ComponentIndex componentIndex;
|
||||
|
||||
private:
|
||||
inline void InvalidateBoundingVolume();
|
||||
void InvalidateRenderableData(const Nz::InstancedRenderable* renderable, Nz::UInt32 flags, unsigned int index);
|
||||
void InvalidateRenderableData(const Nz::InstancedRenderable* renderable, Nz::UInt32 flags, std::size_t index);
|
||||
inline void InvalidateRenderables();
|
||||
inline void InvalidateTransformMatrix();
|
||||
|
||||
@@ -56,12 +66,28 @@ namespace Ndk
|
||||
|
||||
struct Renderable
|
||||
{
|
||||
Renderable(Nz::Matrix4f& transformMatrix) :
|
||||
Renderable(const Nz::Matrix4f& transformMatrix) :
|
||||
data(transformMatrix),
|
||||
dataUpdated(false)
|
||||
{
|
||||
}
|
||||
|
||||
Renderable(Renderable&& renderable) noexcept :
|
||||
data(std::move(renderable.data)),
|
||||
renderable(std::move(renderable.renderable)),
|
||||
dataUpdated(renderable.dataUpdated)
|
||||
{
|
||||
}
|
||||
|
||||
Renderable& operator=(Renderable&& r) noexcept
|
||||
{
|
||||
data = std::move(r.data);
|
||||
dataUpdated = r.dataUpdated;
|
||||
renderable = std::move(r.renderable);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
NazaraSlot(Nz::InstancedRenderable, OnInstancedRenderableInvalidateData, renderableInvalidationSlot);
|
||||
|
||||
mutable Nz::InstancedRenderable::InstanceData data;
|
||||
@@ -80,3 +106,4 @@ namespace Ndk
|
||||
#include <NDK/Components/GraphicsComponent.inl>
|
||||
|
||||
#endif // NDK_COMPONENTS_GRAPHICSCOMPONENT_HPP
|
||||
#endif // NDK_SERVER
|
||||
@@ -3,11 +3,13 @@
|
||||
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp
|
||||
|
||||
#include <algorithm>
|
||||
#include "GraphicsComponent.hpp"
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
inline GraphicsComponent::GraphicsComponent(const GraphicsComponent& graphicsComponent) :
|
||||
Component(graphicsComponent),
|
||||
HandledObject(graphicsComponent),
|
||||
m_boundingVolume(graphicsComponent.m_boundingVolume),
|
||||
m_transformMatrix(graphicsComponent.m_transformMatrix),
|
||||
m_boundingVolumeUpdated(graphicsComponent.m_boundingVolumeUpdated),
|
||||
@@ -41,10 +43,30 @@ namespace Ndk
|
||||
r.data.renderOrder = renderOrder;
|
||||
r.renderable = std::move(renderable);
|
||||
r.renderableInvalidationSlot.Connect(r.renderable->OnInstancedRenderableInvalidateData, std::bind(&GraphicsComponent::InvalidateRenderableData, this, std::placeholders::_1, std::placeholders::_2, m_renderables.size()-1));
|
||||
|
||||
|
||||
InvalidateBoundingVolume();
|
||||
}
|
||||
|
||||
inline void GraphicsComponent::Clear()
|
||||
{
|
||||
m_renderables.clear();
|
||||
|
||||
InvalidateBoundingVolume();
|
||||
}
|
||||
|
||||
inline void GraphicsComponent::Detach(const Nz::InstancedRenderableRef& renderable)
|
||||
{
|
||||
for (auto it = m_renderables.begin(); it != m_renderables.end(); ++it)
|
||||
{
|
||||
if (it->renderable == renderable)
|
||||
{
|
||||
InvalidateBoundingVolume();
|
||||
m_renderables.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline void GraphicsComponent::EnsureBoundingVolumeUpdate() const
|
||||
{
|
||||
if (!m_boundingVolumeUpdated)
|
||||
@@ -57,6 +79,20 @@ namespace Ndk
|
||||
UpdateTransformMatrix();
|
||||
}
|
||||
|
||||
inline void GraphicsComponent::GetAttachedRenderables(RenderableList* renderables) const
|
||||
{
|
||||
NazaraAssert(renderables, "Invalid renderable list");
|
||||
|
||||
renderables->reserve(renderables->size() + m_renderables.size());
|
||||
for (const Renderable& r : m_renderables)
|
||||
renderables->push_back(r.renderable);
|
||||
}
|
||||
|
||||
inline std::size_t GraphicsComponent::GetAttachedRenderableCount() const
|
||||
{
|
||||
return m_renderables.size();
|
||||
}
|
||||
|
||||
inline const Nz::BoundingVolumef& GraphicsComponent::GetBoundingVolume() const
|
||||
{
|
||||
EnsureBoundingVolumeUpdate();
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NDK_SERVER
|
||||
#ifndef NDK_COMPONENTS_LIGHTCOMPONENT_HPP
|
||||
#define NDK_COMPONENTS_LIGHTCOMPONENT_HPP
|
||||
|
||||
@@ -28,3 +29,4 @@ namespace Ndk
|
||||
#include <NDK/Components/LightComponent.inl>
|
||||
|
||||
#endif // NDK_COMPONENTS_LIGHTCOMPONENT_HPP
|
||||
#endif // NDK_SERVER
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NDK_SERVER
|
||||
#ifndef NDK_COMPONENTS_LISTENERCOMPONENT_HPP
|
||||
#define NDK_COMPONENTS_LISTENERCOMPONENT_HPP
|
||||
|
||||
@@ -14,11 +15,11 @@ namespace Ndk
|
||||
class NDK_API ListenerComponent : public Component<ListenerComponent>
|
||||
{
|
||||
public:
|
||||
ListenerComponent();
|
||||
inline ListenerComponent();
|
||||
~ListenerComponent() = default;
|
||||
|
||||
bool IsActive() const;
|
||||
void SetActive(bool active = true);
|
||||
inline bool IsActive() const;
|
||||
inline void SetActive(bool active = true);
|
||||
|
||||
static ComponentIndex componentIndex;
|
||||
|
||||
@@ -30,3 +31,4 @@ namespace Ndk
|
||||
#include <NDK/Components/ListenerComponent.inl>
|
||||
|
||||
#endif // NDK_COMPONENTS_LISTENERCOMPONENT_HPP
|
||||
#endif // NDK_SERVER
|
||||
46
SDK/include/NDK/Components/ParticleEmitterComponent.hpp
Normal file
46
SDK/include/NDK/Components/ParticleEmitterComponent.hpp
Normal file
@@ -0,0 +1,46 @@
|
||||
// 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_SERVER
|
||||
#ifndef NDK_COMPONENTS_PARTICLEEMITTERCOMPONENT_HPP
|
||||
#define NDK_COMPONENTS_PARTICLEEMITTERCOMPONENT_HPP
|
||||
|
||||
#include <Nazara/Graphics/ParticleEmitter.hpp>
|
||||
#include <Nazara/Graphics/ParticleGroup.hpp>
|
||||
#include <NDK/Component.hpp>
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
class NDK_API ParticleEmitterComponent : public Component<ParticleEmitterComponent>, public Nz::ParticleEmitter
|
||||
{
|
||||
public:
|
||||
using SetupFunc = std::function<void(const EntityHandle& /*entity*/, Nz::ParticleMapper& /*mapper*/, unsigned int /*count*/)>;
|
||||
|
||||
inline ParticleEmitterComponent();
|
||||
ParticleEmitterComponent(const ParticleEmitterComponent& emitter) = default;
|
||||
ParticleEmitterComponent(ParticleEmitterComponent&& emitter) = default;
|
||||
~ParticleEmitterComponent() = default;
|
||||
|
||||
void Enable(bool active = true);
|
||||
|
||||
inline bool IsActive() const;
|
||||
|
||||
inline void SetSetupFunc(SetupFunc func);
|
||||
|
||||
static ComponentIndex componentIndex;
|
||||
|
||||
private:
|
||||
void SetupParticles(Nz::ParticleMapper& mapper, unsigned int count) const override;
|
||||
|
||||
SetupFunc m_setupFunc;
|
||||
bool m_isActive;
|
||||
};
|
||||
}
|
||||
|
||||
#include <NDK/Components/ParticleEmitterComponent.inl>
|
||||
|
||||
#endif // NDK_COMPONENTS_PARTICLEEMITTERCOMPONENT_HPP
|
||||
#endif // NDK_SERVER
|
||||
28
SDK/include/NDK/Components/ParticleEmitterComponent.inl
Normal file
28
SDK/include/NDK/Components/ParticleEmitterComponent.inl
Normal file
@@ -0,0 +1,28 @@
|
||||
// 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
|
||||
|
||||
#include <NDK/Components/ParticleEmitterComponent.hpp>
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
inline ParticleEmitterComponent::ParticleEmitterComponent() :
|
||||
m_isActive(true)
|
||||
{
|
||||
}
|
||||
|
||||
inline void Ndk::ParticleEmitterComponent::Enable(bool active)
|
||||
{
|
||||
m_isActive = active;
|
||||
}
|
||||
|
||||
inline bool ParticleEmitterComponent::IsActive() const
|
||||
{
|
||||
return m_isActive;
|
||||
}
|
||||
|
||||
inline void Ndk::ParticleEmitterComponent::SetSetupFunc(SetupFunc func)
|
||||
{
|
||||
m_setupFunc = std::move(func);
|
||||
}
|
||||
}
|
||||
35
SDK/include/NDK/Components/ParticleGroupComponent.hpp
Normal file
35
SDK/include/NDK/Components/ParticleGroupComponent.hpp
Normal file
@@ -0,0 +1,35 @@
|
||||
// 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_SERVER
|
||||
#ifndef NDK_COMPONENTS_PARTICLEGROUPCOMPONENT_HPP
|
||||
#define NDK_COMPONENTS_PARTICLEGROUPCOMPONENT_HPP
|
||||
|
||||
#include <Nazara/Graphics/ParticleGroup.hpp>
|
||||
#include <NDK/Component.hpp>
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
class ParticleGroupComponent;
|
||||
|
||||
using ParticleGroupComponentHandle = Nz::ObjectHandle<ParticleGroupComponent>;
|
||||
|
||||
class NDK_API ParticleGroupComponent : public Component<ParticleGroupComponent>, public Nz::ParticleGroup
|
||||
{
|
||||
public:
|
||||
inline ParticleGroupComponent(unsigned int maxParticleCount, Nz::ParticleLayout layout);
|
||||
inline ParticleGroupComponent(unsigned int maxParticleCount, Nz::ParticleDeclarationConstRef declaration);
|
||||
ParticleGroupComponent(const ParticleGroupComponent&) = default;
|
||||
~ParticleGroupComponent() = default;
|
||||
|
||||
static ComponentIndex componentIndex;
|
||||
};
|
||||
}
|
||||
|
||||
#include <NDK/Components/ParticleGroupComponent.inl>
|
||||
|
||||
#endif // NDK_COMPONENTS_PARTICLEGROUPCOMPONENT_HPP
|
||||
#endif // NDK_SERVER
|
||||
17
SDK/include/NDK/Components/ParticleGroupComponent.inl
Normal file
17
SDK/include/NDK/Components/ParticleGroupComponent.inl
Normal file
@@ -0,0 +1,17 @@
|
||||
#include "ParticleGroupComponent.hpp"
|
||||
// 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
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
inline ParticleGroupComponent::ParticleGroupComponent(unsigned int maxParticleCount, Nz::ParticleLayout layout) :
|
||||
ParticleGroup(maxParticleCount, layout)
|
||||
{
|
||||
}
|
||||
|
||||
inline ParticleGroupComponent::ParticleGroupComponent(unsigned int maxParticleCount, Nz::ParticleDeclarationConstRef declaration) :
|
||||
ParticleGroup(maxParticleCount, std::move(declaration))
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -84,8 +84,12 @@ namespace Nz
|
||||
|
||||
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, FontParams* params, TypeTag<FontParams>)
|
||||
{
|
||||
NazaraUnused(params);
|
||||
|
||||
instance.CheckType(index, Nz::LuaType_Table);
|
||||
|
||||
// Structure is empty for now
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -96,8 +100,8 @@ namespace Nz
|
||||
params->animated = instance.CheckField<bool>("Animated", params->animated);
|
||||
params->center = instance.CheckField<bool>("Center", params->center);
|
||||
params->flipUVs = instance.CheckField<bool>("FlipUVs", params->flipUVs);
|
||||
//params->matrix = instance.CheckField<Matrix4f>("Matrix", params->matrix);
|
||||
params->optimizeIndexBuffers = instance.CheckField<bool>("OptimizeIndexBuffers", params->optimizeIndexBuffers);
|
||||
params->scale = instance.CheckField<Vector3f>("Scale", params->scale);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -255,14 +259,14 @@ namespace Nz
|
||||
|
||||
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, Ndk::EntityHandle* handle, TypeTag<Ndk::EntityHandle>)
|
||||
{
|
||||
*handle = std::move(*static_cast<Ndk::EntityHandle*>(instance.CheckUserdata(index, "Entity")));
|
||||
*handle = *static_cast<Ndk::EntityHandle*>(instance.CheckUserdata(index, "Entity"));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
inline unsigned int LuaImplQueryArg(const LuaInstance& instance, int index, Ndk::WorldHandle* handle, TypeTag<Ndk::WorldHandle>)
|
||||
{
|
||||
*handle = std::move(*static_cast<Ndk::WorldHandle*>(instance.CheckUserdata(index, "World")));
|
||||
*handle = *static_cast<Ndk::WorldHandle*>(instance.CheckUserdata(index, "World"));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -13,11 +13,11 @@ namespace Ndk
|
||||
{
|
||||
class StateMachine;
|
||||
|
||||
class State
|
||||
class NDK_API State
|
||||
{
|
||||
public:
|
||||
State() = default;
|
||||
~State() = default;
|
||||
virtual ~State();
|
||||
|
||||
virtual void Enter(StateMachine& fsm) = 0;
|
||||
virtual void Leave(StateMachine& fsm) = 0;
|
||||
|
||||
@@ -23,6 +23,8 @@ namespace Ndk
|
||||
|
||||
inline void ChangeState(std::shared_ptr<State> state);
|
||||
|
||||
inline const std::shared_ptr<State>& GetCurrentState() const;
|
||||
|
||||
inline bool Update(float elapsedTime);
|
||||
|
||||
inline StateMachine& operator=(StateMachine&& fsm) = default;
|
||||
|
||||
@@ -26,6 +26,11 @@ namespace Ndk
|
||||
m_nextState = std::move(state);
|
||||
}
|
||||
|
||||
inline const std::shared_ptr<State>& StateMachine::GetCurrentState() const
|
||||
{
|
||||
return m_currentState;
|
||||
}
|
||||
|
||||
inline bool StateMachine::Update(float elapsedTime)
|
||||
{
|
||||
if (m_nextState)
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
// This file was automatically generated on 03 Mar 2016 at 14:09:12
|
||||
// This file was automatically generated on 30 Jul 2016 at 15:29:16
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NDK_SYSTEMS_GLOBAL_HPP
|
||||
#define NDK_SYSTEMS_GLOBAL_HPP
|
||||
|
||||
#include <NDK/Systems/ListenerSystem.hpp>
|
||||
#include <NDK/Systems/ParticleSystem.hpp>
|
||||
#include <NDK/Systems/PhysicsSystem.hpp>
|
||||
#include <NDK/Systems/RenderSystem.hpp>
|
||||
#include <NDK/Systems/VelocitySystem.hpp>
|
||||
|
||||
#ifndef NDK_SERVER
|
||||
#include <NDK/Systems/ListenerSystem.hpp>
|
||||
#include <NDK/Systems/RenderSystem.hpp>
|
||||
#endif
|
||||
|
||||
#endif // NDK_SYSTEMS_GLOBAL_HPP
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NDK_SERVER
|
||||
#ifndef NDK_SYSTEMS_LISTENERSYSTEM_HPP
|
||||
#define NDK_SYSTEMS_LISTENERSYSTEM_HPP
|
||||
|
||||
@@ -27,3 +28,4 @@ namespace Ndk
|
||||
#include <NDK/Systems/ListenerSystem.inl>
|
||||
|
||||
#endif // NDK_SYSTEMS_LISTENERSYSTEM_HPP
|
||||
#endif // NDK_SERVER
|
||||
|
||||
29
SDK/include/NDK/Systems/ParticleSystem.hpp
Normal file
29
SDK/include/NDK/Systems/ParticleSystem.hpp
Normal file
@@ -0,0 +1,29 @@
|
||||
// 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_PARTICLESYSTEM_HPP
|
||||
#define NDK_SYSTEMS_PARTICLESYSTEM_HPP
|
||||
|
||||
#include <NDK/System.hpp>
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
class NDK_API ParticleSystem : public System<ParticleSystem>
|
||||
{
|
||||
public:
|
||||
ParticleSystem();
|
||||
~ParticleSystem() = default;
|
||||
|
||||
static SystemIndex systemIndex;
|
||||
|
||||
private:
|
||||
void OnUpdate(float elapsedTime) override;
|
||||
};
|
||||
}
|
||||
|
||||
#include <NDK/Systems/ParticleSystem.inl>
|
||||
|
||||
#endif // NDK_SYSTEMS_PARTICLESYSTEM_HPP
|
||||
3
SDK/include/NDK/Systems/ParticleSystem.inl
Normal file
3
SDK/include/NDK/Systems/ParticleSystem.inl
Normal file
@@ -0,0 +1,3 @@
|
||||
// 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
|
||||
@@ -4,11 +4,14 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NDK_SERVER
|
||||
#ifndef NDK_SYSTEMS_RENDERSYSTEM_HPP
|
||||
#define NDK_SYSTEMS_RENDERSYSTEM_HPP
|
||||
|
||||
#include <Nazara/Graphics/AbstractBackground.hpp>
|
||||
#include <Nazara/Graphics/DeferredRenderTechnique.hpp>
|
||||
#include <Nazara/Graphics/DepthRenderTechnique.hpp>
|
||||
#include <Nazara/Graphics/ForwardRenderTechnique.hpp>
|
||||
#include <Nazara/Renderer/RenderTexture.hpp>
|
||||
#include <NDK/EntityList.hpp>
|
||||
#include <NDK/System.hpp>
|
||||
#include <unordered_map>
|
||||
@@ -48,13 +51,20 @@ namespace Ndk
|
||||
void OnEntityRemoved(Entity* entity) override;
|
||||
void OnEntityValidation(Entity* entity, bool justAdded) override;
|
||||
void OnUpdate(float elapsedTime) override;
|
||||
void UpdateDirectionalShadowMaps(const Nz::AbstractViewer& viewer);
|
||||
void UpdatePointSpotShadowMaps();
|
||||
|
||||
std::unique_ptr<Nz::AbstractRenderTechnique> m_renderTechnique;
|
||||
EntityList m_cameras;
|
||||
EntityList m_drawables;
|
||||
EntityList m_directionalLights;
|
||||
EntityList m_lights;
|
||||
EntityList m_pointSpotLights;
|
||||
EntityList m_particleGroups;
|
||||
Nz::BackgroundRef m_background;
|
||||
Nz::DepthRenderTechnique m_shadowTechnique;
|
||||
Nz::Matrix4f m_coordinateSystemMatrix;
|
||||
Nz::RenderTexture m_shadowRT;
|
||||
bool m_coordinateSystemInvalidated;
|
||||
};
|
||||
}
|
||||
@@ -62,3 +72,4 @@ namespace Ndk
|
||||
#include <NDK/Systems/RenderSystem.inl>
|
||||
|
||||
#endif // NDK_SYSTEMS_RENDERSYSTEM_HPP
|
||||
#endif // NDK_SERVER
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Ndk
|
||||
static_assert(std::is_base_of<BaseSystem, SystemType>::value, "SystemType is not a component");
|
||||
|
||||
// Allocation et affectation du component
|
||||
std::unique_ptr<SystemType> ptr(new SystemType(std::forward(args)...));
|
||||
std::unique_ptr<SystemType> ptr(new SystemType(std::forward<Args>(args)...));
|
||||
return static_cast<SystemType&>(AddSystem(std::move(ptr)));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user