diff options
author | Graham Linden <graham@lindenlab.com> | 2019-02-01 13:41:31 -0800 |
---|---|---|
committer | Graham Linden <graham@lindenlab.com> | 2019-02-01 13:41:31 -0800 |
commit | 5a8610ccb7e1f5a0e4d54170ac922e6820ce3acb (patch) | |
tree | 13af4da0c897474ca41d7c797b15fe3148ad6ada /indra/llinventory | |
parent | 6716e543a160dd50913309834e7bd2d00034854c (diff) |
SL-9996, SL-1130, SL-5546
Fix bug with setting texture matrix for rigged mesh.
Fix z-fighting between sea and sky in ALM by cheating sky, stars, and moon using gl_FragDepth.
Fix handling of atmospheric haze glow w.r.t independent sun/moon positioning
(we can no longer depend on them being mutex to each other).
Diffstat (limited to 'indra/llinventory')
-rw-r--r-- | indra/llinventory/llsettingssky.cpp | 32 | ||||
-rw-r--r-- | indra/llinventory/llsettingssky.h | 3 |
2 files changed, 32 insertions, 3 deletions
diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index f3519dc7cb..db54140e2c 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -32,9 +32,13 @@ #include "llfasttimer.h" #include "v3colorutil.h" +#if LL_WINDOWS +#pragma optimize("", off) +#endif + //========================================================================= namespace { - const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees + const F32 NIGHTTIME_ELEVATION = 8.0f; // degrees const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); const LLUUID IMG_BLOOM1("3c59f7fe-9dc8-47f9-8aaf-a9dd1fbc3bef"); const LLUUID IMG_RAINBOW("11b4c57c-56b3-04ed-1f82-2004363882e4"); @@ -952,16 +956,38 @@ void LLSettingsSky::updateSettings() calculateLightSettings(); } +F32 LLSettingsSky::getSunMoonGlowFactor() const +{ + LLVector3 sunDir = getSunDirection(); + LLVector3 moonDir = getMoonDirection(); + + // sun glow at full iff moon is not up + if (sunDir.mV[VZ] > -NIGHTTIME_ELEVATION_SIN) + { + if (moonDir.mV[2] <= 0.0f) + { + return 1.0f; + } + } + + if (moonDir.mV[2] > 0.0f) + { + return moonDir.mV[VZ] / 3.0f; // ramp moon glow at moonset + } + + return 0.0f; +} + bool LLSettingsSky::getIsSunUp() const { LLVector3 sunDir = getSunDirection(); - return sunDir.mV[2] > NIGHTTIME_ELEVATION_SIN; + return (sunDir.mV[2] >= 0.0f) || ((sunDir.mV[2] > -NIGHTTIME_ELEVATION_SIN) && !getIsMoonUp()); } bool LLSettingsSky::getIsMoonUp() const { LLVector3 moonDir = getMoonDirection(); - return moonDir.mV[2] > NIGHTTIME_ELEVATION_SIN; + return moonDir.mV[2] > 0.0f; } void LLSettingsSky::calculateHeavenlyBodyPositions() const diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index e82ab8db0c..65c0f2c581 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -272,6 +272,9 @@ public: bool getIsSunUp() const; bool getIsMoonUp() const; + // determines how much the haze glow effect occurs in rendering + F32 getSunMoonGlowFactor() const; + LLVector3 getLightDirection() const; LLColor3 getLightDiffuse() const; |