summaryrefslogtreecommitdiff
path: root/indra/llinventory
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2019-04-25 10:59:00 -0700
committerGraham Linden <graham@lindenlab.com>2019-04-25 10:59:00 -0700
commit4ed05fc84fce0fbee76c583e91feed5aff2dbbfc (patch)
tree31bfec7a2b09919d9df3a050d2f2ed369d31f0ad /indra/llinventory
parentca16874379bf76dd844d57b2ee59da531d642a8e (diff)
Fix dark ALM and strangeness at Mid lighting (class 3 but with a darkness about it).
Make a distinct class3/lighting/lightV which boosts to WL levels (* 2.0) and make lighting without WL atmo enabled use class 2 or below. Make forward shaders (alpha and materialF with alpha-blend mode on) more consistent with deferred lighting.
Diffstat (limited to 'indra/llinventory')
-rw-r--r--indra/llinventory/llsettingssky.cpp36
1 files changed, 22 insertions, 14 deletions
diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp
index 41e8882181..c41944bdbb 100644
--- a/indra/llinventory/llsettingssky.cpp
+++ b/indra/llinventory/llsettingssky.cpp
@@ -33,9 +33,8 @@
#include "v3colorutil.h"
//=========================================================================
-namespace {
- const F32 NIGHTTIME_ELEVATION = 8.0f; // degrees
- const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD);
+namespace
+{
const LLUUID IMG_BLOOM1("3c59f7fe-9dc8-47f9-8aaf-a9dd1fbc3bef");
const LLUUID IMG_RAINBOW("11b4c57c-56b3-04ed-1f82-2004363882e4");
const LLUUID IMG_HALO("12149143-f599-91a7-77ac-b52a3c0f59cd");
@@ -958,15 +957,15 @@ F32 LLSettingsSky::getSunMoonGlowFactor() const
LLVector3 moonDir = getMoonDirection();
// sun glow at full iff moon is not up
- if (sunDir.mV[VZ] > -NIGHTTIME_ELEVATION_SIN)
+ if (getIsSunUp())
{
- if (moonDir.mV[2] <= 0.0f)
+ if (!getIsMoonUp())
{
return 1.0f;
}
}
- if (moonDir.mV[2] > 0.0f)
+ if (getIsMoonUp())
{
return 0.25f;
}
@@ -977,13 +976,13 @@ F32 LLSettingsSky::getSunMoonGlowFactor() const
bool LLSettingsSky::getIsSunUp() const
{
LLVector3 sunDir = getSunDirection();
- return (sunDir.mV[2] >= 0.0f) || ((sunDir.mV[2] > -NIGHTTIME_ELEVATION_SIN) && !getIsMoonUp());
+ return sunDir.mV[2] >= 0.0f || !getIsMoonUp();
}
bool LLSettingsSky::getIsMoonUp() const
{
LLVector3 moonDir = getMoonDirection();
- return moonDir.mV[2] > 0.0f;
+ return moonDir.mV[2] >= 0.0f;
}
void LLSettingsSky::calculateHeavenlyBodyPositions() const
@@ -997,10 +996,19 @@ void LLSettingsSky::calculateHeavenlyBodyPositions() const
mSunDirection.normalize();
mMoonDirection.normalize();
- if (mSunDirection.lengthSquared() < 0.01f)
- LL_WARNS("SETTINGS") << "Zero length sun direction. Wailing and gnashing of teeth may follow... or not." << LL_ENDL;
- if (mMoonDirection.lengthSquared() < 0.01f)
- LL_WARNS("SETTINGS") << "Zero length moon direction. Wailing and gnashing of teeth may follow... or not." << LL_ENDL;
+ // find out about degen math earlier rather than later
+ llassert(mSunDirection.length() >= 0.9f);
+ llassert(mMoonDirection.length() >= 0.9f);
+
+ if (mSunDirection.lengthSquared() < 0.9f)
+ {
+ LL_WARNS("SETTINGS") << "Invalid sun direction." << LL_ENDL;
+ }
+
+ if (mMoonDirection.lengthSquared() < 0.9f)
+ {
+ LL_WARNS("SETTINGS") << "Invalid moon direction." << LL_ENDL;
+ }
}
LLVector3 LLSettingsSky::getLightDirection() const
@@ -1280,9 +1288,9 @@ void LLSettingsSky::calculateLightSettings() const
// and vary_sunlight will work properly with moon light
F32 lighty = lightnorm[2];
- if(lighty > 0.001f)
+ if(fabs(lighty) > 0.001f)
{
- lighty = 1.f / lighty;
+ lighty = 1.f / fabs(lighty);
}
lighty = llmax(0.001f, lighty);
componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty));