1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
|
/*
* @file kowopenregionsettings.cpp
* @brief Handler for OpenRegionInfo event queue message.
*
* Copyright (c) 2010, Patrick Sapinski
*
* The source code in this file ("Source Code") is provided to you
* under the terms of the GNU General Public License, version 2.0
* ("GPL"). Terms of the GPL can be found in doc/GPL-license.txt in
* this distribution, or online at
* http://secondlifegrid.net/programs/open_source/licensing/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
*
* ALL SOURCE CODE IS PROVIDED "AS IS." THE AUTHOR MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
*/
#include "llviewerprecompiledheaders.h"
#include "llhttpnode.h"
#include "hippolimits.h"
#include "llfloatertools.h"
#include "llviewercontrol.h"
#include "llagent.h"
#include "llsurface.h"
#include "llviewerregion.h"
#include "llviewerobject.h"
#include "linden_common.h"
#include "llwaterparammanager.h"
#include "llwaterparamset.h"
#include "llwlparammanager.h"
#include "llwlparamset.h"
#include "message.h"
#include "meta7windlight.h"
#include "lightshare.h"
#include "wlsettingsmanager.h"
//DEBUG includes
//#include "llsdserialize.h" //LLSDNotationStreamer - for dumping LLSD to string
class WindLightSettingsUpdate : public LLHTTPNode
{
/*virtual*/ void post(
LLHTTPNode::ResponsePtr response,
const LLSD& context,
const LLSD& input) const
{
if (!input.isMap() || !input.has("body"))
{
llinfos << "malformed WindLightSettingsUpdate update!" << llendl;
return;
}
LLWaterParamSet* mWater;
LLWLParamSet* mSky;
LLUUID* mWaterNormal;
mWater = new LLWaterParamSet();
mSky = new LLWLParamSet();
mWaterNormal = new LLUUID();
LLSD body = input["body"];
mWater->set("waterFogColor",
body["waterColorX"].asReal() / 256.f,
body["waterColorY"].asReal() / 256.f,
body["waterColorZ"].asReal() / 256.f,
body["waterColorW"].asReal() / 256.f);
mWater->set("waterFogDensity", body["waterFogDensityExponent"].asReal());
mWater->set("underWaterFogMod", body["underwaterFogModifier"].asReal());
mWater->set("normScale", body["reflectionWaveletScaleX"].asReal(),
body["reflectionWaveletScaleY"].asReal(),
body["reflectionWaveletScaleZ"].asReal());
mWater->set("fresnelScale", body["fresnelScale"].asReal());
mWater->set("fresnelOffset", body["fresnelOffset"].asReal());
mWater->set("scaleAbove", body["refractScaleAbove"].asReal());
mWater->set("scaleBelow", body["refractScaleBelow"].asReal());
mWater->set("blurMultiplier", body["blurMultiplier"].asReal());
mWater->set("wave2Dir", body["bigWaveDirectionX"].asReal(),
body["bigWaveDirectionY"].asReal());
mWater->set("wave1Dir", body["littleWaveDirectionX"].asReal(),
body["littleWaveDirectionY"].asReal());
mWaterNormal->parseUUID(body["normalMapTexture"].asUUID().asString(), mWaterNormal);
mSky->setSunAngle(body["sunMoonPosition"].asReal());
mSky->setEastAngle(body["eastAngle"].asReal());
mSky->set("sunlight_color",
body["sunMoonColorX"].asReal() * 3.0f,
body["sunMoonColorY"].asReal() * 3.0f,
body["sunMoonColorZ"].asReal() * 3.0f,
body["sunMoonColorW"].asReal() * 3.0f);
mSky->set("ambient",
body["ambientX"].asReal() * 3.0f,
body["ambientY"].asReal() * 3.0f,
body["ambientZ"].asReal() * 3.0f,
body["ambientW"].asReal() * 3.0f);
mSky->set("blue_horizon",
body["horizonX"].asReal() * 2.0f,
body["horizonY"].asReal() * 2.0f,
body["horizonZ"].asReal() * 2.0f,
body["horizonW"].asReal() * 2.0f);
mSky->set("blue_density",
body["blueDensityX"].asReal(),
body["blueDensityY"].asReal(),
body["blueDensityZ"].asReal(),
1.0);
mSky->set("haze_horizon",
body["hazeHorizon"].asReal(),
body["hazeHorizon"].asReal(),
body["hazeHorizon"].asReal(),
1.f);
mSky->set("haze_density",
body["hazeDensity"].asReal(),
0.f, 0.f, 1.f);
mSky->set("cloud_shadow",
body["cloudCoverage"].asReal(),
0.f, 0.f, 1.f);
mSky->set("density_multiplier",
body["densityMultiplier"].asReal() / 1000.0f,
0.f, 0.f, 1.f);
mSky->set("distance_multiplier",
body["distanceMultiplier"].asReal(),
0.f, 0.f, 1.f);
mSky->set("max_y",
body["maxAltitude"].asReal(),
0.f, 0.f, 1.f);
mSky->set("cloud_color",
body["cloudColorX"].asReal(),
body["cloudColorY"].asReal(),
body["cloudColorZ"].asReal(),
body["cloudColorW"].asReal());
mSky->set("cloud_pos_density1",
body["cloudXYDensityX"].asReal(),
body["cloudXYDensityY"].asReal(),
body["cloudXYDensityZ"].asReal(),
1.f);
mSky->set("cloud_pos_density2",
body["cloudDetailXYDensityX"].asReal(),
body["cloudDetailXYDensityY"].asReal(),
body["cloudDetailXYDensityZ"].asReal(),
1.f);
mSky->set("cloud_scale",
body["cloudScale"].asReal(),
0.f, 0.f, 1.f);
mSky->set("gamma",
body["sceneGamma"].asReal(),
0.f, 0.f, 1.f);
mSky->set("glow",
(2 - body["sunGlowSize"].asReal()) * 20,
0.f,
-body["sunGlowFocus"].asReal() * 5,
1.f);
mSky->setCloudScrollX(body["cloudScrollX"].asReal() + 10.0f);
mSky->setCloudScrollY(body["cloudScrollY"].asReal() + 10.0f);
mSky->setEnableCloudScrollX(!body["cloudScrollXLock"].asBoolean());
mSky->setEnableCloudScrollY(!body["cloudScrollYLock"].asBoolean());
mSky->setStarBrightness(body["starBrightness"].asReal());
mSky->set("fade", body["fade"].asReal());
//Update this here.. since it isn't a part of WL... go figure
gHippoLimits->skyUseClassicClouds = body["drawClassicClouds"].asBoolean();
gSavedSettings.setF32("ClassicCloudHeight",body["classicCloudHeight"].asReal());
gSavedSettings.setF32("ClassicCloudRange",body["classicCloudRange"].asReal());
WLSettingsManager::Apply(mSky, mWater, mWaterNormal);
}
};
LLHTTPRegistration<WindLightSettingsUpdate>
gHTTPRegistrationWindLightSettingsUpdate(
"/message/WindLightSettingsUpdate");
|