Former-commit-id: 81dfaea9fd265b8a2610fda2a155cef4a73695b3 [formerly 4ca561497c773dd88058e448f1e1901ce558eb0b] [formerly 5ae1e8f8d0bd13c6ee275b655ec82e66435ae5b1 [formerly 2ea9e9744d6877a1192e6cb844e3172ae8db7218]]
Former-commit-id: d8944c28fa76195f7fdbd682b0d6113d0ae3c487 [formerly a81b6d5a73db2fbe5b0428cb7a8bc3388432c06c]
Former-commit-id: 50f7995003fd968d85a0f3f020313c7d6d9f5d68
This commit is contained in:
Lynix 2016-09-04 20:02:34 +02:00
commit 560825fa8e
5 changed files with 92 additions and 20 deletions

View File

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

View File

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

View File

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

View File

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

View File

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