aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/windlightsettingsupdate.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/windlightsettingsupdate.cpp')
-rw-r--r--linden/indra/newview/windlightsettingsupdate.cpp200
1 files changed, 200 insertions, 0 deletions
diff --git a/linden/indra/newview/windlightsettingsupdate.cpp b/linden/indra/newview/windlightsettingsupdate.cpp
new file mode 100644
index 0000000..a5f9cb7
--- /dev/null
+++ b/linden/indra/newview/windlightsettingsupdate.cpp
@@ -0,0 +1,200 @@
1/*
2 * @file kowopenregionsettings.cpp
3 * @brief Handler for OpenRegionInfo event queue message.
4 *
5 * Copyright (c) 2010, Patrick Sapinski
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#include "llviewerprecompiledheaders.h"
29#include "llhttpnode.h"
30#include "hippoLimits.h"
31#include "llfloatertools.h"
32#include "llviewercontrol.h"
33#include "llagent.h"
34#include "llsurface.h"
35#include "llviewerregion.h"
36#include "llviewerobject.h"
37
38#include "linden_common.h"
39#include "llwaterparammanager.h"
40#include "llwaterparamset.h"
41#include "llwlparammanager.h"
42#include "llwlparamset.h"
43#include "message.h"
44#include "meta7windlight.h"
45#include "lightshare.h"
46#include "wlsettingsmanager.h"
47
48//DEBUG includes
49//#include "llsdserialize.h" //LLSDNotationStreamer - for dumping LLSD to string
50
51class WindLightSettingsUpdate : public LLHTTPNode
52{
53 /*virtual*/ void post(
54 LLHTTPNode::ResponsePtr response,
55 const LLSD& context,
56 const LLSD& input) const
57 {
58 if (!input.isMap() || !input.has("body"))
59 {
60 llinfos << "malformed WindLightSettingsUpdate update!" << llendl;
61 return;
62 }
63 LLWaterParamSet* mWater;
64 LLWLParamSet* mSky;
65 LLUUID* mWaterNormal;
66
67 mWater = new LLWaterParamSet();
68 mSky = new LLWLParamSet();
69 mWaterNormal = new LLUUID();
70
71 LLSD body = input["body"];
72
73 mWater->set("waterFogColor",
74 body["waterColorX"].asReal() / 256.f,
75 body["waterColorY"].asReal() / 256.f,
76 body["waterColorZ"].asReal() / 256.f,
77 body["waterColorW"].asReal() / 256.f);
78 mWater->set("waterFogDensity", body["waterFogDensityExponent"].asReal());
79 mWater->set("underWaterFogMod", body["underwaterFogModifier"].asReal());
80 mWater->set("normScale", body["reflectionWaveletScaleX"].asReal(),
81 body["reflectionWaveletScaleY"].asReal(),
82 body["reflectionWaveletScaleZ"].asReal());
83 mWater->set("fresnelScale", body["fresnelScale"].asReal());
84 mWater->set("fresnelOffset", body["fresnelOffset"].asReal());
85 mWater->set("scaleAbove", body["refractScaleAbove"].asReal());
86 mWater->set("scaleBelow", body["refractScaleBelow"].asReal());
87 mWater->set("blurMultiplier", body["blurMultiplier"].asReal());
88 mWater->set("wave2Dir", body["bigWaveDirectionX"].asReal(),
89 body["bigWaveDirectionY"].asReal());
90 mWater->set("wave1Dir", body["littleWaveDirectionX"].asReal(),
91 body["littleWaveDirectionY"].asReal());
92 mWaterNormal->parseUUID(body["normalMapTexture"].asUUID().asString(), mWaterNormal);
93
94 mSky->setSunAngle(body["sunMoonPosition"].asReal());
95 mSky->setEastAngle(body["eastAngle"].asReal());
96
97 mSky->set("sunlight_color",
98 body["sunMoonColorX"].asReal() * 3.0f,
99 body["sunMoonColorY"].asReal() * 3.0f,
100 body["sunMoonColorZ"].asReal() * 3.0f,
101 body["sunMoonColorW"].asReal() * 3.0f);
102
103 mSky->set("ambient",
104 body["ambientX"].asReal() * 3.0f,
105 body["ambientY"].asReal() * 3.0f,
106 body["ambientZ"].asReal() * 3.0f,
107 body["ambientW"].asReal() * 3.0f);
108
109 mSky->set("blue_horizon",
110 body["horizonX"].asReal() * 2.0f,
111 body["horizonY"].asReal() * 2.0f,
112 body["horizonZ"].asReal() * 2.0f,
113 body["horizonW"].asReal() * 2.0f);
114
115 mSky->set("blue_density",
116 body["blueDensityX"].asReal(),
117 body["blueDensityY"].asReal(),
118 body["blueDensityZ"].asReal(),
119 1.0);
120
121 mSky->set("haze_horizon",
122 body["hazeHorizon"].asReal(),
123 body["hazeHorizon"].asReal(),
124 body["hazeHorizon"].asReal(),
125 1.f);
126
127 mSky->set("haze_density",
128 body["hazeDensity"].asReal(),
129 0.f, 0.f, 1.f);
130
131 mSky->set("cloud_shadow",
132 body["cloudCoverage"].asReal(),
133 0.f, 0.f, 1.f);
134
135 mSky->set("density_multiplier",
136 body["densityMultiplier"].asReal() / 1000.0f,
137 0.f, 0.f, 1.f);
138
139 mSky->set("distance_multiplier",
140 body["distanceMultiplier"].asReal(),
141 0.f, 0.f, 1.f);
142
143 mSky->set("max_y",
144 body["maxAltitude"].asReal(),
145 0.f, 0.f, 1.f);
146
147 mSky->set("cloud_color",
148 body["cloudColorX"].asReal(),
149 body["cloudColorY"].asReal(),
150 body["cloudColorZ"].asReal(),
151 body["cloudColorW"].asReal());
152
153 mSky->set("cloud_pos_density1",
154 body["cloudXYDensityX"].asReal(),
155 body["cloudXYDensityY"].asReal(),
156 body["cloudXYDensityZ"].asReal(),
157 1.f);
158
159 mSky->set("cloud_pos_density2",
160 body["cloudDetailXYDensityX"].asReal(),
161 body["cloudDetailXYDensityY"].asReal(),
162 body["cloudDetailXYDensityZ"].asReal(),
163 1.f);
164
165 mSky->set("cloud_scale",
166 body["cloudScale"].asReal(),
167 0.f, 0.f, 1.f);
168
169 mSky->set("gamma",
170 body["sceneGamma"].asReal(),
171 0.f, 0.f, 1.f);
172
173 mSky->set("glow",
174 (2 - body["sunGlowSize"].asReal()) * 20,
175 0.f,
176 -body["sunGlowFocus"].asReal() * 5,
177 1.f);
178
179 mSky->setCloudScrollX(body["cloudScrollX"].asReal() + 10.0f);
180 mSky->setCloudScrollY(body["cloudScrollY"].asReal() + 10.0f);
181
182 mSky->setEnableCloudScrollX(!body["cloudScrollXLock"].asBoolean());
183 mSky->setEnableCloudScrollY(!body["cloudScrollYLock"].asBoolean());
184
185 mSky->setStarBrightness(body["starBrightness"].asReal());
186
187 mSky->set("fade", body["fade"].asReal());
188
189 //Update this here.. since it isn't a part of WL... go figure
190 gHippoLimits->skyUseClassicClouds = body["drawClassicClouds"].asBoolean();
191 gSavedSettings.setF32("ClassicCloudHeight",body["classicCloudHeight"].asReal());
192 gSavedSettings.setF32("ClassicCloudRange",body["classicCloudRange"].asReal());
193
194 WLSettingsManager::Apply(mSky, mWater, mWaterNormal);
195}
196};
197
198LLHTTPRegistration<WindLightSettingsUpdate>
199gHTTPRegistrationWindLightSettingsUpdate(
200 "/message/WindLightSettingsUpdate"); \ No newline at end of file