summaryrefslogtreecommitdiff
path: root/indra/llinventory
diff options
context:
space:
mode:
authorGraham Linden graham@lindenlab.com <Graham Linden graham@lindenlab.com>2018-05-18 23:14:56 +0100
committerGraham Linden graham@lindenlab.com <Graham Linden graham@lindenlab.com>2018-05-18 23:14:56 +0100
commit8082cb86682c008389cb8127f295e6566ec368e5 (patch)
treee8168fc436aa4aaf5274719c917a64fee0af0a54 /indra/llinventory
parent242fe0610996696a026dc2dc9b1b42c4db2f852c (diff)
Make nighttime elev constant _SIN, since it uses a sin value.
Put that constant in sky settings and eliminate dups. Fix up logic around when to use heavenly bodies (fix broken moon in basic sky). Remove unnecessary clip to horizon. Put in temp code to ena/dis sun/moon based on LLEnvironment::getIsDaytime().
Diffstat (limited to 'indra/llinventory')
-rw-r--r--indra/llinventory/llsettingssky.cpp14
-rw-r--r--indra/llinventory/llsettingssky.h6
2 files changed, 11 insertions, 9 deletions
diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp
index be26439cee..c5dfd765f2 100644
--- a/indra/llinventory/llsettingssky.cpp
+++ b/indra/llinventory/llsettingssky.cpp
@@ -51,9 +51,6 @@ namespace
const F32 LLSettingsSky::DOME_OFFSET(0.96f);
const F32 LLSettingsSky::DOME_RADIUS(15000.f);
-const F32 LLSettingsSky::NIGHTTIME_ELEVATION(-8.0f); // degrees
-const F32 LLSettingsSky::NIGHTTIME_ELEVATION_COS((F32)sin(NIGHTTIME_ELEVATION*DEG_TO_RAD));
-
//=========================================================================
const std::string LLSettingsSky::SETTING_AMBIENT("ambient");
const std::string LLSettingsSky::SETTING_BLUE_DENSITY("blue_density");
@@ -816,6 +813,7 @@ void LLSettingsSky::calculateHeavnlyBodyPositions()
{
mSunDirection = DUE_EAST * getSunRotation();
mSunDirection.normalize();
+
mMoonDirection = DUE_EAST * getMoonRotation();
mMoonDirection.normalize();
@@ -824,7 +822,7 @@ void LLSettingsSky::calculateHeavnlyBodyPositions()
{
mLightDirection = mSunDirection;
}
- else if (mSunDirection.mV[1] < 0.0 && mSunDirection.mV[1] > NIGHTTIME_ELEVATION_COS)
+ else if (mSunDirection.mV[1] < 0.0 && mSunDirection.mV[1] > NIGHTTIME_ELEVATION_SIN)
{
// clamp v1 to 0 so sun never points up and causes weirdness on some machines
LLVector3 vec(mSunDirection);
@@ -834,7 +832,11 @@ void LLSettingsSky::calculateHeavnlyBodyPositions()
}
else
{
- mLightDirection = mMoonDirection;
+ // 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;
}
// calculate the clamp lightnorm for sky (to prevent ugly banding in sky
@@ -993,7 +995,7 @@ void LLSettingsSky::calculateLightSettings()
// and vary_sunlight will work properly with moon light
F32 lighty = lightnorm[1];
- if (lighty < NIGHTTIME_ELEVATION_COS)
+ if (lighty < NIGHTTIME_ELEVATION_SIN)
{
lighty = -lighty;
}
diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h
index 63a20e0d48..8e96735abf 100644
--- a/indra/llinventory/llsettingssky.h
+++ b/indra/llinventory/llsettingssky.h
@@ -37,6 +37,9 @@ const F32 SUN_DIST = 149598.260e6f;
const F32 MOON_RADIUS = 1.737e6f;
const F32 MOON_DIST = 384.400e6f;
+const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees
+const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD);
+
class LLSettingsSky: public LLSettingsBase
{
public:
@@ -504,9 +507,6 @@ private:
static LLSD absorptionConfigDefault();
static LLSD mieConfigDefault();
- static const F32 NIGHTTIME_ELEVATION;
- static const F32 NIGHTTIME_ELEVATION_COS;
-
void calculateHeavnlyBodyPositions();
void calculateLightSettings();