summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2019-01-08 17:18:29 +0000
committerRider Linden <rider@lindenlab.com>2019-01-08 17:18:29 +0000
commit721a8d20b73a921a6bb4ac5b9e0d0ca5a870f4fc (patch)
treee8d1584251e96b4cf12422e8f00f57172ca9547a /indra/newview
parent1871f03d12e7a8e388d188f87e612117bcda75c1 (diff)
parentaed659c5b4cb5ac2378b4aadc91468bbaf9c4362 (diff)
Merged in graham_linden/viewer-eep-sl-10304 (pull request #218)
SL-10304
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/waterF.glsl5
-rw-r--r--indra/newview/lldrawpoolwater.cpp34
2 files changed, 28 insertions, 11 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
index 69543b93ea..869c9e7927 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
@@ -68,10 +68,7 @@ vec3 scaleSoftClipFrag(vec3 l);
vec3 BlendNormal(vec3 bump1, vec3 bump2)
{
- //vec3 normal = bump1.xyz * vec3( 2.0, 2.0, 2.0) - vec3(1.0, 1.0, 0.0);
- //vec3 normal2 = bump2.xyz * vec3(-2.0, -2.0, 2.0) + vec3(1.0, 1.0, -1.0);
- //vec3 n = normalize(normal * dot(normal, normal2) - (normal2 * normal.z));
- vec3 n = normalize(mix(bump1, bump2, blend_factor));
+ vec3 n = mix(bump1, bump2, blend_factor);
return n;
}
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());