diff options
author | UbitUmarov | 2016-10-02 11:12:03 +0100 |
---|---|---|
committer | UbitUmarov | 2016-10-02 11:12:03 +0100 |
commit | cd9d176c3cd710b29b43dd4420c7616ff0f01f43 (patch) | |
tree | 08ae8769bbc989b7355a738b537c79e631a03a21 /OpenSim/Region/Framework/Scenes/Prioritizer.cs | |
parent | fix comment telling the correct default physics engine (diff) | |
download | opensim-SC_OLD-cd9d176c3cd710b29b43dd4420c7616ff0f01f43.zip opensim-SC_OLD-cd9d176c3cd710b29b43dd4420c7616ff0f01f43.tar.gz opensim-SC_OLD-cd9d176c3cd710b29b43dd4420c7616ff0f01f43.tar.bz2 opensim-SC_OLD-cd9d176c3cd710b29b43dd4420c7616ff0f01f43.tar.xz |
change avatar and attachments priority (downgraded) in priritizer option SimpleAngularDistance
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Prioritizer.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Prioritizer.cs | 65 |
1 files changed, 30 insertions, 35 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs index 5669c43..ed80b3a 100644 --- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs +++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs | |||
@@ -274,50 +274,45 @@ namespace OpenSim.Region.Framework.Scenes | |||
274 | 274 | ||
275 | private uint GetPriorityByAngularDistance(IClientAPI client, ISceneEntity entity) | 275 | private uint GetPriorityByAngularDistance(IClientAPI client, ISceneEntity entity) |
276 | { | 276 | { |
277 | uint pqueue = 2; // keep compiler happy | ||
278 | |||
279 | ScenePresence presence = m_scene.GetScenePresence(client.AgentId); | 277 | ScenePresence presence = m_scene.GetScenePresence(client.AgentId); |
280 | if (presence == null) | 278 | if (presence == null) |
281 | return PriorityQueue.NumberOfQueues - 1; | 279 | return PriorityQueue.NumberOfQueues - 1; |
282 | 280 | ||
283 | // All avatars other than our own go into pqueue 1 | 281 | uint pqueue = ComputeAngleDistancePriority(presence, entity); |
284 | if (entity is ScenePresence) | ||
285 | return 1; | ||
286 | |||
287 | if (entity is SceneObjectPart) | ||
288 | { | ||
289 | // Attachments are high priority, | ||
290 | if (((SceneObjectPart)entity).ParentGroup.IsAttachment) | ||
291 | return 2; | ||
292 | |||
293 | pqueue = ComputeAngleDistancePriority(presence, entity); | ||
294 | |||
295 | // Non physical prims are lower priority than physical prims | ||
296 | PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor; | ||
297 | if (physActor == null || !physActor.IsPhysical) | ||
298 | pqueue++; | ||
299 | } | ||
300 | |||
301 | return pqueue; | 282 | return pqueue; |
302 | } | 283 | } |
303 | 284 | ||
304 | private uint ComputeAngleDistancePriority(ScenePresence presence, ISceneEntity entity) | 285 | private uint ComputeAngleDistancePriority(ScenePresence presence, ISceneEntity entity) |
305 | { | 286 | { |
306 | double distance; | ||
307 | |||
308 | Vector3 presencePos = presence.AbsolutePosition; | ||
309 | |||
310 | SceneObjectGroup group = (entity as SceneObjectPart).ParentGroup; | ||
311 | float bradius = group.GetBoundsRadius(); | ||
312 | Vector3 grppos = group.AbsolutePosition + group.getBoundsCenter(); | ||
313 | distance = Vector3.Distance(presencePos, grppos); | ||
314 | distance -= bradius; | ||
315 | distance *= group.getAreaFactor(); | ||
316 | |||
317 | // And convert the distance to a priority queue, this computation gives queues | 287 | // And convert the distance to a priority queue, this computation gives queues |
318 | // at 10, 20, 40, 80, 160, 320, 640, and 1280m | 288 | // at 10, 20, 40, 80, 160, 320, 640, and 1280m |
319 | uint pqueue = PriorityQueue.NumberOfImmediateQueues + 1; // reserve attachments queue | 289 | uint minpqueue = PriorityQueue.NumberOfImmediateQueues; |
320 | uint queues = PriorityQueue.NumberOfQueues - PriorityQueue.NumberOfImmediateQueues; | 290 | uint maxqueue = PriorityQueue.NumberOfQueues - PriorityQueue.NumberOfImmediateQueues -1; |
291 | uint pqueue = minpqueue; | ||
292 | float distance; | ||
293 | |||
294 | Vector3 presencePos = presence.AbsolutePosition; | ||
295 | if(entity is ScenePresence) | ||
296 | { | ||
297 | ScenePresence sp = entity as ScenePresence; | ||
298 | distance = Vector3.Distance(presencePos, sp.AbsolutePosition); | ||
299 | distance *= 0.5f; | ||
300 | } | ||
301 | else | ||
302 | { | ||
303 | SceneObjectGroup group = (entity as SceneObjectPart).ParentGroup; | ||
304 | float bradius = group.GetBoundsRadius(); | ||
305 | Vector3 grppos = group.AbsolutePosition + group.getBoundsCenter(); | ||
306 | distance = Vector3.Distance(presencePos, grppos); | ||
307 | distance -= bradius; | ||
308 | distance *= group.getAreaFactor(); | ||
309 | if(group.IsAttachment) | ||
310 | distance *= 0.5f; | ||
311 | else if(group.GetSittingAvatarsCount() > 0) | ||
312 | distance *= 0.5f; | ||
313 | else if(group.UsesPhysics) | ||
314 | distance *= 0.6f; | ||
315 | } | ||
321 | 316 | ||
322 | if (distance > 10f) | 317 | if (distance > 10f) |
323 | { | 318 | { |
@@ -328,8 +323,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
328 | // 2st constant makes it be log2(distance/10) | 323 | // 2st constant makes it be log2(distance/10) |
329 | 324 | ||
330 | pqueue += (uint)tmp; | 325 | pqueue += (uint)tmp; |
331 | if (pqueue > queues - 1) | 326 | if (pqueue > maxqueue) |
332 | pqueue = queues - 1; | 327 | pqueue = maxqueue; |
333 | } | 328 | } |
334 | 329 | ||
335 | return pqueue; | 330 | return pqueue; |