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/ScenePresence.cs | |
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/Scenes/ScenePresence.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 105 |
1 files changed, 70 insertions, 35 deletions
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."); |