Sdk/GraphicsComponent: Invalidates culling when adding/removing renderables
This commit is contained in:
@@ -74,6 +74,7 @@ namespace Ndk
|
|||||||
|
|
||||||
void ConnectInstancedRenderableSignals(Renderable& renderable);
|
void ConnectInstancedRenderableSignals(Renderable& renderable);
|
||||||
|
|
||||||
|
inline void ForceCullingInvalidation();
|
||||||
inline void InvalidateAABB() const;
|
inline void InvalidateAABB() const;
|
||||||
void InvalidateRenderableData(const Nz::InstancedRenderable* renderable, Nz::UInt32 flags, std::size_t index);
|
void InvalidateRenderableData(const Nz::InstancedRenderable* renderable, Nz::UInt32 flags, std::size_t index);
|
||||||
void InvalidateRenderableMaterial(const Nz::InstancedRenderable* renderable, std::size_t skinIndex, std::size_t matIndex, const Nz::MaterialRef& newMat);
|
void InvalidateRenderableMaterial(const Nz::InstancedRenderable* renderable, std::size_t skinIndex, std::size_t matIndex, const Nz::MaterialRef& newMat);
|
||||||
|
|||||||
@@ -93,6 +93,8 @@ namespace Ndk
|
|||||||
UnregisterMaterial(renderable->GetMaterial(i));
|
UnregisterMaterial(renderable->GetMaterial(i));
|
||||||
|
|
||||||
m_renderables.erase(it);
|
m_renderables.erase(it);
|
||||||
|
|
||||||
|
ForceCullingInvalidation();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -255,6 +257,12 @@ namespace Ndk
|
|||||||
* \brief Invalidates the bounding volume
|
* \brief Invalidates the bounding volume
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
inline void GraphicsComponent::ForceCullingInvalidation()
|
||||||
|
{
|
||||||
|
for (CullingBoxEntry& entry : m_cullingBoxEntries)
|
||||||
|
entry.listEntry.ForceInvalidation(); //< Invalidate render queues
|
||||||
|
}
|
||||||
|
|
||||||
inline void GraphicsComponent::InvalidateAABB() const
|
inline void GraphicsComponent::InvalidateAABB() const
|
||||||
{
|
{
|
||||||
m_boundingVolumesUpdated = false;
|
m_boundingVolumesUpdated = false;
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ namespace Ndk
|
|||||||
RegisterMaterial(entry.renderable->GetMaterial(i));
|
RegisterMaterial(entry.renderable->GetMaterial(i));
|
||||||
|
|
||||||
InvalidateAABB();
|
InvalidateAABB();
|
||||||
|
ForceCullingInvalidation();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphicsComponent::ConnectInstancedRenderableSignals(Renderable& entry)
|
void GraphicsComponent::ConnectInstancedRenderableSignals(Renderable& entry)
|
||||||
@@ -110,8 +111,7 @@ namespace Ndk
|
|||||||
r.dataUpdated = false;
|
r.dataUpdated = false;
|
||||||
r.renderable->InvalidateData(&r.data, flags);
|
r.renderable->InvalidateData(&r.data, flags);
|
||||||
|
|
||||||
for (CullingBoxEntry& entry : m_cullingBoxEntries)
|
ForceCullingInvalidation();
|
||||||
entry.listEntry.ForceInvalidation();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphicsComponent::InvalidateRenderableMaterial(const Nz::InstancedRenderable* renderable, std::size_t skinIndex, std::size_t matIndex, const Nz::MaterialRef& newMat)
|
void GraphicsComponent::InvalidateRenderableMaterial(const Nz::InstancedRenderable* renderable, std::size_t skinIndex, std::size_t matIndex, const Nz::MaterialRef& newMat)
|
||||||
@@ -265,8 +265,7 @@ namespace Ndk
|
|||||||
InvalidateAABB();
|
InvalidateAABB();
|
||||||
InvalidateTransformMatrix();
|
InvalidateTransformMatrix();
|
||||||
|
|
||||||
for (CullingBoxEntry& entry : m_cullingBoxEntries)
|
ForceCullingInvalidation(); //< Force invalidation on movement for now (FIXME)
|
||||||
entry.listEntry.ForceInvalidation(); //< Force invalidation on movement
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphicsComponent::UnregisterMaterial(Nz::Material* material)
|
void GraphicsComponent::UnregisterMaterial(Nz::Material* material)
|
||||||
|
|||||||
Reference in New Issue
Block a user