diff options
author | MW | 2007-10-11 10:50:55 +0000 |
---|---|---|
committer | MW | 2007-10-11 10:50:55 +0000 |
commit | 86e5f82cb12dc5e854fe33526aee0ce899715410 (patch) | |
tree | 99066d2e40c53eb0355262c91704ecad6640208d /OpenSim/Region/Environment | |
parent | * Added FormatProvider to Culture (diff) | |
download | opensim-SC_OLD-86e5f82cb12dc5e854fe33526aee0ce899715410.zip opensim-SC_OLD-86e5f82cb12dc5e854fe33526aee0ce899715410.tar.gz opensim-SC_OLD-86e5f82cb12dc5e854fe33526aee0ce899715410.tar.bz2 opensim-SC_OLD-86e5f82cb12dc5e854fe33526aee0ce899715410.tar.xz |
Some changes to the sending of updates of SceneObjects to clients, that I did a few weeks ago but never committed (and never completely finished what I had planned).
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 13 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 105 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs | 402 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Types/UpdateQueue.cs | 100 |
5 files changed, 355 insertions, 267 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 384ec10..b0f0b9a 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -189,7 +189,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
189 | 189 | ||
190 | m_eventManager.OnPermissionError += SendPermissionAlert; | 190 | m_eventManager.OnPermissionError += SendPermissionAlert; |
191 | 191 | ||
192 | QuadTree = new BasicQuadTreeNode(null, 0, 0, 256, 256); | 192 | QuadTree = new BasicQuadTreeNode(null, "/0/", 0, 0, 256, 256); |
193 | QuadTree.Subdivide(); | 193 | QuadTree.Subdivide(); |
194 | QuadTree.Subdivide(); | 194 | QuadTree.Subdivide(); |
195 | 195 | ||
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 406db9b..22408d3 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -11,6 +11,7 @@ using OpenSim.Framework.Utilities; | |||
11 | using OpenSim.Region.Environment.Interfaces; | 11 | using OpenSim.Region.Environment.Interfaces; |
12 | using OpenSim.Region.Environment.Scenes.Scripting; | 12 | using OpenSim.Region.Environment.Scenes.Scripting; |
13 | using OpenSim.Region.Physics.Manager; | 13 | using OpenSim.Region.Physics.Manager; |
14 | using OpenSim.Region.Environment.Types; | ||
14 | 15 | ||
15 | namespace OpenSim.Region.Environment.Scenes | 16 | namespace OpenSim.Region.Environment.Scenes |
16 | { | 17 | { |
@@ -681,15 +682,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
681 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); | 682 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); |
682 | for (int i = 0; i < avatars.Count; i++) | 683 | for (int i = 0; i < avatars.Count; i++) |
683 | { | 684 | { |
684 | avatars[i].AddFullPart(this); | 685 | avatars[i].QueuePartForUpdate(this); |
685 | // avatars[i].QueuePartForUpdate(this); | ||
686 | } | 686 | } |
687 | } | 687 | } |
688 | 688 | ||
689 | public void AddFullUpdateToAvatar(ScenePresence presence) | 689 | public void AddFullUpdateToAvatar(ScenePresence presence) |
690 | { | 690 | { |
691 | presence.AddFullPart(this); | 691 | presence.QueuePartForUpdate(this); |
692 | //presence.QueuePartForUpdate(this); | ||
693 | } | 692 | } |
694 | 693 | ||
695 | /// <summary> | 694 | /// <summary> |
@@ -745,15 +744,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
745 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); | 744 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); |
746 | for (int i = 0; i < avatars.Count; i++) | 745 | for (int i = 0; i < avatars.Count; i++) |
747 | { | 746 | { |
748 | avatars[i].AddTersePart(this); | 747 | avatars[i].QueuePartForUpdate(this); |
749 | // avatars[i].QueuePartForUpdate(this); | ||
750 | } | 748 | } |
751 | } | 749 | } |
752 | 750 | ||
753 | public void AddTerseUpdateToAvatar(ScenePresence presence) | 751 | public void AddTerseUpdateToAvatar(ScenePresence presence) |
754 | { | 752 | { |
755 | presence.AddTersePart(this); | 753 | presence.QueuePartForUpdate(this); |
756 | // presence.QueuePartForUpdate(this); | ||
757 | } | 754 | } |
758 | 755 | ||
759 | /// <summary> | 756 | /// <summary> |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 428b771..22a0754 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -35,6 +35,7 @@ using OpenSim.Framework.Interfaces; | |||
35 | using OpenSim.Framework.Types; | 35 | using OpenSim.Framework.Types; |
36 | using OpenSim.Framework.Utilities; | 36 | using OpenSim.Framework.Utilities; |
37 | using OpenSim.Region.Physics.Manager; | 37 | using OpenSim.Region.Physics.Manager; |
38 | using OpenSim.Region.Environment.Types; | ||
38 | 39 | ||
39 | namespace OpenSim.Region.Environment.Scenes | 40 | namespace OpenSim.Region.Environment.Scenes |
40 | { | 41 | { |
@@ -89,11 +90,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
89 | 90 | ||
90 | //public List<SceneObjectGroup> InterestList = new List<SceneObjectGroup>(); | 91 | //public List<SceneObjectGroup> InterestList = new List<SceneObjectGroup>(); |
91 | 92 | ||
92 | // private Queue<SceneObjectGroup> m_fullGroupUpdates = new Queue<SceneObjectGroup>(); | 93 | // private string m_currentQuadNode = " "; |
93 | // private Queue<SceneObjectGroup> m_terseGroupUpdates = new Queue<SceneObjectGroup>(); | ||
94 | 94 | ||
95 | private readonly Queue<SceneObjectPart> m_fullPartUpdates = new Queue<SceneObjectPart>(); | 95 | // private Queue<SceneObjectPart> m_fullPartUpdates = new Queue<SceneObjectPart>(); |
96 | private readonly Queue<SceneObjectPart> m_tersePartUpdates = new Queue<SceneObjectPart>(); | 96 | //private Queue<SceneObjectPart> m_tersePartUpdates = new Queue<SceneObjectPart>(); |
97 | |||
98 | private UpdateQueue m_partsUpdateQueue = new UpdateQueue(); | ||
99 | private Dictionary<LLUUID, ScenePartUpdate> m_updateTimes = new Dictionary<LLUUID, ScenePartUpdate>(); | ||
97 | 100 | ||
98 | #region Properties | 101 | #region Properties |
99 | 102 | ||
@@ -277,53 +280,69 @@ namespace OpenSim.Region.Environment.Scenes | |||
277 | 280 | ||
278 | #endregion | 281 | #endregion |
279 | 282 | ||
280 | public void AddTersePart(SceneObjectPart part) | 283 | public void QueuePartForUpdate(SceneObjectPart part) |
281 | { | ||
282 | m_tersePartUpdates.Enqueue(part); | ||
283 | } | ||
284 | |||
285 | public void AddFullPart(SceneObjectPart part) | ||
286 | { | 284 | { |
287 | m_fullPartUpdates.Enqueue(part); | 285 | //if (InterestList.Contains(part.ParentGroup)) |
286 | //{ | ||
287 | lock (m_partsUpdateQueue) | ||
288 | { | ||
289 | m_partsUpdateQueue.Enqueue(part); | ||
290 | } | ||
291 | // } | ||
288 | } | 292 | } |
289 | 293 | ||
290 | public void SendPrimUpdates() | 294 | public void SendPrimUpdates() |
291 | { | 295 | { |
292 | if (m_tersePartUpdates.Count > 0) | 296 | // if (m_scene.QuadTree.GetNodeID(this.AbsolutePosition.X, this.AbsolutePosition.Y) != m_currentQuadNode) |
293 | { | 297 | //{ |
294 | bool terse = true; | 298 | // this.UpdateQuadTreeNode(); |
295 | int terseCount = 0; | 299 | //this.RefreshQuadObject(); |
300 | //} | ||
296 | 301 | ||
297 | while (terse) | 302 | if (m_partsUpdateQueue.Count > 0) |
303 | { | ||
304 | bool runUpdate = true; | ||
305 | int updateCount = 0; | ||
306 | while (runUpdate) | ||
298 | { | 307 | { |
299 | SceneObjectPart part = m_tersePartUpdates.Dequeue(); | 308 | SceneObjectPart part = m_partsUpdateQueue.Dequeue(); |
300 | part.SendTerseUpdate(m_controllingClient); | 309 | if (m_updateTimes.ContainsKey(part.UUID)) |
301 | terseCount++; | 310 | { |
302 | 311 | ScenePartUpdate update = m_updateTimes[part.UUID]; | |
303 | if ((m_tersePartUpdates.Count < 1) | (terseCount > 30)) | 312 | if (update.LastFullUpdateTime < part.TimeStampFull) |
313 | { | ||
314 | //need to do a full update | ||
315 | part.SendFullUpdate(this.ControllingClient); | ||
316 | update.LastFullUpdateTime = (uint)Util.UnixTimeSinceEpoch(); | ||
317 | updateCount++; | ||
318 | } | ||
319 | else if (update.LastTerseUpdateTime < part.TimeStampTerse) | ||
320 | { | ||
321 | part.SendTerseUpdate(this.ControllingClient); | ||
322 | update.LastTerseUpdateTime = (uint)Util.UnixTimeSinceEpoch(); | ||
323 | updateCount++; | ||
324 | } | ||
325 | } | ||
326 | else | ||
304 | { | 327 | { |
305 | terse = false; | 328 | //never been sent to client before so do full update |
329 | part.SendFullUpdate(this.ControllingClient); | ||
330 | ScenePartUpdate update = new ScenePartUpdate(); | ||
331 | update.FullID = part.UUID; | ||
332 | update.LastFullUpdateTime = (uint)Util.UnixTimeSinceEpoch(); | ||
333 | m_updateTimes.Add(part.UUID, update); | ||
334 | updateCount++; | ||
306 | } | 335 | } |
307 | } | ||
308 | } | ||
309 | if (m_fullPartUpdates.Count > 0) | ||
310 | { | ||
311 | bool full = true; | ||
312 | int fullCount = 0; | ||
313 | 336 | ||
314 | while (full) | 337 | if (m_partsUpdateQueue.Count < 1 | updateCount > 60) |
315 | { | ||
316 | SceneObjectPart part = m_fullPartUpdates.Dequeue(); | ||
317 | part.SendFullUpdate(m_controllingClient); | ||
318 | fullCount++; | ||
319 | if ((m_fullPartUpdates.Count < 1) | (fullCount > 40)) | ||
320 | { | 338 | { |
321 | full = false; | 339 | runUpdate = false; |
322 | } | 340 | } |
323 | } | 341 | } |
324 | } | 342 | } |
325 | } | 343 | } |
326 | 344 | ||
345 | |||
327 | #region Status Methods | 346 | #region Status Methods |
328 | 347 | ||
329 | public void MakeAvatarPhysical(LLVector3 pos, bool isFlying) | 348 | public void MakeAvatarPhysical(LLVector3 pos, bool isFlying) |
@@ -901,6 +920,22 @@ namespace OpenSim.Region.Environment.Scenes | |||
901 | } | 920 | } |
902 | } | 921 | } |
903 | 922 | ||
923 | public class ScenePartUpdate | ||
924 | { | ||
925 | public LLUUID FullID; | ||
926 | public uint LastFullUpdateTime; | ||
927 | public uint LastTerseUpdateTime; | ||
928 | |||
929 | public ScenePartUpdate() | ||
930 | { | ||
931 | FullID = LLUUID.Zero; | ||
932 | LastFullUpdateTime = 0; | ||
933 | LastTerseUpdateTime = 0; | ||
934 | } | ||
935 | |||
936 | } | ||
937 | |||
938 | |||
904 | public override void SetText(string text, Vector3 color, double alpha) | 939 | public override void SetText(string text, Vector3 color, double alpha) |
905 | { | 940 | { |
906 | throw new Exception("Can't set Text on avatar."); | 941 | throw new Exception("Can't set Text on avatar."); |
diff --git a/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs b/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs index 2b8d92e..fd1307a 100644 --- a/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs +++ b/OpenSim/Region/Environment/Types/BasicQuadTreeNode.cs | |||
@@ -1,174 +1,230 @@ | |||
1 | using System.Collections.Generic; | 1 | using System.Collections.Generic; |
2 | using OpenSim.Region.Environment.Scenes; | 2 | using OpenSim.Region.Environment.Scenes; |
3 | 3 | ||
4 | namespace OpenSim.Region.Environment.Types | 4 | namespace OpenSim.Region.Environment.Types |
5 | { | 5 | { |
6 | public class BasicQuadTreeNode | 6 | public class BasicQuadTreeNode |
7 | { | 7 | { |
8 | private List<SceneObjectGroup> m_objects = new List<SceneObjectGroup>(); | 8 | private List<SceneObjectGroup> m_objects = new List<SceneObjectGroup>(); |
9 | private BasicQuadTreeNode[] m_childNodes = null; | 9 | private BasicQuadTreeNode[] m_childNodes = null; |
10 | private BasicQuadTreeNode m_parent = null; | 10 | private BasicQuadTreeNode m_parent = null; |
11 | 11 | ||
12 | private short m_leftX; | 12 | private short m_leftX; |
13 | private short m_leftY; | 13 | private short m_leftY; |
14 | private short m_width; | 14 | private short m_width; |
15 | private short m_height; | 15 | private short m_height; |
16 | 16 | //private int m_quadNumber; | |
17 | public BasicQuadTreeNode(BasicQuadTreeNode parent, short leftX, short leftY, short width, short height) | 17 | private string m_quadID; |
18 | { | 18 | |
19 | m_parent = parent; | 19 | public BasicQuadTreeNode(BasicQuadTreeNode parent, string quadID, short leftX, short leftY, short width, short height) |
20 | m_leftX = leftX; | 20 | { |
21 | m_leftY = leftY; | 21 | m_parent = parent; |
22 | m_width = width; | 22 | m_quadID = quadID; |
23 | m_height = height; | 23 | m_leftX = leftX; |
24 | } | 24 | m_leftY = leftY; |
25 | 25 | m_width = width; | |
26 | public void AddObject(SceneObjectGroup obj) | 26 | m_height = height; |
27 | { | 27 | // Console.WriteLine("creating quadtree node " + m_quadID); |
28 | if (m_childNodes == null) | 28 | } |
29 | { | 29 | |
30 | if (!m_objects.Contains(obj)) | 30 | public void AddObject(SceneObjectGroup obj) |
31 | { | 31 | { |
32 | m_objects.Add(obj); | 32 | if (m_childNodes == null) |
33 | } | 33 | { |
34 | } | 34 | if (!m_objects.Contains(obj)) |
35 | else | 35 | { |
36 | { | 36 | m_objects.Add(obj); |
37 | if (obj.AbsolutePosition.X < (m_leftX + (m_width/2))) | 37 | } |
38 | { | 38 | } |
39 | if (obj.AbsolutePosition.Y < (m_leftY + (m_height/2))) | 39 | else |
40 | { | 40 | { |
41 | m_childNodes[0].AddObject(obj); | 41 | if (obj.AbsolutePosition.X < (m_leftX + (m_width / 2))) |
42 | } | 42 | { |
43 | else | 43 | if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2))) |
44 | { | 44 | { |
45 | m_childNodes[2].AddObject(obj); | 45 | m_childNodes[0].AddObject(obj); |
46 | } | 46 | } |
47 | } | 47 | else |
48 | else | 48 | { |
49 | { | 49 | m_childNodes[2].AddObject(obj); |
50 | if (obj.AbsolutePosition.Y < (m_leftY + (m_height/2))) | 50 | } |
51 | { | 51 | } |
52 | m_childNodes[1].AddObject(obj); | 52 | else |
53 | } | 53 | { |
54 | else | 54 | if (obj.AbsolutePosition.Y < (m_leftY + (m_height / 2))) |
55 | { | 55 | { |
56 | m_childNodes[3].AddObject(obj); | 56 | m_childNodes[1].AddObject(obj); |
57 | } | 57 | } |
58 | } | 58 | else |
59 | } | 59 | { |
60 | } | 60 | m_childNodes[3].AddObject(obj); |
61 | 61 | } | |
62 | public void Subdivide() | 62 | } |
63 | { | 63 | } |
64 | if (m_childNodes == null) | 64 | } |
65 | { | 65 | |
66 | m_childNodes = new BasicQuadTreeNode[4]; | 66 | public void Subdivide() |
67 | m_childNodes[0] = | 67 | { |
68 | new BasicQuadTreeNode(this, m_leftX, m_leftY, (short) (m_width/2), (short) (m_height/2)); | 68 | if (m_childNodes == null) |
69 | m_childNodes[1] = | 69 | { |
70 | new BasicQuadTreeNode(this, (short) (m_leftX + (m_width/2)), m_leftY, (short) (m_width/2), | 70 | m_childNodes = new BasicQuadTreeNode[4]; |
71 | (short) (m_height/2)); | 71 | m_childNodes[0] = new BasicQuadTreeNode(this, m_quadID + "1/", m_leftX, m_leftY, (short)(m_width / 2), (short)(m_height / 2)); |
72 | m_childNodes[2] = | 72 | m_childNodes[1] = new BasicQuadTreeNode(this, m_quadID + "2/", (short)(m_leftX + (m_width / 2)), m_leftY, (short)(m_width / 2), (short)(m_height / 2)); |
73 | new BasicQuadTreeNode(this, m_leftX, (short) (m_leftY + (m_height/2)), (short) (m_width/2), | 73 | m_childNodes[2] = new BasicQuadTreeNode(this, m_quadID + "3/", m_leftX, (short)(m_leftY + (m_height / 2)), (short)(m_width / 2), (short)(m_height / 2)); |
74 | (short) (m_height/2)); | 74 | m_childNodes[3] = new BasicQuadTreeNode(this, m_quadID + "4/", (short)(m_leftX + (m_width / 2)), (short)(m_height + (m_height / 2)), (short)(m_width / 2), (short)(m_height / 2)); |
75 | m_childNodes[3] = | 75 | } |
76 | new BasicQuadTreeNode(this, (short) (m_leftX + (m_width/2)), (short) (m_height + (m_height/2)), | 76 | else |
77 | (short) (m_width/2), (short) (m_height/2)); | 77 | { |
78 | } | 78 | for (int i = 0; i < m_childNodes.Length; i++) |
79 | else | 79 | { |
80 | { | 80 | m_childNodes[i].Subdivide(); |
81 | for (int i = 0; i < m_childNodes.Length; i++) | 81 | } |
82 | { | 82 | } |
83 | m_childNodes[i].Subdivide(); | 83 | } |
84 | } | 84 | |
85 | } | 85 | public List<SceneObjectGroup> GetObjectsFrom(float x, float y) |
86 | } | 86 | { |
87 | 87 | if (m_childNodes == null) | |
88 | public List<SceneObjectGroup> GetObjectsFrom(int x, int y) | 88 | { |
89 | { | 89 | return new List<SceneObjectGroup>(m_objects); |
90 | if (m_childNodes == null) | 90 | } |
91 | { | 91 | else |
92 | return m_objects; | 92 | { |
93 | } | 93 | if (x < m_leftX + (m_width / 2)) |
94 | else | 94 | { |
95 | { | 95 | if (y < m_leftY + (m_height / 2)) |
96 | if (x < (m_leftX + (m_width/2))) | 96 | { |
97 | { | 97 | return m_childNodes[0].GetObjectsFrom(x, y); |
98 | if (y < (m_leftY + (m_height/2))) | 98 | } |
99 | { | 99 | else |
100 | return m_childNodes[0].GetObjectsFrom(x, y); | 100 | { |
101 | } | 101 | return m_childNodes[2].GetObjectsFrom(x, y); |
102 | else | 102 | } |
103 | { | 103 | } |
104 | return m_childNodes[2].GetObjectsFrom(x, y); | 104 | else |
105 | } | 105 | { |
106 | } | 106 | if (y < m_leftY + (m_height / 2)) |
107 | else | 107 | { |
108 | { | 108 | return m_childNodes[1].GetObjectsFrom(x, y); |
109 | if (y < (m_leftY + (m_height/2))) | 109 | } |
110 | { | 110 | else |
111 | return m_childNodes[1].GetObjectsFrom(x, y); | 111 | { |
112 | } | 112 | return m_childNodes[3].GetObjectsFrom(x, y); |
113 | else | 113 | } |
114 | { | 114 | } |
115 | return m_childNodes[3].GetObjectsFrom(x, y); | 115 | } |
116 | } | 116 | } |
117 | } | 117 | |
118 | } | 118 | public List<SceneObjectGroup> GetObjectsFrom(string nodeName) |
119 | } | 119 | { |
120 | 120 | if (nodeName == m_quadID) | |
121 | public void Update() | 121 | { |
122 | { | 122 | return new List<SceneObjectGroup>(m_objects); |
123 | if (m_childNodes != null) | 123 | } |
124 | { | 124 | else if (m_childNodes != null) |
125 | for (int i = 0; i < 4; i++) | 125 | { |
126 | { | 126 | for (int i = 0; i < 4; i++) |
127 | m_childNodes[i].Update(); | 127 | { |
128 | } | 128 | List<SceneObjectGroup> retVal; |
129 | } | 129 | retVal = m_childNodes[i].GetObjectsFrom(nodeName); |
130 | else | 130 | if (retVal != null) |
131 | { | 131 | { |
132 | List<SceneObjectGroup> outBounds = new List<SceneObjectGroup>(); | 132 | return retVal; |
133 | foreach (SceneObjectGroup group in m_objects) | 133 | } |
134 | { | 134 | } |
135 | if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && | 135 | } |
136 | ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height)))) | 136 | return null; |
137 | { | 137 | } |
138 | //still in bounds | 138 | |
139 | } | 139 | public string GetNodeID(float x, float y) |
140 | else | 140 | { |
141 | { | 141 | if (m_childNodes == null) |
142 | outBounds.Add(group); | 142 | { |
143 | } | 143 | return m_quadID; |
144 | } | 144 | } |
145 | 145 | else | |
146 | foreach (SceneObjectGroup removee in outBounds) | 146 | { |
147 | { | 147 | if (x < m_leftX + (m_width / 2)) |
148 | m_objects.Remove(removee); | 148 | { |
149 | if (m_parent != null) | 149 | if (y < m_leftY + (m_height / 2)) |
150 | { | 150 | { |
151 | m_parent.PassUp(removee); | 151 | return m_childNodes[0].GetNodeID(x, y); |
152 | } | 152 | } |
153 | } | 153 | else |
154 | outBounds.Clear(); | 154 | { |
155 | } | 155 | return m_childNodes[2].GetNodeID(x, y); |
156 | } | 156 | } |
157 | 157 | } | |
158 | public void PassUp(SceneObjectGroup group) | 158 | else |
159 | { | 159 | { |
160 | if (((group.AbsolutePosition.X > m_leftX) && (group.AbsolutePosition.X < (m_leftX + m_width))) && | 160 | if (y < m_leftY + (m_height / 2)) |
161 | ((group.AbsolutePosition.Y > m_leftY) && (group.AbsolutePosition.Y < (m_leftY + m_height)))) | 161 | { |
162 | { | 162 | return m_childNodes[1].GetNodeID(x, y); |
163 | AddObject(group); | 163 | } |
164 | } | 164 | else |
165 | else | 165 | { |
166 | { | 166 | return m_childNodes[3].GetNodeID(x, y); |
167 | if (m_parent != null) | 167 | } |
168 | { | 168 | } |
169 | m_parent.PassUp(group); | 169 | } |
170 | } | 170 | } |
171 | } | 171 | |
172 | } | 172 | public void Update() |
173 | } | 173 | { |
174 | if (m_childNodes != null) | ||
175 | { | ||
176 | for (int i = 0; i < 4; i++) | ||
177 | { | ||
178 | m_childNodes[i].Update(); | ||
179 | } | ||
180 | } | ||
181 | else | ||
182 | { | ||
183 | List<SceneObjectGroup> outBounds = new List<SceneObjectGroup>(); | ||
184 | foreach (SceneObjectGroup group in m_objects) | ||
185 | { | ||
186 | 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)))) | ||
187 | { | ||
188 | //still in bounds | ||
189 | } | ||
190 | else | ||
191 | { | ||
192 | outBounds.Add(group); | ||
193 | } | ||
194 | } | ||
195 | |||
196 | foreach (SceneObjectGroup removee in outBounds) | ||
197 | { | ||
198 | m_objects.Remove(removee); | ||
199 | if (m_parent != null) | ||
200 | { | ||
201 | m_parent.PassUp(removee); | ||
202 | } | ||
203 | } | ||
204 | outBounds.Clear(); | ||
205 | } | ||
206 | } | ||
207 | |||
208 | public void PassUp(SceneObjectGroup group) | ||
209 | { | ||
210 | 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)))) | ||
211 | { | ||
212 | AddObject(group); | ||
213 | } | ||
214 | else | ||
215 | { | ||
216 | if (m_parent != null) | ||
217 | { | ||
218 | m_parent.PassUp(group); | ||
219 | } | ||
220 | } | ||
221 | } | ||
222 | |||
223 | public string[] GetNeighbours(string nodeName) | ||
224 | { | ||
225 | string[] retVal = new string[1]; | ||
226 | retVal[0] = ""; | ||
227 | return retVal; | ||
228 | } | ||
229 | } | ||
174 | } \ No newline at end of file | 230 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Types/UpdateQueue.cs b/OpenSim/Region/Environment/Types/UpdateQueue.cs index c1fb161..0d341ae 100644 --- a/OpenSim/Region/Environment/Types/UpdateQueue.cs +++ b/OpenSim/Region/Environment/Types/UpdateQueue.cs | |||
@@ -1,51 +1,51 @@ | |||
1 | using System.Collections.Generic; | 1 | using System.Collections.Generic; |
2 | using libsecondlife; | 2 | using libsecondlife; |
3 | using OpenSim.Region.Environment.Scenes; | 3 | using OpenSim.Region.Environment.Scenes; |
4 | 4 | ||
5 | namespace OpenSim.Region.Environment.Types | 5 | namespace OpenSim.Region.Environment.Types |
6 | { | 6 | { |
7 | public class UpdateQueue | 7 | public class UpdateQueue |
8 | { | 8 | { |
9 | private Queue<SceneObjectPart> m_queue; | 9 | private Queue<SceneObjectPart> m_queue; |
10 | 10 | ||
11 | private List<LLUUID> m_ids; | 11 | private List<LLUUID> m_ids; |
12 | 12 | ||
13 | public int Count | 13 | public int Count |
14 | { | 14 | { |
15 | get { return m_queue.Count; } | 15 | get { return m_queue.Count; } |
16 | } | 16 | } |
17 | 17 | ||
18 | public UpdateQueue() | 18 | public UpdateQueue() |
19 | { | 19 | { |
20 | m_queue = new Queue<SceneObjectPart>(); | 20 | m_queue = new Queue<SceneObjectPart>(); |
21 | m_ids = new List<LLUUID>(); | 21 | m_ids = new List<LLUUID>(); |
22 | } | 22 | } |
23 | 23 | ||
24 | public void Enqueue(SceneObjectPart part) | 24 | public void Enqueue(SceneObjectPart part) |
25 | { | 25 | { |
26 | lock (m_ids) | 26 | lock (m_ids) |
27 | { | 27 | { |
28 | if (!m_ids.Contains(part.UUID)) | 28 | if (!m_ids.Contains(part.UUID)) |
29 | { | 29 | { |
30 | m_ids.Add(part.UUID); | 30 | m_ids.Add(part.UUID); |
31 | m_queue.Enqueue(part); | 31 | m_queue.Enqueue(part); |
32 | } | 32 | } |
33 | } | 33 | } |
34 | } | 34 | } |
35 | 35 | ||
36 | public SceneObjectPart Dequeue() | 36 | public SceneObjectPart Dequeue() |
37 | { | 37 | { |
38 | SceneObjectPart part = null; | 38 | SceneObjectPart part = null; |
39 | if (m_queue.Count > 0) | 39 | if (m_queue.Count > 0) |
40 | { | 40 | { |
41 | part = m_queue.Dequeue(); | 41 | part = m_queue.Dequeue(); |
42 | lock (m_ids) | 42 | lock (m_ids) |
43 | { | 43 | { |
44 | m_ids.Remove(part.UUID); | 44 | m_ids.Remove(part.UUID); |
45 | } | 45 | } |
46 | } | 46 | } |
47 | 47 | ||
48 | return part; | 48 | return part; |
49 | } | 49 | } |
50 | } | 50 | } |
51 | } \ No newline at end of file | 51 | } \ No newline at end of file |