aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs6
-rw-r--r--OpenSim/Region/CoreModules/World/Meta7Windlight/Meta7WindlightModule.cs245
-rw-r--r--OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/IRegionDataStore.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs12
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs15
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs11
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs2
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs333
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs7
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs38
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs10
13 files changed, 677 insertions, 8 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 71f9b90..2b5e632 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -770,16 +770,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
770 } 770 }
771 } 771 }
772 772
773 public void SendGenericMessage(string method, List<string> message) 773 public void SendGenericMessage(string method, List<byte[]> message)
774 { 774 {
775 GenericMessagePacket gmp = new GenericMessagePacket(); 775 GenericMessagePacket gmp = new GenericMessagePacket();
776 gmp.MethodData.Method = Util.StringToBytes256(method); 776 gmp.MethodData.Method = Util.StringToBytes256(method);
777 gmp.ParamList = new GenericMessagePacket.ParamListBlock[message.Count]; 777 gmp.ParamList = new GenericMessagePacket.ParamListBlock[message.Count];
778 int i = 0; 778 int i = 0;
779 foreach (string val in message) 779 foreach (byte[] val in message)
780 { 780 {
781 gmp.ParamList[i] = new GenericMessagePacket.ParamListBlock(); 781 gmp.ParamList[i] = new GenericMessagePacket.ParamListBlock();
782 gmp.ParamList[i++].Parameter = Util.StringToBytes256(val); 782 gmp.ParamList[i++].Parameter = val;
783 } 783 }
784 OutPacket(gmp, ThrottleOutPacketType.Task); 784 OutPacket(gmp, ThrottleOutPacketType.Task);
785 } 785 }
diff --git a/OpenSim/Region/CoreModules/World/Meta7Windlight/Meta7WindlightModule.cs b/OpenSim/Region/CoreModules/World/Meta7Windlight/Meta7WindlightModule.cs
new file mode 100644
index 0000000..f180b47
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Meta7Windlight/Meta7WindlightModule.cs
@@ -0,0 +1,245 @@
1/*
2 * Copyright (c) Thomas Grimshaw and Magne Metaverse Research
3 *
4 * This module is not open source. All rights reserved.
5 * Unauthorised copying, distribution or public display is prohibited.
6 *
7 */
8
9using System;
10using System.Collections.Generic;
11using System.IO;
12using System.Reflection;
13using OpenMetaverse;
14using log4net;
15using Nini.Config;
16using OpenSim.Data;
17using OpenSim.Framework;
18using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
19using OpenSim.Region.Framework.Interfaces;
20using OpenSim.Region.Framework.Scenes;
21
22
23namespace OpenSim.Region.CoreModules.World.Meta7Windlight
24{
25 public class Meta7WindlightModule : IRegionModule, ICommandableModule
26 {
27 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
28 private readonly Commander m_commander = new Commander("windlight");
29 private Scene m_scene;
30 private static bool m_enableWindlight;
31
32 #region ICommandableModule Members
33
34 public ICommander CommandInterface
35 {
36 get { return m_commander; }
37 }
38
39 #endregion
40
41 #region IRegionModule Members
42
43 public static bool EnableWindlight
44 {
45 get
46 {
47 return m_enableWindlight;
48 }
49 set
50 {
51 }
52 }
53
54 public void Initialise(Scene scene, IConfigSource config)
55 {
56 m_scene = scene;
57 m_scene.RegisterModuleInterface<IRegionModule>(this);
58 m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
59
60 // ini file settings
61 try
62 {
63 m_enableWindlight = config.Configs["Meta7Windlight"].GetBoolean("enable_windlight", false);
64 }
65 catch (Exception)
66 {
67 m_log.Debug("[WINDLIGHT]: ini failure for enable_windlight - using default");
68 }
69
70 if (m_enableWindlight)
71 {
72 m_scene.EventManager.OnMakeRootAgent += EventManager_OnMakeRootAgent;
73 m_scene.EventManager.OnSaveNewWindlightProfile += EventManager_OnSaveNewWindlightProfile;
74 }
75
76 InstallCommands();
77
78 m_log.Debug("[WINDLIGHT]: Initialised windlight module");
79 }
80 public void SendProfileToClient(ScenePresence presence)
81 {
82 if (m_enableWindlight)
83 {
84 if (presence.IsChildAgent == false)
85 {
86 IClientAPI client = presence.ControllingClient;
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);
132 }
133 }
134 else
135 {
136 //We probably don't want to spam chat with this.. probably
137 //m_log.Debug("[WINDLIGHT]: Module disabled");
138 }
139 }
140 private void EventManager_OnMakeRootAgent(ScenePresence presence)
141 {
142 m_log.Debug("[WINDLIGHT]: Sending windlight scene to new client");
143 SendProfileToClient(presence);
144 }
145
146 private void EventManager_OnSaveNewWindlightProfile()
147 {
148 m_scene.ForEachScenePresence(SendProfileToClient);
149 }
150
151 public void PostInitialise()
152 {
153
154 }
155
156 public void Close()
157 {
158 }
159
160 public string Name
161 {
162 get { return "Meta7WindlightModule"; }
163 }
164
165 public bool IsSharedModule
166 {
167 get { return false; }
168 }
169
170 #endregion
171
172 #region events
173
174 #endregion
175
176 #region ICommandableModule Members
177
178 private void InstallCommands()
179 {
180 Command wlload = new Command("load", CommandIntentions.COMMAND_NON_HAZARDOUS, HandleLoad, "Load windlight profile from the database and broadcast");
181 Command wlenable = new Command("enable", CommandIntentions.COMMAND_NON_HAZARDOUS, HandleEnable, "Enable the windlight plugin");
182 Command wldisable = new Command("disable", CommandIntentions.COMMAND_NON_HAZARDOUS, HandleDisable, "Enable the windlight plugin");
183
184 m_commander.RegisterCommand("load", wlload);
185 m_commander.RegisterCommand("enable", wlenable);
186 m_commander.RegisterCommand("disable", wldisable);
187
188 m_scene.RegisterModuleCommander(m_commander);
189 }
190
191 private void HandleLoad(Object[] args)
192 {
193 if (!m_enableWindlight)
194 {
195 m_log.InfoFormat("[WINDLIGHT]: Cannot load windlight profile, module disabled. Use 'windlight enable' first.");
196 }
197 else
198 {
199 m_log.InfoFormat("[WINDLIGHT]: Loading Windlight profile from database");
200 m_scene.LoadWindlightProfile();
201 m_log.InfoFormat("[WINDLIGHT]: Load complete");
202 }
203 }
204
205 private void HandleDisable(Object[] args)
206 {
207 m_log.InfoFormat("[WINDLIGHT]: Plugin now disabled");
208 m_enableWindlight=false;
209 }
210
211 private void HandleEnable(Object[] args)
212 {
213 m_log.InfoFormat("[WINDLIGHT]: Plugin now enabled");
214 m_enableWindlight = true;
215 }
216
217 /// <summary>
218 /// Processes commandline input. Do not call directly.
219 /// </summary>
220 /// <param name="args">Commandline arguments</param>
221 private void EventManager_OnPluginConsole(string[] args)
222 {
223 if (args[0] == "windlight")
224 {
225 if (args.Length == 1)
226 {
227 m_commander.ProcessConsoleCommand("add", new string[0]);
228 return;
229 }
230
231 string[] tmpArgs = new string[args.Length - 2];
232 int i;
233 for (i = 2; i < args.Length; i++)
234 {
235 tmpArgs[i - 2] = args[i];
236 }
237
238 m_commander.ProcessConsoleCommand(args[1], tmpArgs);
239 }
240 }
241 #endregion
242
243 }
244}
245
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
index 9754da3..816060f 100644
--- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
@@ -433,7 +433,7 @@ namespace OpenSim.Region.Examples.SimpleModule
433 433
434 } 434 }
435 435
436 public void SendGenericMessage(string method, List<string> message) 436 public void SendGenericMessage(string method, List<byte[]> message)
437 { 437 {
438 438
439 } 439 }
diff --git a/OpenSim/Region/Framework/Interfaces/IRegionDataStore.cs b/OpenSim/Region/Framework/Interfaces/IRegionDataStore.cs
index 78bd622..7312799 100644
--- a/OpenSim/Region/Framework/Interfaces/IRegionDataStore.cs
+++ b/OpenSim/Region/Framework/Interfaces/IRegionDataStore.cs
@@ -103,6 +103,8 @@ namespace OpenSim.Region.Framework.Interfaces
103 103
104 void StoreRegionSettings(RegionSettings rs); 104 void StoreRegionSettings(RegionSettings rs);
105 RegionSettings LoadRegionSettings(UUID regionUUID); 105 RegionSettings LoadRegionSettings(UUID regionUUID);
106 RegionMeta7WindlightData LoadRegionWindlightSettings(UUID regionUUID);
107 void StoreRegionWindlightSettings(RegionMeta7WindlightData wl);
106 108
107 void Shutdown(); 109 void Shutdown();
108 } 110 }
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 753344d..a86e263 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -193,7 +193,9 @@ namespace OpenSim.Region.Framework.Scenes
193 public event OnMakeChildAgentDelegate OnMakeChildAgent; 193 public event OnMakeChildAgentDelegate OnMakeChildAgent;
194 194
195 public delegate void OnMakeRootAgentDelegate(ScenePresence presence); 195 public delegate void OnMakeRootAgentDelegate(ScenePresence presence);
196 public delegate void OnSaveNewWindlightProfileDelegate();
196 public event OnMakeRootAgentDelegate OnMakeRootAgent; 197 public event OnMakeRootAgentDelegate OnMakeRootAgent;
198 public event OnSaveNewWindlightProfileDelegate OnSaveNewWindlightProfile;
197 199
198 public delegate void NewInventoryItemUploadComplete(UUID avatarID, UUID assetID, string name, int userlevel); 200 public delegate void NewInventoryItemUploadComplete(UUID avatarID, UUID assetID, string name, int userlevel);
199 201
@@ -411,6 +413,7 @@ namespace OpenSim.Region.Framework.Scenes
411 private IncomingInstantMessage handlerUnhandledInstantMessage = null; //OnUnhandledInstantMessage; 413 private IncomingInstantMessage handlerUnhandledInstantMessage = null; //OnUnhandledInstantMessage;
412 private ClientClosed handlerClientClosed = null; //OnClientClosed; 414 private ClientClosed handlerClientClosed = null; //OnClientClosed;
413 private OnMakeChildAgentDelegate handlerMakeChildAgent = null; //OnMakeChildAgent; 415 private OnMakeChildAgentDelegate handlerMakeChildAgent = null; //OnMakeChildAgent;
416 private OnSaveNewWindlightProfileDelegate handlerSaveNewWindlightProfile = null; //OnSaveNewWindlightProfile;
414 private OnMakeRootAgentDelegate handlerMakeRootAgent = null; //OnMakeRootAgent; 417 private OnMakeRootAgentDelegate handlerMakeRootAgent = null; //OnMakeRootAgent;
415 private OnTerrainTickDelegate handlerTerrainTick = null; // OnTerainTick; 418 private OnTerrainTickDelegate handlerTerrainTick = null; // OnTerainTick;
416 private RegisterCapsEvent handlerRegisterCaps = null; // OnRegisterCaps; 419 private RegisterCapsEvent handlerRegisterCaps = null; // OnRegisterCaps;
@@ -772,6 +775,15 @@ namespace OpenSim.Region.Framework.Scenes
772 } 775 }
773 } 776 }
774 777
778 public void TriggerOnSaveNewWindlightProfile()
779 {
780 handlerSaveNewWindlightProfile = OnSaveNewWindlightProfile;
781 if (handlerSaveNewWindlightProfile != null)
782 {
783 handlerSaveNewWindlightProfile();
784 }
785 }
786
775 public void TriggerOnMakeRootAgent(ScenePresence presence) 787 public void TriggerOnMakeRootAgent(ScenePresence presence)
776 { 788 {
777 handlerMakeRootAgent = OnMakeRootAgent; 789 handlerMakeRootAgent = OnMakeRootAgent;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index a8bab5a..1b275b0 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -539,6 +539,8 @@ namespace OpenSim.Region.Framework.Scenes
539 539
540 // Load region settings 540 // Load region settings
541 m_regInfo.RegionSettings = m_storageManager.DataStore.LoadRegionSettings(m_regInfo.RegionID); 541 m_regInfo.RegionSettings = m_storageManager.DataStore.LoadRegionSettings(m_regInfo.RegionID);
542 m_regInfo.WindlightSettings = m_storageManager.DataStore.LoadRegionWindlightSettings(m_regInfo.RegionID);
543
542 if (m_storageManager.EstateDataStore != null) 544 if (m_storageManager.EstateDataStore != null)
543 { 545 {
544 m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID); 546 m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID);
@@ -1502,6 +1504,19 @@ namespace OpenSim.Region.Framework.Scenes
1502 { 1504 {
1503 m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); 1505 m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
1504 } 1506 }
1507
1508 public void StoreWindlightProfile(RegionMeta7WindlightData wl)
1509 {
1510 m_regInfo.WindlightSettings = wl;
1511 m_storageManager.DataStore.StoreRegionWindlightSettings(wl);
1512 m_eventManager.TriggerOnSaveNewWindlightProfile();
1513 }
1514
1515 public void LoadWindlightProfile()
1516 {
1517 m_regInfo.WindlightSettings = m_storageManager.DataStore.LoadRegionWindlightSettings(RegionInfo.RegionID);
1518 m_eventManager.TriggerOnSaveNewWindlightProfile();
1519 }
1505 1520
1506 /// <summary> 1521 /// <summary>
1507 /// Loads the World heightmap 1522 /// Loads the World heightmap
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
index 8a27b7b..5abbb82 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
@@ -101,7 +101,16 @@ namespace OpenSim.Region.Framework.Scenes.Tests
101 { 101 {
102 throw new NotImplementedException(); 102 throw new NotImplementedException();
103 } 103 }
104 104 public RegionMeta7WindlightData LoadRegionWindlightSettings(UUID regionUUID)
105 {
106 //This connector doesn't support the windlight module yet
107 //Return default LL windlight settings
108 return new RegionMeta7WindlightData();
109 }
110 public void StoreRegionWindlightSettings(RegionMeta7WindlightData wl)
111 {
112 //This connector doesn't support the windlight module yet
113 }
105 public RegionSettings LoadRegionSettings(UUID regionUUID) 114 public RegionSettings LoadRegionSettings(UUID regionUUID)
106 { 115 {
107 return null; 116 return null;
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index 6c3e7eb..bdf1574 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -936,7 +936,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
936 // TODO 936 // TODO
937 } 937 }
938 938
939 public void SendGenericMessage(string method, List<string> message) 939 public void SendGenericMessage(string method, List<byte[]> message)
940 { 940 {
941 941
942 } 942 }
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index cf36d08..975033a 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -522,7 +522,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
522 522
523 } 523 }
524 524
525 public void SendGenericMessage(string method, List<string> message) 525 public void SendGenericMessage(string method, List<byte[]> message)
526 { 526 {
527 527
528 } 528 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 7f739b1..33c67d5 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -42,6 +42,7 @@ using OpenSim.Region.CoreModules.Avatar.NPC;
42using OpenSim.Region.Framework.Interfaces; 42using OpenSim.Region.Framework.Interfaces;
43using OpenSim.Region.Framework.Scenes; 43using OpenSim.Region.Framework.Scenes;
44using OpenSim.Region.Framework.Scenes.Hypergrid; 44using OpenSim.Region.Framework.Scenes.Hypergrid;
45using OpenSim.Region.CoreModules.World.Meta7Windlight;
45using OpenSim.Region.ScriptEngine.Shared; 46using OpenSim.Region.ScriptEngine.Shared;
46using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; 47using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
47using OpenSim.Region.ScriptEngine.Shared.ScriptBase; 48using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
@@ -1974,5 +1975,337 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1974 return ret; 1975 return ret;
1975 } 1976 }
1976 1977
1978 /// <summary>
1979 /// Get the current Windlight scene
1980 /// </summary>
1981 /// <returns>List of windlight parameters</returns>
1982 public LSL_List osGetWindlightScene(LSL_List rules)
1983 {
1984 CheckThreatLevel(ThreatLevel.Low, "osGetWindlightScene");
1985 m_host.AddScriptLPS(1);
1986 RegionMeta7WindlightData wl = m_host.ParentGroup.Scene.RegionInfo.WindlightSettings;
1987
1988 LSL_List values = new LSL_List();
1989 int idx = 0;
1990 while (idx < rules.Length)
1991 {
1992 uint rule = (uint)rules.GetLSLIntegerItem(idx);
1993 LSL_List toadd = new LSL_List();
1994
1995 switch (rule)
1996 {
1997 case (int)ScriptBaseClass.WL_AMBIENT:
1998 toadd.Add(new LSL_Rotation(wl.ambient.X, wl.ambient.Y, wl.ambient.Z, wl.ambient.W));
1999 break;
2000 case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION:
2001 toadd.Add(new LSL_Vector(wl.bigWaveDirection.X, wl.bigWaveDirection.Y, 0.0f));
2002 break;
2003 case (int)ScriptBaseClass.WL_BLUE_DENSITY:
2004 toadd.Add(new LSL_Rotation(wl.blueDensity.X, wl.blueDensity.Y, wl.blueDensity.Z, wl.blueDensity.W));
2005 break;
2006 case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER:
2007 toadd.Add(new LSL_Float(wl.blurMultiplier));
2008 break;
2009 case (int)ScriptBaseClass.WL_CLOUD_COLOR:
2010 toadd.Add(new LSL_Rotation(wl.cloudColor.X, wl.cloudColor.Y, wl.cloudColor.Z, wl.cloudColor.W));
2011 break;
2012 case (int)ScriptBaseClass.WL_CLOUD_COVERAGE:
2013 toadd.Add(new LSL_Float(wl.cloudCoverage));
2014 break;
2015 case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY:
2016 toadd.Add(new LSL_Vector(wl.cloudDetailXYDensity.X, wl.cloudDetailXYDensity.Y, wl.cloudDetailXYDensity.Z));
2017 break;
2018 case (int)ScriptBaseClass.WL_CLOUD_SCALE:
2019 toadd.Add(new LSL_Float(wl.cloudScale));
2020 break;
2021 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X:
2022 toadd.Add(new LSL_Float(wl.cloudScrollX));
2023 break;
2024 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK:
2025 toadd.Add(new LSL_Integer(wl.cloudScrollXLock ? 1 : 0));
2026 break;
2027 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y:
2028 toadd.Add(new LSL_Float(wl.cloudScrollY));
2029 break;
2030 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK:
2031 toadd.Add(new LSL_Integer(wl.cloudScrollYLock ? 1 : 0));
2032 break;
2033 case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY:
2034 toadd.Add(new LSL_Vector(wl.cloudXYDensity.X, wl.cloudXYDensity.Y, wl.cloudXYDensity.Z));
2035 break;
2036 case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER:
2037 toadd.Add(new LSL_Float(wl.densityMultiplier));
2038 break;
2039 case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER:
2040 toadd.Add(new LSL_Float(wl.distanceMultiplier));
2041 break;
2042 case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS:
2043 toadd.Add(new LSL_Integer(wl.drawClassicClouds ? 1 : 0));
2044 break;
2045 case (int)ScriptBaseClass.WL_EAST_ANGLE:
2046 toadd.Add(new LSL_Float(wl.eastAngle));
2047 break;
2048 case (int)ScriptBaseClass.WL_FRESNEL_OFFSET:
2049 toadd.Add(new LSL_Float(wl.fresnelOffset));
2050 break;
2051 case (int)ScriptBaseClass.WL_FRESNEL_SCALE:
2052 toadd.Add(new LSL_Float(wl.fresnelScale));
2053 break;
2054 case (int)ScriptBaseClass.WL_HAZE_DENSITY:
2055 toadd.Add(new LSL_Float(wl.hazeDensity));
2056 break;
2057 case (int)ScriptBaseClass.WL_HAZE_HORIZON:
2058 toadd.Add(new LSL_Float(wl.hazeHorizon));
2059 break;
2060 case (int)ScriptBaseClass.WL_HORIZON:
2061 toadd.Add(new LSL_Rotation(wl.horizon.X, wl.horizon.Y, wl.horizon.Z, wl.horizon.W));
2062 break;
2063 case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION:
2064 toadd.Add(new LSL_Vector(wl.littleWaveDirection.X, wl.littleWaveDirection.Y, 0.0f));
2065 break;
2066 case (int)ScriptBaseClass.WL_MAX_ALTITUDE:
2067 toadd.Add(new LSL_Integer(wl.maxAltitude));
2068 break;
2069 case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE:
2070 toadd.Add(new LSL_Key(wl.normalMapTexture.ToString()));
2071 break;
2072 case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE:
2073 toadd.Add(new LSL_Vector(wl.reflectionWaveletScale.X, wl.reflectionWaveletScale.Y, wl.reflectionWaveletScale.Z));
2074 break;
2075 case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE:
2076 toadd.Add(new LSL_Float(wl.refractScaleAbove));
2077 break;
2078 case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW:
2079 toadd.Add(new LSL_Float(wl.refractScaleBelow));
2080 break;
2081 case (int)ScriptBaseClass.WL_SCENE_GAMMA:
2082 toadd.Add(new LSL_Float(wl.sceneGamma));
2083 break;
2084 case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS:
2085 toadd.Add(new LSL_Float(wl.starBrightness));
2086 break;
2087 case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS:
2088 toadd.Add(new LSL_Float(wl.sunGlowFocus));
2089 break;
2090 case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE:
2091 toadd.Add(new LSL_Float(wl.sunGlowSize));
2092 break;
2093 case (int)ScriptBaseClass.WL_SUN_MOON_COLOR:
2094 toadd.Add(new LSL_Rotation(wl.sunMoonColor.X, wl.sunMoonColor.Y, wl.sunMoonColor.Z, wl.sunMoonColor.W));
2095 break;
2096 case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER:
2097 toadd.Add(new LSL_Float(wl.underwaterFogModifier));
2098 break;
2099 case (int)ScriptBaseClass.WL_WATER_COLOR:
2100 toadd.Add(new LSL_Vector(wl.waterColor.X, wl.waterColor.Y, wl.waterColor.Z));
2101 break;
2102 case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT:
2103 toadd.Add(new LSL_Float(wl.waterFogDensityExponent));
2104 break;
2105 }
2106
2107 if (toadd.Length > 0)
2108 {
2109 values.Add(rule);
2110 values.Add(toadd.Data[0]);
2111 }
2112 idx++;
2113 }
2114
2115
2116 return values;
2117
2118 }
2119
2120 /// <summary>
2121 /// Set the current Windlight scene
2122 /// </summary>
2123 /// <param name="rules"></param>
2124 /// <returns>success: true or false</returns>
2125 public int osSetWindlightScene(LSL_List rules)
2126 {
2127 CheckThreatLevel(ThreatLevel.High, "osSetWindlightScene");
2128 int success = 0;
2129 m_host.AddScriptLPS(1);
2130 if (Meta7WindlightModule.EnableWindlight)
2131 {
2132 RegionMeta7WindlightData wl = m_host.ParentGroup.Scene.RegionInfo.WindlightSettings;
2133
2134 LSL_List values = new LSL_List();
2135 int idx = 0;
2136 success = 1;
2137 while (idx < rules.Length)
2138 {
2139 uint rule = (uint)rules.GetLSLIntegerItem(idx);
2140 LSL_Types.Quaternion iQ;
2141 LSL_Types.Vector3 iV;
2142 switch (rule)
2143 {
2144 case (int)ScriptBaseClass.WL_AMBIENT:
2145 idx++;
2146 iQ = rules.GetQuaternionItem(idx);
2147 wl.ambient = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
2148 break;
2149 case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION:
2150 idx++;
2151 iV = rules.GetVector3Item(idx);
2152 wl.bigWaveDirection = new Vector2((float)iV.x, (float)iV.y);
2153 break;
2154 case (int)ScriptBaseClass.WL_BLUE_DENSITY:
2155 idx++;
2156 iQ = rules.GetQuaternionItem(idx);
2157 wl.blueDensity = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
2158 break;
2159 case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER:
2160 idx++;
2161 wl.blurMultiplier = (float)rules.GetLSLFloatItem(idx);
2162 break;
2163 case (int)ScriptBaseClass.WL_CLOUD_COLOR:
2164 idx++;
2165 iQ = rules.GetQuaternionItem(idx);
2166 wl.cloudColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
2167 break;
2168 case (int)ScriptBaseClass.WL_CLOUD_COVERAGE:
2169 idx++;
2170 wl.cloudCoverage = (float)rules.GetLSLFloatItem(idx);
2171 break;
2172 case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY:
2173 idx++;
2174 iV = rules.GetVector3Item(idx);
2175 wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
2176 break;
2177 case (int)ScriptBaseClass.WL_CLOUD_SCALE:
2178 idx++;
2179 wl.cloudScale = (float)rules.GetLSLFloatItem(idx);
2180 break;
2181 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X:
2182 idx++;
2183 wl.cloudScrollX = (float)rules.GetLSLFloatItem(idx);
2184 break;
2185 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK:
2186 idx++;
2187 wl.cloudScrollXLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
2188 break;
2189 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y:
2190 idx++;
2191 wl.cloudScrollY = (float)rules.GetLSLFloatItem(idx);
2192 break;
2193 case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK:
2194 idx++;
2195 wl.cloudScrollYLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
2196 break;
2197 case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY:
2198 idx++;
2199 iV = rules.GetVector3Item(idx);
2200 wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
2201 break;
2202 case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER:
2203 idx++;
2204 wl.densityMultiplier = (float)rules.GetLSLFloatItem(idx);
2205 break;
2206 case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER:
2207 idx++;
2208 wl.distanceMultiplier = (float)rules.GetLSLFloatItem(idx);
2209 break;
2210 case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS:
2211 idx++;
2212 wl.drawClassicClouds = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
2213 break;
2214 case (int)ScriptBaseClass.WL_EAST_ANGLE:
2215 idx++;
2216 wl.eastAngle = (float)rules.GetLSLFloatItem(idx);
2217 break;
2218 case (int)ScriptBaseClass.WL_FRESNEL_OFFSET:
2219 idx++;
2220 wl.fresnelOffset = (float)rules.GetLSLFloatItem(idx);
2221 break;
2222 case (int)ScriptBaseClass.WL_FRESNEL_SCALE:
2223 idx++;
2224 wl.fresnelScale = (float)rules.GetLSLFloatItem(idx);
2225 break;
2226 case (int)ScriptBaseClass.WL_HAZE_DENSITY:
2227 idx++;
2228 wl.hazeDensity = (float)rules.GetLSLFloatItem(idx);
2229 break;
2230 case (int)ScriptBaseClass.WL_HAZE_HORIZON:
2231 idx++;
2232 wl.hazeHorizon= (float)rules.GetLSLFloatItem(idx);
2233 break;
2234 case (int)ScriptBaseClass.WL_HORIZON:
2235 idx++;
2236 iQ = rules.GetQuaternionItem(idx);
2237 wl.horizon = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
2238 break;
2239 case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION:
2240 idx++;
2241 iV = rules.GetVector3Item(idx);
2242 wl.littleWaveDirection = new Vector2((float)iV.x, (float)iV.y);
2243 break;
2244 case (int)ScriptBaseClass.WL_MAX_ALTITUDE:
2245 idx++;
2246 wl.maxAltitude = (ushort)rules.GetLSLIntegerItem(idx).value;
2247 break;
2248 case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE:
2249 idx++;
2250 wl.normalMapTexture = new UUID(rules.GetLSLStringItem(idx).m_string);
2251 break;
2252 case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE:
2253 idx++;
2254 iV = rules.GetVector3Item(idx);
2255 wl.reflectionWaveletScale= new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
2256 break;
2257 case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE:
2258 idx++;
2259 wl.refractScaleAbove = (float)rules.GetLSLFloatItem(idx);
2260 break;
2261 case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW:
2262 idx++;
2263 wl.refractScaleBelow = (float)rules.GetLSLFloatItem(idx);
2264 break;
2265 case (int)ScriptBaseClass.WL_SCENE_GAMMA:
2266 idx++;
2267 wl.sceneGamma = (float)rules.GetLSLFloatItem(idx);
2268 break;
2269 case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS:
2270 idx++;
2271 wl.starBrightness= (float)rules.GetLSLFloatItem(idx);
2272 break;
2273 case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS:
2274 idx++;
2275 wl.sunGlowFocus= (float)rules.GetLSLFloatItem(idx);
2276 break;
2277 case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE:
2278 idx++;
2279 wl.sunGlowSize= (float)rules.GetLSLFloatItem(idx);
2280 break;
2281 case (int)ScriptBaseClass.WL_SUN_MOON_COLOR:
2282 idx++;
2283 iQ = rules.GetQuaternionItem(idx);
2284 wl.sunMoonColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
2285 break;
2286 case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER:
2287 idx++;
2288 wl.underwaterFogModifier = (float)rules.GetLSLFloatItem(idx);
2289 break;
2290 case (int)ScriptBaseClass.WL_WATER_COLOR:
2291 idx++;
2292 iV = rules.GetVector3Item(idx);
2293 wl.waterColor = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
2294 break;
2295 case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT:
2296 idx++;
2297 wl.waterFogDensityExponent = (float)rules.GetLSLFloatItem(idx);
2298 break;
2299 default:
2300 success = 0;
2301 break;
2302 }
2303 idx++;
2304 }
2305 m_host.ParentGroup.Scene.StoreWindlightProfile(wl);
2306
2307 }
2308 return success;
2309 }
1977 } 2310 }
1978} 2311}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 0b0dc00..dd2869b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -80,7 +80,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
80 // Avatar Info Commands 80 // Avatar Info Commands
81 string osGetAgentIP(string agent); 81 string osGetAgentIP(string agent);
82 LSL_List osGetAgents(); 82 LSL_List osGetAgents();
83 83
84 // Teleport commands 84 // Teleport commands
85 void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); 85 void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
86 void osTeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); 86 void osTeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
@@ -163,5 +163,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
163 key osGetMapTexture(); 163 key osGetMapTexture();
164 key osGetRegionMapTexture(string regionName); 164 key osGetRegionMapTexture(string regionName);
165 LSL_List osGetRegionStats(); 165 LSL_List osGetRegionStats();
166
167 // Windlight Functions
168 LSL_List osGetWindlightScene(LSL_List rules);
169 int osSetWindlightScene(LSL_List rules);
170
166 } 171 }
167} 172}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
index acff8fb..4956c28 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs
@@ -539,5 +539,43 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
539 public const int STATS_ACTIVE_SCRIPTS = 19; 539 public const int STATS_ACTIVE_SCRIPTS = 19;
540 public const int STATS_SCRIPT_LPS = 20; 540 public const int STATS_SCRIPT_LPS = 20;
541 541
542 // Constants for osWindlight*
543 public const int WL_WATER_COLOR = 0;
544 public const int WL_WATER_FOG_DENSITY_EXPONENT = 1;
545 public const int WL_UNDERWATER_FOG_MODIFIER = 2;
546 public const int WL_REFLECTION_WAVELET_SCALE = 3;
547 public const int WL_FRESNEL_SCALE = 4;
548 public const int WL_FRESNEL_OFFSET = 5;
549 public const int WL_REFRACT_SCALE_ABOVE = 6;
550 public const int WL_REFRACT_SCALE_BELOW = 7;
551 public const int WL_BLUR_MULTIPLIER = 8;
552 public const int WL_BIG_WAVE_DIRECTION = 9;
553 public const int WL_LITTLE_WAVE_DIRECTION = 10;
554 public const int WL_NORMAL_MAP_TEXTURE = 11;
555 public const int WL_HORIZON = 12;
556 public const int WL_HAZE_HORIZON = 13;
557 public const int WL_BLUE_DENSITY = 14;
558 public const int WL_HAZE_DENSITY = 15;
559 public const int WL_DENSITY_MULTIPLIER = 16;
560 public const int WL_DISTANCE_MULTIPLIER = 17;
561 public const int WL_MAX_ALTITUDE = 18;
562 public const int WL_SUN_MOON_COLOR = 19;
563 public const int WL_AMBIENT = 20;
564 public const int WL_EAST_ANGLE = 21;
565 public const int WL_SUN_GLOW_FOCUS = 22;
566 public const int WL_SUN_GLOW_SIZE = 23;
567 public const int WL_SCENE_GAMMA = 24;
568 public const int WL_STAR_BRIGHTNESS = 25;
569 public const int WL_CLOUD_COLOR = 26;
570 public const int WL_CLOUD_XY_DENSITY = 27;
571 public const int WL_CLOUD_COVERAGE = 28;
572 public const int WL_CLOUD_SCALE = 29;
573 public const int WL_CLOUD_DETAIL_XY_DENSITY = 30;
574 public const int WL_CLOUD_SCROLL_X = 31;
575 public const int WL_CLOUD_SCROLL_Y = 32;
576 public const int WL_CLOUD_SCROLL_Y_LOCK = 33;
577 public const int WL_CLOUD_SCROLL_X_LOCK = 34;
578 public const int WL_DRAW_CLASSIC_CLOUDS = 35;
579
542 } 580 }
543} 581}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 519463e..1480b8b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -637,5 +637,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
637 { 637 {
638 return m_OSSL_Functions.osGetRegionStats(); 638 return m_OSSL_Functions.osGetRegionStats();
639 } 639 }
640
641 public LSL_List osGetWindlightScene(LSL_List rules)
642 {
643 return m_OSSL_Functions.osGetWindlightScene(rules);
644 }
645
646 public int osSetWindlightScene(LSL_List rules)
647 {
648 return m_OSSL_Functions.osSetWindlightScene(rules);
649 }
640 } 650 }
641} 651}