aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-04-03 06:46:53 +1000
committerDavid Walter Seikel2012-04-03 06:46:53 +1000
commit76ca42509870ef5c6f1cb7a7204dfbc519fa63da (patch)
treeb0847296e499277de8caf5e98466e716d7c7aa28 /linden
parentRevert the fix for http://redmine.kokuaviewer.org/issues/415 as it will be fi... (diff)
downloadmeta-impy-76ca42509870ef5c6f1cb7a7204dfbc519fa63da.zip
meta-impy-76ca42509870ef5c6f1cb7a7204dfbc519fa63da.tar.gz
meta-impy-76ca42509870ef5c6f1cb7a7204dfbc519fa63da.tar.bz2
meta-impy-76ca42509870ef5c6f1cb7a7204dfbc519fa63da.tar.xz
The next bit of WindLight refactoring, some prep work. Also fixes http://redmine.kokuaviewer.org/issues/415 in a better way.
Diffstat (limited to 'linden')
-rw-r--r--linden/indra/newview/llwaterparamset.h3
-rw-r--r--linden/indra/newview/llwlparammanager.cpp110
-rw-r--r--linden/indra/newview/llwlparammanager.h7
-rw-r--r--linden/indra/newview/llwlparamset.h4
4 files changed, 91 insertions, 33 deletions
diff --git a/linden/indra/newview/llwaterparamset.h b/linden/indra/newview/llwaterparamset.h
index efbad31..f2667ab 100644
--- a/linden/indra/newview/llwaterparamset.h
+++ b/linden/indra/newview/llwaterparamset.h
@@ -47,12 +47,13 @@ class LLWaterParamSet;
47class LLWaterParamSet 47class LLWaterParamSet
48{ 48{
49 friend class LLWaterParamManager; 49 friend class LLWaterParamManager;
50 friend class LLWLParamManager;
50 51
51public: 52public:
52 std::string mName; 53 std::string mName;
53 LLUUID mInventoryID; 54 LLUUID mInventoryID;
54 55
55private: 56protected:
56 57
57 LLSD mParamValues; 58 LLSD mParamValues;
58 59
diff --git a/linden/indra/newview/llwlparammanager.cpp b/linden/indra/newview/llwlparammanager.cpp
index 8f1aa23..75592da 100644
--- a/linden/indra/newview/llwlparammanager.cpp
+++ b/linden/indra/newview/llwlparammanager.cpp
@@ -860,59 +860,109 @@ bool LLWLParamManager::isSettingsNotecard(std::string name)
860 return (isSkySettingsNotecard(name) || isWaterSettingsNotecard(name)); 860 return (isSkySettingsNotecard(name) || isWaterSettingsNotecard(name));
861} 861}
862 862
863
864struct WLCombined userSet, regionSet, parcelSet, RLVSet;
865
863//static 866//static
864void LLWLParamManager::apply(LLWaterParamSet * newWater, LLUUID *newWaterNormal, LLWLParamSet *newSky) 867void LLWLParamManager::apply(LLWaterParamSet * newWater, LLUUID *newWaterNormal, LLWLParamSet *newSky)
868// TODO - Pass in scope and day cycle stuff.
865{ 869{
866 LLWaterParamManager* waterMgr = LLWaterParamManager::instance(); 870 LLWaterParamManager* waterMgr = LLWaterParamManager::instance();
867 LLWLParamManager* skyMgr = LLWLParamManager::instance(); 871 LLWLParamManager* skyMgr = LLWLParamManager::instance();
872 struct WLCombined* thisSet = &userSet;
873
874// if (region == scope)
875 thisSet = &regionSet;
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;
868 889
869 F32 fade = 0; //Instant 890 F32 fade = 0; //Instant
870 bool error; 891 bool error;
871 fade = newSky->getFloat("fade", error); 892 fade = newSky->getFloat("fade", error);
872 893
873 newWater->mName = sWaterPresetName; 894 newWater->mName = sWaterPresetName;
874 if(fade != 0 && waterMgr->mCurParams.mName == sWaterPresetName)//Load the settings forcefully the first time 895 newSky->mName = sSkyPresetName;
896 LLWaterParamSet oldWaterSet = waterMgr->mCurParams;
897 LLWLParamSet oldWLSet = skyMgr->mCurParams;
898
899 if (fade)
875 { 900 {
876 LLWaterParamSet oldWset = waterMgr->mCurParams; 901 // TODO - should copy the original, then set that here.
877 //This still needs done so that we update right, but load it to the old 902 // The fade should delete this copy once it's done fading.
878 waterMgr->removeParamSet( sWaterPresetName, false ); 903 waterMgr->removeParamSet( sWaterPresetName, false );
879 waterMgr->addParamSet( sWaterPresetName, oldWset ); 904 waterMgr->addParamSet( sWaterPresetName, oldWaterSet );
880 waterMgr->savePreset( sWaterPresetName );
881 waterMgr->loadPreset( sWaterPresetName, true ); 905 waterMgr->loadPreset( sWaterPresetName, true );
882 waterMgr->setNormalMapID( *newWaterNormal ); 906 waterMgr->setNormalMapID( *newWaterNormal );
883 //Then mix with the new 907
884 waterMgr->SetMixTime(newWater, fade); 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();
885 } 928 }
886 else 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)
887 { 935 {
888 //Instant if fade is 0 936 const std::string& param = i->first;
889 waterMgr->removeParamSet( sWaterPresetName, false ); 937
890 waterMgr->addParamSet( sWaterPresetName, *newWater ); 938 if(i->second.isArray())
891 waterMgr->savePreset( sWaterPresetName ); 939 {
892 waterMgr->loadPreset( sWaterPresetName, true ); 940 for (int j = 0; j < i->second.size(); j++)
893 waterMgr->setNormalMapID( *newWaterNormal ); 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();
894 } 947 }
895 948
896 newSky->mName = sSkyPresetName; 949// TODO - If RLV enabled
897 if(fade != 0 && skyMgr->mCurParams.mName == sSkyPresetName)//Load the settings forcefully the first time 950// Loop through RLVSet, setting the values into the old one, but keeping old values that are not in RLVSet
951
952 if (fade)
898 { 953 {
899 LLWLParamSet oldset = skyMgr->mCurParams; 954 waterMgr->SetMixTime(&oldWaterSet, fade);
900 //This still needs done so that we update right, but load it to the old 955 skyMgr->SetMixTime(&oldWLSet, fade);
901 skyMgr->removeParamSet( sSkyPresetName, true );
902 skyMgr->addParamSet( sSkyPresetName, oldset );
903 skyMgr->savePreset( sSkyPresetName );
904 skyMgr->loadPreset( sSkyPresetName, true );
905 //Then mix with the new
906 skyMgr->SetMixTime(newSky, fade);
907 } 956 }
908 else 957 else
909 { 958 {
910 //Instant if fade is 0 959 waterMgr->removeParamSet( sWaterPresetName, false );
911 skyMgr->mAnimator.mIsRunning = false; 960 waterMgr->addParamSet( sWaterPresetName, oldWaterSet );
912 skyMgr->mAnimator.mUseLindenTime = false; 961 waterMgr->loadPreset( sWaterPresetName, true );
913 skyMgr->removeParamSet( sSkyPresetName, false ); 962 waterMgr->setNormalMapID( *newWaterNormal );
914 skyMgr->addParamSet( sSkyPresetName, *newSky ); 963
915 skyMgr->savePreset( sSkyPresetName ); 964 skyMgr->removeParamSet( sSkyPresetName, true );
965 skyMgr->addParamSet( sSkyPresetName, oldWLSet );
916 skyMgr->loadPreset( sSkyPresetName, true ); 966 skyMgr->loadPreset( sSkyPresetName, true );
917 } 967 }
918 968
diff --git a/linden/indra/newview/llwlparammanager.h b/linden/indra/newview/llwlparammanager.h
index 66975fa..4c7fdc1 100644
--- a/linden/indra/newview/llwlparammanager.h
+++ b/linden/indra/newview/llwlparammanager.h
@@ -333,4 +333,11 @@ inline LLVector4 LLWLParamManager::getRotatedLightDir(void) const
333 return mRotatedLightDir; 333 return mRotatedLightDir;
334} 334}
335 335
336struct WLCombined
337{
338 LLWaterParamSet water;
339 LLWLParamSet sky;
340 BOOL enabled;
341};
342
336#endif 343#endif
diff --git a/linden/indra/newview/llwlparamset.h b/linden/indra/newview/llwlparamset.h
index 3a59f6b..4b6f336 100644
--- a/linden/indra/newview/llwlparamset.h
+++ b/linden/indra/newview/llwlparamset.h
@@ -51,8 +51,8 @@ class LLWLParamSet {
51public: 51public:
52 std::string mName; 52 std::string mName;
53 LLUUID mInventoryID; 53 LLUUID mInventoryID;
54 54
55private: 55protected:
56 56
57 LLSD mParamValues; 57 LLSD mParamValues;
58 58