diff --git a/SDK/include/NDK/Components/GraphicsComponent.hpp b/SDK/include/NDK/Components/GraphicsComponent.hpp index aed427105..4ea76d0d8 100644 --- a/SDK/include/NDK/Components/GraphicsComponent.hpp +++ b/SDK/include/NDK/Components/GraphicsComponent.hpp @@ -23,6 +23,8 @@ namespace Ndk friend class RenderSystem; public: + using RenderableList = std::vector; + GraphicsComponent() = default; inline GraphicsComponent(const GraphicsComponent& graphicsComponent); ~GraphicsComponent() = default; @@ -38,6 +40,9 @@ namespace Ndk inline void EnsureBoundingVolumeUpdate() const; inline void EnsureTransformMatrixUpdate() const; + inline void GetAttachedRenderables(Nz::InstancedRenderableRef* renderables) const; + inline std::size_t GetAttachedRenderableCount() const; + inline const Nz::BoundingVolumef& GetBoundingVolume() const; static ComponentIndex componentIndex; diff --git a/SDK/include/NDK/Components/GraphicsComponent.inl b/SDK/include/NDK/Components/GraphicsComponent.inl index 9ca100d0e..b38ce6dd6 100644 --- a/SDK/include/NDK/Components/GraphicsComponent.inl +++ b/SDK/include/NDK/Components/GraphicsComponent.inl @@ -79,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();