diff options
author | Graham Linden <graham@lindenlab.com> | 2019-01-07 16:47:16 -0800 |
---|---|---|
committer | Graham Linden <graham@lindenlab.com> | 2019-01-07 16:47:16 -0800 |
commit | aed659c5b4cb5ac2378b4aadc91468bbaf9c4362 (patch) | |
tree | 02a7ea05ff7d7987c7fed4497e8008c0e84d1b7b /indra/newview/lldrawpoolwater.cpp | |
parent | 1badfb0e96959725fbe2895994607a088f4a808b (diff) |
SL-10304 fix handling of water normal map blending when both current and next textures are identical.
Diffstat (limited to 'indra/newview/lldrawpoolwater.cpp')
-rw-r--r-- | indra/newview/lldrawpoolwater.cpp | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index d217f95cf3..7aec06e1f8 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -579,12 +579,34 @@ void LLDrawPoolWater::shade() } //bind normal map - S32 bumpTex = shader->enableTexture(LLViewerShaderMgr::BUMP_MAP); + S32 bumpTex = shader->enableTexture(LLViewerShaderMgr::BUMP_MAP); + S32 bumpTex2 = shader->enableTexture(LLViewerShaderMgr::BUMP_MAP2); - if (mWaterNormp[0]) + LLViewerTexture* tex_a = mWaterNormp[0]; + LLViewerTexture* tex_b = mWaterNormp[1]; + + F32 blend_factor = LLEnvironment::instance().getCurrentWater()->getBlendFactor(); + + if (tex_a && (!tex_b || (tex_a == tex_b))) + { + gGL.getTexUnit(bumpTex)->bind(tex_a); + gGL.getTexUnit(bumpTex2)->unbind(LLTexUnit::TT_TEXTURE); + blend_factor = 0; // only one tex provided, no blending + } + else if (tex_b && !tex_a) + { + gGL.getTexUnit(bumpTex)->bind(tex_b); + gGL.getTexUnit(bumpTex2)->unbind(LLTexUnit::TT_TEXTURE); + blend_factor = 0; // only one tex provided, no blending + } + else if (tex_b != tex_a) { - gGL.getTexUnit(bumpTex)->bind(mWaterNormp[0]) ; + gGL.getTexUnit(bumpTex)->bind(tex_a); + gGL.getTexUnit(bumpTex2)->bind(tex_b); + } + if (mWaterNormp[0]) + { if (gSavedSettings.getBOOL("RenderWaterMipNormal")) { mWaterNormp[0]->setFilteringOption(LLTexUnit::TFO_ANISOTROPIC); @@ -597,10 +619,6 @@ void LLDrawPoolWater::shade() if (mWaterNormp[1]) { - bumpTex = shader->enableTexture(LLViewerShaderMgr::BUMP_MAP2); - - gGL.getTexUnit(bumpTex)->bind(mWaterNormp[1]) ; - if (gSavedSettings.getBOOL("RenderWaterMipNormal")) { mWaterNormp[1]->setFilteringOption(LLTexUnit::TFO_ANISOTROPIC); @@ -611,6 +629,8 @@ void LLDrawPoolWater::shade() } } + shader->uniform1f(LLShaderMgr::BLEND_FACTOR, blend_factor); + shader->uniform3fv(LLShaderMgr::WATER_FOGCOLOR, 1, pwater->getWaterFogColor().mV); shader->uniform1f(LLShaderMgr::WATER_FOGDENSITY, pwater->getWaterFogDensity()); |