aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewergenericmessage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llviewergenericmessage.cpp')
-rw-r--r--linden/indra/newview/llviewergenericmessage.cpp110
1 files changed, 9 insertions, 101 deletions
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
48LLDispatcher gGenericDispatcher; 45LLDispatcher 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;