From 102d3653d712f3447bd0a9ed30f9f776a888e9bc Mon Sep 17 00:00:00 2001 From: kaetemi Date: Tue, 5 Aug 2014 02:58:55 +0200 Subject: [PATCH] 3D: Ensure correct fog handling for effects --HG-- branch : multipass-stereo --- code/nel/src/3d/bloom_effect.cpp | 7 +++++++ code/nel/src/3d/fxaa.cpp | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/code/nel/src/3d/bloom_effect.cpp b/code/nel/src/3d/bloom_effect.cpp index aee1a26e7..c468349ac 100644 --- a/code/nel/src/3d/bloom_effect.cpp +++ b/code/nel/src/3d/bloom_effect.cpp @@ -232,6 +232,10 @@ void CBloomEffect::applyBloom() CDriverUser *dru = static_cast(_Driver); IDriver *drv = dru->getDriver(); + // backup + bool fogEnabled = _Driver->fogEnabled(); + _Driver->enableFog(false); + NL3D::ITexture *renderTarget = drv->getRenderTarget(); nlassert(renderTarget); nlassert(renderTarget->isBloomTexture()); @@ -286,6 +290,9 @@ void CBloomEffect::applyBloom() _BlurMat.getObjectPtr()->setTexture(2, NULL); _BlurMat.getObjectPtr()->setTexture(3, NULL); + // restore + _Driver->enableFog(fogEnabled); + // recycle render targets _Driver->getRenderTargetManager().recycleRenderTarget(_BlurFinalTex); _BlurFinalTex = NULL; diff --git a/code/nel/src/3d/fxaa.cpp b/code/nel/src/3d/fxaa.cpp index 73146aabe..f19bcd8b4 100644 --- a/code/nel/src/3d/fxaa.cpp +++ b/code/nel/src/3d/fxaa.cpp @@ -199,6 +199,10 @@ void CFXAA::applyEffect() CDriverUser *dru = static_cast(m_Driver); IDriver *drv = dru->getDriver(); + // backup + bool fogEnabled = m_Driver->fogEnabled(); + m_Driver->enableFog(false); + NL3D::ITexture *renderTarget = drv->getRenderTarget(); nlassert(renderTarget); nlassert(renderTarget->isBloomTexture()); @@ -275,6 +279,9 @@ void CFXAA::applyEffect() drv->activeVertexProgram(NULL); drv->activePixelProgram(NULL); + // restore + m_Driver->enableFog(fogEnabled); + // recycle render target m_Driver->getRenderTargetManager().recycleRenderTarget(otherRenderTarget); }