From 047eb16f4c8fdfb1826136db9ee2eed83cb95416 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 10 Sep 2024 23:07:07 +0300 Subject: viewer#2529 Optimize updateGLVariablesForSettings Intent is to eventually use only stored variables for everything. LLSD operations are far too expensive. --- indra/llinventory/llsettingswater.h | 87 ++++++++++++++++++++++++------------- 1 file changed, 58 insertions(+), 29 deletions(-) (limited to 'indra/llinventory/llsettingswater.h') diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h index 9e7ff61272..0f2a62bba2 100644 --- a/indra/llinventory/llsettingswater.h +++ b/indra/llinventory/llsettingswater.h @@ -55,151 +55,167 @@ public: LLSettingsWater(const LLSD &data); virtual ~LLSettingsWater() { }; - virtual ptr_t buildClone() const = 0; + virtual ptr_t buildClone() = 0; //--------------------------------------------------------------------- virtual std::string getSettingsType() const SETTINGS_OVERRIDE { return std::string("water"); } virtual LLSettingsType::type_e getSettingsTypeValue() const SETTINGS_OVERRIDE { return LLSettingsType::ST_WATER; } // Settings status - virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf) SETTINGS_OVERRIDE; + virtual void blend(LLSettingsBase::ptr_t &end, F64 blendf) SETTINGS_OVERRIDE; virtual void replaceSettings(LLSD settings) SETTINGS_OVERRIDE; void replaceWithWater(LLSettingsWater::ptr_t other); static LLSD defaults(const LLSettingsBase::TrackPosition& position = 0.0f); + void loadValuesFromLLSD() override; + void saveValuesToLLSD() override; + //--------------------------------------------------------------------- F32 getBlurMultiplier() const { - return (F32)mSettings[SETTING_BLUR_MULTIPLIER].asReal(); + return mBlurMultiplier; } void setBlurMultiplier(F32 val) { - setValue(SETTING_BLUR_MULTIPLIER, val); + mBlurMultiplier = val; + setLLSDDirty(); } LLColor3 getWaterFogColor() const { - return LLColor3(mSettings[SETTING_FOG_COLOR]); + return mWaterFogColor; } void setWaterFogColor(LLColor3 val) { - setValue(SETTING_FOG_COLOR, val); + mWaterFogColor = val; + setLLSDDirty(); } F32 getWaterFogDensity() const { - return (F32)mSettings[SETTING_FOG_DENSITY].asReal(); + return mWaterFogDensity; } F32 getModifiedWaterFogDensity(bool underwater) const; void setWaterFogDensity(F32 val) { - setValue(SETTING_FOG_DENSITY, val); + mWaterFogDensity = val; + setLLSDDirty(); } F32 getFogMod() const { - return (F32)mSettings[SETTING_FOG_MOD].asReal(); + return mFogMod; } void setFogMod(F32 val) { - setValue(SETTING_FOG_MOD, val); + mFogMod = val; + setLLSDDirty(); } F32 getFresnelOffset() const { - return (F32)mSettings[SETTING_FRESNEL_OFFSET].asReal(); + return mFresnelOffset; } void setFresnelOffset(F32 val) { - setValue(SETTING_FRESNEL_OFFSET, val); + mFresnelOffset = val; + setLLSDDirty(); } F32 getFresnelScale() const { - return (F32)mSettings[SETTING_FRESNEL_SCALE].asReal(); + return mFresnelScale; } void setFresnelScale(F32 val) { - setValue(SETTING_FRESNEL_SCALE, val); + mFresnelScale = val; + setLLSDDirty(); } LLUUID getTransparentTextureID() const { - return mSettings[SETTING_TRANSPARENT_TEXTURE].asUUID(); + return mTransparentTextureID; } void setTransparentTextureID(LLUUID val) { - setValue(SETTING_TRANSPARENT_TEXTURE, val); + mTransparentTextureID = val; + setLLSDDirty(); } LLUUID getNormalMapID() const { - return mSettings[SETTING_NORMAL_MAP].asUUID(); + return mNormalMapID; } void setNormalMapID(LLUUID val) { - setValue(SETTING_NORMAL_MAP, val); + mNormalMapID = val; + setLLSDDirty(); } LLVector3 getNormalScale() const { - return LLVector3(mSettings[SETTING_NORMAL_SCALE]); + return mNormalScale; } void setNormalScale(LLVector3 val) { - setValue(SETTING_NORMAL_SCALE, val); + mNormalScale = val; + setLLSDDirty(); } F32 getScaleAbove() const { - return (F32)mSettings[SETTING_SCALE_ABOVE].asReal(); + return mScaleAbove; } void setScaleAbove(F32 val) { - setValue(SETTING_SCALE_ABOVE, val); + mScaleAbove = val; + setLLSDDirty(); } F32 getScaleBelow() const { - return (F32)mSettings[SETTING_SCALE_BELOW].asReal(); + return mScaleBelow; } void setScaleBelow(F32 val) { - setValue(SETTING_SCALE_BELOW, val); + mScaleBelow = val; + setLLSDDirty(); } LLVector2 getWave1Dir() const { - return LLVector2(mSettings[SETTING_WAVE1_DIR]); + return mWave1Dir; } void setWave1Dir(LLVector2 val) { - setValue(SETTING_WAVE1_DIR, val); + mWave1Dir = val; + setLLSDDirty(); } LLVector2 getWave2Dir() const { - return LLVector2(mSettings[SETTING_WAVE2_DIR]); + return mWave2Dir; } void setWave2Dir(LLVector2 val) { - setValue(SETTING_WAVE2_DIR, val); + mWave2Dir = val; + setLLSDDirty(); } //------------------------------------------- @@ -218,7 +234,7 @@ public: static LLSD translateLegacySettings(LLSD legacy); - virtual LLSettingsBase::ptr_t buildDerivedClone() const SETTINGS_OVERRIDE { return buildClone(); } + virtual LLSettingsBase::ptr_t buildDerivedClone() SETTINGS_OVERRIDE { return buildClone(); } static LLUUID GetDefaultAssetId(); static LLUUID GetDefaultWaterNormalAssetId(); @@ -241,9 +257,22 @@ protected: LLSettingsWater(); + LLUUID mTransparentTextureID; + LLUUID mNormalMapID; LLUUID mNextTransparentTextureID; LLUUID mNextNormalMapID; + F32 mBlurMultiplier; + LLColor3 mWaterFogColor; + F32 mWaterFogDensity; + F32 mFogMod; + F32 mFresnelOffset; + F32 mFresnelScale; + LLVector3 mNormalScale; + F32 mScaleAbove; + F32 mScaleBelow; + LLVector2 mWave1Dir; + LLVector2 mWave2Dir; }; #endif -- cgit v1.2.3 From 0a110ff0833216b167e032987b0d676f29ad0ee5 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 11 Sep 2024 18:21:03 +0300 Subject: viewer#2529 Track interpolateSDMap's performance viewer#2529 Fix initialization --- indra/llinventory/llsettingswater.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'indra/llinventory/llsettingswater.h') diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h index 0f2a62bba2..9d229e6a0b 100644 --- a/indra/llinventory/llsettingswater.h +++ b/indra/llinventory/llsettingswater.h @@ -81,6 +81,7 @@ public: void setBlurMultiplier(F32 val) { mBlurMultiplier = val; + setDirtyFlag(true); setLLSDDirty(); } @@ -92,6 +93,7 @@ public: void setWaterFogColor(LLColor3 val) { mWaterFogColor = val; + setDirtyFlag(true); setLLSDDirty(); } @@ -105,6 +107,7 @@ public: void setWaterFogDensity(F32 val) { mWaterFogDensity = val; + setDirtyFlag(true); setLLSDDirty(); } @@ -116,6 +119,7 @@ public: void setFogMod(F32 val) { mFogMod = val; + setDirtyFlag(true); setLLSDDirty(); } @@ -127,6 +131,7 @@ public: void setFresnelOffset(F32 val) { mFresnelOffset = val; + setDirtyFlag(true); setLLSDDirty(); } @@ -138,6 +143,7 @@ public: void setFresnelScale(F32 val) { mFresnelScale = val; + setDirtyFlag(true); setLLSDDirty(); } @@ -149,6 +155,7 @@ public: void setTransparentTextureID(LLUUID val) { mTransparentTextureID = val; + setDirtyFlag(true); setLLSDDirty(); } @@ -160,6 +167,7 @@ public: void setNormalMapID(LLUUID val) { mNormalMapID = val; + setDirtyFlag(true); setLLSDDirty(); } @@ -171,6 +179,7 @@ public: void setNormalScale(LLVector3 val) { mNormalScale = val; + setDirtyFlag(true); setLLSDDirty(); } @@ -182,6 +191,7 @@ public: void setScaleAbove(F32 val) { mScaleAbove = val; + setDirtyFlag(true); setLLSDDirty(); } @@ -193,6 +203,7 @@ public: void setScaleBelow(F32 val) { mScaleBelow = val; + setDirtyFlag(true); setLLSDDirty(); } @@ -204,6 +215,7 @@ public: void setWave1Dir(LLVector2 val) { mWave1Dir = val; + setDirtyFlag(true); setLLSDDirty(); } @@ -215,6 +227,7 @@ public: void setWave2Dir(LLVector2 val) { mWave2Dir = val; + setDirtyFlag(true); setLLSDDirty(); } -- cgit v1.2.3 From e71215dcfdb960f64a7f10d2fba71790f8e7bcd1 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 12 Sep 2024 14:32:43 +0300 Subject: viewer#2529 Optimize LLSettingsWater::blend --- indra/llinventory/llsettingswater.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llinventory/llsettingswater.h') diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h index 9d229e6a0b..82fc37cfb3 100644 --- a/indra/llinventory/llsettingswater.h +++ b/indra/llinventory/llsettingswater.h @@ -65,7 +65,8 @@ public: virtual void blend(LLSettingsBase::ptr_t &end, F64 blendf) SETTINGS_OVERRIDE; virtual void replaceSettings(LLSD settings) SETTINGS_OVERRIDE; - void replaceWithWater(LLSettingsWater::ptr_t other); + virtual void replaceSettings(const LLSettingsBase::ptr_t& other_water) override; + void replaceWithWater(const LLSettingsWater::ptr_t& other); static LLSD defaults(const LLSettingsBase::TrackPosition& position = 0.0f); -- cgit v1.2.3