summaryrefslogtreecommitdiff
path: root/indra/llinventory/llsettingssky.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llinventory/llsettingssky.cpp')
-rw-r--r--indra/llinventory/llsettingssky.cpp59
1 files changed, 39 insertions, 20 deletions
diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp
index bb310806bd..db574f2eec 100644
--- a/indra/llinventory/llsettingssky.cpp
+++ b/indra/llinventory/llsettingssky.cpp
@@ -32,25 +32,24 @@
#include "llfasttimer.h"
#include "v3colorutil.h"
-static const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees
-static const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD);
-static const LLVector3 DUE_EAST = LLVector3::x_axis;
//=========================================================================
namespace
{
LLTrace::BlockTimerStatHandle FTM_BLEND_SKYVALUES("Blending Sky Environment");
LLTrace::BlockTimerStatHandle FTM_UPDATE_SKYVALUES("Update Sky Environment");
-}
-static LLQuaternion convert_azimuth_and_altitude_to_quat(F32 azimuth, F32 altitude)
-{
- LLQuaternion quat;
- quat.setEulerAngles(0.0f, -altitude, azimuth);
- return quat;
-}
+ const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees
+ const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD);
+ const LLVector3 DUE_EAST = LLVector3::x_axis;
-const F32 LLSettingsSky::DOME_OFFSET(0.96f);
-const F32 LLSettingsSky::DOME_RADIUS(15000.f);
+ LLQuaternion convert_azimuth_and_altitude_to_quat(F32 azimuth, F32 altitude)
+ {
+ LLQuaternion quat;
+ quat.setEulerAngles(0.0f, -altitude, azimuth);
+ return quat;
+ }
+
+}
//=========================================================================
const std::string LLSettingsSky::SETTING_AMBIENT("ambient");
@@ -114,6 +113,9 @@ static const LLUUID DEFAULT_ASSET_ID("cec9af47-90d4-9093-5245-397e5c9e7749");
const std::string LLSettingsSky::SETTING_LEGACY_HAZE("legacy_haze");
+const F32 LLSettingsSky::DOME_OFFSET(0.96f);
+const F32 LLSettingsSky::DOME_RADIUS(15000.f);
+
namespace
{
@@ -774,6 +776,9 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy)
void LLSettingsSky::updateSettings()
{
+ mPositionsDirty |= isVeryDirty();
+ mLightingDirty |= isVeryDirty();
+
// base class clears dirty flag so as to not trigger recursive update
LLSettingsBase::updateSettings();
@@ -805,6 +810,7 @@ void LLSettingsSky::calculateHeavenlyBodyPositions() const
}*/
mPositionsDirty = false;
+ mLightingDirty = true; // changes light direction
LLQuaternion sunq = getSunRotation();
LLQuaternion moonq = getMoonRotation();
@@ -814,6 +820,12 @@ void LLSettingsSky::calculateHeavenlyBodyPositions() const
mSunDirection.normalize();
mMoonDirection.normalize();
+
+ LL_WARNS("LAPRAS") << "Sun info: Rotation=" << sunq << " Vector=" << mSunDirection << LL_ENDL;
+ LL_WARNS("LAPRAS") << "Moon info: Rotation=" << moonq << " Vector=" << mMoonDirection << LL_ENDL;
+
+ llassert(mSunDirection.lengthSquared() > 0.0);
+ llassert(mMoonDirection.lengthSquared() > 0.0);
}
LLVector3 LLSettingsSky::getLightDirection() const
@@ -823,12 +835,12 @@ LLVector3 LLSettingsSky::getLightDirection() const
// is the normal from the sun or the moon
if (getIsSunUp())
{
- llassert(mSunDirection.length() > 0.01f);
+ llassert(mSunDirection.lengthSquared() > 0.01f);
return mSunDirection;
}
else if (getIsMoonUp())
{
- llassert(mMoonDirection.length() > 0.01f);
+ llassert(mMoonDirection.lengthSquared() > 0.01f);
return mMoonDirection;
}
@@ -892,36 +904,43 @@ F32 LLSettingsSky::getDistanceMultiplier() const
void LLSettingsSky::setBlueDensity(const LLColor3 &val)
{
mSettings[SETTING_LEGACY_HAZE][SETTING_BLUE_DENSITY] = val.getValue();
- markDirty();
+ setDirtyFlag(true);
+ mLightingDirty = true;
}
void LLSettingsSky::setBlueHorizon(const LLColor3 &val)
{
mSettings[SETTING_LEGACY_HAZE][SETTING_BLUE_HORIZON] = val.getValue();
- markDirty();
+ setDirtyFlag(true);
+ mLightingDirty = true;
}
void LLSettingsSky::setDensityMultiplier(F32 val)
{
mSettings[SETTING_LEGACY_HAZE][SETTING_DENSITY_MULTIPLIER] = val;
- markDirty();
+ setDirtyFlag(true);
+ mLightingDirty = true;
}
void LLSettingsSky::setDistanceMultiplier(F32 val)
{
mSettings[SETTING_LEGACY_HAZE][SETTING_DISTANCE_MULTIPLIER] = val;
- markDirty();
+ setDirtyFlag(true);
+ mLightingDirty = true;
}
void LLSettingsSky::setHazeDensity(F32 val)
{
mSettings[SETTING_LEGACY_HAZE][SETTING_HAZE_DENSITY] = val;
- markDirty();
+ setDirtyFlag(true);
+ mLightingDirty = true;
}
+
void LLSettingsSky::setHazeHorizon(F32 val)
{
mSettings[SETTING_LEGACY_HAZE][SETTING_HAZE_HORIZON] = val;
- markDirty();
+ setDirtyFlag(true);
+ mLightingDirty = true;
}
// Sunlight attenuation effect (hue and brightness) due to atmosphere