Former-commit-id: b5aeb44f857f521ce7972b6d2fd6fd359d27b8bc [formerly ead40af346b625a1ed2a77ad79a1c52dbbab513c]
Former-commit-id: e3a670d02a0aa1c8b75fd8976a886c5e625ea8e1
This commit is contained in:
Lynix 2016-07-08 08:38:39 +02:00
commit a6de407ba0
2 changed files with 19 additions and 0 deletions

View File

@ -23,6 +23,8 @@ namespace Ndk
friend class RenderSystem; friend class RenderSystem;
public: public:
using RenderableList = std::vector<Nz::InstancedRenderableRef>;
GraphicsComponent() = default; GraphicsComponent() = default;
inline GraphicsComponent(const GraphicsComponent& graphicsComponent); inline GraphicsComponent(const GraphicsComponent& graphicsComponent);
~GraphicsComponent() = default; ~GraphicsComponent() = default;
@ -38,6 +40,9 @@ namespace Ndk
inline void EnsureBoundingVolumeUpdate() const; inline void EnsureBoundingVolumeUpdate() const;
inline void EnsureTransformMatrixUpdate() const; inline void EnsureTransformMatrixUpdate() const;
inline void GetAttachedRenderables(RenderableList* renderables) const;
inline std::size_t GetAttachedRenderableCount() const;
inline const Nz::BoundingVolumef& GetBoundingVolume() const; inline const Nz::BoundingVolumef& GetBoundingVolume() const;
static ComponentIndex componentIndex; static ComponentIndex componentIndex;

View File

@ -79,6 +79,20 @@ namespace Ndk
UpdateTransformMatrix(); 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 inline const Nz::BoundingVolumef& GraphicsComponent::GetBoundingVolume() const
{ {
EnsureBoundingVolumeUpdate(); EnsureBoundingVolumeUpdate();