Graphics: Clear instances in Clear method
Former-commit-id: 8f116c954577de1e231efe5d0c6c34458e7c195c [formerly 0b07a41900b0cad6305956370a045dd1539e5634] [formerly 4eb1b81cf3b3e2badcf61032988f61ffe511a001 [formerly f016c785f246cead41c81130d04ffb2dfe61e42d]] Former-commit-id: 4f7fd53326b8b60c91d4e4edf53451561c7da7ad [formerly c80c94219ed09321ff35472cc9209e383f14cb59] Former-commit-id: 8e2ec06ccf7bee67a47ad73dce1132c33cc91a5e
This commit is contained in:
parent
5d13fa664b
commit
32aeb96378
|
|
@ -187,18 +187,11 @@ namespace Nz
|
||||||
drawFunc(meshData.primitiveMode, 0, indexCount);
|
drawFunc(meshData.primitiveMode, 0, indexCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
instances.clear();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// And we set it back data to zero
|
|
||||||
matEntry.enabled = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pipelineEntry.maxInstanceCount = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -278,6 +278,36 @@ namespace Nz
|
||||||
Layer& layer = it->second;
|
Layer& layer = it->second;
|
||||||
if (layer.clearCount++ >= 100)
|
if (layer.clearCount++ >= 100)
|
||||||
it = layers.erase(it);
|
it = layers.erase(it);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (auto& pipelinePair : layer.opaqueModels)
|
||||||
|
{
|
||||||
|
const MaterialPipeline* pipeline = pipelinePair.first;
|
||||||
|
auto& pipelineEntry = pipelinePair.second;
|
||||||
|
|
||||||
|
if (pipelineEntry.maxInstanceCount > 0)
|
||||||
|
{
|
||||||
|
for (auto& materialPair : pipelineEntry.materialMap)
|
||||||
|
{
|
||||||
|
auto& matEntry = materialPair.second;
|
||||||
|
|
||||||
|
if (matEntry.enabled)
|
||||||
|
{
|
||||||
|
MeshInstanceContainer& meshInstances = matEntry.meshMap;
|
||||||
|
|
||||||
|
for (auto& meshIt : meshInstances)
|
||||||
|
{
|
||||||
|
auto& meshEntry = meshIt.second;
|
||||||
|
|
||||||
|
meshEntry.instances.clear();
|
||||||
|
}
|
||||||
|
matEntry.enabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pipelineEntry.maxInstanceCount = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -527,6 +527,62 @@ namespace Nz
|
||||||
layers.erase(it++);
|
layers.erase(it++);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
for (auto& pipelinePair : layer.basicSprites)
|
||||||
|
{
|
||||||
|
auto& pipelineEntry = pipelinePair.second;
|
||||||
|
|
||||||
|
if (pipelineEntry.enabled)
|
||||||
|
{
|
||||||
|
for (auto& materialPair : pipelineEntry.materialMap)
|
||||||
|
{
|
||||||
|
auto& matEntry = materialPair.second;
|
||||||
|
|
||||||
|
if (matEntry.enabled)
|
||||||
|
{
|
||||||
|
auto& overlayMap = matEntry.overlayMap;
|
||||||
|
for (auto& overlayIt : overlayMap)
|
||||||
|
{
|
||||||
|
const Texture* overlay = overlayIt.first;
|
||||||
|
auto& spriteChainVector = overlayIt.second.spriteChains;
|
||||||
|
|
||||||
|
spriteChainVector.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
matEntry.enabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pipelineEntry.enabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto& pipelinePair : layer.opaqueModels)
|
||||||
|
{
|
||||||
|
auto& pipelineEntry = pipelinePair.second;
|
||||||
|
|
||||||
|
if (pipelineEntry.maxInstanceCount > 0)
|
||||||
|
{
|
||||||
|
for (auto& materialPair : pipelineEntry.materialMap)
|
||||||
|
{
|
||||||
|
const Material* material = materialPair.first;
|
||||||
|
auto& matEntry = materialPair.second;
|
||||||
|
|
||||||
|
if (matEntry.enabled)
|
||||||
|
{
|
||||||
|
MeshInstanceContainer& meshInstances = matEntry.meshMap;
|
||||||
|
|
||||||
|
for (auto& meshIt : meshInstances)
|
||||||
|
{
|
||||||
|
auto& meshEntry = meshIt.second;
|
||||||
|
|
||||||
|
meshEntry.instances.clear();
|
||||||
|
}
|
||||||
|
matEntry.enabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pipelineEntry.maxInstanceCount = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
layer.otherDrawables.clear();
|
layer.otherDrawables.clear();
|
||||||
layer.transparentModels.clear();
|
layer.transparentModels.clear();
|
||||||
layer.transparentModelData.clear();
|
layer.transparentModelData.clear();
|
||||||
|
|
|
||||||
|
|
@ -386,17 +386,12 @@ namespace Nz
|
||||||
vertexMapper.Unmap();
|
vertexMapper.Unmap();
|
||||||
|
|
||||||
Renderer::DrawIndexedPrimitives(PrimitiveMode_TriangleList, 0, spriteCount * 6);
|
Renderer::DrawIndexedPrimitives(PrimitiveMode_TriangleList, 0, spriteCount * 6);
|
||||||
} while (spriteChain < spriteChainCount);
|
}
|
||||||
|
while (spriteChain < spriteChainCount);
|
||||||
spriteChainVector.clear();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We set it back to zero
|
|
||||||
matEntry.enabled = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pipelineEntry.enabled = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -781,12 +776,8 @@ namespace Nz
|
||||||
instances.clear();
|
instances.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
matEntry.enabled = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pipelineEntry.maxInstanceCount = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue