Sdk/GraphicsComponent: Add Clear method

Former-commit-id: dfa7a9813fe3e15212c16103763cb185e1d8df30 [formerly ead9d5788df957502aa22c526fa272f797348599]
Former-commit-id: 74ce601066d7ab1d28609d6a859495e4626c7a18
This commit is contained in:
Lynix 2016-06-21 19:14:29 +02:00
parent 588794f1cc
commit 63ed1aaa51
2 changed files with 12 additions and 2 deletions

View File

@ -31,7 +31,9 @@ namespace Ndk
inline void Attach(Nz::InstancedRenderableRef renderable, int renderOrder = 0);
inline void Detach(Nz::InstancedRenderableRef renderable);
inline void Clear();
inline void Detach(const Nz::InstancedRenderableRef& renderable);
inline void EnsureBoundingVolumeUpdate() const;
inline void EnsureTransformMatrixUpdate() const;

View File

@ -47,12 +47,20 @@ namespace Ndk
InvalidateBoundingVolume();
}
inline void GraphicsComponent::Detach(Nz::InstancedRenderableRef renderable)
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;
}