diff options
Diffstat (limited to 'linden/indra/newview')
-rw-r--r-- | linden/indra/newview/lightshare.cpp | 210 | ||||
-rw-r--r-- | linden/indra/newview/lightshare.h | 27 | ||||
-rw-r--r-- | linden/indra/newview/llwaterparammanager.cpp | 11 | ||||
-rw-r--r-- | linden/indra/newview/llwaterparamset.h | 1 | ||||
-rw-r--r-- | linden/indra/newview/llwlparammanager.cpp | 117 | ||||
-rw-r--r-- | linden/indra/newview/llwlparammanager.h | 16 | ||||
-rw-r--r-- | linden/indra/newview/llwlparamset.h | 2 |
7 files changed, 243 insertions, 141 deletions
diff --git a/linden/indra/newview/lightshare.cpp b/linden/indra/newview/lightshare.cpp index 378a755..db391f5 100644 --- a/linden/indra/newview/lightshare.cpp +++ b/linden/indra/newview/lightshare.cpp | |||
@@ -1,9 +1,10 @@ | |||
1 | /** | 1 | /** |
2 | * @file lightshare.cpp | 2 | * @file lightshare.cpp |
3 | * @brief Handler for Meta7 Lightshare (region-side Windlight settings). | 3 | * @brief Handler for Meta7 Lightshare (region-side Windlight settings), and other methods of sharing WindLight. |
4 | * | 4 | * |
5 | * Copyright (c) 2010, Tom Grimshaw (Tom Meta) | 5 | * Copyright (c) 2010, Tom Grimshaw (Tom Meta) |
6 | * Copyright (c) 2010, Jacek Antonelli | 6 | * Copyright (c) 2010, Jacek Antonelli |
7 | * Copyright (c) 2012, David Seikel | ||
7 | * | 8 | * |
8 | * The source code in this file ("Source Code") is provided to you | 9 | * The source code in this file ("Source Code") is provided to you |
9 | * under the terms of the GNU General Public License, version 2.0 | 10 | * under the terms of the GNU General Public License, version 2.0 |
@@ -43,6 +44,10 @@ | |||
43 | #include "llworld.h" | 44 | #include "llworld.h" |
44 | 45 | ||
45 | 46 | ||
47 | const std::string LightShare::sRegionPresetName = "(Region settings)"; | ||
48 | const std::string LightShare::sParcelPresetName = "(Parcel settings)"; | ||
49 | const std::string LightShare::sRLVPresetName = "(RLV settings)"; | ||
50 | |||
46 | 51 | ||
47 | LLWaterParamSet* LightShare::mWater = NULL; | 52 | LLWaterParamSet* LightShare::mWater = NULL; |
48 | LLWLParamSet* LightShare::mSky = NULL; | 53 | LLWLParamSet* LightShare::mSky = NULL; |
@@ -131,12 +136,12 @@ void LightShare::applyMaybe(LLWaterParamSet* thisWater, LLUUID* thisWaterNormal, | |||
131 | // If they are using region settings already, or LightShare is | 136 | // If they are using region settings already, or LightShare is |
132 | // always allowed, just apply the new settings, don't bother asking. | 137 | // always allowed, just apply the new settings, don't bother asking. |
133 | if( gSavedSettings.getU32("LightShareAllowed") == LIGHTSHARE_ALWAYS || | 138 | if( gSavedSettings.getU32("LightShareAllowed") == LIGHTSHARE_ALWAYS || |
134 | (sky == LLWLParamManager::sSkyPresetName && water == LLWLParamManager::sWaterPresetName) ) | 139 | (sky == sRegionPresetName && water == sRegionPresetName) ) |
135 | { | 140 | { |
136 | mSky = thisSky; | 141 | mSky = thisSky; |
137 | mWater = thisWater; | 142 | mWater = thisWater; |
138 | mWaterNormal = thisWaterNormal; | 143 | mWaterNormal = thisWaterNormal; |
139 | LLWLParamManager::apply(mWater, mWaterNormal, mSky); | 144 | apply(mWater, mWaterNormal, mSky, WL_SCOPE_REGION); |
140 | return; | 145 | return; |
141 | } | 146 | } |
142 | 147 | ||
@@ -182,7 +187,7 @@ bool LightShare::applyCallback(const LLSD& notification, const LLSD& response) | |||
182 | { | 187 | { |
183 | case 0:{ | 188 | case 0:{ |
184 | // "Apply" | 189 | // "Apply" |
185 | LLWLParamManager::apply(mWater, mWaterNormal, mSky); | 190 | apply(mWater, mWaterNormal, mSky, WL_SCOPE_REGION); |
186 | 191 | ||
187 | break; | 192 | break; |
188 | } | 193 | } |
@@ -205,7 +210,7 @@ bool LightShare::applyCallback(const LLSD& notification, const LLSD& response) | |||
205 | void LightShare::resetRegion() | 210 | void LightShare::resetRegion() |
206 | { | 211 | { |
207 | sIgnoreRegion = false; | 212 | sIgnoreRegion = false; |
208 | LLWorld::getInstance()->rebuildClouds(gAgent.getRegion()); | 213 | apply(NULL, NULL, NULL, WL_SCOPE_REGION); |
209 | } | 214 | } |
210 | 215 | ||
211 | // static | 216 | // static |
@@ -222,6 +227,201 @@ bool LightShare::ignoreTimerHasExpired() | |||
222 | return sIgnoreTimer->hasExpired(); | 227 | return sIgnoreTimer->hasExpired(); |
223 | } | 228 | } |
224 | 229 | ||
230 | // TODO - have regionSet and parcelSet be arrays, so we can deal with height zones. | ||
231 | static struct WLCombined userSet, regionSet, parcelSet, RLVSet; | ||
232 | |||
233 | // TODO - should spread this merging stuff around, | ||
234 | // so that eventually we can get rid of almost identical code for water and sky. | ||
235 | // Then one of these two methods goes away. | ||
236 | |||
237 | //static | ||
238 | void LightShare::mergeWaterSets(LLWaterParamSet* thisSet, LLWaterParamSet* oldSet) | ||
239 | { | ||
240 | for(LLSD::map_const_iterator i = thisSet->mParamValues.beginMap(); | ||
241 | i != thisSet->mParamValues.endMap(); | ||
242 | ++i) | ||
243 | { | ||
244 | const std::string& param = i->first; | ||
245 | |||
246 | if(i->second.isArray()) | ||
247 | { | ||
248 | for (int j = 0; j < i->second.size(); j++) | ||
249 | { | ||
250 | oldSet->mParamValues[param][j] = i->second[j].asReal(); | ||
251 | } | ||
252 | } | ||
253 | else if(i->second.isReal()) | ||
254 | oldSet->mParamValues[param] = i->second.asReal(); | ||
255 | } | ||
256 | } | ||
257 | |||
258 | //static | ||
259 | void LightShare::mergeWLSets(LLWLParamSet* thisSet, LLWLParamSet* oldSet) | ||
260 | { | ||
261 | for(LLSD::map_const_iterator i = thisSet->mParamValues.beginMap(); | ||
262 | i != thisSet->mParamValues.endMap(); | ||
263 | ++i) | ||
264 | { | ||
265 | const std::string& param = i->first; | ||
266 | |||
267 | if(i->second.isArray()) | ||
268 | { | ||
269 | for (int j = 0; j < i->second.size(); j++) | ||
270 | { | ||
271 | oldSet->mParamValues[param][j] = i->second[j].asReal(); | ||
272 | } | ||
273 | } | ||
274 | else if(i->second.isReal()) | ||
275 | oldSet->mParamValues[param] = i->second.asReal(); | ||
276 | } | ||
277 | } | ||
278 | |||
279 | //static | ||
280 | void LightShare::apply(LLWaterParamSet * newWater, LLUUID *newWaterNormal, LLWLParamSet *newSky, WLScope scope) | ||
281 | // TODO - Deal with day cycle stuff. | ||
282 | { | ||
283 | LLWaterParamManager* waterMgr = LLWaterParamManager::instance(); | ||
284 | LLWLParamManager* skyMgr = LLWLParamManager::instance(); | ||
285 | LLWaterParamSet oldWaterSet = waterMgr->mCurParams; | ||
286 | LLWLParamSet oldWLSet = skyMgr->mCurParams; | ||
287 | struct WLCombined* thisSet = &userSet; | ||
288 | bool user = true; | ||
289 | |||
290 | switch(scope) | ||
291 | { | ||
292 | case WL_SCOPE_USER : | ||
293 | { | ||
294 | thisSet = &userSet; | ||
295 | thisSet->water.mName = waterMgr->mCurParams.mName; | ||
296 | thisSet->sky.mName = skyMgr->mCurParams.mName; | ||
297 | thisSet->enabled = true; | ||
298 | // Check if user selected to show the saved region or parcel settings. | ||
299 | if (newSky && (sRegionPresetName == skyMgr->mCurParams.mName)) | ||
300 | thisSet->enabled = false; | ||
301 | if (newWater && (sParcelPresetName == skyMgr->mCurParams.mName)) | ||
302 | thisSet->enabled = false; | ||
303 | break; | ||
304 | } | ||
305 | case WL_SCOPE_REGION : | ||
306 | { | ||
307 | thisSet = ®ionSet; | ||
308 | thisSet->water.mName = sRegionPresetName; | ||
309 | thisSet->sky.mName = sRegionPresetName; | ||
310 | thisSet->enabled = (gSavedSettings.getU32("LightShareAllowed") != LIGHTSHARE_NEVER); | ||
311 | break; | ||
312 | } | ||
313 | case WL_SCOPE_PARCEL : | ||
314 | { | ||
315 | thisSet = &parcelSet; | ||
316 | thisSet->water.mName = sParcelPresetName; | ||
317 | thisSet->sky.mName = sParcelPresetName; | ||
318 | thisSet->enabled = (gSavedSettings.getU32("LightShareAllowed") != LIGHTSHARE_NEVER); | ||
319 | break; | ||
320 | } | ||
321 | case WL_SCOPE_RLV : | ||
322 | { | ||
323 | thisSet = &RLVSet; | ||
324 | thisSet->water.mName = sRLVPresetName; | ||
325 | thisSet->sky.mName = sRLVPresetName; | ||
326 | // TODO set enabled properly. | ||
327 | break; | ||
328 | } | ||
329 | } | ||
330 | |||
331 | if (newWater) | ||
332 | thisSet->water.setAll(newWater->getAll()); | ||
333 | if (newWaterNormal) | ||
334 | thisSet->water.mParamValues["normalMap"] = *newWaterNormal; | ||
335 | if (newSky) | ||
336 | thisSet->sky.setAll(newSky->getAll()); | ||
337 | |||
338 | if ((NULL == newWater) && (NULL == newSky)) | ||
339 | thisSet->enabled = false; | ||
340 | |||
341 | F32 fade = 0; //Instant | ||
342 | bool error; | ||
343 | fade = thisSet->sky.getFloat("fade", error); | ||
344 | |||
345 | if (fade) | ||
346 | { | ||
347 | // TODO - should copy the original, then set that here. | ||
348 | // The fade should delete this copy once it's done fading. | ||
349 | // Dunno if we actually need to do any of this anyway. | ||
350 | waterMgr->removeParamSet( oldWaterSet.mName, false ); | ||
351 | waterMgr->addParamSet( oldWaterSet.mName, oldWaterSet ); | ||
352 | waterMgr->setNormalMapID( *newWaterNormal ); | ||
353 | waterMgr->getParamSet(oldWaterSet.mName, waterMgr->mCurParams); | ||
354 | waterMgr->propagateParameters(); | ||
355 | |||
356 | skyMgr->removeParamSet( oldWLSet.mName, false ); | ||
357 | skyMgr->addParamSet( oldWLSet.mName, oldWLSet ); | ||
358 | skyMgr->getParamSet(oldWLSet.mName, skyMgr->mCurParams); | ||
359 | skyMgr->propagateParameters(); | ||
360 | } | ||
361 | |||
362 | if (regionSet.enabled) | ||
363 | { | ||
364 | waterMgr->setParamSet( regionSet.water.mName, regionSet.water ); | ||
365 | skyMgr->setParamSet( regionSet.sky.mName, regionSet.sky ); | ||
366 | mergeWaterSets(&(regionSet.water), &oldWaterSet); | ||
367 | mergeWLSets(&(regionSet.sky), &oldWLSet); | ||
368 | } | ||
369 | else | ||
370 | { | ||
371 | waterMgr->removeParamSet( regionSet.water.mName, false ); | ||
372 | skyMgr->removeParamSet( regionSet.sky.mName, false ); | ||
373 | } | ||
374 | if (parcelSet.enabled) | ||
375 | { | ||
376 | waterMgr->setParamSet( parcelSet.water.mName, parcelSet.water ); | ||
377 | skyMgr->setParamSet( parcelSet.sky.mName, parcelSet.sky ); | ||
378 | mergeWaterSets(&(parcelSet.water), &oldWaterSet); | ||
379 | mergeWLSets(&(parcelSet.sky), &oldWLSet); | ||
380 | } | ||
381 | else | ||
382 | { | ||
383 | waterMgr->removeParamSet( parcelSet.water.mName, false ); | ||
384 | skyMgr->removeParamSet( parcelSet.sky.mName, false ); | ||
385 | } | ||
386 | if (userSet.enabled) | ||
387 | { | ||
388 | mergeWaterSets(&(userSet.water), &oldWaterSet); | ||
389 | mergeWLSets(&(userSet.sky), &oldWLSet); | ||
390 | } | ||
391 | if (RLVSet.enabled) | ||
392 | { | ||
393 | mergeWaterSets(&(RLVSet.water), &oldWaterSet); | ||
394 | mergeWLSets(&(RLVSet.sky), &oldWLSet); | ||
395 | } | ||
396 | |||
397 | skyMgr->mAnimator.mIsRunning = false; | ||
398 | skyMgr->mAnimator.mUseLindenTime = false; | ||
399 | if (fade) | ||
400 | { | ||
401 | waterMgr->SetMixTime(&oldWaterSet, fade); | ||
402 | skyMgr->SetMixTime(&oldWLSet, fade); | ||
403 | } | ||
404 | else | ||
405 | { | ||
406 | if (newWater) | ||
407 | { | ||
408 | waterMgr->setParamSet( thisSet->water.mName, oldWaterSet ); | ||
409 | waterMgr->setNormalMapID( *newWaterNormal ); | ||
410 | waterMgr->getParamSet(thisSet->water.mName, waterMgr->mCurParams); | ||
411 | waterMgr->propagateParameters(); | ||
412 | } | ||
413 | |||
414 | if (newSky) | ||
415 | { | ||
416 | skyMgr->setParamSet( thisSet->sky.mName, oldWLSet ); | ||
417 | skyMgr->getParamSet(thisSet->sky.mName, skyMgr->mCurParams); | ||
418 | skyMgr->propagateParameters(); | ||
419 | } | ||
420 | } | ||
421 | |||
422 | LLWorld::getInstance()->rebuildClouds(gAgent.getRegion()); | ||
423 | } | ||
424 | |||
225 | bool LightShare::isValid() | 425 | bool LightShare::isValid() |
226 | { | 426 | { |
227 | return mIsValid; | 427 | return mIsValid; |
diff --git a/linden/indra/newview/lightshare.h b/linden/indra/newview/lightshare.h index 1df2084..3561a91 100644 --- a/linden/indra/newview/lightshare.h +++ b/linden/indra/newview/lightshare.h | |||
@@ -37,6 +37,21 @@ | |||
37 | struct Meta7WindlightPacket; | 37 | struct Meta7WindlightPacket; |
38 | 38 | ||
39 | 39 | ||
40 | typedef enum wl_scope | ||
41 | { | ||
42 | WL_SCOPE_USER, | ||
43 | WL_SCOPE_REGION, | ||
44 | WL_SCOPE_PARCEL, | ||
45 | WL_SCOPE_RLV | ||
46 | } WLScope; | ||
47 | |||
48 | struct WLCombined | ||
49 | { | ||
50 | LLWaterParamSet water; | ||
51 | LLWLParamSet sky; | ||
52 | BOOL enabled; | ||
53 | }; | ||
54 | |||
40 | // Encapsulates a "Windlight" (LightShare) message sent from the | 55 | // Encapsulates a "Windlight" (LightShare) message sent from the |
41 | // region, allowing the settings to be applied at a later time. | 56 | // region, allowing the settings to be applied at a later time. |
42 | // | 57 | // |
@@ -51,6 +66,13 @@ public: | |||
51 | LIGHTSHARE_ALWAYS = 2, | 66 | LIGHTSHARE_ALWAYS = 2, |
52 | }; | 67 | }; |
53 | 68 | ||
69 | // The name of the preset where the region settings are stored. | ||
70 | static const std::string sRegionPresetName; | ||
71 | // The name of the preset where the parcel settings are stored. | ||
72 | static const std::string sParcelPresetName; | ||
73 | // The name of the preset where the RLV settings are stored. | ||
74 | static const std::string sRLVPresetName; | ||
75 | |||
54 | // Constructs a new LightShare instance from a GenericMessage | 76 | // Constructs a new LightShare instance from a GenericMessage |
55 | // with the "Windlight" method, such as those sent by a | 77 | // with the "Windlight" method, such as those sent by a |
56 | // Lightshare-enabled OpenSim region. | 78 | // Lightshare-enabled OpenSim region. |
@@ -72,6 +94,8 @@ public: | |||
72 | // (But there's no real validation yet, so this is always true.) | 94 | // (But there's no real validation yet, so this is always true.) |
73 | bool isValid(); | 95 | bool isValid(); |
74 | 96 | ||
97 | static void apply(LLWaterParamSet * newWater, LLUUID *newWaterNormal, LLWLParamSet *newSky, WLScope scope); | ||
98 | |||
75 | private: | 99 | private: |
76 | static LLTimer* sIgnoreTimer; | 100 | static LLTimer* sIgnoreTimer; |
77 | static bool sIgnoreRegion; | 101 | static bool sIgnoreRegion; |
@@ -100,6 +124,9 @@ private: | |||
100 | // Returns true if the ignore timer has expired (i.e. new settings | 124 | // Returns true if the ignore timer has expired (i.e. new settings |
101 | // should not be ignored anymore). | 125 | // should not be ignored anymore). |
102 | static bool ignoreTimerHasExpired(); | 126 | static bool ignoreTimerHasExpired(); |
127 | |||
128 | static void mergeWaterSets(LLWaterParamSet* thisSet, LLWaterParamSet* oldSet); | ||
129 | static void mergeWLSets(LLWLParamSet* thisSet, LLWLParamSet* oldSet); | ||
103 | }; | 130 | }; |
104 | 131 | ||
105 | #endif | 132 | #endif |
diff --git a/linden/indra/newview/llwaterparammanager.cpp b/linden/indra/newview/llwaterparammanager.cpp index 9d0fd86..6e2b420 100644 --- a/linden/indra/newview/llwaterparammanager.cpp +++ b/linden/indra/newview/llwaterparammanager.cpp | |||
@@ -69,6 +69,7 @@ | |||
69 | 69 | ||
70 | #include "llwlparammanager.h" | 70 | #include "llwlparammanager.h" |
71 | #include "llwaterparamset.h" | 71 | #include "llwaterparamset.h" |
72 | #include "lightshare.h" | ||
72 | #include "llpostprocess.h" | 73 | #include "llpostprocess.h" |
73 | #include "llfloaterwater.h" | 74 | #include "llfloaterwater.h" |
74 | 75 | ||
@@ -159,7 +160,7 @@ void LLWaterParamManager::loadPreset(const std::string & name,bool propagate) | |||
159 | if(propagate) | 160 | if(propagate) |
160 | { | 161 | { |
161 | getParamSet(name, mCurParams); | 162 | getParamSet(name, mCurParams); |
162 | propagateParameters(); | 163 | LightShare::apply(&mCurParams, NULL, NULL, WL_SCOPE_USER); |
163 | } | 164 | } |
164 | return; | 165 | return; |
165 | } | 166 | } |
@@ -200,21 +201,21 @@ void LLWaterParamManager::loadPreset(const std::string & name,bool propagate) | |||
200 | if(propagate) | 201 | if(propagate) |
201 | { | 202 | { |
202 | getParamSet(name, mCurParams); | 203 | getParamSet(name, mCurParams); |
203 | propagateParameters(); | 204 | LightShare::apply(&mCurParams, NULL, NULL, WL_SCOPE_USER); |
204 | } | 205 | } |
205 | } | 206 | } |
206 | 207 | ||
207 | bool LLWaterParamManager::loadPresetXML(const std::string& name, std::istream& preset_stream, bool propagate /* = false */, bool check_if_real /* = false */) | 208 | bool LLWaterParamManager::loadPresetXML(const std::string& name, std::istream& preset_stream, bool propagate /* = false */, bool check_if_real /* = false */) |
208 | { | 209 | { |
209 | LLSD paramsData(LLSD::emptyMap()); | 210 | LLSD paramsData(LLSD::emptyMap()); |
210 | 211 | ||
211 | LLPointer<LLSDParser> parser = new LLSDXMLParser(); | 212 | LLPointer<LLSDParser> parser = new LLSDXMLParser(); |
212 | 213 | ||
213 | if(parser->parse(preset_stream, paramsData, LLSDSerialize::SIZE_UNLIMITED) == LLSDParser::PARSE_FAILURE) | 214 | if(parser->parse(preset_stream, paramsData, LLSDSerialize::SIZE_UNLIMITED) == LLSDParser::PARSE_FAILURE) |
214 | { | 215 | { |
215 | return false; | 216 | return false; |
216 | } | 217 | } |
217 | 218 | ||
218 | if(check_if_real) | 219 | if(check_if_real) |
219 | { | 220 | { |
220 | static const char* expected_windlight_settings[] = { | 221 | static const char* expected_windlight_settings[] = { |
diff --git a/linden/indra/newview/llwaterparamset.h b/linden/indra/newview/llwaterparamset.h index f2667ab..09da42b 100644 --- a/linden/indra/newview/llwaterparamset.h +++ b/linden/indra/newview/llwaterparamset.h | |||
@@ -48,6 +48,7 @@ class LLWaterParamSet | |||
48 | { | 48 | { |
49 | friend class LLWaterParamManager; | 49 | friend class LLWaterParamManager; |
50 | friend class LLWLParamManager; | 50 | friend class LLWLParamManager; |
51 | friend class LightShare; | ||
51 | 52 | ||
52 | public: | 53 | public: |
53 | std::string mName; | 54 | std::string mName; |
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 | } | ||
diff --git a/linden/indra/newview/llwlparammanager.h b/linden/indra/newview/llwlparammanager.h index 27e7663..034b2e6 100644 --- a/linden/indra/newview/llwlparammanager.h +++ b/linden/indra/newview/llwlparammanager.h | |||
@@ -230,8 +230,6 @@ public: | |||
230 | static bool isSkySettingsNotecard(std::string name); | 230 | static bool isSkySettingsNotecard(std::string name); |
231 | static bool isSettingsNotecard(std::string name); | 231 | static bool isSettingsNotecard(std::string name); |
232 | 232 | ||
233 | static void apply(LLWaterParamSet * newWater, LLUUID *newWaterNormal, LLWLParamSet *newSky); | ||
234 | |||
235 | public: | 233 | public: |
236 | 234 | ||
237 | // helper variables | 235 | // helper variables |
@@ -288,12 +286,6 @@ public: | |||
288 | // list of all the parameters, listed by name | 286 | // list of all the parameters, listed by name |
289 | std::map<std::string, LLWLParamSet> mParamList; | 287 | std::map<std::string, LLWLParamSet> mParamList; |
290 | 288 | ||
291 | // The name of the water preset where the region settings are stored. | ||
292 | static const std::string sWaterPresetName; | ||
293 | |||
294 | // The name of the sky preset where the region settings are stored. | ||
295 | static const std::string sSkyPresetName; | ||
296 | |||
297 | private: | 289 | private: |
298 | // our parameter manager singleton instance | 290 | // our parameter manager singleton instance |
299 | static LLWLParamManager * sInstance; | 291 | static LLWLParamManager * sInstance; |
@@ -306,7 +298,6 @@ private: | |||
306 | static std::vector<LLWLPresetsObserver*> sObservers; | 298 | static std::vector<LLWLPresetsObserver*> sObservers; |
307 | 299 | ||
308 | static void loadWindlightNotecard(LLVFS *vfs, const LLUUID& asset_id, LLAssetType::EType asset_type, void *user_data, S32 status, LLExtStat ext_status); | 300 | static void loadWindlightNotecard(LLVFS *vfs, const LLUUID& asset_id, LLAssetType::EType asset_type, void *user_data, S32 status, LLExtStat ext_status); |
309 | |||
310 | }; | 301 | }; |
311 | 302 | ||
312 | inline F32 LLWLParamManager::getDomeOffset(void) const | 303 | inline F32 LLWLParamManager::getDomeOffset(void) const |
@@ -334,11 +325,4 @@ inline LLVector4 LLWLParamManager::getRotatedLightDir(void) const | |||
334 | return mRotatedLightDir; | 325 | return mRotatedLightDir; |
335 | } | 326 | } |
336 | 327 | ||
337 | struct WLCombined | ||
338 | { | ||
339 | LLWaterParamSet water; | ||
340 | LLWLParamSet sky; | ||
341 | BOOL enabled; | ||
342 | }; | ||
343 | |||
344 | #endif | 328 | #endif |
diff --git a/linden/indra/newview/llwlparamset.h b/linden/indra/newview/llwlparamset.h index 4b6f336..ce01f84 100644 --- a/linden/indra/newview/llwlparamset.h +++ b/linden/indra/newview/llwlparamset.h | |||
@@ -46,7 +46,7 @@ class LLWLParamSet; | |||
46 | /// A class representing a set of parameter values for the WindLight shaders. | 46 | /// A class representing a set of parameter values for the WindLight shaders. |
47 | class LLWLParamSet { | 47 | class LLWLParamSet { |
48 | 48 | ||
49 | friend class LLWLParamManager; | 49 | friend class LightShare; |
50 | 50 | ||
51 | public: | 51 | public: |
52 | std::string mName; | 52 | std::string mName; |