diff options
author | Graham Linden graham@lindenlab.com <Graham Linden graham@lindenlab.com> | 2018-05-22 21:42:54 +0100 |
---|---|---|
committer | Graham Linden graham@lindenlab.com <Graham Linden graham@lindenlab.com> | 2018-05-22 21:42:54 +0100 |
commit | 13536bb273b7413aa4461c8eeaf5a6a865f4234d (patch) | |
tree | 62dd3daf2dad884b40ae440d4c11cafb3656c170 /indra/llinventory | |
parent | ae5f24eb4d8a215cc26ef45ababc6ddec8f28edb (diff) |
Remove some obsolete sky funcs.
Remove Matrix3/4 funcs using LLQuat 4-float init incorrectly
(they are redundant to angle/axis versions anyway).
Fix up tests referring to removed funcs above.
Diffstat (limited to 'indra/llinventory')
-rw-r--r-- | indra/llinventory/llsettingssky.cpp | 45 | ||||
-rw-r--r-- | indra/llinventory/llsettingssky.h | 3 |
2 files changed, 34 insertions, 14 deletions
diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 25d197d9be..6b8acac3da 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -35,6 +35,7 @@ //========================================================================= namespace { + // vectors in +x at, +y up, +z right coord sys const LLVector3 DUE_EAST(0.0f, 0.0f, 1.0); const LLVector3 VECT_ZENITH(0.f, 1.f, 0.f); const LLVector3 VECT_NORTHSOUTH(1.f, 0.f, 0.f); @@ -599,7 +600,12 @@ LLSD LLSettingsSky::defaults() { LLSD dfltsetting; LLQuaternion sunquat; + + // we're using the roll value of 80 degrees from horizon + // with an euler angle conversion meant for a +x right, +y up, +z at coord sys here sunquat.setEulerAngles(1.39626, 0.0, 0.0); // 80deg Azumith/0deg East + + // then we're using the conjugate which does not give the opposite direction LLQuaternion moonquat = ~sunquat; // Magic constants copied form dfltsetting.xml @@ -807,34 +813,41 @@ void LLSettingsSky::updateSettings() calculateLightSettings(); } +bool LLSettingsSky::getIsSunUp() const +{ + LLVector3 sunDir = getSunDirection(); + return sunDir.mV[1] > NIGHTTIME_ELEVATION_SIN; +} + +bool LLSettingsSky::getIsMoonUp() const +{ + LLVector3 moonDir = getMoonDirection(); + return moonDir.mV[1] > NIGHTTIME_ELEVATION_SIN; +} + void LLSettingsSky::calculateHeavnlyBodyPositions() { - mSunDirection = DUE_EAST * getSunRotation(); + LLQuaternion sunq = getSunRotation(); + LLQuaternion moonq = getMoonRotation(); + + mSunDirection = DUE_EAST * sunq; mSunDirection.normalize(); - mMoonDirection = DUE_EAST * getMoonRotation(); + mMoonDirection = DUE_EAST * moonq; mMoonDirection.normalize(); // is the normal from the sun or the moon - if (mSunDirection.mV[1] >= 0.0) + if (getIsSunUp()) { mLightDirection = mSunDirection; } - else if (mSunDirection.mV[1] < 0.0 && mSunDirection.mV[1] > NIGHTTIME_ELEVATION_SIN) + else if (getIsMoonUp()) { - // clamp v1 to 0 so sun never points up and causes weirdness on some machines - LLVector3 vec(mSunDirection); - vec.mV[1] = 0.0; - vec.normalize(); - mLightDirection = vec; + mLightDirection = mMoonDirection; } else { - // clamp v1 to 0 so moon never points up and causes weirdness on some machines - LLVector3 vec(mMoonDirection); - vec.mV[1] = 0.0; - vec.normalize(); - mLightDirection = vec; + mLightDirection = LLVector3::z_axis; } // calculate the clamp lightnorm for sky (to prevent ugly banding in sky @@ -846,6 +859,10 @@ void LLSettingsSky::calculateHeavnlyBodyPositions() mClampedLightDirection.mV[1] = -0.1f; mClampedLightDirection.normalize(); } + + //LL_INFOS() << "Sun: " << mSunDirection << LL_ENDL; + //LL_INFOS() << "Moon: " << mMoonDirection << LL_ENDL; + //LL_INFOS() << "Light: " << mLightDirection << LL_ENDL; } LLColor3 LLSettingsSky::getBlueDensity() const diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index 8e96735abf..bb8633d338 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -490,6 +490,9 @@ public: void setHazeDensity(F32 val); void setHazeHorizon(F32 val); + bool getIsSunUp() const; + bool getIsMoonUp() const; + protected: static const std::string SETTING_LEGACY_EAST_ANGLE; static const std::string SETTING_LEGACY_ENABLE_CLOUD_SCROLL; |