Culling: Fix some issues

Former-commit-id: cc91c0e8a7f0651743439ce8ac19efacae1aed69 [formerly d7463103fce8210ea8e495a627e5d84e3e4d430b] [formerly 274c2b2c16df1784823027f3f50c6d7024640eee [formerly d5baf025e09e3ef48f5c1db64a07775c75594a8a]]
Former-commit-id: 15230bf754acd065e6db4ba8dd79d37f43ba8a02 [formerly 81b85f2234f378de5eed976d4924ce8ccb08296f]
Former-commit-id: 3cdd9b2416ada3c6ae9bc8bdc527da83c46e0459
This commit is contained in:
Lynix 2016-09-16 00:40:01 +02:00
parent 9e66cf14be
commit 8ec377e72f
4 changed files with 27 additions and 6 deletions

View File

@ -161,7 +161,11 @@ namespace Ndk
NazaraUnused(node);
// Our view matrix depends on NodeComponent position/rotation
InvalidateBoundingVolume();
InvalidateTransformMatrix();
for (VolumeCullingEntry& entry : m_volumeCullingEntries)
entry.listEntry.ForceInvalidation(); //< Force invalidation on movement
}
/*!

View File

@ -183,10 +183,14 @@ namespace Ndk
graphicsComponent.EnsureBoundingVolumeUpdate();
}
bool forceInvalidation = !m_particleGroups.empty(); //< Always regenerate renderqueue if particle groups are present for now (FIXME)
bool forceInvalidation = false;
std::size_t visibilityHash = m_drawableCulling.Cull(camComponent.GetFrustum(), &forceInvalidation);
// Always regenerate renderqueue if particle groups are present for now (FIXME)
if (!m_particleGroups.empty())
forceInvalidation = true;
if (camComponent.UpdateVisibility(visibilityHash) || m_forceRenderQueueInvalidation || forceInvalidation)
{
renderQueue->Clear();

View File

@ -527,6 +527,24 @@ namespace Nz
layers.erase(it++);
else
{
for (auto& pipelinePair : layer.billboards)
{
auto& pipelineEntry = pipelinePair.second;
if (pipelineEntry.enabled)
{
for (auto& matIt : pipelinePair.second.materialMap)
{
auto& entry = matIt.second;
auto& billboardVector = entry.billboards;
billboardVector.clear();
}
}
pipelineEntry.enabled = false;
}
for (auto& pipelinePair : layer.basicSprites)
{
auto& pipelineEntry = pipelinePair.second;

View File

@ -469,8 +469,6 @@ namespace Nz
Renderer::DrawPrimitivesInstanced(renderedBillboardCount, PrimitiveMode_TriangleStrip, 0, 4);
}
while (billboardCount > 0);
billboardVector.clear();
}
}
}
@ -562,8 +560,6 @@ namespace Nz
Renderer::DrawIndexedPrimitives(PrimitiveMode_TriangleList, 0, renderedBillboardCount * 6);
}
while (billboardCount > 0);
billboardVector.clear();
}
}
}
@ -773,7 +769,6 @@ namespace Nz
}
}
}
instances.clear();
}
}
}