diff options
Diffstat (limited to 'indra/newview/lllegacyatmospherics.cpp')
-rw-r--r-- | indra/newview/lllegacyatmospherics.cpp | 75 |
1 files changed, 21 insertions, 54 deletions
diff --git a/indra/newview/lllegacyatmospherics.cpp b/indra/newview/lllegacyatmospherics.cpp index a2acb3efe2..1364067949 100644 --- a/indra/newview/lllegacyatmospherics.cpp +++ b/indra/newview/lllegacyatmospherics.cpp @@ -202,17 +202,11 @@ void LLAtmospherics::init() mInitialized = true; } -LLColor4 LLAtmospherics::calcSkyColorInDir(AtmosphericsVars& vars, const LLVector3 &dir, bool isShiny) -{ - LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); - return calcSkyColorInDir(psky, vars, dir, isShiny); -} - // This cubemap is used as "environmentMap" in indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl -LLColor4 LLAtmospherics::calcSkyColorInDir(const LLSettingsSky::ptr_t &psky, AtmosphericsVars& vars, const LLVector3 &dir, bool isShiny) +LLColor4 LLAtmospherics::calcSkyColorInDir(const LLSettingsSky::ptr_t &psky, AtmosphericsVars& vars, const LLVector3 &dir, bool isShiny, bool low_end) { - F32 sky_saturation = 0.25f; - F32 land_saturation = 0.1f; + const F32 sky_saturation = 0.25f; + const F32 land_saturation = 0.1f; if (isShiny && dir.mV[VZ] < -0.02f) { @@ -227,7 +221,7 @@ LLColor4 LLAtmospherics::calcSkyColorInDir(const LLSettingsSky::ptr_t &psky, Atm } F32 greyscale_sat = brightness * (1.0f - land_saturation); desat_fog = desat_fog * land_saturation + smear(greyscale_sat); - if (!gPipeline.canUseWindLightShaders()) + if (low_end) { col = LLColor4(desat_fog, 0.f); } @@ -258,8 +252,7 @@ LLColor4 LLAtmospherics::calcSkyColorInDir(const LLSettingsSky::ptr_t &psky, Atm return LLColor4(sky_color, 0.0f); } - bool low_end = !gPipeline.canUseWindLightShaders(); - LLColor3 sky_color = low_end ? vars.hazeColor * 2.0f : psky->gammaCorrect(vars.hazeColor * 2.0f); + LLColor3 sky_color = low_end ? vars.hazeColor * 2.0f : psky->gammaCorrect(vars.hazeColor * 2.0f, vars.gamma); return LLColor4(sky_color, 0.0f); } @@ -270,11 +263,12 @@ LLColor4 LLAtmospherics::calcSkyColorInDir(const LLSettingsSky::ptr_t &psky, Atm // indra\newview\lllegacyatmospherics.cpp void LLAtmospherics::calcSkyColorWLVert(const LLSettingsSky::ptr_t &psky, LLVector3 & Pn, AtmosphericsVars& vars) { - LLColor3 blue_density = vars.blue_density; - LLColor3 blue_horizon = vars.blue_horizon; - F32 haze_horizon = vars.haze_horizon; - F32 haze_density = vars.haze_density; - F32 density_multiplier = vars.density_multiplier; + const LLColor3 blue_density = vars.blue_density; + const LLColor3 blue_horizon = vars.blue_horizon; + const F32 haze_horizon = vars.haze_horizon; + const F32 haze_density = vars.haze_density; + const F32 density_multiplier = vars.density_multiplier; + F32 max_y = vars.max_y; LLVector4 sun_norm = vars.sun_norm; @@ -313,7 +307,7 @@ void LLAtmospherics::calcSkyColorWLVert(const LLSettingsSky::ptr_t &psky, LLVect // Sunlight attenuation effect (hue and brightness) due to atmosphere // this is used later for sunlight modulation at various altitudes LLColor3 light_atten = vars.light_atten; - LLColor3 light_transmittance = psky->getLightTransmittance(Plen); + LLColor3 light_transmittance = psky->getLightTransmittanceFast(vars.total_density, vars.density_multiplier, Plen); (void)light_transmittance; // silence Clang warn-error // Calculate relative weights @@ -389,12 +383,6 @@ void LLAtmospherics::updateFog(const F32 distance, const LLVector3& tosun_in) if (!gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_FOG)) { - if (!LLGLSLShader::sNoFixedFunction) - { - glFogf(GL_FOG_DENSITY, 0); - glFogfv(GL_FOG_COLOR, (F32 *) &LLColor4::white.mV); - glFogf(GL_FOG_END, 1000000.f); - } return; } @@ -436,12 +424,16 @@ void LLAtmospherics::updateFog(const F32 distance, const LLVector3& tosun_in) LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); + // NOTE: This is very similar to LLVOSky::cacheEnvironment() + // Differences: + // vars.sun_norm + // vars.sunlight // invariants across whole sky tex process... - vars.blue_density = psky->getBlueDensity(); + vars.blue_density = psky->getBlueDensity(); vars.blue_horizon = psky->getBlueHorizon(); vars.haze_density = psky->getHazeDensity(); vars.haze_horizon = psky->getHazeHorizon(); - vars.density_multiplier = psky->getDensityMultiplier(); + vars.density_multiplier = psky->getDensityMultiplier(); vars.distance_multiplier = psky->getDistanceMultiplier(); vars.max_y = psky->getMaxY(); vars.sun_norm = LLEnvironment::instance().getSunDirectionCFR(); @@ -456,9 +448,9 @@ void LLAtmospherics::updateFog(const F32 distance, const LLVector3& tosun_in) vars.total_density = psky->getTotalDensity(); vars.gamma = psky->getGamma(); - res_color[0] = calcSkyColorInDir(vars, tosun); - res_color[1] = calcSkyColorInDir(vars, perp_tosun); - res_color[2] = calcSkyColorInDir(vars, tosun_45); + res_color[0] = calcSkyColorInDir(psky, vars, tosun); + res_color[1] = calcSkyColorInDir(psky, vars, perp_tosun); + res_color[2] = calcSkyColorInDir(psky, vars, tosun_45); sky_fog_color = color_norm(res_color[0] + res_color[1] + res_color[2]); @@ -486,10 +478,6 @@ void LLAtmospherics::updateFog(const F32 distance, const LLVector3& tosun_in) if (camera_height > water_height) { LLColor4 fog(render_fog_color); - if (!LLGLSLShader::sNoFixedFunction) - { - glFogfv(GL_FOG_COLOR, fog.mV); - } mGLFogCol = fog; if (hide_clip_plane) @@ -497,19 +485,11 @@ void LLAtmospherics::updateFog(const F32 distance, const LLVector3& tosun_in) // 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; - 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; - if (!LLGLSLShader::sNoFixedFunction) - { - glFogi(GL_FOG_MODE, GL_EXP); - } } } else @@ -535,12 +515,6 @@ void LLAtmospherics::updateFog(const F32 distance, const LLVector3& tosun_in) // set the density based on what the shaders use fog_density = water_fog_density * gSavedSettings.getF32("WaterGLFogDensityScale"); - - if (!LLGLSLShader::sNoFixedFunction) - { - glFogfv(GL_FOG_COLOR, (F32 *) &fogCol.mV); - glFogi(GL_FOG_MODE, GL_EXP2); - } } mFogColor = sky_fog_color; @@ -548,13 +522,6 @@ void LLAtmospherics::updateFog(const F32 distance, const LLVector3& tosun_in) 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(); } |