diff options
author | Graham Linden <graham@lindenlab.com> | 2018-06-15 21:15:02 +0100 |
---|---|---|
committer | Graham Linden <graham@lindenlab.com> | 2018-06-15 21:15:02 +0100 |
commit | 66d78ce1c73d5da3bc5bc39fe0196a9f82040105 (patch) | |
tree | 169d7034712a765a1befc2c4154a5f3bdcb5e13a | |
parent | c07775798e0adb134a2b5df8295bdb0ed7d374bc (diff) |
Make water and sky defaults take a position value to allow for default daycycle w/ multiple frames.
Make default daycycle add 8 frames at 0, 0.125, 0.25 etc
Merge over server-side bugfixes.
Eliminate extraneous dirty bits in sky settings.
-rw-r--r-- | indra/llinventory/llsettingsbase.cpp | 19 | ||||
-rw-r--r-- | indra/llinventory/llsettingsbase.h | 5 | ||||
-rw-r--r-- | indra/llinventory/llsettingsdaycycle.cpp | 52 | ||||
-rw-r--r-- | indra/llinventory/llsettingssky.cpp | 68 | ||||
-rw-r--r-- | indra/llinventory/llsettingssky.h | 5 | ||||
-rw-r--r-- | indra/llinventory/llsettingswater.cpp | 7 | ||||
-rw-r--r-- | indra/llinventory/llsettingswater.h | 2 | ||||
-rw-r--r-- | indra/newview/llfloatereditextdaycycle.cpp | 2 |
8 files changed, 74 insertions, 86 deletions
diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp index 24e808c92a..fb4f5cdd60 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 f2fa78e41f..3a5296daa4 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..7dc415e480 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; @@ -287,13 +289,36 @@ LLSD LLSettingsDay::defaults() dfltsetting[SETTING_NAME] = "_default_"; + LLSD frames(LLSD::emptyMap()); LLSD waterTrack; - waterTrack[SETTING_KEYKFRAME] = 0.0f; - waterTrack[SETTING_KEYNAME] = "_default_"; - 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); + + std::string water_frame_name("water:"); + std::string sky_frame_name("sky:"); + + water_frame_name += name; + sky_frame_name += name; + + waterTrack[SETTING_KEYKFRAME] = time; + waterTrack[SETTING_KEYNAME] = water_frame_name; + + skyTrack[SETTING_KEYKFRAME] = time; + skyTrack[SETTING_KEYNAME] = sky_frame_name; + + frames[water_frame_name] = LLSettingsWater::defaults(time); + frames[sky_frame_name] = LLSettingsSky::defaults(time); + + time += FRAME_STEP; + } LLSD tracks; tracks.append(LLSDArray(waterTrack)); @@ -301,10 +326,7 @@ LLSD LLSettingsDay::defaults() dfltsetting[SETTING_TRACKS] = tracks; - LLSD frames(LLSD::emptyMap()); - - frames["water:_defaults_"] = LLSettingsWater::defaults(); - frames["sky:_defaults_"] = LLSettingsSky::defaults(); + dfltsetting[SETTING_FRAMES] = frames; @@ -532,14 +554,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 c25f9a5b2c..83499cc9fc 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -366,9 +366,7 @@ LLSettingsSky::LLSettingsSky(const LLSD &data) : LLSettingsBase(data), mNextSunTextureId(), mNextMoonTextureId(), - mNextCloudTextureId(), - mPositionsDirty(true), - mLightingDirty(true) + mNextCloudTextureId() { } @@ -376,9 +374,7 @@ LLSettingsSky::LLSettingsSky(): LLSettingsBase(), mNextSunTextureId(), mNextMoonTextureId(), - mNextCloudTextureId(), - mPositionsDirty(true), - mLightingDirty(true) + mNextCloudTextureId() { } @@ -396,9 +392,7 @@ void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf) LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, blendf); replaceSettings(blenddata); - mPositionsDirty = true; - mLightingDirty = true; - + setBlendFactor(blendf); mNextSunTextureId = other->getSunTextureId(); mNextMoonTextureId = other->getMoonTextureId(); @@ -585,14 +579,19 @@ 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); + 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(); @@ -784,9 +783,6 @@ 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(); @@ -811,15 +807,6 @@ bool LLSettingsSky::getIsMoonUp() const void LLSettingsSky::calculateHeavenlyBodyPositions() const { - /* can't do this as it gets defeated during animation of env panel settings - if (!mPositionsDirty) - { - return; - }*/ - - mPositionsDirty = false; - mLightingDirty = true; // changes light direction - LLQuaternion sunq = getSunRotation(); LLQuaternion moonq = getMoonRotation(); @@ -829,11 +816,11 @@ 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; + //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 @@ -843,12 +830,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; } @@ -913,42 +898,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 @@ -1037,16 +1016,6 @@ LLColor4 LLSettingsSky::getTotalAmbient() const void LLSettingsSky::calculateLightSettings() const { - /* can't do this as it gets defeated during animation of env panel settings - if (!mLightingDirty) - { - return; - } - - calculateHeavenlyBodyPositions();*/ - - mLightingDirty = false; - // Initialize temp variables LLColor3 sunlight = getSunlightColor(); LLColor3 ambient = getAmbientColor(); @@ -1158,7 +1127,6 @@ LLColor3 LLSettingsSky::getAmbientColor() const void LLSettingsSky::setAmbientColor(const LLColor3 &val) { setValue(SETTING_AMBIENT, val); - mLightingDirty = true; } LLColor3 LLSettingsSky::getCloudColor() const @@ -1241,7 +1209,6 @@ F32 LLSettingsSky::getCloudShadow() const void LLSettingsSky::setCloudShadow(F32 val) { setValue(SETTING_CLOUD_SHADOW, val); - mLightingDirty = true; } F32 LLSettingsSky::getDomeOffset() const @@ -1265,7 +1232,6 @@ void LLSettingsSky::setGamma(F32 val) { mSettings[SETTING_GAMMA] = LLSD::Real(val); setDirtyFlag(true); - mLightingDirty = true; } LLColor3 LLSettingsSky::getGlow() const @@ -1276,7 +1242,6 @@ LLColor3 LLSettingsSky::getGlow() const void LLSettingsSky::setGlow(const LLColor3 &val) { setValue(SETTING_GLOW, val); - mLightingDirty = true; } F32 LLSettingsSky::getMaxY() const @@ -1297,7 +1262,6 @@ LLQuaternion LLSettingsSky::getMoonRotation() const void LLSettingsSky::setMoonRotation(const LLQuaternion &val) { setValue(SETTING_MOON_ROTATION, val); - mPositionsDirty = true; } LLUUID LLSettingsSky::getMoonTextureId() const @@ -1328,7 +1292,6 @@ LLColor3 LLSettingsSky::getSunlightColor() const void LLSettingsSky::setSunlightColor(const LLColor3 &val) { setValue(SETTING_SUNLIGHT_COLOR, val); - mLightingDirty = true; } LLQuaternion LLSettingsSky::getSunRotation() const @@ -1339,7 +1302,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..19b7cd47e9 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; @@ -247,9 +247,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..a1e4929055 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -87,10 +87,13 @@ LLSettingsWater::LLSettingsWater() : } //========================================================================= -LLSD LLSettingsWater::defaults() +LLSD LLSettingsWater::defaults(const LLSettingsBase::TrackPosition& position) { LLSD dfltsetting; + // 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(); @@ -100,7 +103,7 @@ LLSD LLSettingsWater::defaults() 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_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(); 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(); } |