diff options
author | Graham Linden <graham@lindenlab.com> | 2019-04-25 13:02:24 -0700 |
---|---|---|
committer | Graham Linden <graham@lindenlab.com> | 2019-04-25 13:02:24 -0700 |
commit | 5766325290974ee2cfa30fd655060ef396d1e87a (patch) | |
tree | 3a75f4bd27f5aeb51f4bad0b1235603d924540c9 /indra/llinventory/llsettingssky.cpp | |
parent | 48ed3f9318cf3750f1c4f72d1e7195f06d06e53c (diff) |
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.
Diffstat (limited to 'indra/llinventory/llsettingssky.cpp')
-rw-r--r-- | indra/llinventory/llsettingssky.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
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 |