Former-commit-id: d6033d39e82aa38a07067b979d71275e1055394e [formerly 14c23f953516d3231a22935cf6c9dcc3320929f3] [formerly 287b86adee5cbe5b21f61299cd901aa3364bc8f9 [formerly c96fc59c7584384e08cdefc2e818c987a21f63df]]
Former-commit-id: 3918057219c8424763bac64cab681d7ead414e1a [formerly 25f4eccfec48be2d863ff2f9506fbc9925efd10c]
Former-commit-id: f14b3162b530f634967c3c3ca246e54928cad2f6
This commit is contained in:
Lynix 2016-09-04 20:02:34 +02:00
commit f21bc9f074
7 changed files with 282 additions and 210 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;
}
}
}