diff options
| author | Graham Linden <graham@lindenlab.com> | 2018-06-12 18:42:07 +0100 |
|---|---|---|
| committer | Graham Linden <graham@lindenlab.com> | 2018-06-12 18:42:07 +0100 |
| commit | 67ab0084f87c40bf31d7fadded55cc9ea6299ca2 (patch) | |
| tree | 1d8119cd8d0b6078724a8128da37c15321a9f703 /indra/newview/llenvironment.cpp | |
| parent | 327ded51298599a0057c4a3baf388956ecfed2e5 (diff) | |
Fix env panel forward action.
Make env panel update environment when jumping frame to frame.
Add separate funcs for sun/moon vectors in various coord systems.
Make haze glow only pay attention to sun (i.e. fix sun glow when moon is near horizon in daytime).
Diffstat (limited to 'indra/newview/llenvironment.cpp')
| -rw-r--r-- | indra/newview/llenvironment.cpp | 66 |
1 files changed, 60 insertions, 6 deletions
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index a5ee7d0737..f0bec2fda1 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -700,6 +700,18 @@ void LLEnvironment::updateEnvironment(LLSettingsBase::Seconds transition, bool f } } +LLVector4 LLEnvironment::toCFR(const LLVector3 vec) const +{ + LLVector4 vec_cfr(vec.mV[1], vec.mV[0], vec.mV[2], 0.0f); + return vec_cfr; +} + +LLVector4 LLEnvironment::toLightNorm(const LLVector3 vec) const +{ + LLVector4 vec_ogl(vec.mV[1], vec.mV[2], vec.mV[0], 0.0f); + return vec_ogl; +} + LLVector3 LLEnvironment::getLightDirection() const { LLSettingsSky::ptr_t psky = mCurrentEnvironment->getSky(); @@ -710,16 +722,24 @@ LLVector3 LLEnvironment::getLightDirection() const return psky->getLightDirection(); } -LLVector4 LLEnvironment::toCFR(const LLVector3 vec) const +LLVector3 LLEnvironment::getSunDirection() const { - LLVector4 vec_cfr(vec.mV[1], vec.mV[0], vec.mV[2], 0.0f); - return vec_cfr; + LLSettingsSky::ptr_t psky = mCurrentEnvironment->getSky(); + if (!psky) + { + return LLVector3(0, 0, 1); + } + return psky->getSunDirection(); } -LLVector4 LLEnvironment::toLightNorm(const LLVector3 vec) const +LLVector3 LLEnvironment::getMoonDirection() const { - LLVector4 vec_ogl(vec.mV[1], vec.mV[2], vec.mV[0], 0.0f); - return vec_ogl; + LLSettingsSky::ptr_t psky = mCurrentEnvironment->getSky(); + if (!psky) + { + return LLVector3(0, 0, -1); + } + return psky->getMoonDirection(); } LLVector4 LLEnvironment::getLightDirectionCFR() const @@ -729,6 +749,20 @@ LLVector4 LLEnvironment::getLightDirectionCFR() const return light_direction_cfr; } +LLVector4 LLEnvironment::getSunDirectionCFR() const +{ + LLVector3 light_direction = getSunDirection(); + LLVector4 light_direction_cfr = toCFR(light_direction); + return light_direction_cfr; +} + +LLVector4 LLEnvironment::getMoonDirectionCFR() const +{ + LLVector3 light_direction = getMoonDirection(); + LLVector4 light_direction_cfr = toCFR(light_direction); + return light_direction_cfr; +} + LLVector4 LLEnvironment::getClampedLightNorm() const { LLVector3 light_direction = getLightDirection(); @@ -739,6 +773,26 @@ LLVector4 LLEnvironment::getClampedLightNorm() const return toLightNorm(light_direction); } +LLVector4 LLEnvironment::getClampedSunNorm() const +{ + LLVector3 light_direction = getSunDirection(); + if (light_direction.mV[2] < -0.1f) + { + light_direction.mV[2] = -0.1f; + } + return toLightNorm(light_direction); +} + +LLVector4 LLEnvironment::getClampedMoonNorm() const +{ + LLVector3 light_direction = getMoonDirection(); + if (light_direction.mV[2] < -0.1f) + { + light_direction.mV[2] = -0.1f; + } + return toLightNorm(light_direction); +} + LLVector4 LLEnvironment::getRotatedLightNorm() const { LLVector3 light_direction = getLightDirection(); |
