Use rotated lightnorm directly in water shader instead of forcing all shaders marked as water (including lighting) to get that norm
(where it would only affect Mid as only that graphics mode has atmospherics on but isn't using deferred rendering).
meow-7.2.2
Graham Linden 2019-06-06 15:55:50 -07:00
parent a7856d4fc5
commit 158a0104c1
2 changed files with 6 additions and 4 deletions

View File

@ -606,6 +606,10 @@ void LLDrawPoolWater::shade2(bool edge, LLGLSLShader* shader, const LLColor3& li
shader->uniform1f(LLShaderMgr::WATER_SUN_ANGLE2, 0.1f + 0.2f*sunAngle);
shader->uniform1i(LLShaderMgr::WATER_EDGE_FACTOR, edge ? 1 : 0);
LLVector4 rotated_light_direction = LLEnvironment::instance().getRotatedLightNorm();
shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, rotated_light_direction.mV);
shader->uniform3fv(LLShaderMgr::WL_CAMPOSLOCAL, 1, LLViewerCamera::getInstance()->getOrigin().mV);
if (LLViewerCamera::getInstance()->cameraUnderWater())
{
shader->uniform1f(LLShaderMgr::WATER_REFSCALE, pwater->getScaleBelow());

View File

@ -947,10 +947,8 @@ void LLSettingsVOWater::applySpecial(void *ptarget)
F32 blend_factor = env.getCurrentWater()->getBlendFactor();
shader->uniform1f(LLShaderMgr::BLEND_FACTOR, blend_factor);
LLVector4 rotated_light_direction = LLEnvironment::instance().getRotatedLightNorm();
shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, rotated_light_direction.mV);
shader->uniform3fv(LLShaderMgr::WL_CAMPOSLOCAL, 1, LLViewerCamera::getInstance()->getOrigin().mV);
shader->uniform1f(LLViewerShaderMgr::DISTANCE_MULTIPLIER, 0);
// update to normal lightnorm, water shader itself will use rotated lightnorm as necessary
shader->uniform4fv(LLShaderMgr::LIGHTNORM, 1, light_direction.mV);
}
}