summaryrefslogtreecommitdiff
path: root/indra/llinventory
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llinventory')
-rw-r--r--indra/llinventory/llsettingssky.cpp28
-rw-r--r--indra/llinventory/llsettingssky.h3
2 files changed, 28 insertions, 3 deletions
diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp
index f3519dc7cb..612c97168c 100644
--- a/indra/llinventory/llsettingssky.cpp
+++ b/indra/llinventory/llsettingssky.cpp
@@ -34,7 +34,7 @@
//=========================================================================
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 +952,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;