summaryrefslogtreecommitdiff
path: root/indra/llinventory
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llinventory')
-rw-r--r--indra/llinventory/llsettingsbase.cpp16
-rw-r--r--indra/llinventory/llsettingsbase.h46
-rw-r--r--indra/llinventory/llsettingsdaycycle.cpp15
-rw-r--r--indra/llinventory/llsettingssky.cpp59
4 files changed, 110 insertions, 26 deletions
diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp
index a261c98bb1..24e808c92a 100644
--- a/indra/llinventory/llsettingsbase.cpp
+++ b/indra/llinventory/llsettingsbase.cpp
@@ -53,6 +53,7 @@ const std::string LLSettingsBase::SETTING_ID("id");
const std::string LLSettingsBase::SETTING_NAME("name");
const std::string LLSettingsBase::SETTING_HASH("hash");
const std::string LLSettingsBase::SETTING_TYPE("type");
+const std::string LLSettingsBase::SETTING_ASSETID("asset_id");
//=========================================================================
LLSettingsBase::LLSettingsBase():
@@ -309,6 +310,7 @@ LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &valida
static Validator validateId(SETTING_ID, false, LLSD::TypeUUID);
static Validator validateHash(SETTING_HASH, false, LLSD::TypeInteger);
static Validator validateType(SETTING_TYPE, false, LLSD::TypeString);
+ static Validator validateAssetId(SETTING_ASSETID, false, LLSD::TypeUUID);
stringset_t validated;
stringset_t strip;
bool isValid(true);
@@ -337,6 +339,13 @@ LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &valida
}
validated.insert(validateHash.getName());
+ if (!validateAssetId.verify(settings))
+ {
+ errors.append(LLSD::String("Invalid asset Id"));
+ isValid = false;
+ }
+ validated.insert(validateAssetId.getName());
+
if (!validateType.verify(settings))
{
errors.append( LLSD::String("Unable to validate 'type'.") );
@@ -597,12 +606,19 @@ LLSettingsBase::BlendFactor LLSettingsBlenderTimeDelta::calculateBlend(const LLS
void LLSettingsBlenderTimeDelta::applyTimeDelta(const LLSettingsBase::Seconds& timedelta)
{
mTimeSpent += timedelta;
+ mTimeDeltaPassed += timedelta;
if (mTimeSpent > mBlendSpan)
{
triggerComplete();
return;
}
+ if (mTimeDeltaPassed < mTimeDeltaThreshold)
+ {
+ return;
+ }
+
+ mTimeDeltaPassed = LLSettingsBase::Seconds(0.0);
LLSettingsBase::BlendFactor blendf = calculateBlend(mTimeSpent, mBlendSpan);
diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h
index 5e40d185a1..f0d104ff53 100644
--- a/indra/llinventory/llsettingsbase.h
+++ b/indra/llinventory/llsettingsbase.h
@@ -67,6 +67,7 @@ public:
static const std::string SETTING_NAME;
static const std::string SETTING_HASH;
static const std::string SETTING_TYPE;
+ static const std::string SETTING_ASSETID;
typedef std::map<std::string, S32> parammapping_t;
@@ -83,6 +84,7 @@ public:
// Settings status
inline bool hasSetting(const std::string &param) const { return mSettings.has(param); }
inline bool isDirty() const { return mDirty; }
+ inline bool isVeryDirty() const { return mReplaced; }
inline void setDirtyFlag(bool dirty) { mDirty = dirty; }
size_t getHash() const; // Hash will not include Name, ID or a previously stored Hash
@@ -102,11 +104,20 @@ public:
setValue(SETTING_NAME, val);
}
+ inline LLUUID getAssetId() const
+ {
+ if (mSettings.has(SETTING_ASSETID))
+ return mSettings[SETTING_ASSETID].asUUID();
+ return LLUUID();
+ }
+
+
inline void replaceSettings(LLSD settings)
{
mSettings = settings;
mBlendedFactor = 0.0;
setDirtyFlag(true);
+ mReplaced = true;
}
virtual LLSD getSettings() const;
@@ -117,6 +128,8 @@ public:
{
mSettings[name] = value;
mDirty = true;
+ if (mSettings.has(SETTING_ASSETID))
+ mSettings.erase(SETTING_ASSETID);
}
inline void setValue(const std::string &name, const LLSD &value)
@@ -176,7 +189,7 @@ public:
// special consideration from getters.
inline void update() const
{
- if (!mDirty)
+ if ((!mDirty) && (!mReplaced))
return;
(const_cast<LLSettingsBase *>(this))->updateSettings();
}
@@ -226,6 +239,12 @@ public:
typedef std::vector<Validator> validation_list_t;
static LLSD settingValidation(LLSD &settings, validation_list_t &validations);
+
+ inline void setAssetId(LLUUID value)
+ { // note that this skips setLLSD
+ mSettings[SETTING_ASSETID] = value;
+ }
+
protected:
LLSettingsBase();
@@ -249,7 +268,7 @@ protected:
virtual stringset_t getSlerpKeys() const { return stringset_t(); }
// Calculate any custom settings that may need to be cached.
- virtual void updateSettings() { mDirty = false; };
+ virtual void updateSettings() { mDirty = false; mReplaced = false; };
virtual validation_list_t getValidationList() const = 0;
@@ -269,10 +288,9 @@ protected:
mBlendedFactor = blendfactor;
}
- void markDirty() { mDirty = true; }
-
private:
bool mDirty;
+ bool mReplaced; // super dirty!
LLSD combineSDMaps(const LLSD &first, const LLSD &other) const;
@@ -367,7 +385,9 @@ public:
LLSettingsBlender(target, initsetting, endsetting),
mBlendSpan(blend_span),
mLastUpdate(0.0f),
- mTimeSpent(0.0f)
+ mTimeSpent(0.0f),
+ mTimeDeltaThreshold(0.0f),
+ mTimeDeltaPassed(0.0f)
{
mTimeStart = LLSettingsBase::Seconds(LLDate::now().secondsSinceEpoch());
mLastUpdate = mTimeStart;
@@ -384,11 +404,23 @@ public:
mBlendSpan = blend_span;
mTimeStart = LLSettingsBase::Seconds(LLDate::now().secondsSinceEpoch());
mLastUpdate = mTimeStart;
- mTimeSpent = LLSettingsBase::Seconds(0.0);
+ mTimeSpent = LLSettingsBase::Seconds(0.0f);
+ mTimeDeltaPassed = LLSettingsBase::Seconds(0.0f);
}
virtual void applyTimeDelta(const LLSettingsBase::Seconds& timedelta) SETTINGS_OVERRIDE;
+ inline void setTimeDeltaThreshold(const LLSettingsBase::Seconds time)
+ {
+ mTimeDeltaThreshold = time;
+ mTimeDeltaPassed = time + LLSettingsBase::Seconds(1.0); // take the next update call.
+ }
+
+ inline LLSettingsBase::Seconds getTimeDeltaThreshold() const
+ {
+ return mTimeDeltaThreshold;
+ }
+
protected:
LLSettingsBase::BlendFactor calculateBlend(const LLSettingsBase::TrackPosition& spanpos, const LLSettingsBase::TrackPosition& spanlen) const;
@@ -396,6 +428,8 @@ protected:
LLSettingsBase::Seconds mLastUpdate;
LLSettingsBase::Seconds mTimeSpent;
LLSettingsBase::Seconds mTimeStart;
+ LLSettingsBase::Seconds mTimeDeltaThreshold;
+ LLSettingsBase::Seconds mTimeDeltaPassed;
};
diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp
index 0cfc8c09ca..009d7b06f2 100644
--- a/indra/llinventory/llsettingsdaycycle.cpp
+++ b/indra/llinventory/llsettingsdaycycle.cpp
@@ -26,6 +26,7 @@
*/
#include "llsettingsdaycycle.h"
+#include "llerror.h"
#include <algorithm>
#include <boost/make_shared.hpp>
#include "lltrace.h"
@@ -610,6 +611,20 @@ void LLSettingsDay::setSettingsAtKeyframe(const LLSettingsBase::ptr_t &settings,
return;
}
+ std::string type = settings->getSettingsType();
+ if ((track == TRACK_WATER) && (type != "water"))
+ {
+ LL_WARNS("DAYCYCLE") << "Attempt to add frame of type '" << type << "' to water track!" << LL_ENDL;
+ llassert(type == "water");
+ return;
+ }
+ else if ((track != TRACK_WATER) && (type != "sky"))
+ {
+ LL_WARNS("DAYCYCLE") << "Attempt to add frame of type '" << type << "' to sky track!" << LL_ENDL;
+ llassert(type == "sky");
+ return;
+ }
+
mDayTracks[track][llclamp(keyframe, 0.0f, 1.0f)] = settings;
setDirtyFlag(true);
}
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