Ndk/GraphicsComponent: Add Attach method
It will evolve, don't worry. Former-commit-id: 6529d47e076ef102d54fde0a741df72eb80f5ca7
This commit is contained in:
parent
3fdd41cc6b
commit
fac893f379
|
|
@ -7,8 +7,8 @@
|
|||
#ifndef NDK_COMPONENTS_GRAPHICSCOMPONENT_HPP
|
||||
#define NDK_COMPONENTS_GRAPHICSCOMPONENT_HPP
|
||||
|
||||
#include <NDK/Component.hpp>
|
||||
#include <Nazara/Graphics/Renderable.hpp>
|
||||
#include <NDK/Component.hpp>
|
||||
|
||||
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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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 <algorithm>
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue