diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Prioritizer.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Prioritizer.cs | 48 |
1 files changed, 38 insertions, 10 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs index 17b2da1..0f35894 100644 --- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs +++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs | |||
@@ -88,7 +88,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
88 | 88 | ||
89 | // If this is an update for our own avatar give it the highest priority | 89 | // If this is an update for our own avatar give it the highest priority |
90 | if (client.AgentId == entity.UUID) | 90 | if (client.AgentId == entity.UUID) |
91 | return PriorityQueue.ImmediateQueue; | 91 | return 0; |
92 | 92 | ||
93 | uint priority; | 93 | uint priority; |
94 | 94 | ||
@@ -119,16 +119,40 @@ namespace OpenSim.Region.Framework.Scenes | |||
119 | 119 | ||
120 | private uint GetPriorityByTime(IClientAPI client, ISceneEntity entity) | 120 | private uint GetPriorityByTime(IClientAPI client, ISceneEntity entity) |
121 | { | 121 | { |
122 | return 1; | 122 | // And anything attached to this avatar gets top priority as well |
123 | if (entity is SceneObjectPart) | ||
124 | { | ||
125 | SceneObjectPart sop = (SceneObjectPart)entity; | ||
126 | if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.RootPart.AttachedAvatar) | ||
127 | return 1; | ||
128 | } | ||
129 | |||
130 | return PriorityQueue.NumberOfImmediateQueues; // first queue past the immediate queues | ||
123 | } | 131 | } |
124 | 132 | ||
125 | private uint GetPriorityByDistance(IClientAPI client, ISceneEntity entity) | 133 | private uint GetPriorityByDistance(IClientAPI client, ISceneEntity entity) |
126 | { | 134 | { |
135 | // And anything attached to this avatar gets top priority as well | ||
136 | if (entity is SceneObjectPart) | ||
137 | { | ||
138 | SceneObjectPart sop = (SceneObjectPart)entity; | ||
139 | if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.RootPart.AttachedAvatar) | ||
140 | return 1; | ||
141 | } | ||
142 | |||
127 | return ComputeDistancePriority(client,entity,false); | 143 | return ComputeDistancePriority(client,entity,false); |
128 | } | 144 | } |
129 | 145 | ||
130 | private uint GetPriorityByFrontBack(IClientAPI client, ISceneEntity entity) | 146 | private uint GetPriorityByFrontBack(IClientAPI client, ISceneEntity entity) |
131 | { | 147 | { |
148 | // And anything attached to this avatar gets top priority as well | ||
149 | if (entity is SceneObjectPart) | ||
150 | { | ||
151 | SceneObjectPart sop = (SceneObjectPart)entity; | ||
152 | if (sop.ParentGroup.RootPart.IsAttachment && client.AgentId == sop.ParentGroup.RootPart.AttachedAvatar) | ||
153 | return 1; | ||
154 | } | ||
155 | |||
132 | return ComputeDistancePriority(client,entity,true); | 156 | return ComputeDistancePriority(client,entity,true); |
133 | } | 157 | } |
134 | 158 | ||
@@ -143,18 +167,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
143 | { | 167 | { |
144 | if (!presence.IsChildAgent) | 168 | if (!presence.IsChildAgent) |
145 | { | 169 | { |
170 | // All avatars other than our own go into pqueue 1 | ||
171 | if (entity is ScenePresence) | ||
172 | return 1; | ||
173 | |||
146 | if (entity is SceneObjectPart) | 174 | if (entity is SceneObjectPart) |
147 | { | 175 | { |
176 | // Attachments are high priority, | ||
177 | if (((SceneObjectPart)entity).ParentGroup.RootPart.IsAttachment) | ||
178 | return 1; | ||
179 | |||
148 | // Non physical prims are lower priority than physical prims | 180 | // Non physical prims are lower priority than physical prims |
149 | PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor; | 181 | PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor; |
150 | if (physActor == null || !physActor.IsPhysical) | 182 | if (physActor == null || !physActor.IsPhysical) |
151 | pqueue++; | 183 | pqueue++; |
152 | |||
153 | // Attachments are high priority, | ||
154 | // MIC: shouldn't these already be in the highest priority queue already | ||
155 | // since their root position is same as the avatars? | ||
156 | if (((SceneObjectPart)entity).ParentGroup.RootPart.IsAttachment) | ||
157 | pqueue = 1; | ||
158 | } | 184 | } |
159 | } | 185 | } |
160 | } | 186 | } |
@@ -205,8 +231,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
205 | 231 | ||
206 | // And convert the distance to a priority queue, this computation gives queues | 232 | // And convert the distance to a priority queue, this computation gives queues |
207 | // at 10, 20, 40, 80, 160, 320, 640, and 1280m | 233 | // at 10, 20, 40, 80, 160, 320, 640, and 1280m |
208 | uint pqueue = 1; | 234 | uint pqueue = PriorityQueue.NumberOfImmediateQueues; |
209 | for (int i = 0; i < 8; i++) | 235 | uint queues = PriorityQueue.NumberOfQueues - PriorityQueue.NumberOfImmediateQueues; |
236 | |||
237 | for (int i = 0; i < queues - 1; i++) | ||
210 | { | 238 | { |
211 | if (distance < 10 * Math.Pow(2.0,i)) | 239 | if (distance < 10 * Math.Pow(2.0,i)) |
212 | break; | 240 | break; |