diff options
author | Jacek Antonelli | 2010-04-21 01:51:11 -0500 |
---|---|---|
committer | Jacek Antonelli | 2010-06-19 02:40:56 -0500 |
commit | bf7bc88cfcdbd08c2afd965844f64bf315ba4b7e (patch) | |
tree | 86c0891401fe8d54db781e3344a9eed1cbeb54af /linden/indra/newview/llviewergenericmessage.cpp | |
parent | Improved OpenSim Scripting Language function tooltips. (diff) | |
download | meta-impy-bf7bc88cfcdbd08c2afd965844f64bf315ba4b7e.zip meta-impy-bf7bc88cfcdbd08c2afd965844f64bf315ba4b7e.tar.gz meta-impy-bf7bc88cfcdbd08c2afd965844f64bf315ba4b7e.tar.bz2 meta-impy-bf7bc88cfcdbd08c2afd965844f64bf315ba4b7e.tar.xz |
Applied patch for LightShare viewer-side implementation.
Ported from Meta7 viewer by Armin.
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llviewergenericmessage.cpp | 103 |
1 files changed, 91 insertions, 12 deletions
diff --git a/linden/indra/newview/llviewergenericmessage.cpp b/linden/indra/newview/llviewergenericmessage.cpp index e06766b..84f464f 100644 --- a/linden/indra/newview/llviewergenericmessage.cpp +++ b/linden/indra/newview/llviewergenericmessage.cpp | |||
@@ -34,13 +34,16 @@ | |||
34 | #include "llviewerprecompiledheaders.h" | 34 | #include "llviewerprecompiledheaders.h" |
35 | 35 | ||
36 | #include "llviewergenericmessage.h" | 36 | #include "llviewergenericmessage.h" |
37 | 37 | #include "meta7windlight.h" | |
38 | #include "lldispatcher.h" | 38 | #include "lldispatcher.h" |
39 | #include "lluuid.h" | 39 | #include "lluuid.h" |
40 | #include "message.h" | 40 | #include "message.h" |
41 | |||
42 | #include "llagent.h" | 41 | #include "llagent.h" |
43 | 42 | #include "llwaterparamset.h" | |
43 | #include "llwaterparammanager.h" | ||
44 | #include "llwlparamset.h" | ||
45 | #include "llwlparammanager.h" | ||
46 | #include "lluuid.h" | ||
44 | 47 | ||
45 | LLDispatcher gGenericDispatcher; | 48 | LLDispatcher gGenericDispatcher; |
46 | 49 | ||
@@ -82,20 +85,96 @@ void process_generic_message(LLMessageSystem* msg, void**) | |||
82 | { | 85 | { |
83 | LLUUID agent_id; | 86 | LLUUID agent_id; |
84 | msg->getUUID("AgentData", "AgentID", agent_id); | 87 | msg->getUUID("AgentData", "AgentID", agent_id); |
85 | if (agent_id != gAgent.getID()) | 88 | std::string method; |
89 | msg->getStringFast(_PREHASH_MethodData, _PREHASH_Method, method); | ||
90 | |||
91 | if (method == "Windlight" && gSavedSettings.getBOOL("UseServersideWindlightSettings")) | ||
92 | { | ||
93 | //Meta7 WindLight packet | ||
94 | //We are delivering with an agentID of NULL_KEY so as to be | ||
95 | //friendly and not trigger a warning for unsupporting clients. | ||
96 | S32 count = msg->getNumberOfBlocksFast(_PREHASH_ParamList); | ||
97 | for (S32 i = 0; i < count; ++i) | ||
98 | { | ||
99 | // our param is binary data) | ||
100 | S32 size = msg->getSizeFast(_PREHASH_ParamList, i, _PREHASH_Parameter); | ||
101 | if (size >= 0) | ||
102 | { | ||
103 | char buf[250]; | ||
104 | msg->getBinaryDataFast( | ||
105 | _PREHASH_ParamList, _PREHASH_Parameter, | ||
106 | buf, size, i, 249); | ||
107 | |||
108 | Meta7WindlightPacket* wl = (Meta7WindlightPacket*)buf; | ||
109 | |||
110 | LLWaterParamManager * param_mgr = LLWaterParamManager::instance(); | ||
111 | LLWaterParamSet & param_set = param_mgr->mCurParams; | ||
112 | |||
113 | param_set.set("waterFogColor", wl->waterColor.red / 256.f, wl->waterColor.green / 256.f, wl->waterColor.blue / 256.f); | ||
114 | param_set.set("waterFogDensity", pow(2.0f, wl->waterFogDensityExponent)); | ||
115 | param_set.set("underWaterFogMod", wl->underwaterFogModifier); | ||
116 | param_set.set("normScale", wl->reflectionWaveletScale.X,wl->reflectionWaveletScale.Y,wl->reflectionWaveletScale.Z); | ||
117 | param_set.set("fresnelScale", wl->fresnelScale); | ||
118 | param_set.set("fresnelOffset", wl->fresnelOffset); | ||
119 | param_set.set("scaleAbove", wl->refractScaleAbove); | ||
120 | param_set.set("scaleBelow", wl->refractScaleBelow); | ||
121 | param_set.set("blurMultiplier", wl->blurMultiplier); | ||
122 | param_set.set("wave1Dir", wl->littleWaveDirection.X, wl->littleWaveDirection.Y); | ||
123 | param_set.set("wave2Dir", wl->bigWaveDirection.X, wl->bigWaveDirection.Y); | ||
124 | |||
125 | param_mgr->setParamSet( "Meta7CurrentRegion", param_set); | ||
126 | |||
127 | LLWLParamManager * wl_param_mgr = LLWLParamManager::instance(); | ||
128 | LLWLParamSet & wl_param_set = wl_param_mgr->mCurParams; | ||
129 | wl_param_set.setSunAngle(F_TWO_PI * wl->sunMoonPosiiton); | ||
130 | wl_param_set.setEastAngle(F_TWO_PI * wl->eastAngle); | ||
131 | 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); | ||
132 | 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); | ||
133 | 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); | ||
134 | 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); | ||
135 | wl_param_set.set("haze_horizon", wl->hazeHorizon, wl->hazeHorizon, wl->hazeHorizon, 1.f); | ||
136 | wl_param_set.set("haze_density", wl->hazeDensity, wl->hazeDensity, wl->hazeDensity, 1.f); | ||
137 | wl_param_set.set("cloud_shadow", wl->cloudCoverage, wl->cloudCoverage, wl->cloudCoverage, wl->cloudCoverage); | ||
138 | wl_param_set.set("density_multiplier", wl->densityMultiplier / 1000.0f); | ||
139 | wl_param_set.set("distance_multiplier", wl->distanceMultiplier, wl->distanceMultiplier, wl->distanceMultiplier, wl->distanceMultiplier); | ||
140 | wl_param_set.set("max_y",(F32)wl->maxAltitude); | ||
141 | wl_param_set.set("cloud_color", wl->cloudColor.red, wl->cloudColor.green, wl->cloudColor.blue, wl->cloudColor.alpha); | ||
142 | wl_param_set.set("cloud_pos_density1", wl->cloudXYDensity.X, wl->cloudXYDensity.Y, wl->cloudXYDensity.Z); | ||
143 | wl_param_set.set("cloud_pos_density2", wl->cloudDetailXYDensity.X, wl->cloudDetailXYDensity.Y, wl->cloudDetailXYDensity.Z); | ||
144 | wl_param_set.set("cloud_scale", wl->cloudScale, 0.f, 0.f, 1.f); | ||
145 | wl_param_set.set("gamma", wl->sceneGamma, wl->sceneGamma, wl->sceneGamma, 0.0f); | ||
146 | wl_param_set.set("glow",(2 - wl->sunGlowSize) * 20 , 0.f, -wl->sunGlowFocus * 5); | ||
147 | wl_param_set.setCloudScrollX(wl->cloudScrollX + 10.0f); | ||
148 | wl_param_set.setCloudScrollY(wl->cloudScrollY + 10.0f); | ||
149 | wl_param_set.setEnableCloudScrollX(!wl->cloudScrollXLock); | ||
150 | wl_param_set.setEnableCloudScrollY(!wl->cloudScrollYLock); | ||
151 | wl_param_set.setStarBrightness(wl->starBrightness); | ||
152 | wl_param_mgr->removeParamSet("Meta7-CurrentRegion",true); | ||
153 | wl_param_mgr->addParamSet( "Meta7-CurrentRegion", wl_param_set); | ||
154 | wl_param_mgr->savePreset( "Meta7-CurrentRegion"); | ||
155 | LLWLParamManager::instance()->mAnimator.mIsRunning = false; | ||
156 | LLWLParamManager::instance()->mAnimator.mUseLindenTime = false; | ||
157 | wl_param_mgr->loadPreset( "Meta7-CurrentRegion",true); | ||
158 | } | ||
159 | } | ||
160 | } | ||
161 | else if (agent_id != gAgent.getID()) | ||
86 | { | 162 | { |
87 | llwarns << "GenericMessage for wrong agent" << llendl; | 163 | llwarns << "GenericMessage for wrong agent" << llendl; |
88 | return; | 164 | return; |
89 | } | 165 | } |
166 | else | ||
167 | { | ||
90 | 168 | ||
91 | std::string request; | 169 | std::string request; |
92 | LLUUID invoice; | 170 | LLUUID invoice; |
93 | LLDispatcher::sparam_t strings; | 171 | LLDispatcher::sparam_t strings; |
94 | LLDispatcher::unpackMessage(msg, request, invoice, strings); | 172 | LLDispatcher::unpackMessage(msg, request, invoice, strings); |
95 | 173 | ||
96 | if(!gGenericDispatcher.dispatch(request, invoice, strings)) | 174 | if(!gGenericDispatcher.dispatch(request, invoice, strings)) |
97 | { | 175 | { |
98 | llwarns << "GenericMessage " << request << " failed to dispatch" | 176 | llwarns << "GenericMessage " << request << " failed to dispatch" |
99 | << llendl; | 177 | << llendl; |
178 | } | ||
100 | } | 179 | } |
101 | } | 180 | } |