diff options
Diffstat (limited to 'OpenSim/Region')
6 files changed, 321 insertions, 231 deletions
diff --git a/OpenSim/Region/CoreModules/World/Meta7Windlight/Meta7WindlightModule.cs b/OpenSim/Region/CoreModules/World/Meta7Windlight/Meta7WindlightModule.cs index f180b47..72b0b38 100644 --- a/OpenSim/Region/CoreModules/World/Meta7Windlight/Meta7WindlightModule.cs +++ b/OpenSim/Region/CoreModules/World/Meta7Windlight/Meta7WindlightModule.cs | |||
@@ -70,64 +70,69 @@ namespace OpenSim.Region.CoreModules.World.Meta7Windlight | |||
70 | if (m_enableWindlight) | 70 | if (m_enableWindlight) |
71 | { | 71 | { |
72 | m_scene.EventManager.OnMakeRootAgent += EventManager_OnMakeRootAgent; | 72 | m_scene.EventManager.OnMakeRootAgent += EventManager_OnMakeRootAgent; |
73 | m_scene.EventManager.OnSaveNewWindlightProfile += EventManager_OnSaveNewWindlightProfile; | 73 | m_scene.EventManager.OnSaveNewWindlightProfile += EventManager_OnSaveNewWindlightProfile; |
74 | m_scene.EventManager.OnSendNewWindlightProfileTargeted += EventManager_OnSendNewWindlightProfileTargeted; | ||
74 | } | 75 | } |
75 | 76 | ||
76 | InstallCommands(); | 77 | InstallCommands(); |
77 | 78 | ||
78 | m_log.Debug("[WINDLIGHT]: Initialised windlight module"); | 79 | m_log.Debug("[WINDLIGHT]: Initialised windlight module"); |
80 | } | ||
81 | |||
82 | private List<byte[]> compileWindlightSettings(RegionMeta7WindlightData wl) | ||
83 | { | ||
84 | byte[] mBlock = new Byte[249]; | ||
85 | int pos = 0; | ||
86 | |||
87 | wl.waterColor.ToBytes(mBlock, 0); pos += 12; | ||
88 | Utils.FloatToBytes(wl.waterFogDensityExponent).CopyTo(mBlock, pos); pos += 4; | ||
89 | Utils.FloatToBytes(wl.underwaterFogModifier).CopyTo(mBlock, pos); pos += 4; | ||
90 | wl.reflectionWaveletScale.ToBytes(mBlock, pos); pos += 12; | ||
91 | Utils.FloatToBytes(wl.fresnelScale).CopyTo(mBlock, pos); pos += 4; | ||
92 | Utils.FloatToBytes(wl.fresnelOffset).CopyTo(mBlock, pos); pos += 4; | ||
93 | Utils.FloatToBytes(wl.refractScaleAbove).CopyTo(mBlock, pos); pos += 4; | ||
94 | Utils.FloatToBytes(wl.refractScaleBelow).CopyTo(mBlock, pos); pos += 4; | ||
95 | Utils.FloatToBytes(wl.blurMultiplier).CopyTo(mBlock, pos); pos += 4; | ||
96 | wl.bigWaveDirection.ToBytes(mBlock, pos); pos += 8; | ||
97 | wl.littleWaveDirection.ToBytes(mBlock, pos); pos += 8; | ||
98 | wl.normalMapTexture.ToBytes(mBlock, pos); pos += 16; | ||
99 | wl.horizon.ToBytes(mBlock, pos); pos += 16; | ||
100 | Utils.FloatToBytes(wl.hazeHorizon).CopyTo(mBlock, pos); pos += 4; | ||
101 | wl.blueDensity.ToBytes(mBlock, pos); pos += 16; | ||
102 | Utils.FloatToBytes(wl.hazeDensity).CopyTo(mBlock, pos); pos += 4; | ||
103 | Utils.FloatToBytes(wl.densityMultiplier).CopyTo(mBlock, pos); pos += 4; | ||
104 | Utils.FloatToBytes(wl.distanceMultiplier).CopyTo(mBlock, pos); pos += 4; | ||
105 | wl.sunMoonColor.ToBytes(mBlock, pos); pos += 16; | ||
106 | Utils.FloatToBytes(wl.sunMoonPosition).CopyTo(mBlock, pos); pos += 4; | ||
107 | wl.ambient.ToBytes(mBlock, pos); pos += 16; | ||
108 | Utils.FloatToBytes(wl.eastAngle).CopyTo(mBlock, pos); pos += 4; | ||
109 | Utils.FloatToBytes(wl.sunGlowFocus).CopyTo(mBlock, pos); pos += 4; | ||
110 | Utils.FloatToBytes(wl.sunGlowSize).CopyTo(mBlock, pos); pos += 4; | ||
111 | Utils.FloatToBytes(wl.sceneGamma).CopyTo(mBlock, pos); pos += 4; | ||
112 | Utils.FloatToBytes(wl.starBrightness).CopyTo(mBlock, pos); pos += 4; | ||
113 | wl.cloudColor.ToBytes(mBlock, pos); pos += 16; | ||
114 | wl.cloudXYDensity.ToBytes(mBlock, pos); pos += 12; | ||
115 | Utils.FloatToBytes(wl.cloudCoverage).CopyTo(mBlock, pos); pos += 4; | ||
116 | Utils.FloatToBytes(wl.cloudScale).CopyTo(mBlock, pos); pos += 4; | ||
117 | wl.cloudDetailXYDensity.ToBytes(mBlock, pos); pos += 12; | ||
118 | Utils.FloatToBytes(wl.cloudScrollX).CopyTo(mBlock, pos); pos += 4; | ||
119 | Utils.FloatToBytes(wl.cloudScrollY).CopyTo(mBlock, pos); pos += 4; | ||
120 | Utils.UInt16ToBytes(wl.maxAltitude).CopyTo(mBlock, pos); pos += 2; | ||
121 | mBlock[pos] = Convert.ToByte(wl.cloudScrollXLock); pos++; | ||
122 | mBlock[pos] = Convert.ToByte(wl.cloudScrollYLock); pos++; | ||
123 | mBlock[pos] = Convert.ToByte(wl.drawClassicClouds); pos++; | ||
124 | List<byte[]> param = new List<byte[]>(); | ||
125 | param.Add(mBlock); | ||
126 | return param; | ||
79 | } | 127 | } |
80 | public void SendProfileToClient(ScenePresence presence) | 128 | public void SendProfileToClient(ScenePresence presence) |
81 | { | 129 | { |
130 | IClientAPI client = presence.ControllingClient; | ||
82 | if (m_enableWindlight) | 131 | if (m_enableWindlight) |
83 | { | 132 | { |
84 | if (presence.IsChildAgent == false) | 133 | if (presence.IsChildAgent == false) |
85 | { | 134 | { |
86 | IClientAPI client = presence.ControllingClient; | 135 | List<byte[]> param = compileWindlightSettings(m_scene.RegionInfo.WindlightSettings); |
87 | RegionMeta7WindlightData wl = m_scene.RegionInfo.WindlightSettings; | ||
88 | byte[] mBlock = new Byte[249]; | ||
89 | int pos = 0; | ||
90 | |||
91 | wl.waterColor.ToBytes(mBlock, 0); pos += 12; | ||
92 | Utils.FloatToBytes(wl.waterFogDensityExponent).CopyTo(mBlock, pos); pos += 4; | ||
93 | Utils.FloatToBytes(wl.underwaterFogModifier).CopyTo(mBlock, pos); pos += 4; | ||
94 | wl.reflectionWaveletScale.ToBytes(mBlock, pos); pos += 12; | ||
95 | Utils.FloatToBytes(wl.fresnelScale).CopyTo(mBlock, pos); pos += 4; | ||
96 | Utils.FloatToBytes(wl.fresnelOffset).CopyTo(mBlock, pos); pos += 4; | ||
97 | Utils.FloatToBytes(wl.refractScaleAbove).CopyTo(mBlock, pos); pos += 4; | ||
98 | Utils.FloatToBytes(wl.refractScaleBelow).CopyTo(mBlock, pos); pos += 4; | ||
99 | Utils.FloatToBytes(wl.blurMultiplier).CopyTo(mBlock, pos); pos += 4; | ||
100 | wl.bigWaveDirection.ToBytes(mBlock, pos); pos += 8; | ||
101 | wl.littleWaveDirection.ToBytes(mBlock, pos); pos += 8; | ||
102 | wl.normalMapTexture.ToBytes(mBlock, pos); pos += 16; | ||
103 | wl.horizon.ToBytes(mBlock, pos); pos += 16; | ||
104 | Utils.FloatToBytes(wl.hazeHorizon).CopyTo(mBlock, pos); pos += 4; | ||
105 | wl.blueDensity.ToBytes(mBlock, pos); pos += 16; | ||
106 | Utils.FloatToBytes(wl.hazeDensity).CopyTo(mBlock, pos); pos += 4; | ||
107 | Utils.FloatToBytes(wl.densityMultiplier).CopyTo(mBlock, pos); pos += 4; | ||
108 | Utils.FloatToBytes(wl.distanceMultiplier).CopyTo(mBlock, pos); pos += 4; | ||
109 | wl.sunMoonColor.ToBytes(mBlock, pos); pos += 16; | ||
110 | Utils.FloatToBytes(wl.sunMoonPosition).CopyTo(mBlock, pos); pos += 4; | ||
111 | wl.ambient.ToBytes(mBlock, pos); pos += 16; | ||
112 | Utils.FloatToBytes(wl.eastAngle).CopyTo(mBlock, pos); pos += 4; | ||
113 | Utils.FloatToBytes(wl.sunGlowFocus).CopyTo(mBlock, pos); pos += 4; | ||
114 | Utils.FloatToBytes(wl.sunGlowSize).CopyTo(mBlock, pos); pos += 4; | ||
115 | Utils.FloatToBytes(wl.sceneGamma).CopyTo(mBlock, pos); pos += 4; | ||
116 | Utils.FloatToBytes(wl.starBrightness).CopyTo(mBlock, pos); pos += 4; | ||
117 | wl.cloudColor.ToBytes(mBlock, pos); pos += 16; | ||
118 | wl.cloudXYDensity.ToBytes(mBlock, pos); pos += 12; | ||
119 | Utils.FloatToBytes(wl.cloudCoverage).CopyTo(mBlock, pos); pos += 4; | ||
120 | Utils.FloatToBytes(wl.cloudScale).CopyTo(mBlock, pos); pos += 4; | ||
121 | wl.cloudDetailXYDensity.ToBytes(mBlock, pos); pos += 12; | ||
122 | Utils.FloatToBytes(wl.cloudScrollX).CopyTo(mBlock, pos); pos += 4; | ||
123 | Utils.FloatToBytes(wl.cloudScrollY).CopyTo(mBlock, pos); pos += 4; | ||
124 | Utils.UInt16ToBytes(wl.maxAltitude).CopyTo(mBlock, pos); pos += 2; | ||
125 | mBlock[pos] = Convert.ToByte(wl.cloudScrollXLock); pos++; | ||
126 | mBlock[pos] = Convert.ToByte(wl.cloudScrollYLock); pos++; | ||
127 | mBlock[pos] = Convert.ToByte(wl.drawClassicClouds); pos++; | ||
128 | List<byte[]> param = new List<byte[]>(); | ||
129 | param.Add(mBlock); | ||
130 | |||
131 | client.SendGenericMessage("Windlight", param); | 136 | client.SendGenericMessage("Windlight", param); |
132 | } | 137 | } |
133 | } | 138 | } |
@@ -136,13 +141,37 @@ namespace OpenSim.Region.CoreModules.World.Meta7Windlight | |||
136 | //We probably don't want to spam chat with this.. probably | 141 | //We probably don't want to spam chat with this.. probably |
137 | //m_log.Debug("[WINDLIGHT]: Module disabled"); | 142 | //m_log.Debug("[WINDLIGHT]: Module disabled"); |
138 | } | 143 | } |
144 | } | ||
145 | public void SendProfileToClient(ScenePresence presence, RegionMeta7WindlightData wl) | ||
146 | { | ||
147 | IClientAPI client = presence.ControllingClient; | ||
148 | if (m_enableWindlight) | ||
149 | { | ||
150 | if (presence.IsChildAgent == false) | ||
151 | { | ||
152 | List<byte[]> param = compileWindlightSettings(wl); | ||
153 | client.SendGenericMessage("Windlight", param); | ||
154 | } | ||
155 | } | ||
156 | else | ||
157 | { | ||
158 | //We probably don't want to spam chat with this.. probably | ||
159 | //m_log.Debug("[WINDLIGHT]: Module disabled"); | ||
160 | } | ||
139 | } | 161 | } |
140 | private void EventManager_OnMakeRootAgent(ScenePresence presence) | 162 | private void EventManager_OnMakeRootAgent(ScenePresence presence) |
141 | { | 163 | { |
142 | m_log.Debug("[WINDLIGHT]: Sending windlight scene to new client"); | 164 | m_log.Debug("[WINDLIGHT]: Sending windlight scene to new client"); |
143 | SendProfileToClient(presence); | 165 | SendProfileToClient(presence); |
166 | } | ||
167 | private void EventManager_OnSendNewWindlightProfileTargeted(RegionMeta7WindlightData wl, UUID pUUID) | ||
168 | { | ||
169 | ScenePresence Sc; | ||
170 | if (m_scene.TryGetAvatar(pUUID,out Sc)) | ||
171 | { | ||
172 | SendProfileToClient(Sc,wl); | ||
173 | } | ||
144 | } | 174 | } |
145 | |||
146 | private void EventManager_OnSaveNewWindlightProfile() | 175 | private void EventManager_OnSaveNewWindlightProfile() |
147 | { | 176 | { |
148 | m_scene.ForEachScenePresence(SendProfileToClient); | 177 | m_scene.ForEachScenePresence(SendProfileToClient); |
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index a86e263..68e73b1 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -194,7 +194,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
194 | 194 | ||
195 | public delegate void OnMakeRootAgentDelegate(ScenePresence presence); | 195 | public delegate void OnMakeRootAgentDelegate(ScenePresence presence); |
196 | public delegate void OnSaveNewWindlightProfileDelegate(); | 196 | public delegate void OnSaveNewWindlightProfileDelegate(); |
197 | public delegate void OnSendNewWindlightProfileTargetedDelegate(RegionMeta7WindlightData wl, UUID user); | ||
197 | public event OnMakeRootAgentDelegate OnMakeRootAgent; | 198 | public event OnMakeRootAgentDelegate OnMakeRootAgent; |
199 | public event OnSendNewWindlightProfileTargetedDelegate OnSendNewWindlightProfileTargeted; | ||
198 | public event OnSaveNewWindlightProfileDelegate OnSaveNewWindlightProfile; | 200 | public event OnSaveNewWindlightProfileDelegate OnSaveNewWindlightProfile; |
199 | 201 | ||
200 | public delegate void NewInventoryItemUploadComplete(UUID avatarID, UUID assetID, string name, int userlevel); | 202 | public delegate void NewInventoryItemUploadComplete(UUID avatarID, UUID assetID, string name, int userlevel); |
@@ -414,6 +416,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
414 | private ClientClosed handlerClientClosed = null; //OnClientClosed; | 416 | private ClientClosed handlerClientClosed = null; //OnClientClosed; |
415 | private OnMakeChildAgentDelegate handlerMakeChildAgent = null; //OnMakeChildAgent; | 417 | private OnMakeChildAgentDelegate handlerMakeChildAgent = null; //OnMakeChildAgent; |
416 | private OnSaveNewWindlightProfileDelegate handlerSaveNewWindlightProfile = null; //OnSaveNewWindlightProfile; | 418 | private OnSaveNewWindlightProfileDelegate handlerSaveNewWindlightProfile = null; //OnSaveNewWindlightProfile; |
419 | private OnSendNewWindlightProfileTargetedDelegate handlerSendNewWindlightProfileTargeted = null; //OnSendNewWindlightProfileTargeted; | ||
417 | private OnMakeRootAgentDelegate handlerMakeRootAgent = null; //OnMakeRootAgent; | 420 | private OnMakeRootAgentDelegate handlerMakeRootAgent = null; //OnMakeRootAgent; |
418 | private OnTerrainTickDelegate handlerTerrainTick = null; // OnTerainTick; | 421 | private OnTerrainTickDelegate handlerTerrainTick = null; // OnTerainTick; |
419 | private RegisterCapsEvent handlerRegisterCaps = null; // OnRegisterCaps; | 422 | private RegisterCapsEvent handlerRegisterCaps = null; // OnRegisterCaps; |
@@ -775,6 +778,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
775 | } | 778 | } |
776 | } | 779 | } |
777 | 780 | ||
781 | public void TriggerOnSendNewWindlightProfileTargeted(RegionMeta7WindlightData wl, UUID user) | ||
782 | { | ||
783 | handlerSendNewWindlightProfileTargeted = OnSendNewWindlightProfileTargeted; | ||
784 | if (handlerSendNewWindlightProfileTargeted != null) | ||
785 | { | ||
786 | handlerSendNewWindlightProfileTargeted(wl, user); | ||
787 | } | ||
788 | } | ||
789 | |||
778 | public void TriggerOnSaveNewWindlightProfile() | 790 | public void TriggerOnSaveNewWindlightProfile() |
779 | { | 791 | { |
780 | handlerSaveNewWindlightProfile = OnSaveNewWindlightProfile; | 792 | handlerSaveNewWindlightProfile = OnSaveNewWindlightProfile; |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 104d22b..20cae5d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1519,8 +1519,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1519 | public void SaveTerrain() | 1519 | public void SaveTerrain() |
1520 | { | 1520 | { |
1521 | m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); | 1521 | m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); |
1522 | } | 1522 | } |
1523 | 1523 | ||
1524 | public void StoreWindlightProfile(RegionMeta7WindlightData wl) | 1524 | public void StoreWindlightProfile(RegionMeta7WindlightData wl) |
1525 | { | 1525 | { |
1526 | m_regInfo.WindlightSettings = wl; | 1526 | m_regInfo.WindlightSettings = wl; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs index 4cc2f0a..d4250c1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs | |||
@@ -229,8 +229,181 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
229 | 229 | ||
230 | return values; | 230 | return values; |
231 | 231 | ||
232 | } | 232 | } |
233 | |||
234 | private RegionMeta7WindlightData getWindlightProfileFromRules(LSL_List rules) | ||
235 | { | ||
236 | RegionMeta7WindlightData wl = (RegionMeta7WindlightData)m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.Clone(); | ||
233 | 237 | ||
238 | LSL_List values = new LSL_List(); | ||
239 | int idx = 0; | ||
240 | while (idx < rules.Length) | ||
241 | { | ||
242 | uint rule = (uint)rules.GetLSLIntegerItem(idx); | ||
243 | LSL_Types.Quaternion iQ; | ||
244 | LSL_Types.Vector3 iV; | ||
245 | switch (rule) | ||
246 | { | ||
247 | case (int)ScriptBaseClass.WL_AMBIENT: | ||
248 | idx++; | ||
249 | iQ = rules.GetQuaternionItem(idx); | ||
250 | wl.ambient = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); | ||
251 | break; | ||
252 | case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION: | ||
253 | idx++; | ||
254 | iV = rules.GetVector3Item(idx); | ||
255 | wl.bigWaveDirection = new Vector2((float)iV.x, (float)iV.y); | ||
256 | break; | ||
257 | case (int)ScriptBaseClass.WL_BLUE_DENSITY: | ||
258 | idx++; | ||
259 | iQ = rules.GetQuaternionItem(idx); | ||
260 | wl.blueDensity = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); | ||
261 | break; | ||
262 | case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER: | ||
263 | idx++; | ||
264 | wl.blurMultiplier = (float)rules.GetLSLFloatItem(idx); | ||
265 | break; | ||
266 | case (int)ScriptBaseClass.WL_CLOUD_COLOR: | ||
267 | idx++; | ||
268 | iQ = rules.GetQuaternionItem(idx); | ||
269 | wl.cloudColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); | ||
270 | break; | ||
271 | case (int)ScriptBaseClass.WL_CLOUD_COVERAGE: | ||
272 | idx++; | ||
273 | wl.cloudCoverage = (float)rules.GetLSLFloatItem(idx); | ||
274 | break; | ||
275 | case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY: | ||
276 | idx++; | ||
277 | iV = rules.GetVector3Item(idx); | ||
278 | wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); | ||
279 | break; | ||
280 | case (int)ScriptBaseClass.WL_CLOUD_SCALE: | ||
281 | idx++; | ||
282 | wl.cloudScale = (float)rules.GetLSLFloatItem(idx); | ||
283 | break; | ||
284 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X: | ||
285 | idx++; | ||
286 | wl.cloudScrollX = (float)rules.GetLSLFloatItem(idx); | ||
287 | break; | ||
288 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK: | ||
289 | idx++; | ||
290 | wl.cloudScrollXLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false; | ||
291 | break; | ||
292 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y: | ||
293 | idx++; | ||
294 | wl.cloudScrollY = (float)rules.GetLSLFloatItem(idx); | ||
295 | break; | ||
296 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK: | ||
297 | idx++; | ||
298 | wl.cloudScrollYLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false; | ||
299 | break; | ||
300 | case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY: | ||
301 | idx++; | ||
302 | iV = rules.GetVector3Item(idx); | ||
303 | wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); | ||
304 | break; | ||
305 | case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER: | ||
306 | idx++; | ||
307 | wl.densityMultiplier = (float)rules.GetLSLFloatItem(idx); | ||
308 | break; | ||
309 | case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER: | ||
310 | idx++; | ||
311 | wl.distanceMultiplier = (float)rules.GetLSLFloatItem(idx); | ||
312 | break; | ||
313 | case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS: | ||
314 | idx++; | ||
315 | wl.drawClassicClouds = rules.GetLSLIntegerItem(idx).value == 1 ? true : false; | ||
316 | break; | ||
317 | case (int)ScriptBaseClass.WL_EAST_ANGLE: | ||
318 | idx++; | ||
319 | wl.eastAngle = (float)rules.GetLSLFloatItem(idx); | ||
320 | break; | ||
321 | case (int)ScriptBaseClass.WL_FRESNEL_OFFSET: | ||
322 | idx++; | ||
323 | wl.fresnelOffset = (float)rules.GetLSLFloatItem(idx); | ||
324 | break; | ||
325 | case (int)ScriptBaseClass.WL_FRESNEL_SCALE: | ||
326 | idx++; | ||
327 | wl.fresnelScale = (float)rules.GetLSLFloatItem(idx); | ||
328 | break; | ||
329 | case (int)ScriptBaseClass.WL_HAZE_DENSITY: | ||
330 | idx++; | ||
331 | wl.hazeDensity = (float)rules.GetLSLFloatItem(idx); | ||
332 | break; | ||
333 | case (int)ScriptBaseClass.WL_HAZE_HORIZON: | ||
334 | idx++; | ||
335 | wl.hazeHorizon = (float)rules.GetLSLFloatItem(idx); | ||
336 | break; | ||
337 | case (int)ScriptBaseClass.WL_HORIZON: | ||
338 | idx++; | ||
339 | iQ = rules.GetQuaternionItem(idx); | ||
340 | wl.horizon = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); | ||
341 | break; | ||
342 | case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION: | ||
343 | idx++; | ||
344 | iV = rules.GetVector3Item(idx); | ||
345 | wl.littleWaveDirection = new Vector2((float)iV.x, (float)iV.y); | ||
346 | break; | ||
347 | case (int)ScriptBaseClass.WL_MAX_ALTITUDE: | ||
348 | idx++; | ||
349 | wl.maxAltitude = (ushort)rules.GetLSLIntegerItem(idx).value; | ||
350 | break; | ||
351 | case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE: | ||
352 | idx++; | ||
353 | wl.normalMapTexture = new UUID(rules.GetLSLStringItem(idx).m_string); | ||
354 | break; | ||
355 | case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE: | ||
356 | idx++; | ||
357 | iV = rules.GetVector3Item(idx); | ||
358 | wl.reflectionWaveletScale = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); | ||
359 | break; | ||
360 | case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE: | ||
361 | idx++; | ||
362 | wl.refractScaleAbove = (float)rules.GetLSLFloatItem(idx); | ||
363 | break; | ||
364 | case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW: | ||
365 | idx++; | ||
366 | wl.refractScaleBelow = (float)rules.GetLSLFloatItem(idx); | ||
367 | break; | ||
368 | case (int)ScriptBaseClass.WL_SCENE_GAMMA: | ||
369 | idx++; | ||
370 | wl.sceneGamma = (float)rules.GetLSLFloatItem(idx); | ||
371 | break; | ||
372 | case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS: | ||
373 | idx++; | ||
374 | wl.starBrightness = (float)rules.GetLSLFloatItem(idx); | ||
375 | break; | ||
376 | case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS: | ||
377 | idx++; | ||
378 | wl.sunGlowFocus = (float)rules.GetLSLFloatItem(idx); | ||
379 | break; | ||
380 | case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE: | ||
381 | idx++; | ||
382 | wl.sunGlowSize = (float)rules.GetLSLFloatItem(idx); | ||
383 | break; | ||
384 | case (int)ScriptBaseClass.WL_SUN_MOON_COLOR: | ||
385 | idx++; | ||
386 | iQ = rules.GetQuaternionItem(idx); | ||
387 | wl.sunMoonColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); | ||
388 | break; | ||
389 | case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER: | ||
390 | idx++; | ||
391 | wl.underwaterFogModifier = (float)rules.GetLSLFloatItem(idx); | ||
392 | break; | ||
393 | case (int)ScriptBaseClass.WL_WATER_COLOR: | ||
394 | idx++; | ||
395 | iV = rules.GetVector3Item(idx); | ||
396 | wl.waterColor = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); | ||
397 | break; | ||
398 | case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT: | ||
399 | idx++; | ||
400 | wl.waterFogDensityExponent = (float)rules.GetLSLFloatItem(idx); | ||
401 | break; | ||
402 | } | ||
403 | idx++; | ||
404 | } | ||
405 | return wl; | ||
406 | } | ||
234 | /// <summary> | 407 | /// <summary> |
235 | /// Set the current Windlight scene | 408 | /// Set the current Windlight scene |
236 | /// </summary> | 409 | /// </summary> |
@@ -242,188 +415,58 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
242 | { | 415 | { |
243 | CMShoutError("Careminster functions are not enabled."); | 416 | CMShoutError("Careminster functions are not enabled."); |
244 | return 0; | 417 | return 0; |
418 | } | ||
419 | if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) | ||
420 | { | ||
421 | CMShoutError("cmSetWindlightScene can only be used by estate managers or owners."); | ||
422 | return 0; | ||
245 | } | 423 | } |
246 | int success = 0; | 424 | int success = 0; |
247 | m_host.AddScriptLPS(1); | 425 | m_host.AddScriptLPS(1); |
248 | if (Meta7WindlightModule.EnableWindlight) | 426 | if (Meta7WindlightModule.EnableWindlight) |
249 | { | 427 | { |
250 | RegionMeta7WindlightData wl = m_host.ParentGroup.Scene.RegionInfo.WindlightSettings; | 428 | RegionMeta7WindlightData wl = getWindlightProfileFromRules(rules); |
251 | 429 | m_host.ParentGroup.Scene.StoreWindlightProfile(wl); | |
252 | LSL_List values = new LSL_List(); | 430 | success = 1; |
253 | int idx = 0; | 431 | } |
254 | success = 1; | 432 | else |
255 | while (idx < rules.Length) | 433 | { |
256 | { | 434 | CMShoutError("Windlight module is disabled"); |
257 | uint rule = (uint)rules.GetLSLIntegerItem(idx); | 435 | return 0; |
258 | LSL_Types.Quaternion iQ; | ||
259 | LSL_Types.Vector3 iV; | ||
260 | switch (rule) | ||
261 | { | ||
262 | case (int)ScriptBaseClass.WL_AMBIENT: | ||
263 | idx++; | ||
264 | iQ = rules.GetQuaternionItem(idx); | ||
265 | wl.ambient = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); | ||
266 | break; | ||
267 | case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION: | ||
268 | idx++; | ||
269 | iV = rules.GetVector3Item(idx); | ||
270 | wl.bigWaveDirection = new Vector2((float)iV.x, (float)iV.y); | ||
271 | break; | ||
272 | case (int)ScriptBaseClass.WL_BLUE_DENSITY: | ||
273 | idx++; | ||
274 | iQ = rules.GetQuaternionItem(idx); | ||
275 | wl.blueDensity = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); | ||
276 | break; | ||
277 | case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER: | ||
278 | idx++; | ||
279 | wl.blurMultiplier = (float)rules.GetLSLFloatItem(idx); | ||
280 | break; | ||
281 | case (int)ScriptBaseClass.WL_CLOUD_COLOR: | ||
282 | idx++; | ||
283 | iQ = rules.GetQuaternionItem(idx); | ||
284 | wl.cloudColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); | ||
285 | break; | ||
286 | case (int)ScriptBaseClass.WL_CLOUD_COVERAGE: | ||
287 | idx++; | ||
288 | wl.cloudCoverage = (float)rules.GetLSLFloatItem(idx); | ||
289 | break; | ||
290 | case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY: | ||
291 | idx++; | ||
292 | iV = rules.GetVector3Item(idx); | ||
293 | wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); | ||
294 | break; | ||
295 | case (int)ScriptBaseClass.WL_CLOUD_SCALE: | ||
296 | idx++; | ||
297 | wl.cloudScale = (float)rules.GetLSLFloatItem(idx); | ||
298 | break; | ||
299 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X: | ||
300 | idx++; | ||
301 | wl.cloudScrollX = (float)rules.GetLSLFloatItem(idx); | ||
302 | break; | ||
303 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK: | ||
304 | idx++; | ||
305 | wl.cloudScrollXLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false; | ||
306 | break; | ||
307 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y: | ||
308 | idx++; | ||
309 | wl.cloudScrollY = (float)rules.GetLSLFloatItem(idx); | ||
310 | break; | ||
311 | case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK: | ||
312 | idx++; | ||
313 | wl.cloudScrollYLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false; | ||
314 | break; | ||
315 | case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY: | ||
316 | idx++; | ||
317 | iV = rules.GetVector3Item(idx); | ||
318 | wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); | ||
319 | break; | ||
320 | case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER: | ||
321 | idx++; | ||
322 | wl.densityMultiplier = (float)rules.GetLSLFloatItem(idx); | ||
323 | break; | ||
324 | case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER: | ||
325 | idx++; | ||
326 | wl.distanceMultiplier = (float)rules.GetLSLFloatItem(idx); | ||
327 | break; | ||
328 | case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS: | ||
329 | idx++; | ||
330 | wl.drawClassicClouds = rules.GetLSLIntegerItem(idx).value == 1 ? true : false; | ||
331 | break; | ||
332 | case (int)ScriptBaseClass.WL_EAST_ANGLE: | ||
333 | idx++; | ||
334 | wl.eastAngle = (float)rules.GetLSLFloatItem(idx); | ||
335 | break; | ||
336 | case (int)ScriptBaseClass.WL_FRESNEL_OFFSET: | ||
337 | idx++; | ||
338 | wl.fresnelOffset = (float)rules.GetLSLFloatItem(idx); | ||
339 | break; | ||
340 | case (int)ScriptBaseClass.WL_FRESNEL_SCALE: | ||
341 | idx++; | ||
342 | wl.fresnelScale = (float)rules.GetLSLFloatItem(idx); | ||
343 | break; | ||
344 | case (int)ScriptBaseClass.WL_HAZE_DENSITY: | ||
345 | idx++; | ||
346 | wl.hazeDensity = (float)rules.GetLSLFloatItem(idx); | ||
347 | break; | ||
348 | case (int)ScriptBaseClass.WL_HAZE_HORIZON: | ||
349 | idx++; | ||
350 | wl.hazeHorizon = (float)rules.GetLSLFloatItem(idx); | ||
351 | break; | ||
352 | case (int)ScriptBaseClass.WL_HORIZON: | ||
353 | idx++; | ||
354 | iQ = rules.GetQuaternionItem(idx); | ||
355 | wl.horizon = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); | ||
356 | break; | ||
357 | case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION: | ||
358 | idx++; | ||
359 | iV = rules.GetVector3Item(idx); | ||
360 | wl.littleWaveDirection = new Vector2((float)iV.x, (float)iV.y); | ||
361 | break; | ||
362 | case (int)ScriptBaseClass.WL_MAX_ALTITUDE: | ||
363 | idx++; | ||
364 | wl.maxAltitude = (ushort)rules.GetLSLIntegerItem(idx).value; | ||
365 | break; | ||
366 | case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE: | ||
367 | idx++; | ||
368 | wl.normalMapTexture = new UUID(rules.GetLSLStringItem(idx).m_string); | ||
369 | break; | ||
370 | case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE: | ||
371 | idx++; | ||
372 | iV = rules.GetVector3Item(idx); | ||
373 | wl.reflectionWaveletScale = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); | ||
374 | break; | ||
375 | case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE: | ||
376 | idx++; | ||
377 | wl.refractScaleAbove = (float)rules.GetLSLFloatItem(idx); | ||
378 | break; | ||
379 | case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW: | ||
380 | idx++; | ||
381 | wl.refractScaleBelow = (float)rules.GetLSLFloatItem(idx); | ||
382 | break; | ||
383 | case (int)ScriptBaseClass.WL_SCENE_GAMMA: | ||
384 | idx++; | ||
385 | wl.sceneGamma = (float)rules.GetLSLFloatItem(idx); | ||
386 | break; | ||
387 | case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS: | ||
388 | idx++; | ||
389 | wl.starBrightness = (float)rules.GetLSLFloatItem(idx); | ||
390 | break; | ||
391 | case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS: | ||
392 | idx++; | ||
393 | wl.sunGlowFocus = (float)rules.GetLSLFloatItem(idx); | ||
394 | break; | ||
395 | case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE: | ||
396 | idx++; | ||
397 | wl.sunGlowSize = (float)rules.GetLSLFloatItem(idx); | ||
398 | break; | ||
399 | case (int)ScriptBaseClass.WL_SUN_MOON_COLOR: | ||
400 | idx++; | ||
401 | iQ = rules.GetQuaternionItem(idx); | ||
402 | wl.sunMoonColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); | ||
403 | break; | ||
404 | case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER: | ||
405 | idx++; | ||
406 | wl.underwaterFogModifier = (float)rules.GetLSLFloatItem(idx); | ||
407 | break; | ||
408 | case (int)ScriptBaseClass.WL_WATER_COLOR: | ||
409 | idx++; | ||
410 | iV = rules.GetVector3Item(idx); | ||
411 | wl.waterColor = new Vector3((float)iV.x, (float)iV.y, (float)iV.z); | ||
412 | break; | ||
413 | case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT: | ||
414 | idx++; | ||
415 | wl.waterFogDensityExponent = (float)rules.GetLSLFloatItem(idx); | ||
416 | break; | ||
417 | default: | ||
418 | success = 0; | ||
419 | break; | ||
420 | } | ||
421 | idx++; | ||
422 | } | ||
423 | m_host.ParentGroup.Scene.StoreWindlightProfile(wl); | ||
424 | |||
425 | } | 436 | } |
426 | return success; | 437 | return success; |
438 | } | ||
439 | /// <summary> | ||
440 | /// Set the current Windlight scene to a target avatar | ||
441 | /// </summary> | ||
442 | /// <param name="rules"></param> | ||
443 | /// <returns>success: true or false</returns> | ||
444 | public int cmSetWindlightSceneTargeted(LSL_List rules, LSL_Key target) | ||
445 | { | ||
446 | if (!m_CMFunctionsEnabled) | ||
447 | { | ||
448 | CMShoutError("Careminster functions are not enabled."); | ||
449 | return 0; | ||
450 | } | ||
451 | if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200) | ||
452 | { | ||
453 | CMShoutError("cmSetWindlightSceneTargeted can only be used by estate managers or owners."); | ||
454 | return 0; | ||
455 | } | ||
456 | int success = 0; | ||
457 | m_host.AddScriptLPS(1); | ||
458 | if (Meta7WindlightModule.EnableWindlight) | ||
459 | { | ||
460 | RegionMeta7WindlightData wl = getWindlightProfileFromRules(rules); | ||
461 | World.EventManager.TriggerOnSendNewWindlightProfileTargeted(wl, new UUID(target.m_string)); | ||
462 | success = 1; | ||
463 | } | ||
464 | else | ||
465 | { | ||
466 | CMShoutError("Windlight module is disabled"); | ||
467 | return 0; | ||
468 | } | ||
469 | return success; | ||
427 | } | 470 | } |
428 | 471 | ||
429 | } | 472 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs index 9dd0b73..ef990a1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs | |||
@@ -15,6 +15,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
15 | { | 15 | { |
16 | // Windlight Functions | 16 | // Windlight Functions |
17 | LSL_List cmGetWindlightScene(LSL_List rules); | 17 | LSL_List cmGetWindlightScene(LSL_List rules); |
18 | int cmSetWindlightScene(LSL_List rules); | 18 | int cmSetWindlightScene(LSL_List rules); |
19 | int cmSetWindlightSceneTargeted(LSL_List rules, key target); | ||
19 | } | 20 | } |
20 | } | 21 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs index e85d41e..5bc3a88 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs | |||
@@ -66,6 +66,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
66 | public int cmSetWindlightScene(LSL_List rules) | 66 | public int cmSetWindlightScene(LSL_List rules) |
67 | { | 67 | { |
68 | return m_CM_Functions.cmSetWindlightScene(rules); | 68 | return m_CM_Functions.cmSetWindlightScene(rules); |
69 | } | ||
70 | |||
71 | public int cmSetWindlightSceneTargeted(LSL_List rules, key target) | ||
72 | { | ||
73 | return m_CM_Functions.cmSetWindlightSceneTargeted(rules, target); | ||
69 | } | 74 | } |
70 | } | 75 | } |
71 | } | 76 | } |