Skip to content
Snippets Groups Projects
Commit ae099c63 authored by Graham Linden's avatar Graham Linden
Browse files

SL-1655

Make water horizon consistent between ALM and non-ALM rendering again.

Fix using deferred sky rendering in reflections.

Make matrix mode explicit around push/pop for safety.
parent 78866b33
No related branches found
No related tags found
No related merge requests found
...@@ -695,43 +695,19 @@ void LLDrawPoolWater::shade() ...@@ -695,43 +695,19 @@ void LLDrawPoolWater::shade()
water_color.mV[3] = 0.9f; water_color.mV[3] = 0.9f;
} }
{ {
LLGLEnable depth_clamp(gGLManager.mHasDepthClamp ? GL_DEPTH_CLAMP : 0);
LLGLDisable cullface(GL_CULL_FACE); LLGLDisable cullface(GL_CULL_FACE);
for (std::vector<LLFace*>::iterator iter = mDrawFace.begin();
iter != mDrawFace.end(); iter++)
{
LLFace *face = *iter;
if (voskyp->isReflFace(face)) sNeedsReflectionUpdate = TRUE;
{ sNeedsDistortionUpdate = TRUE;
continue;
}
LLVOWater* water = (LLVOWater*) face->getViewerObject(); for (std::vector<LLFace*>::iterator iter = mDrawFace.begin(); iter != mDrawFace.end(); iter++)
{
LLFace *face = *iter;
gGL.getTexUnit(diffTex)->bind(face->getTexture()); gGL.getTexUnit(diffTex)->bind(face->getTexture());
face->renderIndexed();
sNeedsReflectionUpdate = TRUE;
if (water->getUseTexture() || !water->getIsEdgePatch())
{
sNeedsDistortionUpdate = TRUE;
face->renderIndexed();
}
// using squash clip for deferred rendering makes the horizon lines match
// between ALM and non-ALM rendering (SL-1655), but introduces an ugly seem between
// near and far water(SL-9696)...we're going to live with the former and not cause the latter
else if (gGLManager.mHasDepthClamp || deferred_render)
{
face->renderIndexed();
}
else
{
LLGLSquashToFarClip far_clip(get_current_projection());
face->renderIndexed();
}
} }
} }
shader->disableTexture(LLShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); shader->disableTexture(LLShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP);
shader->disableTexture(LLShaderMgr::WATER_SCREENTEX); shader->disableTexture(LLShaderMgr::WATER_SCREENTEX);
......
...@@ -132,6 +132,7 @@ void LLDrawPoolWLSky::renderDome(const LLVector3& camPosLocal, F32 camHeightLoca ...@@ -132,6 +132,7 @@ void LLDrawPoolWLSky::renderDome(const LLVector3& camPosLocal, F32 camHeightLoca
{ {
llassert_always(NULL != shader); llassert_always(NULL != shader);
gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.pushMatrix(); gGL.pushMatrix();
//chop off translation //chop off translation
...@@ -158,6 +159,7 @@ void LLDrawPoolWLSky::renderDome(const LLVector3& camPosLocal, F32 camHeightLoca ...@@ -158,6 +159,7 @@ void LLDrawPoolWLSky::renderDome(const LLVector3& camPosLocal, F32 camHeightLoca
gSky.mVOWLSkyp->drawDome(); gSky.mVOWLSkyp->drawDome();
gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.popMatrix(); gGL.popMatrix();
} }
...@@ -191,6 +193,7 @@ void LLDrawPoolWLSky::renderSkyHazeDeferred(const LLVector3& camPosLocal, F32 ca ...@@ -191,6 +193,7 @@ void LLDrawPoolWLSky::renderSkyHazeDeferred(const LLVector3& camPosLocal, F32 ca
sky_shader->uniform3f(sCamPosLocal, camPosLocal.mV[0], camPosLocal.mV[1], camPosLocal.mV[2]); sky_shader->uniform3f(sCamPosLocal, camPosLocal.mV[0], camPosLocal.mV[1], camPosLocal.mV[2]);
LLGLDisable cull(GL_CULL_FACE);
renderFsSky(camPosLocal, camHeightLocal, sky_shader); renderFsSky(camPosLocal, camHeightLocal, sky_shader);
sky_shader->unbind(); sky_shader->unbind();
...@@ -565,28 +568,23 @@ void LLDrawPoolWLSky::render(S32 pass) ...@@ -565,28 +568,23 @@ void LLDrawPoolWLSky::render(S32 pass)
LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin(); LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin();
renderSkyHaze(origin, camHeightLocal); renderSkyHaze(origin, camHeightLocal);
bool use_advanced = gPipeline.useAdvancedAtmospherics();
if (!use_advanced) gGL.pushMatrix();
{
gGL.pushMatrix();
// MAINT-9006 keep sun position consistent between ALM and non-ALM rendering // MAINT-9006 keep sun position consistent between ALM and non-ALM rendering
//gGL.translatef(origin.mV[0], origin.mV[1], origin.mV[2]); //gGL.translatef(origin.mV[0], origin.mV[1], origin.mV[2]);
// *NOTE: have to bind a texture here since register combiners blending in // *NOTE: have to bind a texture here since register combiners blending in
// renderStars() requires something to be bound and we might as well only // renderStars() requires something to be bound and we might as well only
// bind the moon's texture once. // bind the moon's texture once.
gGL.getTexUnit(0)->bind(gSky.mVOSkyp->mFace[LLVOSky::FACE_MOON]->getTexture()); gGL.getTexUnit(0)->bind(gSky.mVOSkyp->mFace[LLVOSky::FACE_MOON]->getTexture());
gGL.getTexUnit(1)->bind(gSky.mVOSkyp->mFace[LLVOSky::FACE_MOON]->getTexture(LLRender::ALTERNATE_DIFFUSE_MAP)); gGL.getTexUnit(1)->bind(gSky.mVOSkyp->mFace[LLVOSky::FACE_MOON]->getTexture(LLRender::ALTERNATE_DIFFUSE_MAP));
renderHeavenlyBodies(); renderHeavenlyBodies();
renderStars(); renderStars();
gGL.popMatrix(); gGL.popMatrix();
}
renderSkyClouds(origin, camHeightLocal); renderSkyClouds(origin, camHeightLocal);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment