aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
authorMW2007-09-08 07:50:31 +0000
committerMW2007-09-08 07:50:31 +0000
commitc29df824c2db40ccdfbaf7ac6f166c578d77db3a (patch)
tree1e9513d9c5f8d9da48ece5ce796f4d80b5796d82 /OpenSim/Region/Environment
parentadded SQLiteAssetData class first pass. This should work, (diff)
downloadopensim-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/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/ModuleLoader.cs3
-rw-r--r--OpenSim/Region/Environment/Modules/DynamicTextureModule.cs1
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs8
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs5
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs12
-rw-r--r--OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs167
-rw-r--r--OpenSim/Region/Environment/Types/UpdateQueue.cs21
7 files changed, 211 insertions, 6 deletions
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;
5using System.IO; 5using System.IO;
6using System.Collections.Generic; 6using System.Collections.Generic;
7using libsecondlife; 7using libsecondlife;
8using OpenJPEGNet;
9using OpenSim.Region.Environment.Scenes; 8using OpenSim.Region.Environment.Scenes;
10using OpenSim.Region.Environment.Interfaces; 9using OpenSim.Region.Environment.Interfaces;
11using OpenSim.Framework.Interfaces; 10using 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;
44using OpenSim.Region.Environment.LandManagement; 44using OpenSim.Region.Environment.LandManagement;
45using OpenSim.Region.Environment; 45using OpenSim.Region.Environment;
46using OpenSim.Region.Environment.Interfaces; 46using OpenSim.Region.Environment.Interfaces;
47using OpenSim.Region.Environment.Types;
47using OpenSim.Region.Terrain; 48using OpenSim.Region.Terrain;
48using OpenSim.Framework.Data; 49using OpenSim.Framework.Data;
49using Caps = OpenSim.Region.Capabilities.Caps; 50using 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 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.Region.Environment.Scenes;
5
6namespace 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 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.Region.Environment.Scenes;
5using libsecondlife;
6
7namespace 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}