From a3bd769cb33ee59b883998205454bb340d44cb9e Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Fri, 22 Apr 2011 14:55:23 -0700 Subject: Added a second immediate queue to be used for the BestAvatar policy and currently used for all of an avatars attachments by the other policies. Also changed the way items are pulled from the update queues to bias close objects even more. --- OpenSim/Region/Framework/Scenes/Prioritizer.cs | 34 +++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs index 2e80156..a7637c0 100644 --- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs +++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs @@ -88,7 +88,7 @@ namespace OpenSim.Region.Framework.Scenes // If this is an update for our own avatar give it the highest priority if (client.AgentId == entity.UUID) - return PriorityQueue.ImmediateQueue; + return 0; uint priority; @@ -119,16 +119,40 @@ namespace OpenSim.Region.Framework.Scenes private uint GetPriorityByTime(IClientAPI client, ISceneEntity entity) { - return 1; + // And anything attached to this avatar gets top priority as well + if (entity is SceneObjectPart) + { + SceneObjectPart sop = (SceneObjectPart)entity; + if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.RootPart.AttachedAvatar) + return 1; + } + + return PriorityQueue.NumberOfImmediateQueues; // first queue past the immediate queues } private uint GetPriorityByDistance(IClientAPI client, ISceneEntity entity) { + // And anything attached to this avatar gets top priority as well + if (entity is SceneObjectPart) + { + SceneObjectPart sop = (SceneObjectPart)entity; + if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.RootPart.AttachedAvatar) + return 1; + } + return ComputeDistancePriority(client,entity,false); } private uint GetPriorityByFrontBack(IClientAPI client, ISceneEntity entity) { + // And anything attached to this avatar gets top priority as well + if (entity is SceneObjectPart) + { + SceneObjectPart sop = (SceneObjectPart)entity; + if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.RootPart.AttachedAvatar) + return 1; + } + return ComputeDistancePriority(client,entity,true); } @@ -197,8 +221,10 @@ namespace OpenSim.Region.Framework.Scenes // And convert the distance to a priority queue, this computation gives queues // at 10, 20, 40, 80, 160, 320, 640, and 1280m - uint pqueue = 1; - for (int i = 0; i < 8; i++) + uint pqueue = PriorityQueue.NumberOfImmediateQueues; + uint queues = PriorityQueue.NumberOfQueues - PriorityQueue.NumberOfImmediateQueues; + + for (int i = 0; i < queues - 1; i++) { if (distance < 10 * Math.Pow(2.0,i)) break; -- cgit v1.1