aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/wlretrievesettings.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/wlretrievesettings.cpp238
1 files changed, 238 insertions, 0 deletions
diff --git a/linden/indra/newview/wlretrievesettings.cpp b/linden/indra/newview/wlretrievesettings.cpp
new file mode 100644
index 0000000..ca91ba2
--- /dev/null
+++ b/linden/indra/newview/wlretrievesettings.cpp
@@ -0,0 +1,238 @@
1/**
2* @file wlfloaterwindlightsend.cpp
3* @brief WLFloaterWindLightSend class definition
4*
5* $LicenseInfo:firstyear=2007&license=viewergpl$
6*
7* Copyright (c) 2007-2009, Linden Research, Inc.
8*
9* Second Life Viewer Source Code
10* The source code in this file ("Source Code") is provided by Linden Lab
11* to you under the terms of the GNU General Public License, version 2.0
12* ("GPL"), unless you have obtained a separate licensing agreement
13* ("Other License"), formally executed by you and Linden Lab. Terms of
14* the GPL can be found in doc/GPL-license.txt in this distribution, or
15* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16*
17* There are special exceptions to the terms and conditions of the GPL as
18* it is applied to this Source Code. View the full text of the exception
19* in the file doc/FLOSS-exception.txt in this software distribution, or
20* online at
21* http://secondlifegrid.net/programs/open_source/licensing/flossexception
22*
23* By copying, modifying or distributing this software, you acknowledge
24* that you have read and understood your obligations described above,
25* and agree to abide by those obligations.
26*
27* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
28* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29* COMPLETENESS OR PERFORMANCE.
30* $/LicenseInfo$
31*/
32
33#include "llviewerprecompiledheaders.h"
34
35#include "llfloaterwindlight.h"
36
37#include "pipeline.h"
38#include "llsky.h"
39
40#include "llsliderctrl.h"
41#include "llmultislider.h"
42#include "llmultisliderctrl.h"
43#include "llspinctrl.h"
44#include "llcheckboxctrl.h"
45#include "lluictrlfactory.h"
46#include "llviewercamera.h"
47#include "llcombobox.h"
48#include "lllineeditor.h"
49#include "llfloaterdaycycle.h"
50#include "lltabcontainer.h"
51#include "llboost.h"
52
53#include "llagent.h"
54#include "llinventorymodel.h"
55#include "llviewerinventory.h"
56
57#include "v4math.h"
58#include "llviewerdisplay.h"
59#include "llviewercontrol.h"
60#include "llviewerwindow.h"
61#include "llsavedsettingsglue.h"
62
63#include "llwlparamset.h"
64#include "llwlparammanager.h"
65#include "llwaterparammanager.h"
66#include "llpostprocess.h"
67#include "hippoLimits.h"
68#include "wlfloaterwindlightsend.h"
69#include "llviewerregion.h"
70#include "wlsettingsmanager.h"
71#include "lightshare.h"
72
73#include "linden_common.h"
74#include "llviewercontrol.h"
75#include "message.h"
76#include "meta7windlight.h"
77#include "wlretrievesettings.h"
78#include "wlfloatermanager.h"
79
80#undef max
81
82//If we get back a normal response, handle it here
83void retrieveWindlightSettings::result(const LLSD& content)
84{
85 //Clear the lists first
86 WLFloaterManager::mMinAltParamList.clear();
87 WLFloaterManager::mMaxAltParamList.clear();
88 WLFloaterManager::mFadeParamList.clear();
89 WLFloaterManager::mWLParamList.clear();
90 WLFloaterManager::mWaterParamList.clear();
91 WLFloaterManager::mWaterNormalParamList.clear();
92
93 for(LLSD::array_const_iterator wls = content["WindLight"].beginArray();
94 wls != content["WindLight"].endArray();
95 ++wls)
96 {
97 LLSD windLightLLSD = *wls;
98 LLWaterParamSet* mWater;
99 LLWLParamSet* mSky;
100 LLUUID* mWaterNormal;
101
102 mWater = new LLWaterParamSet();
103 mSky = new LLWLParamSet();
104 mWaterNormal = new LLUUID();
105
106 mWater->set("waterFogColor",
107 windLightLLSD["waterColorX"].asReal() / 256.f,
108 windLightLLSD["waterColorY"].asReal() / 256.f,
109 windLightLLSD["waterColorZ"].asReal() / 256.f,
110 windLightLLSD["waterColorW"].asReal() / 256.f);
111 mWater->set("waterFogDensity", windLightLLSD["waterFogDensityExponent"].asReal());
112 mWater->set("underWaterFogMod", windLightLLSD["underwaterFogModifier"].asReal());
113 mWater->set("normScale", windLightLLSD["reflectionWaveletScaleX"].asReal(),
114 windLightLLSD["reflectionWaveletScaleY"].asReal(),
115 windLightLLSD["reflectionWaveletScaleZ"].asReal());
116 mWater->set("fresnelScale", windLightLLSD["fresnelScale"].asReal());
117 mWater->set("fresnelOffset", windLightLLSD["fresnelOffset"].asReal());
118 mWater->set("scaleAbove", windLightLLSD["refractScaleAbove"].asReal());
119 mWater->set("scaleBelow", windLightLLSD["refractScaleBelow"].asReal());
120 mWater->set("blurMultiplier", windLightLLSD["blurMultiplier"].asReal());
121 mWater->set("wave2Dir", windLightLLSD["bigWaveDirectionX"].asReal(),
122 windLightLLSD["bigWaveDirectionY"].asReal());
123 mWater->set("wave1Dir", windLightLLSD["littleWaveDirectionX"].asReal(),
124 windLightLLSD["littleWaveDirectionY"].asReal());
125 mWaterNormal->parseUUID(windLightLLSD["normalMapTexture"].asUUID().asString(), mWaterNormal);
126
127 mSky->setSunAngle(windLightLLSD["sunMoonPosition"].asReal());
128 mSky->setEastAngle(windLightLLSD["eastAngle"].asReal());
129
130 mSky->set("sunlight_color",
131 windLightLLSD["sunMoonColorX"].asReal() * 3.0f,
132 windLightLLSD["sunMoonColorY"].asReal() * 3.0f,
133 windLightLLSD["sunMoonColorZ"].asReal() * 3.0f,
134 windLightLLSD["sunMoonColorW"].asReal() * 3.0f);
135
136 mSky->set("ambient",
137 windLightLLSD["ambientX"].asReal() * 3.0f,
138 windLightLLSD["ambientY"].asReal() * 3.0f,
139 windLightLLSD["ambientZ"].asReal() * 3.0f,
140 windLightLLSD["ambientW"].asReal() * 3.0f);
141
142 mSky->set("blue_horizon",
143 windLightLLSD["horizonX"].asReal() * 2.0f,
144 windLightLLSD["horizonY"].asReal() * 2.0f,
145 windLightLLSD["horizonZ"].asReal() * 2.0f,
146 windLightLLSD["horizonW"].asReal() * 2.0f);
147
148 mSky->set("blue_density",
149 windLightLLSD["blueDensityX"].asReal(),
150 windLightLLSD["blueDensityY"].asReal(),
151 windLightLLSD["blueDensityZ"].asReal(),
152 1.0);
153
154 mSky->set("haze_horizon",
155 windLightLLSD["hazeHorizon"].asReal(),
156 windLightLLSD["hazeHorizon"].asReal(),
157 windLightLLSD["hazeHorizon"].asReal(),
158 1.f);
159
160 mSky->set("haze_density",
161 windLightLLSD["hazeDensity"].asReal(),
162 0.f, 0.f, 1.f);
163
164 mSky->set("cloud_shadow",
165 windLightLLSD["cloudCoverage"].asReal(),
166 0.f, 0.f, 1.f);
167
168 mSky->set("density_multiplier",
169 windLightLLSD["densityMultiplier"].asReal() / 1000.0f,
170 0.f, 0.f, 1.f);
171
172 mSky->set("distance_multiplier",
173 windLightLLSD["distanceMultiplier"].asReal(),
174 0.f, 0.f, 1.f);
175
176 mSky->set("max_y",
177 windLightLLSD["maxAltitude"].asReal(),
178 0.f, 0.f, 1.f);
179
180 mSky->set("cloud_color",
181 windLightLLSD["cloudColorX"].asReal(),
182 windLightLLSD["cloudColorY"].asReal(),
183 windLightLLSD["cloudColorZ"].asReal(),
184 windLightLLSD["cloudColorW"].asReal());
185
186 mSky->set("cloud_pos_density1",
187 windLightLLSD["cloudXYDensityX"].asReal(),
188 windLightLLSD["cloudXYDensityY"].asReal(),
189 windLightLLSD["cloudXYDensityZ"].asReal(),
190 1.f);
191
192 mSky->set("cloud_pos_density2",
193 windLightLLSD["cloudDetailXYDensityX"].asReal(),
194 windLightLLSD["cloudDetailXYDensityY"].asReal(),
195 windLightLLSD["cloudDetailXYDensityZ"].asReal(),
196 1.f);
197
198 mSky->set("cloud_scale",
199 windLightLLSD["cloudScale"].asReal(),
200 0.f, 0.f, 1.f);
201
202 mSky->set("gamma",
203 windLightLLSD["sceneGamma"].asReal(),
204 0.f, 0.f, 1.f);
205
206 mSky->set("glow",
207 (2 - windLightLLSD["sunGlowSize"].asReal()) * 20,
208 0.f,
209 -windLightLLSD["sunGlowFocus"].asReal() * 5,
210 1.f);
211
212 mSky->setCloudScrollX(windLightLLSD["cloudScrollX"].asReal() + 10.0f);
213 mSky->setCloudScrollY(windLightLLSD["cloudScrollY"].asReal() + 10.0f);
214
215 mSky->setEnableCloudScrollX(!windLightLLSD["cloudScrollXLock"].asBoolean());
216 mSky->setEnableCloudScrollY(!windLightLLSD["cloudScrollYLock"].asBoolean());
217
218 mSky->setStarBrightness(windLightLLSD["starBrightness"].asReal());
219
220 mSky->set("fade", windLightLLSD["fade"].asReal());
221
222 WLFloaterManager::mMinAltParamList[windLightLLSD["Name"].asString()] = windLightLLSD["minEffectiveAltitude"].asReal();
223 WLFloaterManager::mMaxAltParamList[windLightLLSD["Name"].asString()] = windLightLLSD["maxEffectiveAltitude"].asReal();
224 WLFloaterManager::mFadeParamList[windLightLLSD["Name"].asString()] = windLightLLSD["fade"].asReal();
225
226 WLFloaterManager::mWLParamList[windLightLLSD["Name"].asString()] = mSky;
227 WLFloaterManager::mWaterParamList[windLightLLSD["Name"].asString()] = mWater;
228 WLFloaterManager::mWaterNormalParamList[windLightLLSD["Name"].asString()] = mWaterNormal;
229 }
230 WLFloaterManager::UpdateFloater();
231}
232
233//If we get back an error (not found, etc...), handle it here
234void retrieveWindlightSettings::error(U32 status, const std::string& reason)
235{
236 LL_INFOS("Inventory") << "retrieveWindlightSettings::error "
237 << status << ": " << reason << LL_ENDL;
238} \ No newline at end of file