aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/lightshare.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2010-07-31 01:11:11 -0500
committerJacek Antonelli2010-08-01 00:33:38 -0500
commitb6478ed527c35a817a72f351fae2169ed7ba2827 (patch)
treed8b4e8ecfa682cba6607d9a6945d0308513dfa1d /linden/indra/newview/lightshare.cpp
parentAdded notification option to ignore all LightShare until you change regions. (diff)
downloadmeta-impy-b6478ed527c35a817a72f351fae2169ed7ba2827.zip
meta-impy-b6478ed527c35a817a72f351fae2169ed7ba2827.tar.gz
meta-impy-b6478ed527c35a817a72f351fae2169ed7ba2827.tar.bz2
meta-impy-b6478ed527c35a817a72f351fae2169ed7ba2827.tar.xz
Tidied up and documented lightshare.cpp and lightshare.h.
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/lightshare.cpp26
1 files changed, 11 insertions, 15 deletions
diff --git a/linden/indra/newview/lightshare.cpp b/linden/indra/newview/lightshare.cpp
index b2bbb96..1d87ab1 100644
--- a/linden/indra/newview/lightshare.cpp
+++ b/linden/indra/newview/lightshare.cpp
@@ -2,7 +2,7 @@
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).
4 * 4 *
5 * Copyright (c) 2010, Tom Meta / Meta7 5 * Copyright (c) 2010, Tom Grimshaw (Tom Meta)
6 * Copyright (c) 2010, Jacek Antonelli 6 * Copyright (c) 2010, Jacek Antonelli
7 * 7 *
8 * The source code in this file ("Source Code") is provided to you 8 * The source code in this file ("Source Code") is provided to you
@@ -30,8 +30,6 @@
30#include "lightshare.h" 30#include "lightshare.h"
31 31
32#include "linden_common.h" 32#include "linden_common.h"
33
34#include "lluuid.h"
35#include "llviewercontrol.h" 33#include "llviewercontrol.h"
36#include "llwaterparammanager.h" 34#include "llwaterparammanager.h"
37#include "llwaterparamset.h" 35#include "llwaterparamset.h"
@@ -41,7 +39,6 @@
41#include "meta7windlight.h" 39#include "meta7windlight.h"
42 40
43 41
44// The names of the presets where the region settings are stored.
45const std::string WindlightMessage::sWaterPresetName = "(Region settings)"; 42const std::string WindlightMessage::sWaterPresetName = "(Region settings)";
46const std::string WindlightMessage::sSkyPresetName = "(Region settings)"; 43const std::string WindlightMessage::sSkyPresetName = "(Region settings)";
47 44
@@ -82,7 +79,7 @@ WindlightMessage::WindlightMessage( LLMessageSystem* msg ) :
82 79
83 mWater = new LLWaterParamSet(); 80 mWater = new LLWaterParamSet();
84 mSky = new LLWLParamSet(); 81 mSky = new LLWLParamSet();
85 mWaterNormal = LLUUID(); 82 mWaterNormal = new LLUUID();
86 83
87 process_packet(&buf[0]); 84 process_packet(&buf[0]);
88 process_water(); 85 process_water();
@@ -97,6 +94,7 @@ WindlightMessage::~WindlightMessage()
97{ 94{
98 delete mWater; 95 delete mWater;
99 delete mSky; 96 delete mSky;
97 delete mWaterNormal;
100} 98}
101 99
102 100
@@ -127,8 +125,8 @@ void WindlightMessage::processWindlight(LLMessageSystem* msg, void**)
127 if( !ignoreTimerHasExpired() ) 125 if( !ignoreTimerHasExpired() )
128 { 126 {
129 // The user recently ignored a windlight message, so ignore 127 // The user recently ignored a windlight message, so ignore
130 // this one too, and reset the timer. 128 // this one too, and restart the timer.
131 resetIgnoreTimer(); 129 restartIgnoreTimer();
132 delete wl; 130 delete wl;
133 return; 131 return;
134 } 132 }
@@ -145,10 +143,8 @@ void WindlightMessage::processWindlight(LLMessageSystem* msg, void**)
145 // No most recent, so store this and create notification 143 // No most recent, so store this and create notification
146 // asking the user whether to apply or not. 144 // asking the user whether to apply or not.
147 sMostRecent = wl; 145 sMostRecent = wl;
148 LLNotifications::instance() 146 LLNotifications::instance().add("ConfirmLightShare", LLSD(), LLSD(),
149 .add("ConfirmLightShare", 147 boost::bind(&applyCallback, _1, _2));
150 LLSD(), LLSD(),
151 boost::bind(&applyCallback, _1, _2));
152 return; 148 return;
153 } 149 }
154 else 150 else
@@ -177,7 +173,7 @@ bool WindlightMessage::applyCallback(const LLSD& notification,
177 } 173 }
178 case 1:{ 174 case 1:{
179 // "Not Now", ignore until the region stops spamming 175 // "Not Now", ignore until the region stops spamming
180 resetIgnoreTimer(); 176 restartIgnoreTimer();
181 break; 177 break;
182 } 178 }
183 case 2:{ 179 case 2:{
@@ -202,7 +198,7 @@ void WindlightMessage::resetRegion()
202 198
203 199
204// static 200// static
205void WindlightMessage::resetIgnoreTimer() 201void WindlightMessage::restartIgnoreTimer()
206{ 202{
207 F32 time = gSavedSettings.getF32("LightShareIgnoreTimer"); 203 F32 time = gSavedSettings.getF32("LightShareIgnoreTimer");
208 sIgnoreTimer->start(); 204 sIgnoreTimer->start();
@@ -226,7 +222,7 @@ bool WindlightMessage::apply()
226 water_mgr->addParamSet( sWaterPresetName, *mWater ); 222 water_mgr->addParamSet( sWaterPresetName, *mWater );
227 water_mgr->savePreset( sWaterPresetName ); 223 water_mgr->savePreset( sWaterPresetName );
228 water_mgr->loadPreset( sWaterPresetName, true ); 224 water_mgr->loadPreset( sWaterPresetName, true );
229 water_mgr->setNormalMapID( mWaterNormal ); 225 water_mgr->setNormalMapID( *mWaterNormal );
230 226
231 mSky->mName = sSkyPresetName; 227 mSky->mName = sSkyPresetName;
232 sky_mgr->mAnimator.mIsRunning = false; 228 sky_mgr->mAnimator.mIsRunning = false;
@@ -306,7 +302,7 @@ void WindlightMessage::process_water()
306 (U8)(mPacket->normalMapTexture[14]), 302 (U8)(mPacket->normalMapTexture[14]),
307 (U8)(mPacket->normalMapTexture[15])); 303 (U8)(mPacket->normalMapTexture[15]));
308 304
309 mWaterNormal.set(uuid); 305 mWaterNormal->set(uuid);
310} 306}
311 307
312 308