Graphics: Clear instances in Clear method
Former-commit-id: 66b0db92e353312b6cf3d68526417b5fb77c0bef [formerly 897579017072102b658dc637b91bc52d80a061cd] [formerly 7685fb2c3c18c030ce5a3ac6a29129bd39de88c8 [formerly 7ba2bc156951247f5f7ba7ebfb3d65bced1731e7]] Former-commit-id: a1eb128bba2d28589a7988f6f98a860839c07cfe [formerly 1fed3d7b8cbc84c528ce27db61123ce8fc562e97] Former-commit-id: cc56728a6e0a6b84c4969850287109c8e92281cd
This commit is contained in:
parent
3755fc2487
commit
7781a27641
|
|
@ -187,18 +187,11 @@ namespace Nz
|
|||
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;
|
||||
if (layer.clearCount++ >= 100)
|
||||
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++);
|
||||
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.transparentModels.clear();
|
||||
layer.transparentModelData.clear();
|
||||
|
|
|
|||
|
|
@ -386,17 +386,12 @@ namespace Nz
|
|||
vertexMapper.Unmap();
|
||||
|
||||
Renderer::DrawIndexedPrimitives(PrimitiveMode_TriangleList, 0, spriteCount * 6);
|
||||
} while (spriteChain < spriteChainCount);
|
||||
|
||||
spriteChainVector.clear();
|
||||
}
|
||||
while (spriteChain < spriteChainCount);
|
||||
}
|
||||
}
|
||||
|
||||
// We set it back to zero
|
||||
matEntry.enabled = false;
|
||||
}
|
||||
}
|
||||
pipelineEntry.enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -781,12 +776,8 @@ namespace Nz
|
|||
instances.clear();
|
||||
}
|
||||
}
|
||||
|
||||
matEntry.enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
pipelineEntry.maxInstanceCount = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue