From cdfd66eec27355930a50309273961ad4bc7e4606 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 5 Apr 2011 22:58:53 -0700 Subject: STORM-610 : Changes to water color and density in the Environment Editor now persist between sessions. --- indra/newview/llwaterparammanager.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'indra/newview/llwaterparammanager.cpp') diff --git a/indra/newview/llwaterparammanager.cpp b/indra/newview/llwaterparammanager.cpp index d239347810..3d3d43e20d 100644 --- a/indra/newview/llwaterparammanager.cpp +++ b/indra/newview/llwaterparammanager.cpp @@ -72,6 +72,7 @@ LLWaterParamManager::LLWaterParamManager() : mWave1Dir(.5f, .5f, "wave1Dir"), mWave2Dir(.5f, .5f, "wave2Dir"), mDensitySliderValue(1.0f), + mPrevFogDensity(16.0f), // 2^4 mWaterFogKS(1.0f) { } @@ -265,6 +266,20 @@ void LLWaterParamManager::update(LLViewerCamera * cam) // update the shaders and the menu propagateParameters(); + // If water fog color has been changed, save it. + if (mPrevFogColor != mFogColor) + { + gSavedSettings.setColor4("WaterFogColor", mFogColor); + mPrevFogColor = mFogColor; + } + + // If water fog density has been changed, save it. + if (mPrevFogDensity != mFogDensity) + { + gSavedSettings.setF32("WaterFogDensity", mFogDensity); + mPrevFogDensity = mFogDensity; + } + // sync menus if they exist LLFloaterWater* waterfloater = LLFloaterReg::findTypedInstance("env_water"); if(waterfloater) @@ -449,7 +464,20 @@ LLWaterParamManager * LLWaterParamManager::instance() sInstance->loadAllPresets(LLStringUtil::null); sInstance->getParamSet("Default", sInstance->mCurParams); + sInstance->initOverrides(); } return sInstance; } + +void LLWaterParamManager::initOverrides() +{ + // Override fog color from the current preset with the saved setting. + LLColor4 fog_color_override = gSavedSettings.getColor4("WaterFogColor"); + mCurParams.set("waterFogColor", mPrevFogColor = mFogColor = fog_color_override); + + // Do the same with fog density. + F32 fog_density = gSavedSettings.getF32("WaterFogDensity"); + mCurParams.set("waterFogDensity", mPrevFogDensity = mFogDensity = fog_density); + setDensitySliderValue(mFogDensity.mExp); +} -- cgit v1.2.3 From 74787fda486a68e344caf125fc76c80ca9c40822 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 6 Apr 2011 14:51:00 -0700 Subject: STORM-610 : Fix init of and default color value --- indra/newview/llwaterparammanager.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'indra/newview/llwaterparammanager.cpp') diff --git a/indra/newview/llwaterparammanager.cpp b/indra/newview/llwaterparammanager.cpp index 3d3d43e20d..4b3a9a4dc3 100644 --- a/indra/newview/llwaterparammanager.cpp +++ b/indra/newview/llwaterparammanager.cpp @@ -73,6 +73,7 @@ LLWaterParamManager::LLWaterParamManager() : mWave2Dir(.5f, .5f, "wave2Dir"), mDensitySliderValue(1.0f), mPrevFogDensity(16.0f), // 2^4 + mPrevFogColor(22.f/255.f, 43.f/255.f, 54.f/255.f, 0.0f), mWaterFogKS(1.0f) { } @@ -474,10 +475,14 @@ void LLWaterParamManager::initOverrides() { // Override fog color from the current preset with the saved setting. LLColor4 fog_color_override = gSavedSettings.getColor4("WaterFogColor"); - mCurParams.set("waterFogColor", mPrevFogColor = mFogColor = fog_color_override); + mFogColor = fog_color_override; + mPrevFogColor = fog_color_override; + mCurParams.set("waterFogColor", fog_color_override); // Do the same with fog density. F32 fog_density = gSavedSettings.getF32("WaterFogDensity"); - mCurParams.set("waterFogDensity", mPrevFogDensity = mFogDensity = fog_density); + mPrevFogDensity = fog_density; + mFogDensity = fog_density; + mCurParams.set("waterFogDensity", fog_density); setDensitySliderValue(mFogDensity.mExp); } -- cgit v1.2.3 From e213a36f703629dcfe27ed65ac1f66a5a5194b67 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Wed, 11 May 2011 18:12:23 +0300 Subject: STORM-477 Restored the backed out changeset: b62b260aa04d --- indra/newview/llwaterparammanager.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'indra/newview/llwaterparammanager.cpp') diff --git a/indra/newview/llwaterparammanager.cpp b/indra/newview/llwaterparammanager.cpp index 4b3a9a4dc3..67bb965f99 100644 --- a/indra/newview/llwaterparammanager.cpp +++ b/indra/newview/llwaterparammanager.cpp @@ -33,6 +33,7 @@ #include "pipeline.h" #include "llsky.h" +#include "lldiriterator.h" #include "llfloaterreg.h" #include "llsliderctrl.h" #include "llspinctrl.h" @@ -87,11 +88,12 @@ void LLWaterParamManager::loadAllPresets(const std::string& file_name) std::string path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/water", "")); LL_DEBUGS2("AppInit", "Shaders") << "Loading Default water settings from " << path_name << LL_ENDL; - bool found = true; + bool found = true; + LLDirIterator app_settings_iter(path_name, "*.xml"); while(found) { std::string name; - found = gDirUtilp->getNextFileInDir(path_name, "*.xml", name); + found = app_settings_iter.next(name); if(found) { @@ -113,11 +115,12 @@ void LLWaterParamManager::loadAllPresets(const std::string& file_name) std::string path_name2(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight/water", "")); LL_DEBUGS2("AppInit", "Shaders") << "Loading User water settings from " << path_name2 << LL_ENDL; - found = true; + found = true; + LLDirIterator user_settings_iter(path_name2, "*.xml"); while(found) { std::string name; - found = gDirUtilp->getNextFileInDir(path_name2, "*.xml", name); + found = user_settings_iter.next(name); if(found) { name=name.erase(name.length()-4); -- cgit v1.2.3