diff options
author | Justin Clark-Casey (justincc) | 2010-05-21 21:58:55 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-05-21 21:58:55 +0100 |
commit | 89f1ddb0a5b1a019dcd32b7c410e5a3dd3a2747b (patch) | |
tree | 84c03b2affadd720d883b5d127328838b153da9d /OpenSim/Region/ClientStack/LindenUDP | |
parent | rearrange SceneGraph.AddSceneObject() to return earlier if an object with tha... (diff) | |
parent | * Moving all of the prioritization/reprioritization code into a new file Prio... (diff) | |
download | opensim-SC-89f1ddb0a5b1a019dcd32b7c410e5a3dd3a2747b.zip opensim-SC-89f1ddb0a5b1a019dcd32b7c410e5a3dd3a2747b.tar.gz opensim-SC-89f1ddb0a5b1a019dcd32b7c410e5a3dd3a2747b.tar.bz2 opensim-SC-89f1ddb0a5b1a019dcd32b7c410e5a3dd3a2747b.tar.xz |
Merge branch 'master' of ssh://justincc@opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 46 |
1 files changed, 17 insertions, 29 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index c8a542b..9eb35fa 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -50,18 +50,6 @@ using Nini.Config; | |||
50 | 50 | ||
51 | namespace OpenSim.Region.ClientStack.LindenUDP | 51 | namespace OpenSim.Region.ClientStack.LindenUDP |
52 | { | 52 | { |
53 | public class EntityUpdate | ||
54 | { | ||
55 | public ISceneEntity Entity; | ||
56 | public PrimUpdateFlags Flags; | ||
57 | |||
58 | public EntityUpdate(ISceneEntity entity, PrimUpdateFlags flags) | ||
59 | { | ||
60 | Entity = entity; | ||
61 | Flags = flags; | ||
62 | } | ||
63 | } | ||
64 | |||
65 | public delegate bool PacketMethod(IClientAPI simClient, Packet packet); | 53 | public delegate bool PacketMethod(IClientAPI simClient, Packet packet); |
66 | 54 | ||
67 | /// <summary> | 55 | /// <summary> |
@@ -325,6 +313,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
325 | 313 | ||
326 | private int m_cachedTextureSerial; | 314 | private int m_cachedTextureSerial; |
327 | private PriorityQueue m_entityUpdates; | 315 | private PriorityQueue m_entityUpdates; |
316 | private Prioritizer m_prioritizer; | ||
328 | 317 | ||
329 | /// <value> | 318 | /// <value> |
330 | /// List used in construction of data blocks for an object update packet. This is to stop us having to | 319 | /// List used in construction of data blocks for an object update packet. This is to stop us having to |
@@ -462,6 +451,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
462 | m_propertiesPacketTimer = new Timer(100); | 451 | m_propertiesPacketTimer = new Timer(100); |
463 | m_propertiesPacketTimer.Elapsed += ProcessObjectPropertiesPacket; | 452 | m_propertiesPacketTimer.Elapsed += ProcessObjectPropertiesPacket; |
464 | 453 | ||
454 | m_prioritizer = new Prioritizer(m_scene); | ||
455 | |||
465 | RegisterLocalPacketHandlers(); | 456 | RegisterLocalPacketHandlers(); |
466 | } | 457 | } |
467 | 458 | ||
@@ -3457,14 +3448,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3457 | /// </summary> | 3448 | /// </summary> |
3458 | public void SendPrimUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) | 3449 | public void SendPrimUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) |
3459 | { | 3450 | { |
3460 | double priority; | 3451 | double priority = m_prioritizer.GetUpdatePriority(this, entity); |
3461 | |||
3462 | if (entity is SceneObjectPart) | ||
3463 | priority = ((SceneObjectPart)entity).ParentGroup.GetUpdatePriority(this); | ||
3464 | else if (entity is ScenePresence) | ||
3465 | priority = ((ScenePresence)entity).GetUpdatePriority(this); | ||
3466 | else | ||
3467 | priority = 0.0d; | ||
3468 | 3452 | ||
3469 | lock (m_entityUpdates.SyncRoot) | 3453 | lock (m_entityUpdates.SyncRoot) |
3470 | m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags), entity.LocalId); | 3454 | m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags), entity.LocalId); |
@@ -3613,19 +3597,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3613 | #endregion Packet Sending | 3597 | #endregion Packet Sending |
3614 | } | 3598 | } |
3615 | 3599 | ||
3616 | public void ReprioritizeUpdates(UpdatePriorityHandler handler) | 3600 | public void ReprioritizeUpdates() |
3617 | { | 3601 | { |
3618 | //m_log.Debug("[CLIENT]: Reprioritizing prim updates for " + m_firstName + " " + m_lastName); | 3602 | //m_log.Debug("[CLIENT]: Reprioritizing prim updates for " + m_firstName + " " + m_lastName); |
3619 | 3603 | ||
3620 | PriorityQueue.UpdatePriorityHandler update_priority_handler = | ||
3621 | delegate(ref double priority, uint local_id) | ||
3622 | { | ||
3623 | priority = handler(new UpdatePriorityData(priority, local_id)); | ||
3624 | return priority != double.NaN; | ||
3625 | }; | ||
3626 | |||
3627 | lock (m_entityUpdates.SyncRoot) | 3604 | lock (m_entityUpdates.SyncRoot) |
3628 | m_entityUpdates.Reprioritize(update_priority_handler); | 3605 | m_entityUpdates.Reprioritize(UpdatePriorityHandler); |
3606 | } | ||
3607 | |||
3608 | private bool UpdatePriorityHandler(ref double priority, uint localID) | ||
3609 | { | ||
3610 | EntityBase entity; | ||
3611 | if (m_scene.Entities.TryGetValue(localID, out entity)) | ||
3612 | { | ||
3613 | priority = m_prioritizer.GetUpdatePriority(this, entity); | ||
3614 | } | ||
3615 | |||
3616 | return priority != double.NaN; | ||
3629 | } | 3617 | } |
3630 | 3618 | ||
3631 | public void FlushPrimUpdates() | 3619 | public void FlushPrimUpdates() |