diff options
Diffstat (limited to 'linden/indra/newview/llettherebelight.h')
-rw-r--r-- | linden/indra/newview/llettherebelight.h | 132 |
1 files changed, 132 insertions, 0 deletions
diff --git a/linden/indra/newview/llettherebelight.h b/linden/indra/newview/llettherebelight.h new file mode 100644 index 0000000..3c997e5 --- /dev/null +++ b/linden/indra/newview/llettherebelight.h | |||
@@ -0,0 +1,132 @@ | |||
1 | /** | ||
2 | * @file llettherebelight.h | ||
3 | * @brief WindlightMessage class definition. | ||
4 | * | ||
5 | * Copyright (c) 2010, Jacek Antonelli | ||
6 | * | ||
7 | * The source code in this file ("Source Code") is provided to you | ||
8 | * under the terms of the GNU General Public License, version 2.0 | ||
9 | * ("GPL"). Terms of the GPL can be found in doc/GPL-license.txt in | ||
10 | * this distribution, or online at | ||
11 | * http://secondlifegrid.net/programs/open_source/licensing/gplv2 | ||
12 | * | ||
13 | * There are special exceptions to the terms and conditions of the GPL as | ||
14 | * it is applied to this Source Code. View the full text of the exception | ||
15 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
16 | * online at | ||
17 | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
18 | * | ||
19 | * By copying, modifying or distributing this software, you acknowledge | ||
20 | * that you have read and understood your obligations described above, | ||
21 | * and agree to abide by those obligations. | ||
22 | * | ||
23 | * ALL SOURCE CODE IS PROVIDED "AS IS." THE AUTHOR MAKES NO | ||
24 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
25 | * COMPLETENESS OR PERFORMANCE. | ||
26 | */ | ||
27 | |||
28 | |||
29 | #ifndef LIGHTSHARE_H | ||
30 | #define LIGHTSHARE_H | ||
31 | |||
32 | #include <string> | ||
33 | #include "llwlparamset.h" | ||
34 | #include "llwaterparamset.h" | ||
35 | #include "lluuid.h" | ||
36 | |||
37 | struct Meta7WindlightPacket; | ||
38 | |||
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 | |||
55 | // Encapsulates a "Windlight" (LightShare) message sent from the | ||
56 | // region, allowing the settings to be applied at a later time. | ||
57 | // | ||
58 | class LightShare | ||
59 | { | ||
60 | public: | ||
61 | // The meanings of the LightShareAllowed user setting. | ||
62 | enum LIGHTSHARE_ALLOWED | ||
63 | { | ||
64 | LIGHTSHARE_NEVER = 0, | ||
65 | LIGHTSHARE_ASK = 1, | ||
66 | LIGHTSHARE_ALWAYS = 2, | ||
67 | }; | ||
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 | |||
76 | // Constructs a new LightShare instance from a GenericMessage | ||
77 | // with the "Windlight" method, such as those sent by a | ||
78 | // Lightshare-enabled OpenSim region. | ||
79 | LightShare( LLMessageSystem* msg ); | ||
80 | |||
81 | ~LightShare(); | ||
82 | |||
83 | // Message handler for GenericMessage with the "Windlight" method. | ||
84 | // Creates and applies a new LightShare (or prompts user). | ||
85 | static void processWindlight(LLMessageSystem* msg, void**); | ||
86 | |||
87 | static void applyMaybe(LLWaterParamSet* thisWater, LLUUID* thisVaterNormal, LLWLParamSet* thisSky); | ||
88 | |||
89 | // Called after the user has entered a new region, to reset the | ||
90 | // "ignore while in this region" state. | ||
91 | static void resetRegion(); | ||
92 | |||
93 | // Returns true if the message contains valid Windlight settings. | ||
94 | // (But there's no real validation yet, so this is always true.) | ||
95 | bool isValid(); | ||
96 | |||
97 | static void apply(LLWaterParamSet * newWater, LLUUID *newWaterNormal, LLWLParamSet *newSky, WLScope scope); | ||
98 | |||
99 | private: | ||
100 | static LLTimer* sIgnoreTimer; | ||
101 | static bool sIgnoreRegion; | ||
102 | |||
103 | Meta7WindlightPacket* mPacket; | ||
104 | static LLWaterParamSet* mWater; | ||
105 | static LLWLParamSet* mSky; | ||
106 | static LLUUID* mWaterNormal; | ||
107 | bool mIsValid; | ||
108 | |||
109 | // Callback when the user interacts with the notification. | ||
110 | static bool applyCallback(const LLSD& notification, const LLSD& response); | ||
111 | |||
112 | // Converts the message's raw bytes into a Meta7WindlightPacket. | ||
113 | void process_packet( char* buf ); | ||
114 | |||
115 | // Constructs a LLWaterParamSet from the Meta7WindlightPacket. | ||
116 | void process_water(); | ||
117 | |||
118 | // Constructs a LLWLParamSet from the Meta7WindlightPacket. | ||
119 | void process_sky(); | ||
120 | |||
121 | // Restart the timer for temporarily ignoring settings. | ||
122 | static void restartIgnoreTimer(); | ||
123 | |||
124 | // Returns true if the ignore timer has expired (i.e. new settings | ||
125 | // should not be ignored anymore). | ||
126 | static bool ignoreTimerHasExpired(); | ||
127 | |||
128 | static void mergeWaterSets(LLWaterParamSet* thisSet, LLWaterParamSet* oldSet); | ||
129 | static void mergeWLSets(LLWLParamSet* thisSet, LLWLParamSet* oldSet); | ||
130 | }; | ||
131 | |||
132 | #endif | ||