diff --git a/SDK/include/NDK/Components/GraphicsComponent.hpp b/SDK/include/NDK/Components/GraphicsComponent.hpp index 7450c2f6e..c34d1cf42 100644 --- a/SDK/include/NDK/Components/GraphicsComponent.hpp +++ b/SDK/include/NDK/Components/GraphicsComponent.hpp @@ -7,8 +7,8 @@ #ifndef NDK_COMPONENTS_GRAPHICSCOMPONENT_HPP #define NDK_COMPONENTS_GRAPHICSCOMPONENT_HPP -#include #include +#include namespace Ndk { @@ -18,7 +18,9 @@ namespace Ndk GraphicsComponent() = default; ~GraphicsComponent() = default; - void AddToRenderQueue(NzAbstractRenderQueue* renderQueue, const NzMatrix4f& transformMatrix) const; + inline void AddToRenderQueue(NzAbstractRenderQueue* renderQueue, const NzMatrix4f& transformMatrix) const; + + inline void Attach(NzRenderableRef renderable); static ComponentIndex componentIndex; diff --git a/SDK/include/NDK/Components/GraphicsComponent.inl b/SDK/include/NDK/Components/GraphicsComponent.inl index 5d4479ac1..9fa6a81b3 100644 --- a/SDK/include/NDK/Components/GraphicsComponent.inl +++ b/SDK/include/NDK/Components/GraphicsComponent.inl @@ -2,6 +2,8 @@ // This file is part of the "Nazara Development Kit" // For conditions of distribution and use, see copyright notice in Prerequesites.hpp +#include + namespace Ndk { inline void GraphicsComponent::AddToRenderQueue(NzAbstractRenderQueue* renderQueue, const NzMatrix4f& transformMatrix) const @@ -9,4 +11,11 @@ namespace Ndk for (const Renderable& object : m_renderables) object.renderable->AddToRenderQueue(renderQueue, transformMatrix); } + + inline void GraphicsComponent::Attach(NzRenderableRef renderable) + { + m_renderables.resize(m_renderables.size() + 1); + Renderable& r = m_renderables.back(); + r.renderable = std::move(renderable); + } }