diff options
author | MW | 2007-09-08 07:50:31 +0000 |
---|---|---|
committer | MW | 2007-09-08 07:50:31 +0000 |
commit | c29df824c2db40ccdfbaf7ac6f166c578d77db3a (patch) | |
tree | 1e9513d9c5f8d9da48ece5ce796f4d80b5796d82 /OpenSim | |
parent | added SQLiteAssetData class first pass. This should work, (diff) | |
download | opensim-SC_OLD-c29df824c2db40ccdfbaf7ac6f166c578d77db3a.zip opensim-SC_OLD-c29df824c2db40ccdfbaf7ac6f166c578d77db3a.tar.gz opensim-SC_OLD-c29df824c2db40ccdfbaf7ac6f166c578d77db3a.tar.bz2 opensim-SC_OLD-c29df824c2db40ccdfbaf7ac6f166c578d77db3a.tar.xz |
Converted the LSL scripting engine into a IRegionModule, so now all "modules" share a common base interface and are loaded from the single loader. (It seems to work fine, but I have left the old scriptengine loader, incase we have to change back).
Removed the reference to OpenJpeg in the DynamicTextureModule, to see if that was causing the build problem someone is having.
Added a Temporary fix for the "existing connection was forcibly closed by the remote host" exception on windows when a user logs out of a multiregion instance.
Some early work to prepare for improving the way clients are updated (about prims etc).
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/General/Util.cs | 14 | ||||
-rw-r--r-- | OpenSim/Region/Application/OpenSimMain.cs | 18 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientViewBase.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/PacketServer.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/UDPServer.cs | 18 | ||||
-rw-r--r-- | OpenSim/Region/Environment/ModuleLoader.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Modules/DynamicTextureModule.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 12 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs | 167 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Types/UpdateQueue.cs | 21 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs | 33 |
14 files changed, 295 insertions, 25 deletions
diff --git a/OpenSim/Framework/General/Util.cs b/OpenSim/Framework/General/Util.cs index 5eae206..1ec7d78 100644 --- a/OpenSim/Framework/General/Util.cs +++ b/OpenSim/Framework/General/Util.cs | |||
@@ -152,15 +152,15 @@ namespace OpenSim.Framework.Utilities | |||
152 | return capsPath; | 152 | return capsPath; |
153 | } | 153 | } |
154 | 154 | ||
155 | //public static int fast_distance2d(int x, int y) | 155 | public static int fast_distance2d(int x, int y) |
156 | //{ | 156 | { |
157 | // x = System.Math.Abs(x); | 157 | x = System.Math.Abs(x); |
158 | // y = System.Math.Abs(y); | 158 | y = System.Math.Abs(y); |
159 | 159 | ||
160 | // int min = System.Math.Min(x, y); | 160 | int min = System.Math.Min(x, y); |
161 | 161 | ||
162 | // return (x + y - (min >> 1) - (min >> 2) + (min >> 4)); | 162 | return (x + y - (min >> 1) - (min >> 2) + (min >> 4)); |
163 | //} | 163 | } |
164 | 164 | ||
165 | public static string FieldToString(byte[] bytes) | 165 | public static string FieldToString(byte[] bytes) |
166 | { | 166 | { |
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index 1170f80..9e0bc09 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs | |||
@@ -191,8 +191,8 @@ namespace OpenSim | |||
191 | MainLog.Instance.Verbose("Loading Shared Modules"); | 191 | MainLog.Instance.Verbose("Loading Shared Modules"); |
192 | m_moduleLoader.LoadDefaultSharedModules(m_exceptSharedModules); | 192 | m_moduleLoader.LoadDefaultSharedModules(m_exceptSharedModules); |
193 | 193 | ||
194 | // Load all script engines found | 194 | // Load all script engines found (scripting engine is now a IRegionModule so loaded in the module loader |
195 | OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineLoader ScriptEngineLoader = new OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineLoader(m_log); | 195 | // OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineLoader ScriptEngineLoader = new OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineLoader(m_log); |
196 | 196 | ||
197 | for (int i = 0; i < configFiles.Length; i++) | 197 | for (int i = 0; i < configFiles.Length; i++) |
198 | { | 198 | { |
@@ -209,11 +209,11 @@ namespace OpenSim | |||
209 | scene.SetModuleInterfaces(); | 209 | scene.SetModuleInterfaces(); |
210 | 210 | ||
211 | // Check if we have a script engine to load | 211 | // Check if we have a script engine to load |
212 | if (m_scriptEngine != null && m_scriptEngine != "") | 212 | //if (m_scriptEngine != null && m_scriptEngine != "") |
213 | { | 213 | //{ |
214 | OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface ScriptEngine = ScriptEngineLoader.LoadScriptEngine(m_scriptEngine); | 214 | // OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface ScriptEngine = ScriptEngineLoader.LoadScriptEngine(m_scriptEngine); |
215 | scene.AddScriptEngine(ScriptEngine, m_log); | 215 | // scene.AddScriptEngine(ScriptEngine, m_log); |
216 | } | 216 | //} |
217 | 217 | ||
218 | //Server side object editing permissions checking | 218 | //Server side object editing permissions checking |
219 | if (m_permissions) | 219 | if (m_permissions) |
@@ -371,7 +371,7 @@ namespace OpenSim | |||
371 | /// <param name="cmdparams">Additional arguments passed to the command</param> | 371 | /// <param name="cmdparams">Additional arguments passed to the command</param> |
372 | public void RunCmd(string command, string[] cmdparams) | 372 | public void RunCmd(string command, string[] cmdparams) |
373 | { | 373 | { |
374 | if ((m_consoleRegion == null) || (command == "change-region") || (command == "shutdown")) | 374 | if ((m_consoleRegion == null) || (command == "change-region") || (command == "shutdown")) |
375 | { | 375 | { |
376 | switch (command) | 376 | switch (command) |
377 | { | 377 | { |
@@ -603,7 +603,7 @@ namespace OpenSim | |||
603 | string result = ""; | 603 | string result = ""; |
604 | for (int i = pos; i < commandParams.Length; i++) | 604 | for (int i = pos; i < commandParams.Length; i++) |
605 | { | 605 | { |
606 | result += commandParams[i] +" "; | 606 | result += commandParams[i] + " "; |
607 | } | 607 | } |
608 | result = result.TrimEnd(' '); | 608 | result = result.TrimEnd(' '); |
609 | return result; | 609 | return result; |
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index ff527fb..52fc568 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs | |||
@@ -128,6 +128,14 @@ namespace OpenSim.Region.ClientStack | |||
128 | m_networkServer.RemoveClientCircuit(this.CircuitCode); | 128 | m_networkServer.RemoveClientCircuit(this.CircuitCode); |
129 | this.ClientThread.Abort(); | 129 | this.ClientThread.Abort(); |
130 | } | 130 | } |
131 | |||
132 | public override void ConnectionClosed() | ||
133 | { | ||
134 | clientPingTimer.Stop(); | ||
135 | m_clientThreads.Remove(this.CircuitCode); | ||
136 | m_networkServer.RemoveClientCircuit(this.CircuitCode); | ||
137 | this.ClientThread.Abort(); | ||
138 | } | ||
131 | #endregion | 139 | #endregion |
132 | 140 | ||
133 | # region Packet Handling | 141 | # region Packet Handling |
diff --git a/OpenSim/Region/ClientStack/ClientViewBase.cs b/OpenSim/Region/ClientStack/ClientViewBase.cs index 0b2c875..8a7c764 100644 --- a/OpenSim/Region/ClientStack/ClientViewBase.cs +++ b/OpenSim/Region/ClientStack/ClientViewBase.cs | |||
@@ -315,6 +315,10 @@ namespace OpenSim.Region.ClientStack | |||
315 | 315 | ||
316 | } | 316 | } |
317 | 317 | ||
318 | public virtual void ConnectionClosed() | ||
319 | { | ||
320 | } | ||
321 | |||
318 | #region Nested Classes | 322 | #region Nested Classes |
319 | 323 | ||
320 | public class QueItem | 324 | public class QueItem |
diff --git a/OpenSim/Region/ClientStack/PacketServer.cs b/OpenSim/Region/ClientStack/PacketServer.cs index 66a7ffd..59f11d5 100644 --- a/OpenSim/Region/ClientStack/PacketServer.cs +++ b/OpenSim/Region/ClientStack/PacketServer.cs | |||
@@ -74,6 +74,14 @@ namespace OpenSim.Region.ClientStack | |||
74 | } | 74 | } |
75 | } | 75 | } |
76 | 76 | ||
77 | public virtual void ConnectionClosed(uint circuitCode) | ||
78 | { | ||
79 | if (this.ClientThreads.ContainsKey(circuitCode)) | ||
80 | { | ||
81 | ClientThreads[circuitCode].ConnectionClosed(); | ||
82 | } | ||
83 | } | ||
84 | |||
77 | /// <summary> | 85 | /// <summary> |
78 | /// | 86 | /// |
79 | /// </summary> | 87 | /// </summary> |
diff --git a/OpenSim/Region/ClientStack/UDPServer.cs b/OpenSim/Region/ClientStack/UDPServer.cs index 45eb0cd..8b4a3cb 100644 --- a/OpenSim/Region/ClientStack/UDPServer.cs +++ b/OpenSim/Region/ClientStack/UDPServer.cs | |||
@@ -101,7 +101,23 @@ namespace OpenSim.Region.ClientStack | |||
101 | ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); | 101 | ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); |
102 | epSender = (EndPoint)ipeSender; | 102 | epSender = (EndPoint)ipeSender; |
103 | Packet packet = null; | 103 | Packet packet = null; |
104 | int numBytes = Server.EndReceiveFrom(result, ref epSender); | 104 | |
105 | int numBytes; | ||
106 | |||
107 | try | ||
108 | { | ||
109 | numBytes = Server.EndReceiveFrom(result, ref epSender); | ||
110 | } | ||
111 | catch (System.Net.Sockets.SocketException) | ||
112 | { | ||
113 | Console.WriteLine("Remote host Closed connection"); | ||
114 | this._packetServer.ConnectionClosed(this.clientCircuits[epSender]); | ||
115 | ipeSender = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); | ||
116 | epSender = (EndPoint)ipeSender; | ||
117 | Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); | ||
118 | return; | ||
119 | } | ||
120 | |||
105 | int packetEnd = numBytes - 1; | 121 | int packetEnd = numBytes - 1; |
106 | 122 | ||
107 | packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer); | 123 | packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer); |
diff --git a/OpenSim/Region/Environment/ModuleLoader.cs b/OpenSim/Region/Environment/ModuleLoader.cs index e8e7bc2..be3384b 100644 --- a/OpenSim/Region/Environment/ModuleLoader.cs +++ b/OpenSim/Region/Environment/ModuleLoader.cs | |||
@@ -44,6 +44,9 @@ namespace OpenSim.Region.Environment | |||
44 | LoadedModules.Add(avatarProfiles); | 44 | LoadedModules.Add(avatarProfiles); |
45 | 45 | ||
46 | this.LoadRegionModule("OpenSim.Region.ExtensionsScriptModule.dll", "ExtensionsScriptingModule", scene); | 46 | this.LoadRegionModule("OpenSim.Region.ExtensionsScriptModule.dll", "ExtensionsScriptingModule", scene); |
47 | |||
48 | string lslPath = System.IO.Path.Combine("ScriptEngines", "OpenSim.Region.ScriptEngine.DotNetEngine.dll"); | ||
49 | this.LoadRegionModule(lslPath, "LSLScriptingModule", scene); | ||
47 | } | 50 | } |
48 | 51 | ||
49 | public void LoadDefaultSharedModules(string exceptModules) | 52 | public void LoadDefaultSharedModules(string exceptModules) |
diff --git a/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs b/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs index 9fbd68e..8223919 100644 --- a/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs +++ b/OpenSim/Region/Environment/Modules/DynamicTextureModule.cs | |||
@@ -5,7 +5,6 @@ using System.Threading; | |||
5 | using System.IO; | 5 | using System.IO; |
6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
7 | using libsecondlife; | 7 | using libsecondlife; |
8 | using OpenJPEGNet; | ||
9 | using OpenSim.Region.Environment.Scenes; | 8 | using OpenSim.Region.Environment.Scenes; |
10 | using OpenSim.Region.Environment.Interfaces; | 9 | using OpenSim.Region.Environment.Interfaces; |
11 | using OpenSim.Framework.Interfaces; | 10 | using OpenSim.Framework.Interfaces; |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 4151074..1ce75e0 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -44,6 +44,7 @@ using OpenSim.Framework.Communications.Caches; | |||
44 | using OpenSim.Region.Environment.LandManagement; | 44 | using OpenSim.Region.Environment.LandManagement; |
45 | using OpenSim.Region.Environment; | 45 | using OpenSim.Region.Environment; |
46 | using OpenSim.Region.Environment.Interfaces; | 46 | using OpenSim.Region.Environment.Interfaces; |
47 | using OpenSim.Region.Environment.Types; | ||
47 | using OpenSim.Region.Terrain; | 48 | using OpenSim.Region.Terrain; |
48 | using OpenSim.Framework.Data; | 49 | using OpenSim.Framework.Data; |
49 | using Caps = OpenSim.Region.Capabilities.Caps; | 50 | using Caps = OpenSim.Region.Capabilities.Caps; |
@@ -72,6 +73,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
72 | private int m_timePhase = 24; | 73 | private int m_timePhase = 24; |
73 | private int m_timeUpdateCount; | 74 | private int m_timeUpdateCount; |
74 | 75 | ||
76 | public BasicQuadTreeNode QuadTree; | ||
77 | |||
75 | private Mutex updateLock; | 78 | private Mutex updateLock; |
76 | 79 | ||
77 | protected ModuleLoader m_moduleLoader; | 80 | protected ModuleLoader m_moduleLoader; |
@@ -178,6 +181,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
178 | 181 | ||
179 | m_eventManager.OnPermissionError += SendPermissionAlert; | 182 | m_eventManager.OnPermissionError += SendPermissionAlert; |
180 | 183 | ||
184 | QuadTree = new BasicQuadTreeNode(null, 0, 0, 256, 256); | ||
185 | QuadTree.Subdivide(); | ||
186 | QuadTree.Subdivide(); | ||
187 | |||
181 | MainLog.Instance.Verbose("Creating new entitities instance"); | 188 | MainLog.Instance.Verbose("Creating new entitities instance"); |
182 | Entities = new Dictionary<LLUUID, EntityBase>(); | 189 | Entities = new Dictionary<LLUUID, EntityBase>(); |
183 | Avatars = new Dictionary<LLUUID, ScenePresence>(); | 190 | Avatars = new Dictionary<LLUUID, ScenePresence>(); |
@@ -596,6 +603,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
596 | { | 603 | { |
597 | if (!Entities.ContainsKey(sceneObject.UUID)) | 604 | if (!Entities.ContainsKey(sceneObject.UUID)) |
598 | { | 605 | { |
606 | QuadTree.AddObject(sceneObject); | ||
599 | Entities.Add(sceneObject.UUID, sceneObject); | 607 | Entities.Add(sceneObject.UUID, sceneObject); |
600 | } | 608 | } |
601 | } | 609 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index dec017e..9e207c8 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -43,6 +43,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
43 | 43 | ||
44 | protected byte[] m_particleSystem = new byte[0]; | 44 | protected byte[] m_particleSystem = new byte[0]; |
45 | 45 | ||
46 | public uint TimeStampFull = 0; | ||
47 | public uint TimeStampTerse = 0; | ||
48 | |||
46 | protected SceneObjectGroup m_parentGroup; | 49 | protected SceneObjectGroup m_parentGroup; |
47 | 50 | ||
48 | /// <summary> | 51 | /// <summary> |
@@ -366,6 +369,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
366 | { | 369 | { |
367 | m_parentGroup.HasChanged = true; | 370 | m_parentGroup.HasChanged = true; |
368 | } | 371 | } |
372 | this.TimeStampFull =(uint) Util.UnixTimeSinceEpoch(); | ||
369 | m_updateFlag = 2; | 373 | m_updateFlag = 2; |
370 | } | 374 | } |
371 | 375 | ||
@@ -380,6 +384,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
380 | { | 384 | { |
381 | m_parentGroup.HasChanged = true; | 385 | m_parentGroup.HasChanged = true; |
382 | } | 386 | } |
387 | this.TimeStampTerse = (uint)Util.UnixTimeSinceEpoch(); | ||
383 | m_updateFlag = 1; | 388 | m_updateFlag = 1; |
384 | } | 389 | } |
385 | } | 390 | } |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 285c691..7b7c595 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -88,11 +88,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
88 | public delegate void SignificantClientMovement(IClientAPI remote_client); | 88 | public delegate void SignificantClientMovement(IClientAPI remote_client); |
89 | public event SignificantClientMovement OnSignificantClientMovement; | 89 | public event SignificantClientMovement OnSignificantClientMovement; |
90 | 90 | ||
91 | public List<SceneObjectGroup> InterestList = new List<SceneObjectGroup>(); | ||
92 | |||
91 | // private Queue<SceneObjectGroup> m_fullGroupUpdates = new Queue<SceneObjectGroup>(); | 93 | // private Queue<SceneObjectGroup> m_fullGroupUpdates = new Queue<SceneObjectGroup>(); |
92 | // private Queue<SceneObjectGroup> m_terseGroupUpdates = new Queue<SceneObjectGroup>(); | 94 | // private Queue<SceneObjectGroup> m_terseGroupUpdates = new Queue<SceneObjectGroup>(); |
93 | 95 | ||
94 | private Queue<SceneObjectPart> m_fullPartUpdates = new Queue<SceneObjectPart>(); | 96 | private Queue<SceneObjectPart> m_fullPartUpdates = new Queue<SceneObjectPart>(); |
95 | private Queue<SceneObjectPart> m_teserPartUpdates = new Queue<SceneObjectPart>(); | 97 | private Queue<SceneObjectPart> m_tersePartUpdates = new Queue<SceneObjectPart>(); |
96 | 98 | ||
97 | #region Properties | 99 | #region Properties |
98 | /// <summary> | 100 | /// <summary> |
@@ -201,7 +203,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
201 | 203 | ||
202 | public void AddTersePart(SceneObjectPart part) | 204 | public void AddTersePart(SceneObjectPart part) |
203 | { | 205 | { |
204 | m_teserPartUpdates.Enqueue(part); | 206 | m_tersePartUpdates.Enqueue(part); |
205 | } | 207 | } |
206 | 208 | ||
207 | public void AddFullPart(SceneObjectPart part) | 209 | public void AddFullPart(SceneObjectPart part) |
@@ -211,18 +213,18 @@ namespace OpenSim.Region.Environment.Scenes | |||
211 | 213 | ||
212 | public void SendPrimUpdates() | 214 | public void SendPrimUpdates() |
213 | { | 215 | { |
214 | if (m_teserPartUpdates.Count > 0) | 216 | if (m_tersePartUpdates.Count > 0) |
215 | { | 217 | { |
216 | bool terse = true; | 218 | bool terse = true; |
217 | int terseCount = 0; | 219 | int terseCount = 0; |
218 | 220 | ||
219 | while (terse) | 221 | while (terse) |
220 | { | 222 | { |
221 | SceneObjectPart part = m_teserPartUpdates.Dequeue(); | 223 | SceneObjectPart part = m_tersePartUpdates.Dequeue(); |
222 | part.SendTerseUpdate(this.ControllingClient); | 224 | part.SendTerseUpdate(this.ControllingClient); |
223 | terseCount++; | 225 | terseCount++; |
224 | 226 | ||
225 | if ((m_teserPartUpdates.Count < 1) |(terseCount > 30)) | 227 | if ((m_tersePartUpdates.Count < 1) |(terseCount > 30)) |
226 | { | 228 | { |
227 | terse = false; | 229 | terse = false; |
228 | } | 230 | } |
diff --git a/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs b/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs new file mode 100644 index 0000000..c7b0524 --- /dev/null +++ b/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs | |||
@@ -0,0 +1,167 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenSim.Region.Environment.Scenes; | ||
5 | |||
6 | namespace OpenSim.Region.Environment.Types | ||
7 | { | ||
8 | public class BasicQuadTreeNode | ||
9 | { | ||
10 | private List<SceneObjectGroup> m_objects = new List<SceneObjectGroup>(); | ||
11 | private BasicQuadTreeNode[] m_childNodes = null; | ||
12 | private BasicQuadTreeNode m_parent = null; | ||
13 | |||
14 | private short m_leftX; | ||
15 | private short m_leftY; | ||
16 | private short m_width; | ||
17 | private short m_height; | ||
18 | |||
19 | public BasicQuadTreeNode(BasicQuadTreeNode parent, short leftX, short leftY, short width, short height) | ||
20 | { | ||
21 | m_parent = parent; | ||
22 | m_leftX = leftX; | ||
23 | m_leftY = leftY; | ||
24 | m_width = width; | ||
25 | m_height = height; | ||
26 | } | ||
27 | |||
28 | public void AddObject(SceneObjectGroup obj) | ||
29 | { | ||
30 | if (m_childNodes == null) | ||
31 | { | ||
32 | if (!m_objects.Contains(obj)) | ||
33 | { | ||
34 | m_objects.Add(obj); | ||
35 | } | ||
36 | } | ||
37 | else | ||
38 | { | ||
39 | if (obj.AbsolutePosition.X < (m_leftX + (m_width / 2))) | ||
40 | { | ||
41 | if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2))) | ||
42 | { | ||
43 | m_childNodes[0].AddObject(obj); | ||
44 | } | ||
45 | else | ||
46 | { | ||
47 | m_childNodes[2].AddObject(obj); | ||
48 | } | ||
49 | } | ||
50 | else | ||
51 | { | ||
52 | if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2))) | ||
53 | { | ||
54 | m_childNodes[1].AddObject(obj); | ||
55 | } | ||
56 | else | ||
57 | { | ||
58 | m_childNodes[3].AddObject(obj); | ||
59 | } | ||
60 | } | ||
61 | } | ||
62 | } | ||
63 | |||
64 | public void Subdivide() | ||
65 | { | ||
66 | if (m_childNodes == null) | ||
67 | { | ||
68 | m_childNodes = new BasicQuadTreeNode[4]; | ||
69 | m_childNodes[0] = new BasicQuadTreeNode(this, m_leftX, m_leftY,(short) (m_width / 2), (short)( m_height / 2)); | ||
70 | m_childNodes[1] = new BasicQuadTreeNode(this,(short)( m_leftX + (m_width / 2)), m_leftY,(short)( m_width / 2),(short) (m_height / 2)); | ||
71 | m_childNodes[2] = new BasicQuadTreeNode(this, m_leftX, (short)( m_leftY + (m_height / 2)), (short)(m_width / 2),(short)( m_height / 2)); | ||
72 | m_childNodes[3] = new BasicQuadTreeNode(this, (short)( m_leftX + (m_width / 2)),(short)( m_height + (m_height / 2)),(short)( m_width / 2), (short)(m_height / 2)); | ||
73 | } | ||
74 | else | ||
75 | { | ||
76 | for (int i = 0; i < m_childNodes.Length; i++) | ||
77 | { | ||
78 | m_childNodes[i].Subdivide(); | ||
79 | } | ||
80 | } | ||
81 | } | ||
82 | |||
83 | public List<SceneObjectGroup> GetObjectsFrom(int x, int y) | ||
84 | { | ||
85 | if (m_childNodes == null) | ||
86 | { | ||
87 | return m_objects; | ||
88 | } | ||
89 | else | ||
90 | { | ||
91 | if (x < (m_leftX + (m_width / 2))) | ||
92 | { | ||
93 | if (y < (m_leftY + (m_height / 2))) | ||
94 | { | ||
95 | return m_childNodes[0].GetObjectsFrom(x, y); | ||
96 | } | ||
97 | else | ||
98 | { | ||
99 | return m_childNodes[2].GetObjectsFrom(x, y); | ||
100 | } | ||
101 | } | ||
102 | else | ||
103 | { | ||
104 | if (y < (m_leftY + (m_height / 2))) | ||
105 | { | ||
106 | return m_childNodes[1].GetObjectsFrom(x, y); | ||
107 | } | ||
108 | else | ||
109 | { | ||
110 | return m_childNodes[3].GetObjectsFrom(x, y); | ||
111 | } | ||
112 | } | ||
113 | } | ||
114 | } | ||
115 | |||
116 | public void Update() | ||
117 | { | ||
118 | if (m_childNodes != null) | ||
119 | { | ||
120 | for (int i = 0; i < 4; i++) | ||
121 | { | ||
122 | m_childNodes[i].Update(); | ||
123 | } | ||
124 | } | ||
125 | else | ||
126 | { | ||
127 | List<SceneObjectGroup> outBounds = new List<SceneObjectGroup>(); | ||
128 | foreach (SceneObjectGroup group in m_objects) | ||
129 | { | ||
130 | if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height)))) | ||
131 | { | ||
132 | //still in bounds | ||
133 | } | ||
134 | else | ||
135 | { | ||
136 | outBounds.Add(group); | ||
137 | } | ||
138 | } | ||
139 | |||
140 | foreach (SceneObjectGroup removee in outBounds) | ||
141 | { | ||
142 | m_objects.Remove(removee); | ||
143 | if (m_parent != null) | ||
144 | { | ||
145 | m_parent.PassUp(removee); | ||
146 | } | ||
147 | } | ||
148 | outBounds.Clear(); | ||
149 | } | ||
150 | } | ||
151 | |||
152 | public void PassUp(SceneObjectGroup group) | ||
153 | { | ||
154 | if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height)))) | ||
155 | { | ||
156 | this.AddObject(group); | ||
157 | } | ||
158 | else | ||
159 | { | ||
160 | if (m_parent != null) | ||
161 | { | ||
162 | m_parent.PassUp(group); | ||
163 | } | ||
164 | } | ||
165 | } | ||
166 | } | ||
167 | } | ||
diff --git a/OpenSim/Region/Environment/Types/UpdateQueue.cs b/OpenSim/Region/Environment/Types/UpdateQueue.cs new file mode 100644 index 0000000..d7eb6ee --- /dev/null +++ b/OpenSim/Region/Environment/Types/UpdateQueue.cs | |||
@@ -0,0 +1,21 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenSim.Region.Environment.Scenes; | ||
5 | using libsecondlife; | ||
6 | |||
7 | namespace OpenSim.Region.Environment.Types | ||
8 | { | ||
9 | public class UpdateQueue | ||
10 | { | ||
11 | private Queue<SceneObjectPart> m_queue; | ||
12 | |||
13 | private List<LLUUID> m_ids; | ||
14 | |||
15 | public UpdateQueue() | ||
16 | { | ||
17 | m_queue = new Queue<SceneObjectPart>(); | ||
18 | m_ids = new List<LLUUID>(); | ||
19 | } | ||
20 | } | ||
21 | } | ||
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs index d0823d0..694059c 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs | |||
@@ -30,8 +30,9 @@ using System; | |||
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Text; | 31 | using System.Text; |
32 | using OpenSim.Framework.Console; | 32 | using OpenSim.Framework.Console; |
33 | //using OpenSim.Region.Environment.Scenes; | 33 | using OpenSim.Region.Environment.Scenes; |
34 | using OpenSim.Region.Environment.Scenes.Scripting; | 34 | using OpenSim.Region.Environment.Scenes.Scripting; |
35 | using OpenSim.Region.Environment.Interfaces; | ||
35 | using libsecondlife; | 36 | using libsecondlife; |
36 | 37 | ||
37 | namespace OpenSim.Region.ScriptEngine.DotNetEngine | 38 | namespace OpenSim.Region.ScriptEngine.DotNetEngine |
@@ -40,7 +41,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
40 | /// This is the root object for ScriptEngine | 41 | /// This is the root object for ScriptEngine |
41 | /// </summary> | 42 | /// </summary> |
42 | [Serializable] | 43 | [Serializable] |
43 | public class ScriptEngine : OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface | 44 | public class ScriptEngine :IRegionModule |
44 | { | 45 | { |
45 | 46 | ||
46 | internal OpenSim.Region.Environment.Scenes.Scene World; | 47 | internal OpenSim.Region.Environment.Scenes.Scene World; |
@@ -99,5 +100,33 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
99 | // Log.Status("ScriptEngine", "DEBUG FUNCTION: StartScript: " + ScriptID); | 100 | // Log.Status("ScriptEngine", "DEBUG FUNCTION: StartScript: " + ScriptID); |
100 | // myScriptManager.StartScript(ScriptID, ObjectID); | 101 | // myScriptManager.StartScript(ScriptID, ObjectID); |
101 | //} | 102 | //} |
103 | |||
104 | #region IRegionModule | ||
105 | |||
106 | public void Initialise(Scene scene) | ||
107 | { | ||
108 | this.InitializeEngine(scene, MainLog.Instance); | ||
109 | } | ||
110 | |||
111 | public void PostInitialise() | ||
112 | { | ||
113 | |||
114 | } | ||
115 | |||
116 | public void CloseDown() | ||
117 | { | ||
118 | } | ||
119 | |||
120 | public string GetName() | ||
121 | { | ||
122 | return "LSLScriptingModule"; | ||
123 | } | ||
124 | |||
125 | public bool IsSharedModule() | ||
126 | { | ||
127 | return false; | ||
128 | } | ||
129 | |||
130 | #endregion | ||
102 | } | 131 | } |
103 | } | 132 | } |