summaryrefslogtreecommitdiff
path: root/indra/newview/llvosky.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llvosky.cpp')
-rw-r--r--indra/newview/llvosky.cpp59
1 files changed, 41 insertions, 18 deletions
diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp
index 66ba6249d3..e9db37821b 100644
--- a/indra/newview/llvosky.cpp
+++ b/indra/newview/llvosky.cpp
@@ -755,6 +755,11 @@ void LLVOSky::calcSkyColorWLVert(LLVector3 & Pn, LLColor3 & vary_HazeColor, LLCo
// project the direction ray onto the sky dome.
F32 phi = acos(Pn[1]);
F32 sinA = sin(F_PI - phi);
+ if (fabsf(sinA) < 0.01f)
+ { //avoid division by zero
+ sinA = 0.01f;
+ }
+
F32 Plen = dome_radius * sin(F_PI + phi + asin(dome_offset_ratio * sinA)) / sinA;
Pn *= Plen;
@@ -1262,7 +1267,7 @@ void LLVOSky::updateDummyVertexBuffer()
LLStrider<LLVector3> vertices ;
mFace[FACE_DUMMY]->getVertexBuffer()->getVertexStrider(vertices, 0);
*vertices = mCameraPosAgent ;
- mFace[FACE_DUMMY]->getVertexBuffer()->setBuffer(0) ;
+ mFace[FACE_DUMMY]->getVertexBuffer()->flush();
}
//----------------------------------
//end of fake vertex buffer updating
@@ -1346,7 +1351,7 @@ BOOL LLVOSky::updateGeometry(LLDrawable *drawable)
*indicesp++ = index_offset + 3;
*indicesp++ = index_offset + 2;
- buff->setBuffer(0);
+ buff->flush();
}
}
@@ -1511,7 +1516,7 @@ BOOL LLVOSky::updateHeavenlyBodyGeometry(LLDrawable *drawable, const S32 f, cons
*indicesp++ = index_offset + 2;
*indicesp++ = index_offset + 3;
- facep->getVertexBuffer()->setBuffer(0);
+ facep->getVertexBuffer()->flush();
if (is_sun)
{
@@ -2025,7 +2030,7 @@ void LLVOSky::updateReflectionGeometry(LLDrawable *drawable, F32 H,
}
}
- face->getVertexBuffer()->setBuffer(0);
+ face->getVertexBuffer()->flush();
}
@@ -2035,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;
}
@@ -2107,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)
@@ -2115,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
@@ -2141,23 +2158,29 @@ 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;
+ LLDrawPoolWater::sWaterFogEnd = fog_distance*2.2f;
- glFogf(GL_FOG_END, fog_distance*2.2f);
-
- glFogf(GL_FOG_DENSITY, fog_density);
-
- glHint(GL_FOG_HINT, GL_NICEST);
+ 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();
}