diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llettherebelight.h (renamed from linden/indra/newview/lightshare.h) | 92 |
1 files changed, 50 insertions, 42 deletions
diff --git a/linden/indra/newview/lightshare.h b/linden/indra/newview/llettherebelight.h index 4792823..d83e827 100644 --- a/linden/indra/newview/lightshare.h +++ b/linden/indra/newview/llettherebelight.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * @file lightshare.h | 2 | * @file llettherebelight.h |
3 | * @brief WindlightMessage class definition. | 3 | * @brief WindlightMessage class definition. |
4 | * | 4 | * |
5 | * Copyright (c) 2010, Jacek Antonelli | 5 | * Copyright (c) 2010, Jacek Antonelli |
@@ -30,23 +30,34 @@ | |||
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 | ||
34 | struct Meta7WindlightPacket; | 37 | struct Meta7WindlightPacket; |
35 | class LLMessageSystem; | ||
36 | class LLSD; | ||
37 | class LLTimer; | ||
38 | class LLUUID; | ||
39 | class LLWaterParamSet; | ||
40 | class LLWLParamSet; | ||
41 | 38 | ||
42 | 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 | |||
43 | // Encapsulates a "Windlight" (LightShare) message sent from the | 55 | // Encapsulates a "Windlight" (LightShare) message sent from the |
44 | // region, allowing the settings to be applied at a later time. | 56 | // region, allowing the settings to be applied at a later time. |
45 | // | 57 | // |
46 | class WindlightMessage | 58 | class LightShare |
47 | { | 59 | { |
48 | public: | 60 | public: |
49 | |||
50 | // The meanings of the LightShareAllowed user setting. | 61 | // The meanings of the LightShareAllowed user setting. |
51 | enum LIGHTSHARE_ALLOWED | 62 | enum LIGHTSHARE_ALLOWED |
52 | { | 63 | { |
@@ -55,66 +66,54 @@ class WindlightMessage | |||
55 | LIGHTSHARE_ALWAYS = 2, | 66 | LIGHTSHARE_ALWAYS = 2, |
56 | }; | 67 | }; |
57 | 68 | ||
58 | // Constructs a new WindlightMessage instance from a GenericMessage | 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 | |||
76 | // Constructs a new LightShare instance from a GenericMessage | ||
59 | // with the "Windlight" method, such as those sent by a | 77 | // with the "Windlight" method, such as those sent by a |
60 | // Lightshare-enabled OpenSim region. | 78 | // Lightshare-enabled OpenSim region. |
61 | WindlightMessage( LLMessageSystem* msg ); | 79 | LightShare( LLMessageSystem* msg ); |
62 | 80 | ||
63 | ~WindlightMessage(); | 81 | ~LightShare(); |
64 | |||
65 | // The name of the water preset where the region settings are stored. | ||
66 | static const std::string sWaterPresetName; | ||
67 | |||
68 | // The name of the sky preset where the region settings are stored. | ||
69 | static const std::string sSkyPresetName; | ||
70 | 82 | ||
71 | // The name of the preset where the backup settings are stored. | 83 | // The name of the preset where the backup settings are stored. |
72 | static const std::string sBackupWaterPresetName; | 84 | static const std::string sBackupWaterPresetName; |
73 | static const std::string sBackupSkyPresetName; | 85 | static const std::string sBackupSkyPresetName; |
74 | 86 | ||
75 | // Message handler for GenericMessage with the "Windlight" method. | 87 | // Message handler for GenericMessage with the "Windlight" method. |
76 | // Creates and applies a new WindlightMessage (or prompts user). | 88 | // Creates and applies a new LightShare (or prompts user). |
77 | static void processWindlight(LLMessageSystem* msg, void**); | 89 | static void processWindlight(LLMessageSystem* msg, void**); |
78 | 90 | ||
79 | // Callback when the user interacts with the notification. | 91 | static void applyMaybe(LLWaterParamSet* thisWater, LLUUID* thisVaterNormal, LLWLParamSet* thisSky); |
80 | static bool applyCallback(const LLSD& notification, | ||
81 | const LLSD& response); | ||
82 | 92 | ||
83 | // Called after the user has entered a new region, to reset the | 93 | // Called after the user has entered a new region, to reset the |
84 | // "ignore while in this region" state. | 94 | // "ignore while in this region" state. |
85 | // Also resets/deactivates the Windlight settings in response to the "WindlightReset" method. | 95 | // Also resets/deactivates the Windlight settings in response to the "WindlightReset" method. |
86 | static void resetRegion(); | 96 | static void resetRegion(); |
87 | 97 | ||
88 | // Applies/activates the Windlight settings from the message. | ||
89 | bool apply(); | ||
90 | |||
91 | // Returns true if the message contains valid Windlight settings. | 98 | // Returns true if the message contains valid Windlight settings. |
92 | // (But there's no real validation yet, so this is always true.) | 99 | // (But there's no real validation yet, so this is always true.) |
93 | bool isValid(); | 100 | bool isValid(); |
94 | 101 | ||
102 | static void apply(LLWaterParamSet * newWater, LLUUID *newWaterNormal, LLWLParamSet *newSky, WLScope scope); | ||
95 | 103 | ||
96 | protected: | 104 | private: |
97 | |||
98 | // Restart the timer for temporarily ignoring settings. | ||
99 | static void restartIgnoreTimer(); | ||
100 | |||
101 | // Returns true if the ignore timer has expired (i.e. new settings | ||
102 | // should not be ignored anymore). | ||
103 | static bool ignoreTimerHasExpired(); | ||
104 | |||
105 | |||
106 | private: | ||
107 | |||
108 | static WindlightMessage* sMostRecent; | ||
109 | static LLTimer* sIgnoreTimer; | 105 | static LLTimer* sIgnoreTimer; |
110 | static bool sIgnoreRegion; | 106 | static bool sIgnoreRegion; |
111 | 107 | ||
112 | Meta7WindlightPacket* mPacket; | 108 | Meta7WindlightPacket* mPacket; |
113 | LLWaterParamSet* mWater; | 109 | static LLWaterParamSet* mWater; |
114 | LLWLParamSet* mSky; | 110 | static LLWLParamSet* mSky; |
115 | LLUUID* mWaterNormal; | 111 | static LLUUID* mWaterNormal; |
116 | bool mIsValid; | 112 | bool mIsValid; |
117 | 113 | ||
114 | // Callback when the user interacts with the notification. | ||
115 | static bool applyCallback(const LLSD& notification, const LLSD& response); | ||
116 | |||
118 | // Converts the message's raw bytes into a Meta7WindlightPacket. | 117 | // Converts the message's raw bytes into a Meta7WindlightPacket. |
119 | void process_packet( char* buf ); | 118 | void process_packet( char* buf ); |
120 | 119 | ||
@@ -124,6 +123,15 @@ class WindlightMessage | |||
124 | // Constructs a LLWLParamSet from the Meta7WindlightPacket. | 123 | // Constructs a LLWLParamSet from the Meta7WindlightPacket. |
125 | void process_sky(); | 124 | void process_sky(); |
126 | 125 | ||
126 | // Restart the timer for temporarily ignoring settings. | ||
127 | static void restartIgnoreTimer(); | ||
128 | |||
129 | // Returns true if the ignore timer has expired (i.e. new settings | ||
130 | // should not be ignored anymore). | ||
131 | static bool ignoreTimerHasExpired(); | ||
132 | |||
133 | static void mergeWaterSets(LLWaterParamSet* thisSet, LLWaterParamSet* oldSet); | ||
134 | static void mergeWLSets(LLWLParamSet* thisSet, LLWLParamSet* oldSet); | ||
127 | }; | 135 | }; |
128 | 136 | ||
129 | #endif | 137 | #endif |