diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llettherebelight.cpp (renamed from linden/indra/newview/lightshare.cpp) | 358 |
1 files changed, 244 insertions, 114 deletions
diff --git a/linden/indra/newview/lightshare.cpp b/linden/indra/newview/llettherebelight.cpp index 599a527..7fc2a3d 100644 --- a/linden/indra/newview/lightshare.cpp +++ b/linden/indra/newview/llettherebelight.cpp | |||
@@ -1,9 +1,10 @@ | |||
1 | /** | 1 | /** |
2 | * @file lightshare.cpp | 2 | * @file llettherebelight.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 |
@@ -27,7 +28,6 @@ | |||
27 | */ | 28 | */ |
28 | 29 | ||
29 | 30 | ||
30 | #include "lightshare.h" | ||
31 | 31 | ||
32 | #include "linden_common.h" | 32 | #include "linden_common.h" |
33 | #include "llviewercontrol.h" | 33 | #include "llviewercontrol.h" |
@@ -38,30 +38,26 @@ | |||
38 | #include "message.h" | 38 | #include "message.h" |
39 | #include "meta7windlight.h" | 39 | #include "meta7windlight.h" |
40 | 40 | ||
41 | #include "llettherebelight.h" | ||
41 | 42 | ||
42 | const std::string WindlightMessage::sWaterPresetName = "(Region settings)"; | 43 | #include "llagent.h" |
43 | const std::string WindlightMessage::sSkyPresetName = "(Region settings)"; | 44 | #include "llworld.h" |
44 | const std::string WindlightMessage::sBackupWaterPresetName = "(Backup settings)"; | ||
45 | const std::string WindlightMessage::sBackupSkyPresetName = "(Backup settings)"; | ||
46 | 45 | ||
47 | // Backups. | ||
48 | LLWaterParamSet waterBackup; | ||
49 | LLWLParamSet skyBackup; | ||
50 | //LLUUID* waterNormalBackup = NULL; | ||
51 | bool animatorIsRunning = true; | ||
52 | bool animatorUseEstateTime = true; | ||
53 | bool backup = false; | ||
54 | 46 | ||
55 | WindlightMessage* WindlightMessage::sMostRecent = NULL; | 47 | const std::string LightShare::sRegionPresetName = "(Region settings)"; |
56 | LLTimer* WindlightMessage::sIgnoreTimer = new LLTimer(); | 48 | const std::string LightShare::sParcelPresetName = "(Parcel settings)"; |
57 | bool WindlightMessage::sIgnoreRegion = false; | 49 | const std::string LightShare::sRLVPresetName = "(RLV settings)"; |
58 | 50 | ||
59 | 51 | ||
60 | WindlightMessage::WindlightMessage( LLMessageSystem* msg ) : | 52 | LLWaterParamSet* LightShare::mWater = NULL; |
53 | LLWLParamSet* LightShare::mSky = NULL; | ||
54 | LLUUID* LightShare::mWaterNormal = NULL; | ||
55 | LLTimer* LightShare::sIgnoreTimer = new LLTimer(); | ||
56 | bool LightShare::sIgnoreRegion = false; | ||
57 | |||
58 | |||
59 | LightShare::LightShare( LLMessageSystem* msg ) : | ||
61 | mPacket(NULL), | 60 | mPacket(NULL), |
62 | mWater(NULL), | ||
63 | mSky(NULL), | ||
64 | mWaterNormal(NULL), | ||
65 | mIsValid(false) | 61 | mIsValid(false) |
66 | { | 62 | { |
67 | std::string method; | 63 | std::string method; |
@@ -86,10 +82,7 @@ WindlightMessage::WindlightMessage( LLMessageSystem* msg ) : | |||
86 | buf, size, 0, 249); | 82 | buf, size, 0, 249); |
87 | 83 | ||
88 | mWater = new LLWaterParamSet(); | 84 | mWater = new LLWaterParamSet(); |
89 | // mSky = new LLWLParamSet(); | 85 | mSky = new LLWLParamSet(); |
90 | LLWLParamManager * wl_param_mgr = LLWLParamManager::instance(); | ||
91 | static LLWLParamSet & sSky = wl_param_mgr->mCurParams; | ||
92 | mSky = &sSky; | ||
93 | 86 | ||
94 | mWaterNormal = new LLUUID(); | 87 | mWaterNormal = new LLUUID(); |
95 | 88 | ||
@@ -102,21 +95,21 @@ WindlightMessage::WindlightMessage( LLMessageSystem* msg ) : | |||
102 | } | 95 | } |
103 | 96 | ||
104 | 97 | ||
105 | WindlightMessage::~WindlightMessage() | 98 | LightShare::~LightShare() |
106 | { | 99 | { |
107 | delete mWater; | 100 | delete mWater; |
108 | // delete mSky; | 101 | delete mSky; |
109 | delete mWaterNormal; | 102 | delete mWaterNormal; |
110 | } | 103 | } |
111 | 104 | ||
112 | 105 | ||
113 | // static | 106 | // static |
114 | void WindlightMessage::processWindlight(LLMessageSystem* msg, void**) | 107 | void LightShare::processWindlight(LLMessageSystem* msg, void**) |
115 | { | 108 | { |
116 | if( gSavedSettings.getU32("LightShareAllowed") <= LIGHTSHARE_NEVER ) | 109 | if( gSavedSettings.getU32("LightShareAllowed") <= LIGHTSHARE_NEVER ) |
117 | return; | 110 | return; |
118 | 111 | ||
119 | WindlightMessage* wl = new WindlightMessage(msg); | 112 | LightShare* wl = new LightShare(msg); |
120 | 113 | ||
121 | if (!wl) | 114 | if (!wl) |
122 | return; | 115 | return; |
@@ -127,16 +120,28 @@ void WindlightMessage::processWindlight(LLMessageSystem* msg, void**) | |||
127 | return; | 120 | return; |
128 | } | 121 | } |
129 | 122 | ||
123 | applyMaybe(wl->mWater, wl->mWaterNormal, wl->mSky); | ||
124 | } | ||
125 | |||
126 | |||
127 | //static | ||
128 | void LightShare::applyMaybe(LLWaterParamSet* thisWater, LLUUID* thisWaterNormal, LLWLParamSet* thisSky) | ||
129 | { | ||
130 | if( gSavedSettings.getU32("LightShareAllowed") <= LIGHTSHARE_NEVER ) | ||
131 | return; | ||
132 | |||
130 | std::string water = LLWaterParamManager::instance()->mCurParams.mName; | 133 | std::string water = LLWaterParamManager::instance()->mCurParams.mName; |
131 | std::string sky = LLWLParamManager::instance()->mCurParams.mName; | 134 | std::string sky = LLWLParamManager::instance()->mCurParams.mName; |
132 | 135 | ||
133 | // If they are using region settings already, or LightShare is | 136 | // If they are using region settings already, or LightShare is |
134 | // always allowed, just apply the new settings, don't bother asking. | 137 | // always allowed, just apply the new settings, don't bother asking. |
135 | if( gSavedSettings.getU32("LightShareAllowed") == LIGHTSHARE_ALWAYS || | 138 | if( gSavedSettings.getU32("LightShareAllowed") == LIGHTSHARE_ALWAYS || |
136 | (sky == sSkyPresetName && water == sWaterPresetName) ) | 139 | (sky == sRegionPresetName && water == sRegionPresetName) ) |
137 | { | 140 | { |
138 | wl->apply(); | 141 | mSky = thisSky; |
139 | delete wl; | 142 | mWater = thisWater; |
143 | mWaterNormal = thisWaterNormal; | ||
144 | apply(mWater, mWaterNormal, mSky, WL_SCOPE_REGION); | ||
140 | return; | 145 | return; |
141 | } | 146 | } |
142 | 147 | ||
@@ -145,41 +150,36 @@ void WindlightMessage::processWindlight(LLMessageSystem* msg, void**) | |||
145 | // The user recently ignored a windlight message, so ignore | 150 | // The user recently ignored a windlight message, so ignore |
146 | // this one too, and restart the timer. | 151 | // this one too, and restart the timer. |
147 | restartIgnoreTimer(); | 152 | restartIgnoreTimer(); |
148 | delete wl; | ||
149 | return; | 153 | return; |
150 | } | 154 | } |
151 | 155 | ||
152 | if(sIgnoreRegion) | 156 | if(sIgnoreRegion) |
153 | { | 157 | { |
154 | // We are ignoring new settings until user enters a new region. | 158 | // We are ignoring new settings until user enters a new region. |
155 | delete wl; | ||
156 | return; | 159 | return; |
157 | } | 160 | } |
158 | 161 | ||
159 | if( gSavedSettings.getU32("LightShareAllowed") == LIGHTSHARE_ASK && | 162 | if( gSavedSettings.getU32("LightShareAllowed") == LIGHTSHARE_ASK && mSky == NULL && mWater == NULL) |
160 | sMostRecent == NULL ) | ||
161 | { | 163 | { |
162 | // No most recent, so store this and create notification | 164 | // No most recent, so store this and create notification |
163 | // asking the user whether to apply or not. | 165 | // asking the user whether to apply or not. |
164 | sMostRecent = wl; | 166 | mSky = thisSky; |
165 | LLNotifications::instance().add("ConfirmLightShare", LLSD(), LLSD(), | 167 | mWater = thisWater; |
168 | mWaterNormal = thisWaterNormal; | ||
169 | LLNotifications::instance().add("ConfirmLightShare", LLSD(), LLSD(), | ||
166 | boost::bind(&applyCallback, _1, _2)); | 170 | boost::bind(&applyCallback, _1, _2)); |
167 | return; | ||
168 | } | 171 | } |
169 | else | 172 | else |
170 | { | 173 | { |
171 | // No new notification (to avoid spamming the user), just | 174 | // No new notification (to avoid spamming the user, we do keep the saves from above) |
172 | // store this as most recent. | 175 | mSky = thisSky; |
173 | delete sMostRecent; | 176 | mWater = thisWater; |
174 | sMostRecent = wl; | 177 | mWaterNormal = thisWaterNormal; |
175 | return; | ||
176 | } | 178 | } |
177 | } | 179 | } |
178 | 180 | ||
179 | |||
180 | // static | 181 | // static |
181 | bool WindlightMessage::applyCallback(const LLSD& notification, | 182 | bool LightShare::applyCallback(const LLSD& notification, const LLSD& response) |
182 | const LLSD& response) | ||
183 | { | 183 | { |
184 | S32 option = LLNotification::getSelectedOption(notification, response); | 184 | S32 option = LLNotification::getSelectedOption(notification, response); |
185 | 185 | ||
@@ -187,7 +187,8 @@ bool WindlightMessage::applyCallback(const LLSD& notification, | |||
187 | { | 187 | { |
188 | case 0:{ | 188 | case 0:{ |
189 | // "Apply" | 189 | // "Apply" |
190 | sMostRecent->apply(); | 190 | apply(mWater, mWaterNormal, mSky, WL_SCOPE_REGION); |
191 | |||
191 | break; | 192 | break; |
192 | } | 193 | } |
193 | case 1:{ | 194 | case 1:{ |
@@ -202,41 +203,18 @@ bool WindlightMessage::applyCallback(const LLSD& notification, | |||
202 | } | 203 | } |
203 | } | 204 | } |
204 | 205 | ||
205 | delete sMostRecent; | ||
206 | sMostRecent = NULL; | ||
207 | |||
208 | return false; | 206 | return false; |
209 | } | 207 | } |
210 | 208 | ||
211 | |||
212 | // static | 209 | // static |
213 | void WindlightMessage::resetRegion() | 210 | void LightShare::resetRegion() |
214 | { | 211 | { |
215 | sIgnoreRegion = false; | 212 | sIgnoreRegion = false; |
216 | 213 | apply(NULL, NULL, NULL, WL_SCOPE_REGION); | |
217 | // According to Melanie Thielker - | ||
218 | // The new WindlightReset message from OpenSim is for resetting Windlight presets when leaving a sim that uses Lightshare. | ||
219 | // Hopefully if you are moving to a sim that has new LightShare data, that gets sent after this reset, or the reset is never sent. | ||
220 | if (backup) | ||
221 | { | ||
222 | LLWaterParamManager* water_mgr = LLWaterParamManager::instance(); | ||
223 | LLWLParamManager* sky_mgr = LLWLParamManager::instance(); | ||
224 | |||
225 | llinfos << "Restoring WindLight presets " << waterBackup.mName << " and " << skyBackup.mName << "." << llendl; | ||
226 | water_mgr->loadPreset(waterBackup.mName, true); | ||
227 | // Don't think we need to do this. | ||
228 | //if (waterNormalBackup) | ||
229 | //water_mgr->setNormalMapID(*waterNormalBackup); | ||
230 | sky_mgr->mAnimator.mIsRunning = animatorIsRunning; | ||
231 | sky_mgr->mAnimator.mUseLindenTime = animatorUseEstateTime; | ||
232 | sky_mgr->loadPreset(skyBackup.mName, true); | ||
233 | backup = false; | ||
234 | } | ||
235 | } | 214 | } |
236 | 215 | ||
237 | |||
238 | // static | 216 | // static |
239 | void WindlightMessage::restartIgnoreTimer() | 217 | void LightShare::restartIgnoreTimer() |
240 | { | 218 | { |
241 | F32 time = gSavedSettings.getF32("LightShareIgnoreTimer"); | 219 | F32 time = gSavedSettings.getF32("LightShareIgnoreTimer"); |
242 | sIgnoreTimer->start(); | 220 | sIgnoreTimer->start(); |
@@ -244,65 +222,219 @@ void WindlightMessage::restartIgnoreTimer() | |||
244 | } | 222 | } |
245 | 223 | ||
246 | // static | 224 | // static |
247 | bool WindlightMessage::ignoreTimerHasExpired() | 225 | bool LightShare::ignoreTimerHasExpired() |
248 | { | 226 | { |
249 | return sIgnoreTimer->hasExpired(); | 227 | return sIgnoreTimer->hasExpired(); |
250 | } | 228 | } |
251 | 229 | ||
230 | // TODO - have regionSet and parcelSet be arrays, so we can deal with height zones. | ||
231 | static struct WLCombined userSet, regionSet, parcelSet, RLVSet; | ||
252 | 232 | ||
253 | bool WindlightMessage::apply() | 233 | // TODO - should spread this merging stuff around, |
254 | { | 234 | // so that eventually we can get rid of almost identical code for water and sky. |
255 | LLWaterParamManager* water_mgr = LLWaterParamManager::instance(); | 235 | // Then one of these two methods goes away. |
256 | LLWLParamManager* sky_mgr = LLWLParamManager::instance(); | ||
257 | 236 | ||
258 | if (!backup) | 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) | ||
259 | { | 243 | { |
260 | llinfos << "Backing up WindLight presets '" << water_mgr->mCurParams.mName << " and " << sky_mgr->mCurParams.mName << "'." << llendl; | 244 | const std::string& param = i->first; |
261 | waterBackup = water_mgr->mCurParams; | 245 | |
262 | //waterNormalBackup = waterBackup->getNormalMapID(); | 246 | if(i->second.isArray()) |
263 | skyBackup = sky_mgr->mCurParams; | 247 | { |
264 | animatorIsRunning = sky_mgr->mAnimator.mIsRunning; | 248 | for (int j = 0; j < i->second.size(); j++) |
265 | animatorUseEstateTime = sky_mgr->mAnimator.mUseLindenTime; | 249 | { |
266 | backup = true; | 250 | oldSet->mParamValues[param][j] = i->second[j].asReal(); |
251 | } | ||
252 | } | ||
253 | else if(i->second.isReal()) | ||
254 | oldSet->mParamValues[param] = i->second.asReal(); | ||
267 | } | 255 | } |
256 | } | ||
268 | 257 | ||
269 | mWater->mName = sWaterPresetName; | 258 | //static |
270 | water_mgr->removeParamSet( sWaterPresetName, false ); | 259 | void LightShare::mergeWLSets(LLWLParamSet* thisSet, LLWLParamSet* oldSet) |
271 | water_mgr->addParamSet( sWaterPresetName, *mWater ); | 260 | { |
272 | // Don't think we need to save it, the load gets the one we added above. | 261 | for(LLSD::map_const_iterator i = thisSet->mParamValues.beginMap(); |
273 | //water_mgr->savePreset( sWaterPresetName ); | 262 | i != thisSet->mParamValues.endMap(); |
274 | water_mgr->loadPreset( sWaterPresetName, true ); | 263 | ++i) |
275 | water_mgr->setNormalMapID( *mWaterNormal ); | 264 | { |
276 | 265 | const std::string& param = i->first; | |
277 | mSky->mName = sSkyPresetName; | 266 | |
278 | sky_mgr->mAnimator.mIsRunning = false; | 267 | if(i->second.isArray()) |
279 | sky_mgr->mAnimator.mUseLindenTime = false; | 268 | { |
280 | sky_mgr->removeParamSet( sSkyPresetName, false ); | 269 | for (int j = 0; j < i->second.size(); j++) |
281 | sky_mgr->addParamSet( sSkyPresetName, *mSky ); | 270 | { |
282 | // Don't think we need to save it, the load gets the one we added above. | 271 | oldSet->mParamValues[param][j] = i->second[j].asReal(); |
283 | //sky_mgr->savePreset( sSkyPresetName ); | 272 | } |
284 | sky_mgr->loadPreset( sSkyPresetName, true ); | 273 | } |
285 | 274 | else if(i->second.isReal()) | |
286 | return true; | 275 | oldSet->mParamValues[param] = i->second.asReal(); |
276 | } | ||
287 | } | 277 | } |
288 | 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()); | ||
289 | 337 | ||
290 | // static | 338 | if ((NULL == newWater) && (NULL == newSky)) |
291 | bool WindlightMessage::isValid() | 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 | |||
425 | bool LightShare::isValid() | ||
292 | { | 426 | { |
293 | return mIsValid; | 427 | return mIsValid; |
294 | } | 428 | } |
295 | 429 | ||
296 | 430 | void LightShare::process_packet( char* buf ) | |
297 | void WindlightMessage::process_packet( char* buf ) | ||
298 | { | 431 | { |
299 | // *FIXME: Horrible idea, fragile, not byte-order or endian | 432 | // *FIXME: Horrible idea, fragile, not byte-order or endian |
300 | // safe, no validation, etc. etc. -Jacek | 433 | // safe, no validation, etc. etc. -Jacek |
301 | mPacket = (Meta7WindlightPacket*)buf; | 434 | mPacket = (Meta7WindlightPacket*)buf; |
302 | } | 435 | } |
303 | 436 | ||
304 | 437 | void LightShare::process_water() | |
305 | void WindlightMessage::process_water() | ||
306 | { | 438 | { |
307 | mWater->set("waterFogColor", | 439 | mWater->set("waterFogColor", |
308 | mPacket->waterColor.red / 256.f, | 440 | mPacket->waterColor.red / 256.f, |
@@ -358,7 +490,7 @@ void WindlightMessage::process_water() | |||
358 | } | 490 | } |
359 | 491 | ||
360 | 492 | ||
361 | void WindlightMessage::process_sky() | 493 | void LightShare::process_sky() |
362 | { | 494 | { |
363 | mSky->setSunAngle(F_TWO_PI * mPacket->sunMoonPosiiton); | 495 | mSky->setSunAngle(F_TWO_PI * mPacket->sunMoonPosiiton); |
364 | mSky->setEastAngle(F_TWO_PI * mPacket->eastAngle); | 496 | mSky->setEastAngle(F_TWO_PI * mPacket->eastAngle); |
@@ -453,5 +585,3 @@ void WindlightMessage::process_sky() | |||
453 | 585 | ||
454 | mSky->setStarBrightness(mPacket->starBrightness); | 586 | mSky->setStarBrightness(mPacket->starBrightness); |
455 | } | 587 | } |
456 | |||
457 | |||