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/Scenes | |
parent | * Added FormatProvider to Culture (diff) | |
download | opensim-SC-86e5f82cb12dc5e854fe33526aee0ce899715410.zip opensim-SC-86e5f82cb12dc5e854fe33526aee0ce899715410.tar.gz opensim-SC-86e5f82cb12dc5e854fe33526aee0ce899715410.tar.bz2 opensim-SC-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/Scenes')
-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 |
3 files changed, 76 insertions, 44 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."); |