summaryrefslogtreecommitdiff
path: root/indra/newview/lldrawpoolwater.cpp
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2019-01-08 09:47:21 -0800
committerGraham Linden <graham@lindenlab.com>2019-01-08 09:47:21 -0800
commit368602fb8168b95a889cadba85242a42c0f53049 (patch)
tree6fe71feb03ecbaccf4f182b923dd6944ead61d21 /indra/newview/lldrawpoolwater.cpp
parent40208fd820cf99681aff01d0cd688c861ae7acb7 (diff)
parent84bb8e1167fde0ceac4c40bcc2b1841238817097 (diff)
Merge
Diffstat (limited to 'indra/newview/lldrawpoolwater.cpp')
-rw-r--r--indra/newview/lldrawpoolwater.cpp34
1 files changed, 27 insertions, 7 deletions
diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp
index ee37f36cbd..9820720fb9 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());