summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2018-06-21 16:50:00 -0700
committerRider Linden <rider@lindenlab.com>2018-06-21 16:50:00 -0700
commitf15ee2c965a8bfebc9d7b30fb7b42d653c6f88ed (patch)
tree73449b72a5216641078c24a416965786b7259d96 /indra
parentb94df67b1f349d77cb108fe169c94d873a193099 (diff)
parenta02b3500b9979c10336eb13674279b3c07367445 (diff)
Merge
Diffstat (limited to 'indra')
-rw-r--r--indra/llinventory/llsettingsbase.cpp19
-rw-r--r--indra/llinventory/llsettingsbase.h5
-rw-r--r--indra/llinventory/llsettingsdaycycle.cpp67
-rw-r--r--indra/llinventory/llsettingssky.cpp272
-rw-r--r--indra/llinventory/llsettingssky.h6
-rw-r--r--indra/llinventory/llsettingswater.cpp59
-rw-r--r--indra/llinventory/llsettingswater.h2
-rw-r--r--indra/newview/llfloatereditextdaycycle.cpp2
-rw-r--r--indra/newview/llsettingsvo.cpp9
-rw-r--r--indra/newview/llvosky.cpp4
10 files changed, 228 insertions, 217 deletions
diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp
index db30a25a4c..7bcafabb8a 100644
--- a/indra/llinventory/llsettingsbase.cpp
+++ b/indra/llinventory/llsettingsbase.cpp
@@ -580,10 +580,18 @@ F64 LLSettingsBlender::setBlendFactor(const LLSettingsBase::BlendFactor& blendf_
}
blendf = llclamp(blendf, 0.0f, 1.0f);
- mTarget->replaceSettings(mInitial->getSettings());
- if (!mFinal || (mInitial == mFinal) || (blendf == 0.0))
- { // this is a trivial blend. Results will be identical to the initial.
- return blendf;
+ if (mTarget)
+ {
+ mTarget->replaceSettings(mInitial->getSettings());
+ if (!mFinal || (mInitial == mFinal) || (blendf == 0.0))
+ { // this is a trivial blend. Results will be identical to the initial.
+ return blendf;
+ }
+ mTarget->blend(mFinal, blendf);
+ }
+ else
+ {
+ LL_WARNS("SETTINGS") << "No target for settings blender." << LL_ENDL;
}
mTarget->blend(mFinal, blendf);
@@ -592,7 +600,8 @@ F64 LLSettingsBlender::setBlendFactor(const LLSettingsBase::BlendFactor& blendf_
void LLSettingsBlender::triggerComplete()
{
- mTarget->replaceSettings(mFinal->getSettings());
+ if (mTarget)
+ mTarget->replaceSettings(mFinal->getSettings());
LLSettingsBlender::ptr_t hold = shared_from_this(); // prevents this from deleting too soon
mOnFinished(shared_from_this());
}
diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h
index 81158d64a7..7f88227a6d 100644
--- a/indra/llinventory/llsettingsbase.h
+++ b/indra/llinventory/llsettingsbase.h
@@ -312,7 +312,7 @@ public:
mInitial(initsetting),
mFinal(endsetting)
{
- if (mInitial)
+ if (mInitial && mTarget)
mTarget->replaceSettings(mInitial->getSettings());
if (!mFinal)
@@ -333,7 +333,8 @@ public:
if (!mFinal)
mFinal = mInitial;
- mTarget->replaceSettings(mInitial->getSettings());
+ if (mTarget)
+ mTarget->replaceSettings(mInitial->getSettings());
}
LLSettingsBase::ptr_t getTarget() const
diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp
index 51bc6b0e54..2c8bddee93 100644
--- a/indra/llinventory/llsettingsdaycycle.cpp
+++ b/indra/llinventory/llsettingsdaycycle.cpp
@@ -233,11 +233,13 @@ bool LLSettingsDay::initialize()
keyframe = llclamp(keyframe, 0.0f, 1.0f);
LLSettingsBase::ptr_t setting;
+
if ((*it).has(SETTING_KEYNAME))
{
+ std::string key_name = (*it)[SETTING_KEYNAME];
if (i == TRACK_WATER)
{
- setting = used[(*it)[SETTING_KEYNAME]];
+ setting = used[key_name];
if (setting && setting->getSettingsType() != "water")
{
LL_WARNS("DAYCYCLE") << "Water track referencing " << setting->getSettingsType() << " frame at " << keyframe << "." << LL_ENDL;
@@ -246,7 +248,7 @@ bool LLSettingsDay::initialize()
}
else
{
- setting = used[(*it)[SETTING_KEYNAME]];
+ setting = used[key_name];
if (setting && setting->getSettingsType() != "sky")
{
LL_WARNS("DAYCYCLE") << "Sky track #" << i << " referencing " << setting->getSettingsType() << " frame at " << keyframe << "." << LL_ENDL;
@@ -283,32 +285,51 @@ bool LLSettingsDay::initialize()
//=========================================================================
LLSD LLSettingsDay::defaults()
{
- LLSD dfltsetting;
+ static LLSD dfltsetting;
- dfltsetting[SETTING_NAME] = "_default_";
+ if (dfltsetting.size() == 0)
+ {
+ dfltsetting[SETTING_NAME] = "_default_";
+ dfltsetting[SETTING_TYPE] = "daycycle";
- LLSD waterTrack;
- waterTrack[SETTING_KEYKFRAME] = 0.0f;
- waterTrack[SETTING_KEYNAME] = "_default_";
+ LLSD frames(LLSD::emptyMap());
+ LLSD waterTrack;
+ LLSD skyTrack;
- LLSD skyTrack;
- skyTrack[SETTING_KEYKFRAME] = 0.0f;
- skyTrack[SETTING_KEYNAME] = "_default_";
+
+ const U32 FRAME_COUNT = 8;
+ const F32 FRAME_STEP = 1.0f / F32(FRAME_COUNT);
+ F32 time = 0.0f;
+ for (U32 i = 0; i < FRAME_COUNT; i++)
+ {
+ std::string name("_default_");
+ name += ('a' + i);
- LLSD tracks;
- tracks.append(LLSDArray(waterTrack));
- tracks.append(LLSDArray(skyTrack));
+ std::string water_frame_name("water:");
+ std::string sky_frame_name("sky:");
- dfltsetting[SETTING_TRACKS] = tracks;
+ water_frame_name += name;
+ sky_frame_name += name;
- LLSD frames(LLSD::emptyMap());
+ waterTrack[SETTING_KEYKFRAME] = time;
+ waterTrack[SETTING_KEYNAME] = water_frame_name;
- frames["water:_defaults_"] = LLSettingsWater::defaults();
- frames["sky:_defaults_"] = LLSettingsSky::defaults();
+ skyTrack[SETTING_KEYKFRAME] = time;
+ skyTrack[SETTING_KEYNAME] = sky_frame_name;
- dfltsetting[SETTING_FRAMES] = frames;
+ frames[water_frame_name] = LLSettingsWater::defaults(time);
+ frames[sky_frame_name] = LLSettingsSky::defaults(time);
- dfltsetting[SETTING_TYPE] = "daycycle";
+ time += FRAME_STEP;
+ }
+
+ LLSD tracks;
+ tracks.append(LLSDArray(waterTrack));
+ tracks.append(LLSDArray(skyTrack));
+
+ dfltsetting[SETTING_TRACKS] = tracks;
+ dfltsetting[SETTING_FRAMES] = frames;
+ }
return dfltsetting;
}
@@ -532,14 +553,6 @@ bool LLSettingsDay::moveTrackKeyframe(S32 trackno, const LLSettingsBase::TrackPo
CycleTrack_t::iterator iter = track.find(old_frame);
if (iter != track.end())
{
- /*TODO check that we are not moving too close to another keyframe */
-// CycleTrack_t::value_type existing = getSettingsNearKeyfarme(new_frame, trackno, 2.5f);
-// if ((*iter).first != existing.first)
-// {
-// LL_WARNS("DAYCYCLE") << "Track too close to existing track. Not moving." << LL_ENDL;
-// return false;
-// }
-
LLSettingsBase::ptr_t base = iter->second;
track.erase(iter);
track[llclamp(new_frame, 0.0f, 1.0f)] = base;
diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp
index 5de8c7bad6..bf0115b80b 100644
--- a/indra/llinventory/llsettingssky.cpp
+++ b/indra/llinventory/llsettingssky.cpp
@@ -33,21 +33,15 @@
#include "v3colorutil.h"
//=========================================================================
-namespace
-{
-
-
- 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;
-
- LLQuaternion convert_azimuth_and_altitude_to_quat(F32 azimuth, F32 altitude)
- {
- LLQuaternion quat;
- quat.setEulerAngles(0.0f, -altitude, azimuth);
- return quat;
- }
+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;
+static LLQuaternion convert_azimuth_and_altitude_to_quat(F32 azimuth, F32 altitude)
+{
+ LLQuaternion quat;
+ quat.setEulerAngles(0.0f, altitude, azimuth);
+ return quat;
}
static LLTrace::BlockTimerStatHandle FTM_BLEND_SKYVALUES("Blending Sky Environment");
@@ -370,9 +364,7 @@ LLSettingsSky::LLSettingsSky(const LLSD &data) :
LLSettingsBase(data),
mNextSunTextureId(),
mNextMoonTextureId(),
- mNextCloudTextureId(),
- mPositionsDirty(true),
- mLightingDirty(true)
+ mNextCloudTextureId()
{
}
@@ -380,9 +372,7 @@ LLSettingsSky::LLSettingsSky():
LLSettingsBase(),
mNextSunTextureId(),
mNextMoonTextureId(),
- mNextCloudTextureId(),
- mPositionsDirty(true),
- mLightingDirty(true)
+ mNextCloudTextureId()
{
}
@@ -397,16 +387,20 @@ void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf)
llassert(getSettingsType() == end->getSettingsType());
LLSettingsSky::ptr_t other = PTR_NAMESPACE::dynamic_pointer_cast<LLSettingsSky>(end);
- LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf);
-
- replaceSettings(blenddata);
- mPositionsDirty = true;
- mLightingDirty = true;
+ if (other)
+ {
+ LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf);
+ replaceSettings(blenddata);
+ mNextSunTextureId = other->getSunTextureId();
+ mNextMoonTextureId = other->getMoonTextureId();
+ mNextCloudTextureId = other->getCloudNoiseTextureId();
+ }
+ else
+ {
+ LL_WARNS("SETTINGS") << "Could not cast end settings to sky. No blend performed." << LL_ENDL;
+ }
setBlendFactor(blendf);
- mNextSunTextureId = other->getSunTextureId();
- mNextMoonTextureId = other->getMoonTextureId();
- mNextCloudTextureId = other->getCloudNoiseTextureId();
}
LLSettingsSky::stringset_t LLSettingsSky::getSkipInterpolateKeys() const
@@ -589,50 +583,59 @@ LLSD LLSettingsSky::mieConfigDefault()
return dflt_mie;
}
-LLSD LLSettingsSky::defaults()
+LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position)
{
- LLSD dfltsetting;
- LLQuaternion sunquat;
- LLQuaternion moonquat;
-
- sunquat = convert_azimuth_and_altitude_to_quat(0.0f, 80.0f * DEG_TO_RAD);
- moonquat = convert_azimuth_and_altitude_to_quat(F_PI, 80.0f * DEG_TO_RAD);
+ static LLSD dfltsetting;
- // Magic constants copied form dfltsetting.xml
- dfltsetting[SETTING_CLOUD_COLOR] = LLColor4(0.4099, 0.4099, 0.4099, 0.0).getValue();
- dfltsetting[SETTING_CLOUD_POS_DENSITY1] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue();
- dfltsetting[SETTING_CLOUD_POS_DENSITY2] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue();
- dfltsetting[SETTING_CLOUD_SCALE] = LLSD::Real(0.4199);
- dfltsetting[SETTING_CLOUD_SCROLL_RATE] = LLSDArray(10.1999)(10.0109);
- dfltsetting[SETTING_CLOUD_SHADOW] = LLSD::Real(0.2699);
+ if (dfltsetting.size() == 0)
+ {
+ LLQuaternion sunquat;
+ LLQuaternion moonquat;
+
+ F32 azimuth = (F_PI * position) + (80.0f * DEG_TO_RAD);
+ F32 altitude = (F_PI * position);
+
+ // give the sun and moon slightly different tracks through the sky
+ // instead of positioning them at opposite poles from each other...
+ sunquat = convert_azimuth_and_altitude_to_quat(altitude, azimuth);
+ moonquat = convert_azimuth_and_altitude_to_quat(altitude + (F_PI * 0.125f), azimuth + (F_PI * 0.125f));
+
+ // Magic constants copied form dfltsetting.xml
+ dfltsetting[SETTING_CLOUD_COLOR] = LLColor4(0.4099, 0.4099, 0.4099, 0.0).getValue();
+ dfltsetting[SETTING_CLOUD_POS_DENSITY1] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue();
+ dfltsetting[SETTING_CLOUD_POS_DENSITY2] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue();
+ dfltsetting[SETTING_CLOUD_SCALE] = LLSD::Real(0.4199);
+ dfltsetting[SETTING_CLOUD_SCROLL_RATE] = LLSDArray(10.1999)(10.0109);
+ dfltsetting[SETTING_CLOUD_SHADOW] = LLSD::Real(0.2699);
- dfltsetting[SETTING_DOME_OFFSET] = LLSD::Real(0.96f);
- dfltsetting[SETTING_DOME_RADIUS] = LLSD::Real(15000.f);
- dfltsetting[SETTING_GAMMA] = LLSD::Real(1.0);
- dfltsetting[SETTING_GLOW] = LLColor4(5.000, 0.0010, -0.4799, 1.0).getValue();
+ dfltsetting[SETTING_DOME_OFFSET] = LLSD::Real(0.96f);
+ dfltsetting[SETTING_DOME_RADIUS] = LLSD::Real(15000.f);
+ dfltsetting[SETTING_GAMMA] = LLSD::Real(1.0);
+ dfltsetting[SETTING_GLOW] = LLColor4(5.000, 0.0010, -0.4799, 1.0).getValue();
- dfltsetting[SETTING_MAX_Y] = LLSD::Real(1605);
- dfltsetting[SETTING_MOON_ROTATION] = moonquat.getValue();
- dfltsetting[SETTING_STAR_BRIGHTNESS] = LLSD::Real(0.0000);
- dfltsetting[SETTING_SUNLIGHT_COLOR] = LLColor4(0.7342, 0.7815, 0.8999, 0.0).getValue();
- dfltsetting[SETTING_SUN_ROTATION] = sunquat.getValue();
-
- dfltsetting[SETTING_BLOOM_TEXTUREID] = IMG_BLOOM1;
- dfltsetting[SETTING_CLOUD_TEXTUREID] = GetDefaultCloudNoiseTextureId();
- dfltsetting[SETTING_MOON_TEXTUREID] = GetDefaultMoonTextureId();
- dfltsetting[SETTING_SUN_TEXTUREID] = GetDefaultSunTextureId();
-
- dfltsetting[SETTING_TYPE] = "sky";
-
- // defaults are for earth...
- dfltsetting[SETTING_PLANET_RADIUS] = 6360.0f;
- dfltsetting[SETTING_SKY_BOTTOM_RADIUS] = 6360.0f;
- dfltsetting[SETTING_SKY_TOP_RADIUS] = 6420.0f;
- dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00935f / 2.0f;
-
- dfltsetting[SETTING_RAYLEIGH_CONFIG] = rayleighConfigDefault();
- dfltsetting[SETTING_MIE_CONFIG] = mieConfigDefault();
- dfltsetting[SETTING_ABSORPTION_CONFIG] = absorptionConfigDefault();
+ dfltsetting[SETTING_MAX_Y] = LLSD::Real(1605);
+ dfltsetting[SETTING_MOON_ROTATION] = moonquat.getValue();
+ dfltsetting[SETTING_STAR_BRIGHTNESS] = LLSD::Real(0.0000);
+ dfltsetting[SETTING_SUNLIGHT_COLOR] = LLColor4(0.7342, 0.7815, 0.8999, 0.0).getValue();
+ dfltsetting[SETTING_SUN_ROTATION] = sunquat.getValue();
+
+ dfltsetting[SETTING_BLOOM_TEXTUREID] = IMG_BLOOM1;
+ dfltsetting[SETTING_CLOUD_TEXTUREID] = GetDefaultCloudNoiseTextureId();
+ dfltsetting[SETTING_MOON_TEXTUREID] = GetDefaultMoonTextureId();
+ dfltsetting[SETTING_SUN_TEXTUREID] = GetDefaultSunTextureId();
+
+ dfltsetting[SETTING_TYPE] = "sky";
+
+ // defaults are for earth...
+ dfltsetting[SETTING_PLANET_RADIUS] = 6360.0f;
+ dfltsetting[SETTING_SKY_BOTTOM_RADIUS] = 6360.0f;
+ dfltsetting[SETTING_SKY_TOP_RADIUS] = 6420.0f;
+ dfltsetting[SETTING_SUN_ARC_RADIANS] = 0.00935f / 2.0f;
+
+ dfltsetting[SETTING_RAYLEIGH_CONFIG] = rayleighConfigDefault();
+ dfltsetting[SETTING_MIE_CONFIG] = mieConfigDefault();
+ dfltsetting[SETTING_ABSORPTION_CONFIG] = absorptionConfigDefault();
+ }
return dfltsetting;
}
@@ -770,11 +773,17 @@ LLSD LLSettingsSky::translateLegacySettings(const LLSD& legacy)
if (legacy.has(SETTING_LEGACY_EAST_ANGLE) && legacy.has(SETTING_LEGACY_SUN_ANGLE))
{ // convert the east and sun angles into a quaternion.
- F32 azimuth = legacy[SETTING_LEGACY_EAST_ANGLE].asReal();
- F32 altitude = legacy[SETTING_LEGACY_SUN_ANGLE].asReal();
+ F32 two_pi = F_PI * 2.0f;
+ // get counter-clockwise radian angle from clockwise legacy WL east angle...
+ F32 azimuth = two_pi - legacy[SETTING_LEGACY_EAST_ANGLE].asReal();
+
+ F32 altitude = legacy[SETTING_LEGACY_SUN_ANGLE].asReal();
+
LLQuaternion sunquat = convert_azimuth_and_altitude_to_quat(azimuth, altitude);
- LLQuaternion moonquat = convert_azimuth_and_altitude_to_quat(azimuth + F_PI, altitude);
+
+ // original WL moon dir was diametrically opposed to the sun dir
+ LLQuaternion moonquat = convert_azimuth_and_altitude_to_quat(azimuth + F_PI, -altitude);
//LLVector3 sundir = DUE_EAST * sunquat;
//LLVector3 moondir = DUE_EAST * moonquat;
@@ -790,9 +799,6 @@ void LLSettingsSky::updateSettings()
{
LL_RECORD_BLOCK_TIME(FTM_RECALCULATE_SKYVALUES);
- mPositionsDirty |= isVeryDirty();
- mLightingDirty |= isVeryDirty();
-
// base class clears dirty flag so as to not trigger recursive update
LLSettingsBase::updateSettings();
@@ -817,31 +823,20 @@ bool LLSettingsSky::getIsMoonUp() const
void LLSettingsSky::calculateHeavenlyBodyPositions() const
{
- if (!mPositionsDirty)
- {
- return;
- }
- {
- LL_RECORD_BLOCK_TIME(FTM_RECALCULATE_BODIES);
+ LLQuaternion sunq = getSunRotation();
+ LLQuaternion moonq = getMoonRotation();
- mPositionsDirty = false;
- mLightingDirty = true; // changes light direction
+ mSunDirection = DUE_EAST * sunq;
+ mMoonDirection = DUE_EAST * moonq;
- LLQuaternion sunq = getSunRotation();
- LLQuaternion moonq = getMoonRotation();
+ mSunDirection.normalize();
+ mMoonDirection.normalize();
- mSunDirection = DUE_EAST * sunq;
- mMoonDirection = DUE_EAST * moonq;
+ //LL_WARNS("LAPRAS") << "Sun info: Rotation=" << sunq << " Vector=" << mSunDirection << LL_ENDL;
+ //LL_WARNS("LAPRAS") << "Moon info: Rotation=" << moonq << " Vector=" << mMoonDirection << LL_ENDL;
- 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);
- }
+ llassert(mSunDirection.lengthSquared() > 0.01f);
+ llassert(mMoonDirection.lengthSquared() > 0.01f);
}
LLVector3 LLSettingsSky::getLightDirection() const
@@ -851,12 +846,10 @@ LLVector3 LLSettingsSky::getLightDirection() const
// is the normal from the sun or the moon
if (getIsSunUp())
{
- llassert(mSunDirection.lengthSquared() > 0.01f);
return mSunDirection;
}
else if (getIsMoonUp())
{
- llassert(mMoonDirection.lengthSquared() > 0.01f);
return mMoonDirection;
}
@@ -921,42 +914,36 @@ void LLSettingsSky::setBlueDensity(const LLColor3 &val)
{
mSettings[SETTING_LEGACY_HAZE][SETTING_BLUE_DENSITY] = val.getValue();
setDirtyFlag(true);
- mLightingDirty = true;
}
void LLSettingsSky::setBlueHorizon(const LLColor3 &val)
{
mSettings[SETTING_LEGACY_HAZE][SETTING_BLUE_HORIZON] = val.getValue();
setDirtyFlag(true);
- mLightingDirty = true;
}
void LLSettingsSky::setDensityMultiplier(F32 val)
{
mSettings[SETTING_LEGACY_HAZE][SETTING_DENSITY_MULTIPLIER] = val;
setDirtyFlag(true);
- mLightingDirty = true;
}
void LLSettingsSky::setDistanceMultiplier(F32 val)
{
mSettings[SETTING_LEGACY_HAZE][SETTING_DISTANCE_MULTIPLIER] = val;
setDirtyFlag(true);
- mLightingDirty = true;
}
void LLSettingsSky::setHazeDensity(F32 val)
{
mSettings[SETTING_LEGACY_HAZE][SETTING_HAZE_DENSITY] = val;
setDirtyFlag(true);
- mLightingDirty = true;
}
void LLSettingsSky::setHazeHorizon(F32 val)
{
mSettings[SETTING_LEGACY_HAZE][SETTING_HAZE_HORIZON] = val;
setDirtyFlag(true);
- mLightingDirty = true;
}
// Sunlight attenuation effect (hue and brightness) due to atmosphere
@@ -1045,52 +1032,41 @@ LLColor4 LLSettingsSky::getTotalAmbient() const
void LLSettingsSky::calculateLightSettings() const
{
- if (!mLightingDirty)
- {
- return;
- }
+ // Initialize temp variables
+ LLColor3 sunlight = getSunlightColor();
+ LLColor3 ambient = getAmbientColor();
+ F32 cloud_shadow = getCloudShadow();
+ LLVector3 lightnorm = getLightDirection();
- {
- LL_RECORD_BLOCK_TIME(FTM_RECALCULATE_LIGHTING);
+ // Sunlight attenuation effect (hue and brightness) due to atmosphere
+ // this is used later for sunlight modulation at various altitudes
+ F32 max_y = getMaxY();
+ LLColor3 light_atten = getLightAttenuation(max_y);
+ LLColor3 light_transmittance = getLightTransmittance();
- mLightingDirty = false;
+ // and vary_sunlight will work properly with moon light
+ F32 lighty = lightnorm[1];
- // Initialize temp variables
- LLColor3 sunlight = getSunlightColor();
- LLColor3 ambient = getAmbientColor();
- F32 cloud_shadow = getCloudShadow();
- LLVector3 lightnorm = getLightDirection();
-
- // Sunlight attenuation effect (hue and brightness) due to atmosphere
- // this is used later for sunlight modulation at various altitudes
- F32 max_y = getMaxY();
- LLColor3 light_atten = getLightAttenuation(max_y);
- LLColor3 light_transmittance = getLightTransmittance();
-
- // and vary_sunlight will work properly with moon light
- F32 lighty = lightnorm[1];
-
- lighty = llmax(0.f, lighty);
- if (lighty > 0.f)
- {
- lighty = 1.f / lighty;
- }
- componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty));
+ lighty = llmax(0.f, lighty);
+ if(lighty > 0.f)
+ {
+ lighty = 1.f / lighty;
+ }
+ componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty));
- //increase ambient when there are more clouds
- LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5f;
+ //increase ambient when there are more clouds
+ LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5f;
- //brightness of surface both sunlight and ambient
- mSunDiffuse = gammaCorrect(componentMult(sunlight, light_transmittance));
- mSunAmbient = gammaCorrect(componentMult(tmpAmbient, light_transmittance) * 0.5);
+ //brightness of surface both sunlight and ambient
+ mSunDiffuse = gammaCorrect(componentMult(sunlight, light_transmittance));
+ mSunAmbient = gammaCorrect(componentMult(tmpAmbient, light_transmittance) * 0.5);
- mMoonDiffuse = gammaCorrect(componentMult(LLColor3::white, light_transmittance));
- mMoonAmbient = gammaCorrect(componentMult(LLColor3::white, light_transmittance) * 0.5f);
- mTotalAmbient = mSunAmbient;
+ mMoonDiffuse = gammaCorrect(componentMult(LLColor3::white, light_transmittance));
+ mMoonAmbient = gammaCorrect(componentMult(LLColor3::white, light_transmittance) * 0.5f);
+ mTotalAmbient = mSunAmbient;
- mFadeColor = mTotalAmbient + (mSunDiffuse + mMoonDiffuse) * 0.5f;
- mFadeColor.setAlpha(0);
- }
+ mFadeColor = mTotalAmbient + (mSunDiffuse + mMoonDiffuse) * 0.5f;
+ mFadeColor.setAlpha(0);
}
LLUUID LLSettingsSky::GetDefaultAssetId()
@@ -1113,6 +1089,11 @@ LLUUID LLSettingsSky::GetDefaultCloudNoiseTextureId()
return DEFAULT_CLOUD_ID;
}
+LLUUID LLSettingsSky::GetDefaultBloomTextureId()
+{
+ return IMG_BLOOM1;
+}
+
F32 LLSettingsSky::getPlanetRadius() const
{
return mSettings[SETTING_PLANET_RADIUS].asReal();
@@ -1167,7 +1148,6 @@ LLColor3 LLSettingsSky::getAmbientColor() const
void LLSettingsSky::setAmbientColor(const LLColor3 &val)
{
setValue(SETTING_AMBIENT, val);
- mLightingDirty = true;
}
LLColor3 LLSettingsSky::getCloudColor() const
@@ -1250,7 +1230,6 @@ F32 LLSettingsSky::getCloudShadow() const
void LLSettingsSky::setCloudShadow(F32 val)
{
setValue(SETTING_CLOUD_SHADOW, val);
- mLightingDirty = true;
}
F32 LLSettingsSky::getDomeOffset() const
@@ -1274,7 +1253,6 @@ void LLSettingsSky::setGamma(F32 val)
{
mSettings[SETTING_GAMMA] = LLSD::Real(val);
setDirtyFlag(true);
- mLightingDirty = true;
}
LLColor3 LLSettingsSky::getGlow() const
@@ -1285,7 +1263,6 @@ LLColor3 LLSettingsSky::getGlow() const
void LLSettingsSky::setGlow(const LLColor3 &val)
{
setValue(SETTING_GLOW, val);
- mLightingDirty = true;
}
F32 LLSettingsSky::getMaxY() const
@@ -1306,7 +1283,6 @@ LLQuaternion LLSettingsSky::getMoonRotation() const
void LLSettingsSky::setMoonRotation(const LLQuaternion &val)
{
setValue(SETTING_MOON_ROTATION, val);
- mPositionsDirty = true;
}
LLUUID LLSettingsSky::getMoonTextureId() const
@@ -1337,7 +1313,6 @@ LLColor3 LLSettingsSky::getSunlightColor() const
void LLSettingsSky::setSunlightColor(const LLColor3 &val)
{
setValue(SETTING_SUNLIGHT_COLOR, val);
- mLightingDirty = true;
}
LLQuaternion LLSettingsSky::getSunRotation() const
@@ -1348,7 +1323,6 @@ LLQuaternion LLSettingsSky::getSunRotation() const
void LLSettingsSky::setSunRotation(const LLQuaternion &val)
{
setValue(SETTING_SUN_ROTATION, val);
- mPositionsDirty = true;
}
LLUUID LLSettingsSky::getSunTextureId() const
diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h
index e6783f6694..e7b4678f7f 100644
--- a/indra/llinventory/llsettingssky.h
+++ b/indra/llinventory/llsettingssky.h
@@ -105,7 +105,7 @@ public:
virtual void replaceSettings(LLSD settings) SETTINGS_OVERRIDE;
- static LLSD defaults();
+ static LLSD defaults(const LLSettingsBase::TrackPosition& position = 0.0f);
F32 getPlanetRadius() const;
F32 getSkyBottomRadius() const;
@@ -234,6 +234,7 @@ public:
static LLUUID GetDefaultSunTextureId();
static LLUUID GetDefaultMoonTextureId();
static LLUUID GetDefaultCloudNoiseTextureId();
+ static LLUUID GetDefaultBloomTextureId();
protected:
static const std::string SETTING_LEGACY_EAST_ANGLE;
@@ -247,9 +248,6 @@ protected:
virtual void updateSettings() SETTINGS_OVERRIDE;
private:
- mutable bool mPositionsDirty;
- mutable bool mLightingDirty;
-
static LLSD rayleighConfigDefault();
static LLSD absorptionConfigDefault();
static LLSD mieConfigDefault();
diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp
index 16281e23cc..3e0c6dcb82 100644
--- a/indra/llinventory/llsettingswater.cpp
+++ b/indra/llinventory/llsettingswater.cpp
@@ -87,26 +87,32 @@ LLSettingsWater::LLSettingsWater() :
}
//=========================================================================
-LLSD LLSettingsWater::defaults()
+LLSD LLSettingsWater::defaults(const LLSettingsBase::TrackPosition& position)
{
- LLSD dfltsetting;
-
- // Magic constants copied form defaults.xml
- dfltsetting[SETTING_BLUR_MULTIPILER] = LLSD::Real(0.04000f);
- dfltsetting[SETTING_FOG_COLOR] = LLColor3(0.0156f, 0.1490f, 0.2509f).getValue();
- dfltsetting[SETTING_FOG_DENSITY] = LLSD::Real(2.0f);
- dfltsetting[SETTING_FOG_MOD] = LLSD::Real(0.25f);
- dfltsetting[SETTING_FRESNEL_OFFSET] = LLSD::Real(0.5f);
- dfltsetting[SETTING_FRESNEL_SCALE] = LLSD::Real(0.3999);
- dfltsetting[SETTING_TRANSPARENT_TEXTURE] = GetDefaultTransparentTextureAssetId();
- dfltsetting[SETTING_NORMAL_MAP] = GetDefaultWaterNormalAssetId();
- dfltsetting[SETTING_NORMAL_SCALE] = LLVector3(2.0f, 2.0f, 2.0f).getValue();
- dfltsetting[SETTING_SCALE_ABOVE] = LLSD::Real(0.0299f);
- dfltsetting[SETTING_SCALE_BELOW] = LLSD::Real(0.2000f);
- dfltsetting[SETTING_WAVE1_DIR] = LLVector2(1.04999f, -0.42000f).getValue();
- dfltsetting[SETTING_WAVE2_DIR] = LLVector2(1.10999f, -1.16000f).getValue();
-
- dfltsetting[SETTING_TYPE] = "water";
+ static LLSD dfltsetting;
+
+ if (dfltsetting.size() == 0)
+ {
+ // give the normal scale offset some variability over track time...
+ F32 normal_scale_offset = (position * 0.5f) - 0.25f;
+
+ // Magic constants copied form defaults.xml
+ dfltsetting[SETTING_BLUR_MULTIPILER] = LLSD::Real(0.04000f);
+ dfltsetting[SETTING_FOG_COLOR] = LLColor3(0.0156f, 0.1490f, 0.2509f).getValue();
+ dfltsetting[SETTING_FOG_DENSITY] = LLSD::Real(2.0f);
+ dfltsetting[SETTING_FOG_MOD] = LLSD::Real(0.25f);
+ dfltsetting[SETTING_FRESNEL_OFFSET] = LLSD::Real(0.5f);
+ dfltsetting[SETTING_FRESNEL_SCALE] = LLSD::Real(0.3999);
+ dfltsetting[SETTING_TRANSPARENT_TEXTURE] = GetDefaultTransparentTextureAssetId();
+ dfltsetting[SETTING_NORMAL_MAP] = GetDefaultWaterNormalAssetId();
+ dfltsetting[SETTING_NORMAL_SCALE] = LLVector3(2.0f + normal_scale_offset, 2.0f + normal_scale_offset, 2.0f + normal_scale_offset).getValue();
+ dfltsetting[SETTING_SCALE_ABOVE] = LLSD::Real(0.0299f);
+ dfltsetting[SETTING_SCALE_BELOW] = LLSD::Real(0.2000f);
+ dfltsetting[SETTING_WAVE1_DIR] = LLVector2(1.04999f, -0.42000f).getValue();
+ dfltsetting[SETTING_WAVE2_DIR] = LLVector2(1.10999f, -1.16000f).getValue();
+
+ dfltsetting[SETTING_TYPE] = "water";
+ }
return dfltsetting;
}
@@ -170,12 +176,19 @@ LLSD LLSettingsWater::translateLegacySettings(LLSD legacy)
void LLSettingsWater::blend(const LLSettingsBase::ptr_t &end, F64 blendf)
{
LLSettingsWater::ptr_t other = PTR_NAMESPACE::static_pointer_cast<LLSettingsWater>(end);
- LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf);
-
- replaceSettings(blenddata);
+ if (other)
+ {
+ LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf);
+ replaceSettings(blenddata);
+ mNextNormalMapID = other->getNormalMapID();
+ mNextTransparentTextureID = other->getTransparentTextureID();
+ }
+ else
+ {
+ LL_WARNS("SETTINGS") << "Cound not cast end settings to water. No blend performed." << LL_ENDL;
+ }
setBlendFactor(blendf);
mNextNormalMapID = other->getNormalMapID();
- mNextTransparentTextureID = other->getTransparentTextureID();
}
LLSettingsWater::validation_list_t LLSettingsWater::getValidationList() const
diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h
index 9d006d492d..83d54da6a5 100644
--- a/indra/llinventory/llsettingswater.h
+++ b/indra/llinventory/llsettingswater.h
@@ -62,7 +62,7 @@ public:
// Settings status
virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf) SETTINGS_OVERRIDE;
- static LLSD defaults();
+ static LLSD defaults(const LLSettingsBase::TrackPosition& position = 0.0f);
//---------------------------------------------------------------------
F32 getBlurMultiplier() const
diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp
index 7815f4244a..933d5c62ab 100644
--- a/indra/newview/llfloatereditextdaycycle.cpp
+++ b/indra/newview/llfloatereditextdaycycle.cpp
@@ -845,6 +845,7 @@ void LLFloaterEditExtDayCycle::onAssetLoaded(LLUUID asset_id, LLSettingsBase::pt
updateEditEnvironment();
LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_EDIT);
synchronizeTabs();
+ updateTabs();
refresh();
}
@@ -869,6 +870,7 @@ void LLFloaterEditExtDayCycle::loadLiveEnvironment(LLEnvironment::EnvSelection_t
updateEditEnvironment();
synchronizeTabs();
+ updateTabs();
refresh();
}
diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp
index deaaffb1f5..44bb9fc6f5 100644
--- a/indra/newview/llsettingsvo.cpp
+++ b/indra/newview/llsettingsvo.cpp
@@ -525,10 +525,11 @@ void LLSettingsVOSky::updateSettings()
F32 sun_dynamic_range = llmax(gSavedSettings.getF32("RenderSunDynamicRange"), 0.0001f);
mSceneLightStrength = 2.0f * (1.0f + sun_dynamic_range * dp);
- // Axis swaps convert from +x right, +z up, +y at
- // to CFR +x at, +z up, +y right coord sys
- LLVector3 sun_direction_cfr(sun_direction.mV[0], -sun_direction.mV[1], sun_direction.mV[2]);
- LLVector3 moon_direction_cfr(moon_direction.mV[0], -moon_direction.mV[1], moon_direction.mV[2]);
+ // Axis swaps convert from "normal" (+x right, +z up, +y at)
+ // to CFR (+x at, +z up, +y right) coord sys
+ LLVector3 sun_direction_cfr(sun_direction.mV[1], sun_direction.mV[0], sun_direction.mV[2]);
+ LLVector3 moon_direction_cfr(moon_direction.mV[1], moon_direction.mV[0], moon_direction.mV[2]);
+
gSky.setSunAndMoonDirectionsCFR(sun_direction_cfr, moon_direction_cfr);
gSky.setSunTextures(getSunTextureId(), getNextSunTextureId());
gSky.setMoonTextures(getMoonTextureId(), getNextMoonTextureId());
diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp
index 7c1fda46ff..4c84e40c73 100644
--- a/indra/newview/llvosky.cpp
+++ b/indra/newview/llvosky.cpp
@@ -389,7 +389,7 @@ LLVOSky::LLVOSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
mSun.setIntensity(SUN_INTENSITY);
mMoon.setIntensity(0.1f * SUN_INTENSITY);
- mBloomTexturep = LLViewerTextureManager::getFetchedTexture(IMG_BLOOM1);
+ mBloomTexturep = LLViewerTextureManager::getFetchedTexture(LLSettingsSky::GetDefaultBloomTextureId());
mBloomTexturep->setNoDelete() ;
mBloomTexturep->setAddressMode(LLTexUnit::TAM_CLAMP);
@@ -488,7 +488,7 @@ void LLVOSky::restoreGL()
setMoonTextures(psky->getMoonTextureId(), psky->getNextMoonTextureId());
}
- mBloomTexturep = LLViewerTextureManager::getFetchedTexture(IMG_BLOOM1);
+ mBloomTexturep = LLViewerTextureManager::getFetchedTexture(LLSettingsSky::GetDefaultBloomTextureId());
mBloomTexturep->setNoDelete() ;
mBloomTexturep->setAddressMode(LLTexUnit::TAM_CLAMP);