From 5766325290974ee2cfa30fd655060ef396d1e87a Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 25 Apr 2019 13:02:24 -0700 Subject: SL-10904, SL-10998, SL-11018 Fix handling of 1/light_y when y was tiny but getting even tinier. Add similar adjustment to shader version of same calc. --- indra/llinventory/llsettingssky.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'indra/llinventory/llsettingssky.cpp') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 07a03f0315..1490708ca5 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1275,12 +1275,14 @@ void LLSettingsSky::calculateLightSettings() const LLColor3 light_transmittance = getLightTransmittance(); // and vary_sunlight will work properly with moon light - F32 lighty = lightnorm[2]; - if(fabs(lighty) > 0.001f) + const F32 LIMIT = FLT_EPSILON * 8.0f; + + F32 lighty = fabs(lightnorm[2]); + if(lighty >= LIMIT) { - lighty = 1.f / fabs(lighty); + lighty = 1.f / lighty; } - lighty = llmax(0.001f, lighty); + lighty = llmax(LIMIT, lighty); componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty)); //increase ambient when there are more clouds -- cgit v1.3