summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl7
-rw-r--r--indra/newview/lldrawpoolsky.cpp9
-rw-r--r--indra/newview/lldrawpoolwater.cpp2
-rw-r--r--indra/newview/lldrawpoolwater.h1
-rw-r--r--indra/newview/llface.cpp6
-rw-r--r--indra/newview/llviewerdisplay.cpp5
-rw-r--r--indra/newview/llvosky.cpp41
-rw-r--r--indra/newview/llwaterparammanager.cpp1
8 files changed, 50 insertions, 22 deletions
diff --git a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl
index e4db326bed..57b3a6d001 100644
--- a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl
@@ -26,6 +26,9 @@
VARYING float fog_depth;
+uniform vec4 waterFogColor;
+uniform float waterFogEnd;
+
vec4 applyWaterFog(vec4 color)
{
// GL_EXP2 Fog
@@ -33,9 +36,9 @@ vec4 applyWaterFog(vec4 color)
// GL_EXP Fog
// float fog = exp(-gl_Fog.density * fog_depth);
// GL_LINEAR Fog
- float fog = (gl_Fog.end - fog_depth) * gl_Fog.scale;
+ float fog = (waterFogEnd - fog_depth) * gl_Fog.scale;
fog = clamp(fog, 0.0, 1.0);
- color.rgb = mix(gl_Fog.color.rgb, color.rgb, fog);
+ color.rgb = mix(waterFogColor.rgb, color.rgb, fog);
return color;
}
diff --git a/indra/newview/lldrawpoolsky.cpp b/indra/newview/lldrawpoolsky.cpp
index 8a3871b6b4..7f7d9f65c6 100644
--- a/indra/newview/lldrawpoolsky.cpp
+++ b/indra/newview/lldrawpoolsky.cpp
@@ -76,13 +76,14 @@ void LLDrawPoolSky::render(S32 pass)
return;
}
- // use a shader only underwater
+ // don't render sky under water (background just gets cleared to fog color)
if(mVertexShaderLevel > 0 && LLPipeline::sUnderWaterRender)
{
- mShader = &gObjectFullbrightWaterProgram;
- mShader->bind();
+ return;
}
- else if (LLGLSLShader::sNoFixedFunction)
+
+
+ if (LLGLSLShader::sNoFixedFunction)
{ //just use the UI shader (generic single texture no lighting)
gOneTextureNoColorProgram.bind();
}
diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp
index 5de0b8c796..f6fe96877d 100644
--- a/indra/newview/lldrawpoolwater.cpp
+++ b/indra/newview/lldrawpoolwater.cpp
@@ -59,6 +59,8 @@ BOOL LLDrawPoolWater::sSkipScreenCopy = FALSE;
BOOL LLDrawPoolWater::sNeedsReflectionUpdate = TRUE;
BOOL LLDrawPoolWater::sNeedsDistortionUpdate = TRUE;
LLColor4 LLDrawPoolWater::sWaterFogColor = LLColor4(0.2f, 0.5f, 0.5f, 0.f);
+F32 LLDrawPoolWater::sWaterFogEnd = 0.f;
+
LLVector3 LLDrawPoolWater::sLightDir;
LLDrawPoolWater::LLDrawPoolWater() :
diff --git a/indra/newview/lldrawpoolwater.h b/indra/newview/lldrawpoolwater.h
index 99b541ca5a..aeeba179d6 100644
--- a/indra/newview/lldrawpoolwater.h
+++ b/indra/newview/lldrawpoolwater.h
@@ -49,6 +49,7 @@ public:
static LLVector3 sLightDir;
static LLColor4 sWaterFogColor;
+ static F32 sWaterFogEnd;
enum
{
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp
index d36379b0e7..36b88ebbd4 100644
--- a/indra/newview/llface.cpp
+++ b/indra/newview/llface.cpp
@@ -1764,7 +1764,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
if (rebuild_emissive)
{
LLFastTimer t(FTM_FACE_GEOM_EMISSIVE);
- LLStrider<U8> emissive;
+ LLStrider<LLColor4U> emissive;
mVertexBuffer->getEmissiveStrider(emissive, mGeomIndex, mGeomCount, map_range);
U8 glow = (U8) llclamp((S32) (getTextureEntry()->getGlow()*255), 0, 255);
@@ -1783,8 +1783,8 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
src.loadua((F32*) vec);
LLVector4a* dst = (LLVector4a*) emissive.get();
- S32 num_vecs = num_vertices/16;
- if (num_vertices%16 > 0)
+ S32 num_vecs = num_vertices/4;
+ if (num_vertices%4 > 0)
{
++num_vecs;
}
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index e47ac8680a..20c9071052 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -866,6 +866,11 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
else
{
gPipeline.mScreen.bindTarget();
+ if (LLPipeline::sUnderWaterRender && !gPipeline.canUseWindLightShaders())
+ {
+ const LLColor4 &col = LLDrawPoolWater::sWaterFogColor;
+ glClearColor(col.mV[0], col.mV[1], col.mV[2], 0.f);
+ }
gPipeline.mScreen.clear();
}
diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp
index d90c3be6c7..e9db37821b 100644
--- a/indra/newview/llvosky.cpp
+++ b/indra/newview/llvosky.cpp
@@ -2040,9 +2040,12 @@ void LLVOSky::updateFog(const F32 distance)
{
if (!gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_FOG))
{
- glFogf(GL_FOG_DENSITY, 0);
- glFogfv(GL_FOG_COLOR, (F32 *) &LLColor4::white.mV);
- glFogf(GL_FOG_END, 1000000.f);
+ if (!LLGLSLShader::sNoFixedFunction)
+ {
+ glFogf(GL_FOG_DENSITY, 0);
+ glFogfv(GL_FOG_COLOR, (F32 *) &LLColor4::white.mV);
+ glFogf(GL_FOG_END, 1000000.f);
+ }
return;
}
@@ -2112,7 +2115,10 @@ void LLVOSky::updateFog(const F32 distance)
if (camera_height > water_height)
{
LLColor4 fog(render_fog_color);
- glFogfv(GL_FOG_COLOR, fog.mV);
+ if (!LLGLSLShader::sNoFixedFunction)
+ {
+ glFogfv(GL_FOG_COLOR, fog.mV);
+ }
mGLFogCol = fog;
if (hide_clip_plane)
@@ -2120,13 +2126,19 @@ void LLVOSky::updateFog(const F32 distance)
// For now, set the density to extend to the cull distance.
const F32 f_log = 2.14596602628934723963618357029f; // sqrt(fabs(log(0.01f)))
fog_density = f_log/fog_distance;
- glFogi(GL_FOG_MODE, GL_EXP2);
+ if (!LLGLSLShader::sNoFixedFunction)
+ {
+ glFogi(GL_FOG_MODE, GL_EXP2);
+ }
}
else
{
const F32 f_log = 4.6051701859880913680359829093687f; // fabs(log(0.01f))
fog_density = (f_log)/fog_distance;
- glFogi(GL_FOG_MODE, GL_EXP);
+ if (!LLGLSLShader::sNoFixedFunction)
+ {
+ glFogi(GL_FOG_MODE, GL_EXP);
+ }
}
}
else
@@ -2146,24 +2158,27 @@ void LLVOSky::updateFog(const F32 distance)
fogCol.setAlpha(1);
// set the gl fog color
- glFogfv(GL_FOG_COLOR, (F32 *) &fogCol.mV);
mGLFogCol = fogCol;
// set the density based on what the shaders use
fog_density = water_fog_density * gSavedSettings.getF32("WaterGLFogDensityScale");
- glFogi(GL_FOG_MODE, GL_EXP2);
+
+ if (!LLGLSLShader::sNoFixedFunction)
+ {
+ glFogfv(GL_FOG_COLOR, (F32 *) &fogCol.mV);
+ glFogi(GL_FOG_MODE, GL_EXP2);
+ }
}
mFogColor = sky_fog_color;
mFogColor.setAlpha(1);
- LLGLSFog gls_fog;
-
- glFogf(GL_FOG_END, fog_distance*2.2f);
-
- glFogf(GL_FOG_DENSITY, fog_density);
+ LLDrawPoolWater::sWaterFogEnd = fog_distance*2.2f;
if (!LLGLSLShader::sNoFixedFunction)
{
+ LLGLSFog gls_fog;
+ glFogf(GL_FOG_END, fog_distance*2.2f);
+ glFogf(GL_FOG_DENSITY, fog_density);
glHint(GL_FOG_HINT, GL_NICEST);
}
stop_glerror();
diff --git a/indra/newview/llwaterparammanager.cpp b/indra/newview/llwaterparammanager.cpp
index 1a98d4c6c2..20b34637b8 100644
--- a/indra/newview/llwaterparammanager.cpp
+++ b/indra/newview/llwaterparammanager.cpp
@@ -190,6 +190,7 @@ void LLWaterParamManager::updateShaderUniforms(LLGLSLShader * shader)
shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, LLWLParamManager::getInstance()->getRotatedLightDir().mV);
shader->uniform3fv("camPosLocal", 1, LLViewerCamera::getInstance()->getOrigin().mV);
shader->uniform4fv("waterFogColor", 1, LLDrawPoolWater::sWaterFogColor.mV);
+ shader->uniform1f("waterFogEnd", LLDrawPoolWater::sWaterFogEnd);
shader->uniform4fv("waterPlane", 1, mWaterPlane.mV);
shader->uniform1f("waterFogDensity", getFogDensity());
shader->uniform1f("waterFogKS", mWaterFogKS);