diff options
-rw-r--r-- | linden/indra/newview/CMakeLists.txt | 2 | ||||
-rw-r--r-- | linden/indra/newview/lightshare.cpp | 302 | ||||
-rw-r--r-- | linden/indra/newview/lightshare.h | 67 | ||||
-rw-r--r-- | linden/indra/newview/llviewergenericmessage.cpp | 110 | ||||
-rw-r--r-- | linden/indra/newview/llwindlightremotectrl.cpp | 3 | ||||
-rw-r--r-- | linden/indra/newview/meta7windlight.h | 35 |
6 files changed, 416 insertions, 103 deletions
diff --git a/linden/indra/newview/CMakeLists.txt b/linden/indra/newview/CMakeLists.txt index a5f2cbb..7077dde 100644 --- a/linden/indra/newview/CMakeLists.txt +++ b/linden/indra/newview/CMakeLists.txt | |||
@@ -76,6 +76,7 @@ set(viewer_SOURCE_FILES | |||
76 | hippoRestRequest.cpp | 76 | hippoRestRequest.cpp |
77 | jcfloater_animation_list.cpp | 77 | jcfloater_animation_list.cpp |
78 | jcfloaterareasearch.cpp | 78 | jcfloaterareasearch.cpp |
79 | lightshare.cpp | ||
79 | llagent.cpp | 80 | llagent.cpp |
80 | llagentaccess.cpp | 81 | llagentaccess.cpp |
81 | llagentdata.cpp | 82 | llagentdata.cpp |
@@ -507,6 +508,7 @@ set(viewer_HEADER_FILES | |||
507 | hippoRestRequest.h | 508 | hippoRestRequest.h |
508 | jcfloater_animation_list.h | 509 | jcfloater_animation_list.h |
509 | jcfloaterareasearch.h | 510 | jcfloaterareasearch.h |
511 | lightshare.h | ||
510 | llagent.h | 512 | llagent.h |
511 | llagentaccess.h | 513 | llagentaccess.h |
512 | llagentdata.h | 514 | llagentdata.h |
diff --git a/linden/indra/newview/lightshare.cpp b/linden/indra/newview/lightshare.cpp new file mode 100644 index 0000000..24d4139 --- /dev/null +++ b/linden/indra/newview/lightshare.cpp | |||
@@ -0,0 +1,302 @@ | |||
1 | /** | ||
2 | * @file lightshare.cpp | ||
3 | * @brief Handler for Meta7 Lightshare (region-side Windlight settings). | ||
4 | * | ||
5 | * Copyright (c) 2010, Tom Meta / Meta7 | ||
6 | * Copyright (c) 2010, Jacek Antonelli | ||
7 | * | ||
8 | * 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 | * ("GPL"). Terms of the GPL can be found in doc/GPL-license.txt in | ||
11 | * this distribution, or online at | ||
12 | * http://secondlifegrid.net/programs/open_source/licensing/gplv2 | ||
13 | * | ||
14 | * There are special exceptions to the terms and conditions of the GPL as | ||
15 | * it is applied to this Source Code. View the full text of the exception | ||
16 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
17 | * online at | ||
18 | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
19 | * | ||
20 | * By copying, modifying or distributing this software, you acknowledge | ||
21 | * that you have read and understood your obligations described above, | ||
22 | * and agree to abide by those obligations. | ||
23 | * | ||
24 | * ALL SOURCE CODE IS PROVIDED "AS IS." THE AUTHOR MAKES NO | ||
25 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
26 | * COMPLETENESS OR PERFORMANCE. | ||
27 | */ | ||
28 | |||
29 | |||
30 | #include "lightshare.h" | ||
31 | |||
32 | #include "linden_common.h" | ||
33 | |||
34 | #include "lluuid.h" | ||
35 | #include "llviewercontrol.h" | ||
36 | #include "llwaterparammanager.h" | ||
37 | #include "llwaterparamset.h" | ||
38 | #include "llwlparammanager.h" | ||
39 | #include "llwlparamset.h" | ||
40 | #include "message.h" | ||
41 | #include "meta7windlight.h" | ||
42 | |||
43 | |||
44 | // The names of the presets where the region settings are stored. | ||
45 | const std::string WindlightMessage::sWaterPresetName = "(Region settings)"; | ||
46 | const std::string WindlightMessage::sSkyPresetName = "(Region settings)"; | ||
47 | |||
48 | |||
49 | WindlightMessage::WindlightMessage( LLMessageSystem* msg ) : | ||
50 | mPacket(NULL), | ||
51 | mWater(NULL), | ||
52 | mSky(NULL), | ||
53 | mWaterNormal(NULL), | ||
54 | mIsValid(false) | ||
55 | { | ||
56 | std::string method; | ||
57 | msg->getStringFast(_PREHASH_MethodData, _PREHASH_Method, method); | ||
58 | |||
59 | if( method != "Windlight" ) | ||
60 | { | ||
61 | return; // Wrong message type, somehow. | ||
62 | } | ||
63 | |||
64 | S32 size = msg->getSizeFast(_PREHASH_ParamList, 0, | ||
65 | _PREHASH_Parameter); | ||
66 | |||
67 | if( size < 0 || 250 < size ) | ||
68 | { | ||
69 | return; // Too small or too big. | ||
70 | } | ||
71 | |||
72 | // Unpack and process the message's binary payload. | ||
73 | char buf[250]; | ||
74 | msg->getBinaryDataFast(_PREHASH_ParamList, | ||
75 | _PREHASH_Parameter, | ||
76 | buf, size, 0, 249); | ||
77 | |||
78 | mWater = new LLWaterParamSet(); | ||
79 | mSky = new LLWLParamSet(); | ||
80 | mWaterNormal = LLUUID(); | ||
81 | |||
82 | process_packet(&buf[0]); | ||
83 | process_water(); | ||
84 | process_sky(); | ||
85 | |||
86 | // *TODO: Actually validate the settings. | ||
87 | mIsValid = true; | ||
88 | } | ||
89 | |||
90 | |||
91 | WindlightMessage::~WindlightMessage() | ||
92 | { | ||
93 | delete mWater; | ||
94 | delete mSky; | ||
95 | } | ||
96 | |||
97 | |||
98 | // static | ||
99 | void WindlightMessage::processWindlight(LLMessageSystem* msg, void**) | ||
100 | { | ||
101 | if( gSavedSettings.getBOOL("UseServersideWindlightSettings") ) | ||
102 | { | ||
103 | WindlightMessage wl = WindlightMessage(msg); | ||
104 | if( wl.isValid() ) | ||
105 | { | ||
106 | wl.apply(); | ||
107 | } | ||
108 | } | ||
109 | } | ||
110 | |||
111 | |||
112 | bool WindlightMessage::apply() | ||
113 | { | ||
114 | LLWaterParamManager* water_mgr = LLWaterParamManager::instance(); | ||
115 | LLWLParamManager* sky_mgr = LLWLParamManager::instance(); | ||
116 | |||
117 | mWater->mName = sWaterPresetName; | ||
118 | water_mgr->removeParamSet( sWaterPresetName, false ); | ||
119 | water_mgr->addParamSet( sWaterPresetName, *mWater ); | ||
120 | water_mgr->savePreset( sWaterPresetName ); | ||
121 | water_mgr->loadPreset( sWaterPresetName, true ); | ||
122 | water_mgr->setNormalMapID( mWaterNormal ); | ||
123 | |||
124 | mSky->mName = sSkyPresetName; | ||
125 | sky_mgr->mAnimator.mIsRunning = false; | ||
126 | sky_mgr->mAnimator.mUseLindenTime = false; | ||
127 | sky_mgr->removeParamSet( sSkyPresetName, false ); | ||
128 | sky_mgr->addParamSet( sSkyPresetName, *mSky ); | ||
129 | sky_mgr->savePreset( sSkyPresetName ); | ||
130 | sky_mgr->loadPreset( sSkyPresetName, true ); | ||
131 | |||
132 | return true; | ||
133 | } | ||
134 | |||
135 | |||
136 | bool WindlightMessage::isValid() | ||
137 | { | ||
138 | return mIsValid; | ||
139 | } | ||
140 | |||
141 | |||
142 | void WindlightMessage::process_packet( char* buf ) | ||
143 | { | ||
144 | // *FIXME: Horrible idea, fragile, not byte-order or endian | ||
145 | // safe, no validation, etc. etc. -Jacek | ||
146 | mPacket = (Meta7WindlightPacket*)buf; | ||
147 | } | ||
148 | |||
149 | |||
150 | void WindlightMessage::process_water() | ||
151 | { | ||
152 | mWater->set("waterFogColor", | ||
153 | mPacket->waterColor.red / 256.f, | ||
154 | mPacket->waterColor.green / 256.f, | ||
155 | mPacket->waterColor.blue / 256.f); | ||
156 | |||
157 | mWater->set("waterFogDensity", | ||
158 | pow(2.0f, mPacket->waterFogDensityExponent)); | ||
159 | |||
160 | mWater->set("underWaterFogMod", mPacket->underwaterFogModifier); | ||
161 | |||
162 | mWater->set("normScale", | ||
163 | mPacket->reflectionWaveletScale.X, | ||
164 | mPacket->reflectionWaveletScale.Y, | ||
165 | mPacket->reflectionWaveletScale.Z); | ||
166 | |||
167 | mWater->set("fresnelScale", mPacket->fresnelScale); | ||
168 | mWater->set("fresnelOffset", mPacket->fresnelOffset); | ||
169 | mWater->set("scaleAbove", mPacket->refractScaleAbove); | ||
170 | mWater->set("scaleBelow", mPacket->refractScaleBelow); | ||
171 | mWater->set("blurMultiplier", mPacket->blurMultiplier); | ||
172 | |||
173 | mWater->set("wave1Dir", | ||
174 | mPacket->littleWaveDirection.X, | ||
175 | mPacket->littleWaveDirection.Y); | ||
176 | |||
177 | mWater->set("wave2Dir", | ||
178 | mPacket->bigWaveDirection.X, | ||
179 | mPacket->bigWaveDirection.Y); | ||
180 | |||
181 | |||
182 | // Format a UUID string from a block of raw bytes. Ugh. | ||
183 | std::string uuid = llformat( | ||
184 | "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", | ||
185 | (U8)(mPacket->normalMapTexture[0]), | ||
186 | (U8)(mPacket->normalMapTexture[1]), | ||
187 | (U8)(mPacket->normalMapTexture[2]), | ||
188 | (U8)(mPacket->normalMapTexture[3]), | ||
189 | (U8)(mPacket->normalMapTexture[4]), | ||
190 | (U8)(mPacket->normalMapTexture[5]), | ||
191 | (U8)(mPacket->normalMapTexture[6]), | ||
192 | (U8)(mPacket->normalMapTexture[7]), | ||
193 | (U8)(mPacket->normalMapTexture[8]), | ||
194 | (U8)(mPacket->normalMapTexture[9]), | ||
195 | (U8)(mPacket->normalMapTexture[10]), | ||
196 | (U8)(mPacket->normalMapTexture[11]), | ||
197 | (U8)(mPacket->normalMapTexture[12]), | ||
198 | (U8)(mPacket->normalMapTexture[13]), | ||
199 | (U8)(mPacket->normalMapTexture[14]), | ||
200 | (U8)(mPacket->normalMapTexture[15])); | ||
201 | |||
202 | mWaterNormal.set(uuid); | ||
203 | } | ||
204 | |||
205 | |||
206 | void WindlightMessage::process_sky() | ||
207 | { | ||
208 | mSky->setSunAngle(F_TWO_PI * mPacket->sunMoonPosiiton); | ||
209 | mSky->setEastAngle(F_TWO_PI * mPacket->eastAngle); | ||
210 | |||
211 | mSky->set("sunlight_color", | ||
212 | mPacket->sunMoonColor.red * 3.0f, | ||
213 | mPacket->sunMoonColor.green * 3.0f, | ||
214 | mPacket->sunMoonColor.blue * 3.0f, | ||
215 | mPacket->sunMoonColor.alpha * 3.0f); | ||
216 | |||
217 | mSky->set("ambient", | ||
218 | mPacket->ambient.red * 3.0f, | ||
219 | mPacket->ambient.green * 3.0f, | ||
220 | mPacket->ambient.blue * 3.0f, | ||
221 | mPacket->ambient.alpha * 3.0f); | ||
222 | |||
223 | mSky->set("blue_horizon", | ||
224 | mPacket->horizon.red * 2.0f, | ||
225 | mPacket->horizon.green *2.0f, | ||
226 | mPacket->horizon.blue * 2.0f, | ||
227 | mPacket->horizon.alpha * 2.0f); | ||
228 | |||
229 | mSky->set("blue_density", | ||
230 | mPacket->blueDensity.red * 2.0f, | ||
231 | mPacket->blueDensity.green * 2.0f, | ||
232 | mPacket->blueDensity.blue * 2.0f, | ||
233 | mPacket->blueDensity.alpha * 2.0f); | ||
234 | |||
235 | mSky->set("haze_horizon", | ||
236 | mPacket->hazeHorizon, | ||
237 | mPacket->hazeHorizon, | ||
238 | mPacket->hazeHorizon, | ||
239 | 1.f); | ||
240 | |||
241 | mSky->set("haze_density", | ||
242 | mPacket->hazeDensity, | ||
243 | 0.f, 0.f, 1.f); | ||
244 | |||
245 | mSky->set("cloud_shadow", | ||
246 | mPacket->cloudCoverage, | ||
247 | 0.f, 0.f, 1.f); | ||
248 | |||
249 | mSky->set("density_multiplier", | ||
250 | mPacket->densityMultiplier / 1000.0f, | ||
251 | 0.f, 0.f, 1.f); | ||
252 | |||
253 | mSky->set("distance_multiplier", | ||
254 | mPacket->distanceMultiplier, | ||
255 | 0.f, 0.f, 1.f); | ||
256 | |||
257 | mSky->set("max_y", | ||
258 | (F32)mPacket->maxAltitude, | ||
259 | 0.f, 0.f, 1.f); | ||
260 | |||
261 | mSky->set("cloud_color", | ||
262 | mPacket->cloudColor.red, | ||
263 | mPacket->cloudColor.green, | ||
264 | mPacket->cloudColor.blue, | ||
265 | mPacket->cloudColor.alpha); | ||
266 | |||
267 | mSky->set("cloud_pos_density1", | ||
268 | mPacket->cloudXYDensity.X, | ||
269 | mPacket->cloudXYDensity.Y, | ||
270 | mPacket->cloudXYDensity.Z, | ||
271 | 1.f); | ||
272 | |||
273 | mSky->set("cloud_pos_density2", | ||
274 | mPacket->cloudDetailXYDensity.X, | ||
275 | mPacket->cloudDetailXYDensity.Y, | ||
276 | mPacket->cloudDetailXYDensity.Z, | ||
277 | 1.f); | ||
278 | |||
279 | mSky->set("cloud_scale", | ||
280 | mPacket->cloudScale, | ||
281 | 0.f, 0.f, 1.f); | ||
282 | |||
283 | mSky->set("gamma", | ||
284 | mPacket->sceneGamma, | ||
285 | 0.f, 0.f, 1.f); | ||
286 | |||
287 | mSky->set("glow", | ||
288 | (2 - mPacket->sunGlowSize) * 20, | ||
289 | 0.f, | ||
290 | -mPacket->sunGlowFocus * 5, | ||
291 | 1.f); | ||
292 | |||
293 | mSky->setCloudScrollX(mPacket->cloudScrollX + 10.0f); | ||
294 | mSky->setCloudScrollY(mPacket->cloudScrollY + 10.0f); | ||
295 | |||
296 | mSky->setEnableCloudScrollX(!mPacket->cloudScrollXLock); | ||
297 | mSky->setEnableCloudScrollY(!mPacket->cloudScrollYLock); | ||
298 | |||
299 | mSky->setStarBrightness(mPacket->starBrightness); | ||
300 | } | ||
301 | |||
302 | |||
diff --git a/linden/indra/newview/lightshare.h b/linden/indra/newview/lightshare.h new file mode 100644 index 0000000..a76cd1b --- /dev/null +++ b/linden/indra/newview/lightshare.h | |||
@@ -0,0 +1,67 @@ | |||
1 | /** | ||
2 | * @file lightshare.h | ||
3 | * @brief Public interface for lightshare.cpp | ||
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 "message.h" | ||
33 | #include "meta7windlight.h" | ||
34 | #include "llwaterparamset.h" | ||
35 | #include "llwlparamset.h" | ||
36 | |||
37 | |||
38 | // Encapsulates a "Windlight" (LightShare) message sent from the | ||
39 | // server, allowing the settings to be applied at a later time. | ||
40 | // | ||
41 | class WindlightMessage | ||
42 | { | ||
43 | public: | ||
44 | |||
45 | static const std::string sWaterPresetName; | ||
46 | static const std::string sSkyPresetName; | ||
47 | |||
48 | WindlightMessage( LLMessageSystem* msg ); | ||
49 | ~WindlightMessage(); | ||
50 | static void processWindlight(LLMessageSystem* msg, void**); | ||
51 | bool apply(); | ||
52 | bool isValid(); | ||
53 | |||
54 | private: | ||
55 | |||
56 | Meta7WindlightPacket* mPacket; | ||
57 | LLWaterParamSet* mWater; | ||
58 | LLWLParamSet* mSky; | ||
59 | LLUUID mWaterNormal; | ||
60 | bool mIsValid; | ||
61 | |||
62 | void process_packet( char* buf ); | ||
63 | void process_water(); | ||
64 | void process_sky(); | ||
65 | }; | ||
66 | |||
67 | #endif | ||
diff --git a/linden/indra/newview/llviewergenericmessage.cpp b/linden/indra/newview/llviewergenericmessage.cpp index c9954b3..8078888 100644 --- a/linden/indra/newview/llviewergenericmessage.cpp +++ b/linden/indra/newview/llviewergenericmessage.cpp | |||
@@ -32,18 +32,15 @@ | |||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include "llviewerprecompiledheaders.h" | 34 | #include "llviewerprecompiledheaders.h" |
35 | |||
36 | #include "llviewergenericmessage.h" | 35 | #include "llviewergenericmessage.h" |
37 | #include "meta7windlight.h" | 36 | |
38 | #include "lldispatcher.h" | 37 | #include "lldispatcher.h" |
39 | #include "lluuid.h" | 38 | #include "lluuid.h" |
40 | #include "message.h" | 39 | #include "message.h" |
41 | #include "llagent.h" | 40 | #include "llagent.h" |
42 | #include "llwaterparamset.h" | ||
43 | #include "llwaterparammanager.h" | ||
44 | #include "llwlparamset.h" | ||
45 | #include "llwlparammanager.h" | ||
46 | #include "lluuid.h" | 41 | #include "lluuid.h" |
42 | #include "lightshare.h" | ||
43 | |||
47 | 44 | ||
48 | LLDispatcher gGenericDispatcher; | 45 | LLDispatcher gGenericDispatcher; |
49 | 46 | ||
@@ -88,109 +85,20 @@ void process_generic_message(LLMessageSystem* msg, void**) | |||
88 | std::string method; | 85 | std::string method; |
89 | msg->getStringFast(_PREHASH_MethodData, _PREHASH_Method, method); | 86 | msg->getStringFast(_PREHASH_MethodData, _PREHASH_Method, method); |
90 | 87 | ||
91 | //This needs to be handled by a dispatcher really, but I'm not sure where is the best place to put it | 88 | // TODO: Use a proper dispatcher. |
92 | if (method == "Windlight" && gSavedSettings.getBOOL("UseServersideWindlightSettings")) | 89 | if(method == "Windlight") |
93 | { | 90 | { |
94 | //Meta7 WindLight packet | 91 | WindlightMessage::processWindlight(msg, NULL); |
95 | //We are delivering with an agentID of NULL_KEY so as to be | 92 | return; |
96 | //friendly and not trigger a warning for unsupporting clients. | ||
97 | S32 count = msg->getNumberOfBlocksFast(_PREHASH_ParamList); | ||
98 | for (S32 i = 0; i < count; ++i) | ||
99 | { | ||
100 | // our param is binary data) | ||
101 | S32 size = msg->getSizeFast(_PREHASH_ParamList, i, _PREHASH_Parameter); | ||
102 | if (size >= 0) | ||
103 | { | ||
104 | char buf[250]; | ||
105 | msg->getBinaryDataFast( | ||
106 | _PREHASH_ParamList, _PREHASH_Parameter, | ||
107 | buf, size, i, 249); | ||
108 | |||
109 | Meta7WindlightPacket* wl = (Meta7WindlightPacket*)buf; | ||
110 | |||
111 | LLWaterParamManager * param_mgr = LLWaterParamManager::instance(); | ||
112 | LLWaterParamSet & param_set = param_mgr->mCurParams; | ||
113 | |||
114 | param_set.set("waterFogColor", wl->waterColor.red / 256.f, wl->waterColor.green / 256.f, wl->waterColor.blue / 256.f); | ||
115 | param_set.set("waterFogDensity", pow(2.0f, wl->waterFogDensityExponent)); | ||
116 | param_set.set("underWaterFogMod", wl->underwaterFogModifier); | ||
117 | param_set.set("normScale", wl->reflectionWaveletScale.X,wl->reflectionWaveletScale.Y,wl->reflectionWaveletScale.Z); | ||
118 | param_set.set("fresnelScale", wl->fresnelScale); | ||
119 | param_set.set("fresnelOffset", wl->fresnelOffset); | ||
120 | param_set.set("scaleAbove", wl->refractScaleAbove); | ||
121 | param_set.set("scaleBelow", wl->refractScaleBelow); | ||
122 | param_set.set("blurMultiplier", wl->blurMultiplier); | ||
123 | param_set.set("wave1Dir", wl->littleWaveDirection.X, wl->littleWaveDirection.Y); | ||
124 | param_set.set("wave2Dir", wl->bigWaveDirection.X, wl->bigWaveDirection.Y); | ||
125 | |||
126 | LLUUID normalMapTexture; | ||
127 | |||
128 | std::string out = llformat( | ||
129 | "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", | ||
130 | (U8)(wl->normalMapTexture[0]), | ||
131 | (U8)(wl->normalMapTexture[1]), | ||
132 | (U8)(wl->normalMapTexture[2]), | ||
133 | (U8)(wl->normalMapTexture[3]), | ||
134 | (U8)(wl->normalMapTexture[4]), | ||
135 | (U8)(wl->normalMapTexture[5]), | ||
136 | (U8)(wl->normalMapTexture[6]), | ||
137 | (U8)(wl->normalMapTexture[7]), | ||
138 | (U8)(wl->normalMapTexture[8]), | ||
139 | (U8)(wl->normalMapTexture[9]), | ||
140 | (U8)(wl->normalMapTexture[10]), | ||
141 | (U8)(wl->normalMapTexture[11]), | ||
142 | (U8)(wl->normalMapTexture[12]), | ||
143 | (U8)(wl->normalMapTexture[13]), | ||
144 | (U8)(wl->normalMapTexture[14]), | ||
145 | (U8)(wl->normalMapTexture[15])); | ||
146 | |||
147 | normalMapTexture.set(out); | ||
148 | |||
149 | param_mgr->setParamSet( "Meta7CurrentRegion", param_set); | ||
150 | param_mgr->setNormalMapID(normalMapTexture); | ||
151 | |||
152 | LLWLParamManager * wl_param_mgr = LLWLParamManager::instance(); | ||
153 | LLWLParamSet & wl_param_set = wl_param_mgr->mCurParams; | ||
154 | wl_param_set.setSunAngle(F_TWO_PI * wl->sunMoonPosiiton); | ||
155 | wl_param_set.setEastAngle(F_TWO_PI * wl->eastAngle); | ||
156 | wl_param_set.set("sunlight_color", wl->sunMoonColor.red * 3.0f, wl->sunMoonColor.green * 3.0f, wl->sunMoonColor.blue * 3.0f, wl->sunMoonColor.alpha * 3.0f); | ||
157 | wl_param_set.set("ambient", wl->ambient.red * 3.0f, wl->ambient.green * 3.0f, wl->ambient.blue * 3.0f, wl->ambient.alpha * 3.0f); | ||
158 | wl_param_set.set("blue_horizon", wl->horizon.red * 2.0f, wl->horizon.green *2.0f, wl->horizon.blue * 2.0f, wl->horizon.alpha * 2.0f); | ||
159 | wl_param_set.set("blue_density", wl->blueDensity.red * 2.0f, wl->blueDensity.green * 2.0f, wl->blueDensity.blue * 2.0f, wl->blueDensity.alpha * 2.0f); | ||
160 | wl_param_set.set("haze_horizon", wl->hazeHorizon, wl->hazeHorizon, wl->hazeHorizon, 1.f); | ||
161 | wl_param_set.set("haze_density", wl->hazeDensity, wl->hazeDensity, wl->hazeDensity, 1.f); | ||
162 | wl_param_set.set("cloud_shadow", wl->cloudCoverage, wl->cloudCoverage, wl->cloudCoverage, wl->cloudCoverage); | ||
163 | wl_param_set.set("density_multiplier", wl->densityMultiplier / 1000.0f); | ||
164 | wl_param_set.set("distance_multiplier", wl->distanceMultiplier, wl->distanceMultiplier, wl->distanceMultiplier, wl->distanceMultiplier); | ||
165 | wl_param_set.set("max_y",(F32)wl->maxAltitude); | ||
166 | wl_param_set.set("cloud_color", wl->cloudColor.red, wl->cloudColor.green, wl->cloudColor.blue, wl->cloudColor.alpha); | ||
167 | wl_param_set.set("cloud_pos_density1", wl->cloudXYDensity.X, wl->cloudXYDensity.Y, wl->cloudXYDensity.Z); | ||
168 | wl_param_set.set("cloud_pos_density2", wl->cloudDetailXYDensity.X, wl->cloudDetailXYDensity.Y, wl->cloudDetailXYDensity.Z); | ||
169 | wl_param_set.set("cloud_scale", wl->cloudScale, 0.f, 0.f, 1.f); | ||
170 | wl_param_set.set("gamma", wl->sceneGamma, wl->sceneGamma, wl->sceneGamma, 0.0f); | ||
171 | wl_param_set.set("glow",(2 - wl->sunGlowSize) * 20 , 0.f, -wl->sunGlowFocus * 5); | ||
172 | wl_param_set.setCloudScrollX(wl->cloudScrollX + 10.0f); | ||
173 | wl_param_set.setCloudScrollY(wl->cloudScrollY + 10.0f); | ||
174 | wl_param_set.setEnableCloudScrollX(!wl->cloudScrollXLock); | ||
175 | wl_param_set.setEnableCloudScrollY(!wl->cloudScrollYLock); | ||
176 | wl_param_set.setStarBrightness(wl->starBrightness); | ||
177 | wl_param_mgr->removeParamSet("Meta7-CurrentRegion",true); | ||
178 | wl_param_mgr->addParamSet( "Meta7-CurrentRegion", wl_param_set); | ||
179 | wl_param_mgr->savePreset( "Meta7-CurrentRegion"); | ||
180 | LLWLParamManager::instance()->mAnimator.mIsRunning = false; | ||
181 | LLWLParamManager::instance()->mAnimator.mUseLindenTime = false; | ||
182 | wl_param_mgr->loadPreset( "Meta7-CurrentRegion",true); | ||
183 | } | ||
184 | } | ||
185 | } | 93 | } |
186 | else if (agent_id != gAgent.getID()) | 94 | |
95 | if( agent_id != gAgent.getID() ) | ||
187 | { | 96 | { |
188 | llwarns << "GenericMessage for wrong agent" << llendl; | 97 | llwarns << "GenericMessage for wrong agent" << llendl; |
189 | return; | 98 | return; |
190 | } | 99 | } |
191 | else | 100 | else |
192 | { | 101 | { |
193 | |||
194 | std::string request; | 102 | std::string request; |
195 | LLUUID invoice; | 103 | LLUUID invoice; |
196 | LLDispatcher::sparam_t strings; | 104 | LLDispatcher::sparam_t strings; |
diff --git a/linden/indra/newview/llwindlightremotectrl.cpp b/linden/indra/newview/llwindlightremotectrl.cpp index 0beb3e5..b5c15a5 100644 --- a/linden/indra/newview/llwindlightremotectrl.cpp +++ b/linden/indra/newview/llwindlightremotectrl.cpp | |||
@@ -173,8 +173,7 @@ void LLWindlightRemoteCtrl::refreshPresets() | |||
173 | mPresetsCombo->addSimpleElement(getString("midnight"), ADD_BOTTOM); | 173 | mPresetsCombo->addSimpleElement(getString("midnight"), ADD_BOTTOM); |
174 | mPresetsCombo->addSimpleElement(getString("revert_region"), ADD_BOTTOM); | 174 | mPresetsCombo->addSimpleElement(getString("revert_region"), ADD_BOTTOM); |
175 | 175 | ||
176 | if (mPresetsCombo->getSelectedItemLabel() != currentParams.mName && | 176 | if (!currentParams.mName.empty()) |
177 | !currentParams.mName.empty()) | ||
178 | { | 177 | { |
179 | mPresetsCombo->selectByValue(LLSD(currentParams.mName)); | 178 | mPresetsCombo->selectByValue(LLSD(currentParams.mName)); |
180 | } | 179 | } |
diff --git a/linden/indra/newview/meta7windlight.h b/linden/indra/newview/meta7windlight.h index 9927558..04ce86d 100644 --- a/linden/indra/newview/meta7windlight.h +++ b/linden/indra/newview/meta7windlight.h | |||
@@ -1,3 +1,36 @@ | |||
1 | /** | ||
2 | * @file lightshare.cpp | ||
3 | * @brief Handler for Meta7 Lightshare (region-side Windlight settings). | ||
4 | * | ||
5 | * Copyright (c) 2010, Tom Meta / Meta7 Project | ||
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 META7WINDLIGHT_H | ||
30 | #define META7WINDLIGHT_H | ||
31 | |||
32 | #include "linden_common.h" | ||
33 | |||
1 | struct M7Color3{ | 34 | struct M7Color3{ |
2 | M7Color3(){}; | 35 | M7Color3(){}; |
3 | M7Color3(F32 pRed, F32 pGreen, F32 pBlue) | 36 | M7Color3(F32 pRed, F32 pGreen, F32 pBlue) |
@@ -94,3 +127,5 @@ struct Meta7WindlightPacket { | |||
94 | 127 | ||
95 | 128 | ||
96 | }; | 129 | }; |
130 | |||
131 | #endif | ||