diff options
Diffstat (limited to 'linden/indra/newview/llwlparammanager.cpp')
-rw-r--r-- | linden/indra/newview/llwlparammanager.cpp | 117 |
1 files changed, 3 insertions, 114 deletions
diff --git a/linden/indra/newview/llwlparammanager.cpp b/linden/indra/newview/llwlparammanager.cpp index 75592da..b4d999c 100644 --- a/linden/indra/newview/llwlparammanager.cpp +++ b/linden/indra/newview/llwlparammanager.cpp | |||
@@ -34,6 +34,7 @@ | |||
34 | 34 | ||
35 | #include "llwlparammanager.h" | 35 | #include "llwlparammanager.h" |
36 | #include "llwaterparammanager.h" | 36 | #include "llwaterparammanager.h" |
37 | #include "lightshare.h" | ||
37 | 38 | ||
38 | #include "pipeline.h" | 39 | #include "pipeline.h" |
39 | #include "llsky.h" | 40 | #include "llsky.h" |
@@ -77,9 +78,6 @@ | |||
77 | 78 | ||
78 | #include "curl/curl.h" | 79 | #include "curl/curl.h" |
79 | 80 | ||
80 | const std::string LLWLParamManager::sWaterPresetName = "(Region settings)"; | ||
81 | const std::string LLWLParamManager::sSkyPresetName = "(Region settings)"; | ||
82 | |||
83 | LLWLParamManager * LLWLParamManager::sInstance = NULL; | 81 | LLWLParamManager * LLWLParamManager::sInstance = NULL; |
84 | std::vector<LLWLPresetsObserver*> LLWLParamManager::sObservers; | 82 | std::vector<LLWLPresetsObserver*> LLWLParamManager::sObservers; |
85 | LLFrameTimer wlSmoothTransitionTimer; | 83 | LLFrameTimer wlSmoothTransitionTimer; |
@@ -346,7 +344,7 @@ void LLWLParamManager::loadPreset(const std::string & name,bool propagate) | |||
346 | if(propagate) | 344 | if(propagate) |
347 | { | 345 | { |
348 | getParamSet(name, mCurParams); | 346 | getParamSet(name, mCurParams); |
349 | propagateParameters(); | 347 | LightShare::apply(NULL, NULL, &mCurParams, WL_SCOPE_USER); |
350 | } | 348 | } |
351 | return; | 349 | return; |
352 | } | 350 | } |
@@ -388,7 +386,7 @@ void LLWLParamManager::loadPreset(const std::string & name,bool propagate) | |||
388 | if(propagate) | 386 | if(propagate) |
389 | { | 387 | { |
390 | getParamSet(name, mCurParams); | 388 | getParamSet(name, mCurParams); |
391 | propagateParameters(); | 389 | LightShare::apply(NULL, NULL, &mCurParams, WL_SCOPE_USER); |
392 | } | 390 | } |
393 | 391 | ||
394 | notifyObservers(); | 392 | notifyObservers(); |
@@ -859,112 +857,3 @@ bool LLWLParamManager::isSettingsNotecard(std::string name) | |||
859 | { | 857 | { |
860 | return (isSkySettingsNotecard(name) || isWaterSettingsNotecard(name)); | 858 | return (isSkySettingsNotecard(name) || isWaterSettingsNotecard(name)); |
861 | } | 859 | } |
862 | |||
863 | |||
864 | struct WLCombined userSet, regionSet, parcelSet, RLVSet; | ||
865 | |||
866 | //static | ||
867 | void LLWLParamManager::apply(LLWaterParamSet * newWater, LLUUID *newWaterNormal, LLWLParamSet *newSky) | ||
868 | // TODO - Pass in scope and day cycle stuff. | ||
869 | { | ||
870 | LLWaterParamManager* waterMgr = LLWaterParamManager::instance(); | ||
871 | LLWLParamManager* skyMgr = LLWLParamManager::instance(); | ||
872 | struct WLCombined* thisSet = &userSet; | ||
873 | |||
874 | // if (region == scope) | ||
875 | thisSet = ®ionSet; | ||
876 | // if (parcel== scope) | ||
877 | // thisSet = &parcelSet; | ||
878 | // if (RLV == scope) | ||
879 | // thisSet = &RLVSet; | ||
880 | |||
881 | thisSet->water.setAll(newWater->getAll()); | ||
882 | thisSet->water.mParamValues["normalMap"] = *newWaterNormal; | ||
883 | thisSet->sky.setAll(newSky->getAll()); | ||
884 | |||
885 | // TODO - if scope is region or parcel, and not using server settings | ||
886 | // return | ||
887 | |||
888 | thisSet->enabled = true; | ||
889 | |||
890 | F32 fade = 0; //Instant | ||
891 | bool error; | ||
892 | fade = newSky->getFloat("fade", error); | ||
893 | |||
894 | newWater->mName = sWaterPresetName; | ||
895 | newSky->mName = sSkyPresetName; | ||
896 | LLWaterParamSet oldWaterSet = waterMgr->mCurParams; | ||
897 | LLWLParamSet oldWLSet = skyMgr->mCurParams; | ||
898 | |||
899 | if (fade) | ||
900 | { | ||
901 | // TODO - should copy the original, then set that here. | ||
902 | // The fade should delete this copy once it's done fading. | ||
903 | waterMgr->removeParamSet( sWaterPresetName, false ); | ||
904 | waterMgr->addParamSet( sWaterPresetName, oldWaterSet ); | ||
905 | waterMgr->loadPreset( sWaterPresetName, true ); | ||
906 | waterMgr->setNormalMapID( *newWaterNormal ); | ||
907 | |||
908 | skyMgr->removeParamSet( sSkyPresetName, true ); | ||
909 | skyMgr->addParamSet( sSkyPresetName, oldWLSet ); | ||
910 | skyMgr->loadPreset( sSkyPresetName, true ); | ||
911 | } | ||
912 | |||
913 | for(LLSD::map_const_iterator i = thisSet->water.mParamValues.beginMap(); | ||
914 | i != thisSet->water.mParamValues.endMap(); | ||
915 | ++i) | ||
916 | { | ||
917 | const std::string& param = i->first; | ||
918 | |||
919 | if(i->second.isArray()) | ||
920 | { | ||
921 | for (int j = 0; j < i->second.size(); j++) | ||
922 | { | ||
923 | oldWaterSet.mParamValues[param][j] = i->second[j].asReal(); | ||
924 | } | ||
925 | } | ||
926 | else if(i->second.isReal()) | ||
927 | oldWaterSet.mParamValues[param] = i->second.asReal(); | ||
928 | } | ||
929 | |||
930 | skyMgr->mAnimator.mIsRunning = false; | ||
931 | skyMgr->mAnimator.mUseLindenTime = false; | ||
932 | for(LLSD::map_const_iterator i = thisSet->sky.mParamValues.beginMap(); | ||
933 | i != thisSet->sky.mParamValues.endMap(); | ||
934 | ++i) | ||
935 | { | ||
936 | const std::string& param = i->first; | ||
937 | |||
938 | if(i->second.isArray()) | ||
939 | { | ||
940 | for (int j = 0; j < i->second.size(); j++) | ||
941 | { | ||
942 | oldWLSet.mParamValues[param][j] = i->second[j].asReal(); | ||
943 | } | ||
944 | } | ||
945 | else if(i->second.isReal()) | ||
946 | oldWLSet.mParamValues[param] = i->second.asReal(); | ||
947 | } | ||
948 | |||
949 | // TODO - If RLV enabled | ||
950 | // Loop through RLVSet, setting the values into the old one, but keeping old values that are not in RLVSet | ||
951 | |||
952 | if (fade) | ||
953 | { | ||
954 | waterMgr->SetMixTime(&oldWaterSet, fade); | ||
955 | skyMgr->SetMixTime(&oldWLSet, fade); | ||
956 | } | ||
957 | else | ||
958 | { | ||
959 | waterMgr->removeParamSet( sWaterPresetName, false ); | ||
960 | waterMgr->addParamSet( sWaterPresetName, oldWaterSet ); | ||
961 | waterMgr->loadPreset( sWaterPresetName, true ); | ||
962 | waterMgr->setNormalMapID( *newWaterNormal ); | ||
963 | |||
964 | skyMgr->removeParamSet( sSkyPresetName, true ); | ||
965 | skyMgr->addParamSet( sSkyPresetName, oldWLSet ); | ||
966 | skyMgr->loadPreset( sSkyPresetName, true ); | ||
967 | } | ||
968 | |||
969 | LLWorld::getInstance()->rebuildClouds(gAgent.getRegion()); | ||
970 | } | ||