Graphics/CullingList: Add forceInvalidation parameter

This commit is contained in:
Lynix 2018-08-25 22:41:34 +02:00
parent a3a4ed89b8
commit fd9db1b639
3 changed files with 26 additions and 3 deletions

View File

@ -208,7 +208,7 @@ namespace Ndk
if (m_isCullingEnabled) if (m_isCullingEnabled)
visibilityHash = m_drawableCulling.Cull(camComponent.GetFrustum(), &forceInvalidation); visibilityHash = m_drawableCulling.Cull(camComponent.GetFrustum(), &forceInvalidation);
else else
visibilityHash = m_drawableCulling.FillWithAllEntries(); visibilityHash = m_drawableCulling.FillWithAllEntries(&forceInvalidation);
// Always regenerate renderqueue if particle groups are present for now (FIXME) // Always regenerate renderqueue if particle groups are present for now (FIXME)
if (!m_lights.empty() || !m_particleGroups.empty()) if (!m_lights.empty() || !m_particleGroups.empty())

View File

@ -41,7 +41,7 @@ namespace Nz
std::size_t Cull(const Frustumf& frustum, bool* forceInvalidation = nullptr); std::size_t Cull(const Frustumf& frustum, bool* forceInvalidation = nullptr);
std::size_t FillWithAllEntries(); std::size_t FillWithAllEntries(bool* forceInvalidation = nullptr);
NoTestEntry RegisterNoTest(const T* renderable); NoTestEntry RegisterNoTest(const T* renderable);
SphereEntry RegisterSphereTest(const T* renderable); SphereEntry RegisterSphereTest(const T* renderable);

View File

@ -71,28 +71,51 @@ namespace Nz
} }
template<typename T> template<typename T>
std::size_t CullingList<T>::FillWithAllEntries() std::size_t CullingList<T>::FillWithAllEntries(bool* forceInvalidation)
{ {
m_results.clear(); m_results.clear();
bool forcedInvalidation = false;
std::size_t visibleHash = 0U; std::size_t visibleHash = 0U;
for (NoTestVisibilityEntry& entry : m_noTestList) for (NoTestVisibilityEntry& entry : m_noTestList)
{ {
m_results.push_back(entry.renderable); m_results.push_back(entry.renderable);
Nz::HashCombine(visibleHash, entry.renderable); Nz::HashCombine(visibleHash, entry.renderable);
if (entry.forceInvalidation)
{
forcedInvalidation = true;
entry.forceInvalidation = false;
}
} }
for (SphereVisibilityEntry& entry : m_sphereTestList) for (SphereVisibilityEntry& entry : m_sphereTestList)
{ {
m_results.push_back(entry.renderable); m_results.push_back(entry.renderable);
Nz::HashCombine(visibleHash, entry.renderable); Nz::HashCombine(visibleHash, entry.renderable);
if (entry.forceInvalidation)
{
forcedInvalidation = true;
entry.forceInvalidation = false;
}
} }
for (VolumeVisibilityEntry& entry : m_volumeTestList) for (VolumeVisibilityEntry& entry : m_volumeTestList)
{ {
m_results.push_back(entry.renderable); m_results.push_back(entry.renderable);
Nz::HashCombine(visibleHash, entry.renderable); Nz::HashCombine(visibleHash, entry.renderable);
if (entry.forceInvalidation)
{
forcedInvalidation = true;
entry.forceInvalidation = false;
} }
}
if (forceInvalidation)
*forceInvalidation = forcedInvalidation;
return visibleHash; return visibleHash;
} }