Former-commit-id: d40335a1d84793068db6d9ea7291e4053d00b349 [formerly 60aa10a46378c238c40f700bfd6c6e5585558da2] [formerly 0133433740741edc53e2070b8c2fdf5a4b831361 [formerly deb7b7432d4e327e8f9438814eafaa25dd3d9a51]]
Former-commit-id: f1eea3bf4fe3d0024217f5e9b38046cf2517b0cc [formerly 6a21f03e56a7d5c8d4aa9855f2aa50e9e7b30ae3]
Former-commit-id: 124f40eb3bbd24740ca15338a99153bab98846a4
This commit is contained in:
Lynix 2016-09-04 20:02:34 +02:00
commit 82f39221f7
5 changed files with 92 additions and 20 deletions

View File

@ -43,7 +43,7 @@ namespace Nz
break; break;
case WindowEventType_MouseButtonReleased: case WindowEventType_MouseButtonReleased:
OnMouseButtonPressed(this, event.mouseButton); OnMouseButtonReleased(this, event.mouseButton);
break; break;
case WindowEventType_MouseEntered: case WindowEventType_MouseEntered:

View File

@ -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;
} }
} }
} }

View File

@ -273,11 +273,43 @@ namespace Nz
layers.clear(); layers.clear();
else else
{ {
for (auto it = layers.begin(); it != layers.end(); ++it) for (auto it = layers.begin(); it != layers.end();)
{ {
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;
}
}
++it;
}
} }
} }

View File

@ -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();

View File

@ -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;
} }
} }
} }