aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api
diff options
context:
space:
mode:
authorMelanie2010-03-31 04:23:51 +0100
committerMelanie2010-03-31 04:23:51 +0100
commit19ae5e5dbb3ae12907305a7fad4cd2f4952ae94c (patch)
tree68e6b86248b26d60f3aad63c2de67c4f99ff43cd /OpenSim/Region/ScriptEngine/Shared/Api
parentAdding the configuration example (diff)
downloadopensim-SC_OLD-19ae5e5dbb3ae12907305a7fad4cd2f4952ae94c.zip
opensim-SC_OLD-19ae5e5dbb3ae12907305a7fad4cd2f4952ae94c.tar.gz
opensim-SC_OLD-19ae5e5dbb3ae12907305a7fad4cd2f4952ae94c.tar.bz2
opensim-SC_OLD-19ae5e5dbb3ae12907305a7fad4cd2f4952ae94c.tar.xz
Adding the LightShare module and scripting API. This code was written by
TomMeta and was contributed by Meta7.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs477
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs21
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Constants.cs77
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs76
4 files changed, 651 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
new file mode 100644
index 0000000..4e8a3c4
--- /dev/null
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs
@@ -0,0 +1,477 @@
1using System;
2using System.Reflection;
3using System.Collections;
4using System.Collections.Generic;
5using System.Runtime.Remoting.Lifetime;
6using OpenMetaverse;
7using Nini.Config;
8using OpenSim;
9using OpenSim.Framework;
10using OpenSim.Region.CoreModules.World.LightShare;
11using OpenSim.Region.Framework.Interfaces;
12using OpenSim.Region.Framework.Scenes;
13using OpenSim.Region.ScriptEngine.Shared;
14using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
15using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
16using OpenSim.Region.ScriptEngine.Interfaces;
17using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
18
19using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
20using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
21using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
22using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
23using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
24using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
25using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
26
27namespace OpenSim.Region.ScriptEngine.Shared.Api
28{
29 [Serializable]
30 public class CM_Api : MarshalByRefObject, ICM_Api, IScriptApi
31 {
32 internal IScriptEngine m_ScriptEngine;
33 internal SceneObjectPart m_host;
34 internal uint m_localID;
35 internal UUID m_itemID;
36 internal bool m_CMFunctionsEnabled = false;
37 internal IScriptModuleComms m_comms = null;
38
39 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID)
40 {
41 m_ScriptEngine = ScriptEngine;
42 m_host = host;
43 m_localID = localID;
44 m_itemID = itemID;
45
46 if (m_ScriptEngine.Config.GetBoolean("AllowCareminsterFunctions", false))
47 m_CMFunctionsEnabled = true;
48
49 m_comms = m_ScriptEngine.World.RequestModuleInterface<IScriptModuleComms>();
50 if (m_comms == null)
51 m_CMFunctionsEnabled = false;
52 }
53
54 public override Object InitializeLifetimeService()
55 {
56 ILease lease = (ILease)base.InitializeLifetimeService();
57
58 if (lease.CurrentState == LeaseState.Initial)
59 {
60 lease.InitialLeaseTime = TimeSpan.FromMinutes(0);
61 // lease.RenewOnCallTime = TimeSpan.FromSeconds(10.0);
62 // lease.SponsorshipTimeout = TimeSpan.FromMinutes(1.0);
63 }
64 return lease;
65 }
66
67 public Scene World
68 {
69 get { return m_ScriptEngine.World; }
70 }
71
72 //
73 //Dumps an error message on the debug console.
74 //
75
76 internal void CMShoutError(string message)
77 {
78 if (message.Length > 1023)
79 message = message.Substring(0, 1023);
80
81 World.SimChat(Utils.StringToBytes(message),
82 ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, true);
83
84 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
85 wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message);
86 }
87
88 /// <summary>
89 /// Get the current Windlight scene
90 /// </summary>
91 /// <returns>List of windlight parameters</returns>
92 public LSL_List cmGetWindlightScene(LSL_List rules)
93 {
94 if (!m_CMFunctionsEnabled)
95 {
96 CMShoutError("Careminster functions are not enabled.");
97 return new LSL_List();
98 }
99 m_host.AddScriptLPS(1);
100 RegionLightShareData wl = m_host.ParentGroup.Scene.RegionInfo.WindlightSettings;
101
102 LSL_List values = new LSL_List();
103 int idx = 0;
104 while (idx < rules.Length)
105 {
106 uint rule = (uint)rules.GetLSLIntegerItem(idx);
107 LSL_List toadd = new LSL_List();
108
109 switch (rule)
110 {
111 case (int)ScriptBaseClass.WL_AMBIENT:
112 toadd.Add(new LSL_Rotation(wl.ambient.X, wl.ambient.Y, wl.ambient.Z, wl.ambient.W));
113 break;
114 case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION:
115 toadd.Add(new LSL_Vector(wl.bigWaveDirection.X, wl.bigWaveDirection.Y, 0.0f));
116 break;
117 case (int)ScriptBaseClass.WL_BLUE_DENSITY:
118 toadd.Add(new LSL_Rotation(wl.blueDensity.X, wl.blueDensity.Y, wl.blueDensity.Z, wl.blueDensity.W));
119 break;
120 case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER:
121 toadd.Add(new LSL_Float(wl.blurMultiplier));
122 break;
123 case (int)ScriptBaseClass.WL_CLOUD_COLOR:
124 toadd.Add(new LSL_Rotation(wl.cloudColor.X, wl.cloudColor.Y, wl.cloudColor.Z, wl.cloudColor.W));
125 break;
126 case (int)ScriptBaseClass.WL_CLOUD_COVERAGE:
127 toadd.Add(new LSL_Float(wl.cloudCoverage));
128 break;
129 case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY:
130 toadd.Add(new LSL_Vector(wl.cloudDetailXYDensity.X, wl.cloudDetailXYDensity.Y, wl.cloudDetailXYDensity.Z));
131 break;
132 case (int)ScriptBaseClass.WL_CLOUD_SCALE:
133 toadd.Add(new LSL_Float(wl.cloudScale));
134 break;
135 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X:
136 toadd.Add(new LSL_Float(wl.cloudScrollX));
137 break;
138 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK:
139 toadd.Add(new LSL_Integer(wl.cloudScrollXLock ? 1 : 0));
140 break;
141 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y:
142 toadd.Add(new LSL_Float(wl.cloudScrollY));
143 break;
144 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK:
145 toadd.Add(new LSL_Integer(wl.cloudScrollYLock ? 1 : 0));
146 break;
147 case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY:
148 toadd.Add(new LSL_Vector(wl.cloudXYDensity.X, wl.cloudXYDensity.Y, wl.cloudXYDensity.Z));
149 break;
150 case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER:
151 toadd.Add(new LSL_Float(wl.densityMultiplier));
152 break;
153 case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER:
154 toadd.Add(new LSL_Float(wl.distanceMultiplier));
155 break;
156 case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS:
157 toadd.Add(new LSL_Integer(wl.drawClassicClouds ? 1 : 0));
158 break;
159 case (int)ScriptBaseClass.WL_EAST_ANGLE:
160 toadd.Add(new LSL_Float(wl.eastAngle));
161 break;
162 case (int)ScriptBaseClass.WL_FRESNEL_OFFSET:
163 toadd.Add(new LSL_Float(wl.fresnelOffset));
164 break;
165 case (int)ScriptBaseClass.WL_FRESNEL_SCALE:
166 toadd.Add(new LSL_Float(wl.fresnelScale));
167 break;
168 case (int)ScriptBaseClass.WL_HAZE_DENSITY:
169 toadd.Add(new LSL_Float(wl.hazeDensity));
170 break;
171 case (int)ScriptBaseClass.WL_HAZE_HORIZON:
172 toadd.Add(new LSL_Float(wl.hazeHorizon));
173 break;
174 case (int)ScriptBaseClass.WL_HORIZON:
175 toadd.Add(new LSL_Rotation(wl.horizon.X, wl.horizon.Y, wl.horizon.Z, wl.horizon.W));
176 break;
177 case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION:
178 toadd.Add(new LSL_Vector(wl.littleWaveDirection.X, wl.littleWaveDirection.Y, 0.0f));
179 break;
180 case (int)ScriptBaseClass.WL_MAX_ALTITUDE:
181 toadd.Add(new LSL_Integer(wl.maxAltitude));
182 break;
183 case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE:
184 toadd.Add(new LSL_Key(wl.normalMapTexture.ToString()));
185 break;
186 case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE:
187 toadd.Add(new LSL_Vector(wl.reflectionWaveletScale.X, wl.reflectionWaveletScale.Y, wl.reflectionWaveletScale.Z));
188 break;
189 case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE:
190 toadd.Add(new LSL_Float(wl.refractScaleAbove));
191 break;
192 case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW:
193 toadd.Add(new LSL_Float(wl.refractScaleBelow));
194 break;
195 case (int)ScriptBaseClass.WL_SCENE_GAMMA:
196 toadd.Add(new LSL_Float(wl.sceneGamma));
197 break;
198 case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS:
199 toadd.Add(new LSL_Float(wl.starBrightness));
200 break;
201 case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS:
202 toadd.Add(new LSL_Float(wl.sunGlowFocus));
203 break;
204 case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE:
205 toadd.Add(new LSL_Float(wl.sunGlowSize));
206 break;
207 case (int)ScriptBaseClass.WL_SUN_MOON_COLOR:
208 toadd.Add(new LSL_Rotation(wl.sunMoonColor.X, wl.sunMoonColor.Y, wl.sunMoonColor.Z, wl.sunMoonColor.W));
209 break;
210 case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER:
211 toadd.Add(new LSL_Float(wl.underwaterFogModifier));
212 break;
213 case (int)ScriptBaseClass.WL_WATER_COLOR:
214 toadd.Add(new LSL_Vector(wl.waterColor.X, wl.waterColor.Y, wl.waterColor.Z));
215 break;
216 case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT:
217 toadd.Add(new LSL_Float(wl.waterFogDensityExponent));
218 break;
219 }
220
221 if (toadd.Length > 0)
222 {
223 values.Add(rule);
224 values.Add(toadd.Data[0]);
225 }
226 idx++;
227 }
228
229
230 return values;
231
232 }
233
234 private RegionLightShareData getWindlightProfileFromRules(LSL_List rules)
235 {
236 RegionLightShareData wl = (RegionLightShareData)m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.Clone();
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_SUN_MOON_POSITION:
248 idx++;
249 wl.sunMoonPosition = (float)rules.GetLSLFloatItem(idx);
250 break;
251 case (int)ScriptBaseClass.WL_AMBIENT:
252 idx++;
253 iQ = rules.GetQuaternionItem(idx);
254 wl.ambient = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
255 break;
256 case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION:
257 idx++;
258 iV = rules.GetVector3Item(idx);
259 wl.bigWaveDirection = new Vector2((float)iV.x, (float)iV.y);
260 break;
261 case (int)ScriptBaseClass.WL_BLUE_DENSITY:
262 idx++;
263 iQ = rules.GetQuaternionItem(idx);
264 wl.blueDensity = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
265 break;
266 case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER:
267 idx++;
268 wl.blurMultiplier = (float)rules.GetLSLFloatItem(idx);
269 break;
270 case (int)ScriptBaseClass.WL_CLOUD_COLOR:
271 idx++;
272 iQ = rules.GetQuaternionItem(idx);
273 wl.cloudColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
274 break;
275 case (int)ScriptBaseClass.WL_CLOUD_COVERAGE:
276 idx++;
277 wl.cloudCoverage = (float)rules.GetLSLFloatItem(idx);
278 break;
279 case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY:
280 idx++;
281 iV = rules.GetVector3Item(idx);
282 wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
283 break;
284 case (int)ScriptBaseClass.WL_CLOUD_SCALE:
285 idx++;
286 wl.cloudScale = (float)rules.GetLSLFloatItem(idx);
287 break;
288 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X:
289 idx++;
290 wl.cloudScrollX = (float)rules.GetLSLFloatItem(idx);
291 break;
292 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK:
293 idx++;
294 wl.cloudScrollXLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
295 break;
296 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y:
297 idx++;
298 wl.cloudScrollY = (float)rules.GetLSLFloatItem(idx);
299 break;
300 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK:
301 idx++;
302 wl.cloudScrollYLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
303 break;
304 case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY:
305 idx++;
306 iV = rules.GetVector3Item(idx);
307 wl.cloudXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
308 break;
309 case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER:
310 idx++;
311 wl.densityMultiplier = (float)rules.GetLSLFloatItem(idx);
312 break;
313 case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER:
314 idx++;
315 wl.distanceMultiplier = (float)rules.GetLSLFloatItem(idx);
316 break;
317 case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS:
318 idx++;
319 wl.drawClassicClouds = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
320 break;
321 case (int)ScriptBaseClass.WL_EAST_ANGLE:
322 idx++;
323 wl.eastAngle = (float)rules.GetLSLFloatItem(idx);
324 break;
325 case (int)ScriptBaseClass.WL_FRESNEL_OFFSET:
326 idx++;
327 wl.fresnelOffset = (float)rules.GetLSLFloatItem(idx);
328 break;
329 case (int)ScriptBaseClass.WL_FRESNEL_SCALE:
330 idx++;
331 wl.fresnelScale = (float)rules.GetLSLFloatItem(idx);
332 break;
333 case (int)ScriptBaseClass.WL_HAZE_DENSITY:
334 idx++;
335 wl.hazeDensity = (float)rules.GetLSLFloatItem(idx);
336 break;
337 case (int)ScriptBaseClass.WL_HAZE_HORIZON:
338 idx++;
339 wl.hazeHorizon = (float)rules.GetLSLFloatItem(idx);
340 break;
341 case (int)ScriptBaseClass.WL_HORIZON:
342 idx++;
343 iQ = rules.GetQuaternionItem(idx);
344 wl.horizon = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
345 break;
346 case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION:
347 idx++;
348 iV = rules.GetVector3Item(idx);
349 wl.littleWaveDirection = new Vector2((float)iV.x, (float)iV.y);
350 break;
351 case (int)ScriptBaseClass.WL_MAX_ALTITUDE:
352 idx++;
353 wl.maxAltitude = (ushort)rules.GetLSLIntegerItem(idx).value;
354 break;
355 case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE:
356 idx++;
357 wl.normalMapTexture = new UUID(rules.GetLSLStringItem(idx).m_string);
358 break;
359 case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE:
360 idx++;
361 iV = rules.GetVector3Item(idx);
362 wl.reflectionWaveletScale = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
363 break;
364 case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE:
365 idx++;
366 wl.refractScaleAbove = (float)rules.GetLSLFloatItem(idx);
367 break;
368 case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW:
369 idx++;
370 wl.refractScaleBelow = (float)rules.GetLSLFloatItem(idx);
371 break;
372 case (int)ScriptBaseClass.WL_SCENE_GAMMA:
373 idx++;
374 wl.sceneGamma = (float)rules.GetLSLFloatItem(idx);
375 break;
376 case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS:
377 idx++;
378 wl.starBrightness = (float)rules.GetLSLFloatItem(idx);
379 break;
380 case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS:
381 idx++;
382 wl.sunGlowFocus = (float)rules.GetLSLFloatItem(idx);
383 break;
384 case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE:
385 idx++;
386 wl.sunGlowSize = (float)rules.GetLSLFloatItem(idx);
387 break;
388 case (int)ScriptBaseClass.WL_SUN_MOON_COLOR:
389 idx++;
390 iQ = rules.GetQuaternionItem(idx);
391 wl.sunMoonColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
392 break;
393 case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER:
394 idx++;
395 wl.underwaterFogModifier = (float)rules.GetLSLFloatItem(idx);
396 break;
397 case (int)ScriptBaseClass.WL_WATER_COLOR:
398 idx++;
399 iV = rules.GetVector3Item(idx);
400 wl.waterColor = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
401 break;
402 case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT:
403 idx++;
404 wl.waterFogDensityExponent = (float)rules.GetLSLFloatItem(idx);
405 break;
406 }
407 idx++;
408 }
409 return wl;
410 }
411 /// <summary>
412 /// Set the current Windlight scene
413 /// </summary>
414 /// <param name="rules"></param>
415 /// <returns>success: true or false</returns>
416 public int cmSetWindlightScene(LSL_List rules)
417 {
418 if (!m_CMFunctionsEnabled)
419 {
420 CMShoutError("Careminster functions are not enabled.");
421 return 0;
422 }
423 if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
424 {
425 CMShoutError("cmSetWindlightScene can only be used by estate managers or owners.");
426 return 0;
427 }
428 int success = 0;
429 m_host.AddScriptLPS(1);
430 if (LightShareModule.EnableWindlight)
431 {
432 RegionLightShareData wl = getWindlightProfileFromRules(rules);
433 m_host.ParentGroup.Scene.StoreWindlightProfile(wl);
434 success = 1;
435 }
436 else
437 {
438 CMShoutError("Windlight module is disabled");
439 return 0;
440 }
441 return success;
442 }
443 /// <summary>
444 /// Set the current Windlight scene to a target avatar
445 /// </summary>
446 /// <param name="rules"></param>
447 /// <returns>success: true or false</returns>
448 public int cmSetWindlightSceneTargeted(LSL_List rules, LSL_Key target)
449 {
450 if (!m_CMFunctionsEnabled)
451 {
452 CMShoutError("Careminster functions are not enabled.");
453 return 0;
454 }
455 if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
456 {
457 CMShoutError("cmSetWindlightSceneTargeted can only be used by estate managers or owners.");
458 return 0;
459 }
460 int success = 0;
461 m_host.AddScriptLPS(1);
462 if (LightShareModule.EnableWindlight)
463 {
464 RegionLightShareData wl = getWindlightProfileFromRules(rules);
465 World.EventManager.TriggerOnSendNewWindlightProfileTargeted(wl, new UUID(target.m_string));
466 success = 1;
467 }
468 else
469 {
470 CMShoutError("Windlight module is disabled");
471 return 0;
472 }
473 return success;
474 }
475
476 }
477}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs
new file mode 100644
index 0000000..ef990a1
--- /dev/null
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs
@@ -0,0 +1,21 @@
1using System.Collections;
2using OpenSim.Region.ScriptEngine.Interfaces;
3
4using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
5using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
6using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
7using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
8using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
9using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
10using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
11
12namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
13{
14 public interface ICM_Api
15 {
16 // Windlight Functions
17 LSL_List cmGetWindlightScene(LSL_List rules);
18 int cmSetWindlightScene(LSL_List rules);
19 int cmSetWindlightSceneTargeted(LSL_List rules, key target);
20 }
21}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Constants.cs
new file mode 100644
index 0000000..522c020
--- /dev/null
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Constants.cs
@@ -0,0 +1,77 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
30using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
31using LSLInteger = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
32
33namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
34{
35 public partial class ScriptBaseClass
36 {
37 // Constants for cmWindlight*
38 public const int WL_WATER_COLOR = 0;
39 public const int WL_WATER_FOG_DENSITY_EXPONENT = 1;
40 public const int WL_UNDERWATER_FOG_MODIFIER = 2;
41 public const int WL_REFLECTION_WAVELET_SCALE = 3;
42 public const int WL_FRESNEL_SCALE = 4;
43 public const int WL_FRESNEL_OFFSET = 5;
44 public const int WL_REFRACT_SCALE_ABOVE = 6;
45 public const int WL_REFRACT_SCALE_BELOW = 7;
46 public const int WL_BLUR_MULTIPLIER = 8;
47 public const int WL_BIG_WAVE_DIRECTION = 9;
48 public const int WL_LITTLE_WAVE_DIRECTION = 10;
49 public const int WL_NORMAL_MAP_TEXTURE = 11;
50 public const int WL_HORIZON = 12;
51 public const int WL_HAZE_HORIZON = 13;
52 public const int WL_BLUE_DENSITY = 14;
53 public const int WL_HAZE_DENSITY = 15;
54 public const int WL_DENSITY_MULTIPLIER = 16;
55 public const int WL_DISTANCE_MULTIPLIER = 17;
56 public const int WL_MAX_ALTITUDE = 18;
57 public const int WL_SUN_MOON_COLOR = 19;
58 public const int WL_AMBIENT = 20;
59 public const int WL_EAST_ANGLE = 21;
60 public const int WL_SUN_GLOW_FOCUS = 22;
61 public const int WL_SUN_GLOW_SIZE = 23;
62 public const int WL_SCENE_GAMMA = 24;
63 public const int WL_STAR_BRIGHTNESS = 25;
64 public const int WL_CLOUD_COLOR = 26;
65 public const int WL_CLOUD_XY_DENSITY = 27;
66 public const int WL_CLOUD_COVERAGE = 28;
67 public const int WL_CLOUD_SCALE = 29;
68 public const int WL_CLOUD_DETAIL_XY_DENSITY = 30;
69 public const int WL_CLOUD_SCROLL_X = 31;
70 public const int WL_CLOUD_SCROLL_Y = 32;
71 public const int WL_CLOUD_SCROLL_Y_LOCK = 33;
72 public const int WL_CLOUD_SCROLL_X_LOCK = 34;
73 public const int WL_DRAW_CLASSIC_CLOUDS = 35;
74 public const int WL_SUN_MOON_POSITION = 36;
75
76 }
77}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs
new file mode 100644
index 0000000..5bc3a88
--- /dev/null
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs
@@ -0,0 +1,76 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Runtime.Remoting.Lifetime;
30using System.Threading;
31using System.Reflection;
32using System.Collections;
33using System.Collections.Generic;
34using OpenSim.Framework;
35using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.ScriptEngine.Interfaces;
37using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
38using integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
39using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
40using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
41using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
42using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
43using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
44using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
45using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
46
47namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
48{
49 public partial class ScriptBaseClass : MarshalByRefObject
50 {
51 public ICM_Api m_CM_Functions;
52
53 public void ApiTypeCM(IScriptApi api)
54 {
55 if (!(api is ICM_Api))
56 return;
57
58 m_CM_Functions = (ICM_Api)api;
59 }
60
61 public LSL_List cmGetWindlightScene(LSL_List rules)
62 {
63 return m_CM_Functions.cmGetWindlightScene(rules);
64 }
65
66 public int cmSetWindlightScene(LSL_List rules)
67 {
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);
74 }
75 }
76}