aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/lightshare.h
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/lightshare.h')
-rw-r--r--linden/indra/newview/lightshare.h65
1 files changed, 23 insertions, 42 deletions
diff --git a/linden/indra/newview/lightshare.h b/linden/indra/newview/lightshare.h
index e3cccf0..1df2084 100644
--- a/linden/indra/newview/lightshare.h
+++ b/linden/indra/newview/lightshare.h
@@ -30,23 +30,19 @@
30#define LIGHTSHARE_H 30#define LIGHTSHARE_H
31 31
32#include <string> 32#include <string>
33#include "llwlparamset.h"
34#include "llwaterparamset.h"
35#include "lluuid.h"
33 36
34struct Meta7WindlightPacket; 37struct Meta7WindlightPacket;
35class LLMessageSystem;
36class LLSD;
37class LLTimer;
38class LLUUID;
39class LLWaterParamSet;
40class LLWLParamSet;
41 38
42 39
43// Encapsulates a "Windlight" (LightShare) message sent from the 40// Encapsulates a "Windlight" (LightShare) message sent from the
44// region, allowing the settings to be applied at a later time. 41// region, allowing the settings to be applied at a later time.
45// 42//
46class WindlightMessage 43class LightShare
47{ 44{
48 public: 45public:
49
50 // The meanings of the LightShareAllowed user setting. 46 // The meanings of the LightShareAllowed user setting.
51 enum LIGHTSHARE_ALLOWED 47 enum LIGHTSHARE_ALLOWED
52 { 48 {
@@ -55,61 +51,40 @@ class WindlightMessage
55 LIGHTSHARE_ALWAYS = 2, 51 LIGHTSHARE_ALWAYS = 2,
56 }; 52 };
57 53
58 // Constructs a new WindlightMessage instance from a GenericMessage 54 // Constructs a new LightShare instance from a GenericMessage
59 // with the "Windlight" method, such as those sent by a 55 // with the "Windlight" method, such as those sent by a
60 // Lightshare-enabled OpenSim region. 56 // Lightshare-enabled OpenSim region.
61 WindlightMessage( LLMessageSystem* msg ); 57 LightShare( LLMessageSystem* msg );
62
63 ~WindlightMessage();
64
65 // The name of the water preset where the region settings are stored.
66 static const std::string sWaterPresetName;
67 58
68 // The name of the sky preset where the region settings are stored. 59 ~LightShare();
69 static const std::string sSkyPresetName;
70 60
71 // Message handler for GenericMessage with the "Windlight" method. 61 // Message handler for GenericMessage with the "Windlight" method.
72 // Creates and applies a new WindlightMessage (or prompts user). 62 // Creates and applies a new LightShare (or prompts user).
73 static void processWindlight(LLMessageSystem* msg, void**); 63 static void processWindlight(LLMessageSystem* msg, void**);
74 64
75 // Callback when the user interacts with the notification. 65 static void applyMaybe(LLWaterParamSet* thisWater, LLUUID* thisVaterNormal, LLWLParamSet* thisSky);
76 static bool applyCallback(const LLSD& notification,
77 const LLSD& response);
78 66
79 // Called after the user has entered a new region, to reset the 67 // Called after the user has entered a new region, to reset the
80 // "ignore while in this region" state. 68 // "ignore while in this region" state.
81 static void resetRegion(); 69 static void resetRegion();
82 70
83 // Applies/activates the Windlight settings from the message.
84 bool apply();
85
86 // Returns true if the message contains valid Windlight settings. 71 // Returns true if the message contains valid Windlight settings.
87 // (But there's no real validation yet, so this is always true.) 72 // (But there's no real validation yet, so this is always true.)
88 bool isValid(); 73 bool isValid();
89 74
90 75private:
91 protected:
92
93 // Restart the timer for temporarily ignoring settings.
94 static void restartIgnoreTimer();
95
96 // Returns true if the ignore timer has expired (i.e. new settings
97 // should not be ignored anymore).
98 static bool ignoreTimerHasExpired();
99
100
101 private:
102
103 static WindlightMessage* sMostRecent;
104 static LLTimer* sIgnoreTimer; 76 static LLTimer* sIgnoreTimer;
105 static bool sIgnoreRegion; 77 static bool sIgnoreRegion;
106 78
107 Meta7WindlightPacket* mPacket; 79 Meta7WindlightPacket* mPacket;
108 LLWaterParamSet* mWater; 80 static LLWaterParamSet* mWater;
109 LLWLParamSet* mSky; 81 static LLWLParamSet* mSky;
110 LLUUID* mWaterNormal; 82 static LLUUID* mWaterNormal;
111 bool mIsValid; 83 bool mIsValid;
112 84
85 // Callback when the user interacts with the notification.
86 static bool applyCallback(const LLSD& notification, const LLSD& response);
87
113 // Converts the message's raw bytes into a Meta7WindlightPacket. 88 // Converts the message's raw bytes into a Meta7WindlightPacket.
114 void process_packet( char* buf ); 89 void process_packet( char* buf );
115 90
@@ -119,6 +94,12 @@ class WindlightMessage
119 // Constructs a LLWLParamSet from the Meta7WindlightPacket. 94 // Constructs a LLWLParamSet from the Meta7WindlightPacket.
120 void process_sky(); 95 void process_sky();
121 96
97 // Restart the timer for temporarily ignoring settings.
98 static void restartIgnoreTimer();
99
100 // Returns true if the ignore timer has expired (i.e. new settings
101 // should not be ignored anymore).
102 static bool ignoreTimerHasExpired();
122}; 103};
123 104
124#endif 105#endif