diff --git a/include/Nazara/Utility/EventHandler.inl b/include/Nazara/Utility/EventHandler.inl index c066b6810..719ffddcb 100644 --- a/include/Nazara/Utility/EventHandler.inl +++ b/include/Nazara/Utility/EventHandler.inl @@ -43,7 +43,7 @@ namespace Nz break; case WindowEventType_MouseButtonReleased: - OnMouseButtonPressed(this, event.mouseButton); + OnMouseButtonReleased(this, event.mouseButton); break; case WindowEventType_MouseEntered: diff --git a/src/Nazara/Graphics/DeferredGeometryPass.cpp b/src/Nazara/Graphics/DeferredGeometryPass.cpp index 1c4f8b8bb..dbdb95f5a 100644 --- a/src/Nazara/Graphics/DeferredGeometryPass.cpp +++ b/src/Nazara/Graphics/DeferredGeometryPass.cpp @@ -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; } } } diff --git a/src/Nazara/Graphics/DeferredRenderQueue.cpp b/src/Nazara/Graphics/DeferredRenderQueue.cpp index 7d214b217..b240edcd7 100644 --- a/src/Nazara/Graphics/DeferredRenderQueue.cpp +++ b/src/Nazara/Graphics/DeferredRenderQueue.cpp @@ -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; + } } } diff --git a/src/Nazara/Graphics/ForwardRenderQueue.cpp b/src/Nazara/Graphics/ForwardRenderQueue.cpp index 882a6f61e..2de6b66e4 100644 --- a/src/Nazara/Graphics/ForwardRenderQueue.cpp +++ b/src/Nazara/Graphics/ForwardRenderQueue.cpp @@ -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(); diff --git a/src/Nazara/Graphics/ForwardRenderTechnique.cpp b/src/Nazara/Graphics/ForwardRenderTechnique.cpp index 91507ee68..959ef2f03 100644 --- a/src/Nazara/Graphics/ForwardRenderTechnique.cpp +++ b/src/Nazara/Graphics/ForwardRenderTechnique.cpp @@ -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; } } }