aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs174
1 files changed, 95 insertions, 79 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index d7113bf..87fac0c 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -93,12 +93,13 @@ namespace OpenSim.Region.Framework.Scenes
93 public Vector3 lastKnownAllowedPosition; 93 public Vector3 lastKnownAllowedPosition;
94 public bool sentMessageAboutRestrictedParcelFlyingDown; 94 public bool sentMessageAboutRestrictedParcelFlyingDown;
95 95
96 96 private Vector3 m_lastPosition;
97 private Quaternion m_lastRotation;
98 private Vector3 m_lastVelocity;
97 99
98 private bool m_updateflag; 100 private bool m_updateflag;
99 private byte m_movementflag; 101 private byte m_movementflag;
100 private readonly List<NewForce> m_forcesList = new List<NewForce>(); 102 private readonly List<NewForce> m_forcesList = new List<NewForce>();
101 private short m_updateCount;
102 private uint m_requestedSitTargetID; 103 private uint m_requestedSitTargetID;
103 private UUID m_requestedSitTargetUUID = UUID.Zero; 104 private UUID m_requestedSitTargetUUID = UUID.Zero;
104 private SendCourseLocationsMethod m_sendCourseLocationsMethod; 105 private SendCourseLocationsMethod m_sendCourseLocationsMethod;
@@ -145,12 +146,9 @@ namespace OpenSim.Region.Framework.Scenes
145 public string JID = string.Empty; 146 public string JID = string.Empty;
146 147
147 // Agent moves with a PID controller causing a force to be exerted. 148 // Agent moves with a PID controller causing a force to be exerted.
148 private bool m_newForce;
149 private bool m_newCoarseLocations = true; 149 private bool m_newCoarseLocations = true;
150 private float m_health = 100f; 150 private float m_health = 100f;
151 151
152 private Vector3 m_lastVelocity = Vector3.Zero;
153
154 // Default AV Height 152 // Default AV Height
155 private float m_avHeight = 127.0f; 153 private float m_avHeight = 127.0f;
156 154
@@ -158,16 +156,6 @@ namespace OpenSim.Region.Framework.Scenes
158 protected ulong crossingFromRegion; 156 protected ulong crossingFromRegion;
159 157
160 private readonly Vector3[] Dir_Vectors = new Vector3[6]; 158 private readonly Vector3[] Dir_Vectors = new Vector3[6];
161
162 /// <value>
163 /// The avatar position last sent to clients
164 /// </value>
165 private Vector3 lastPhysPos = Vector3.Zero;
166
167 /// <value>
168 /// The avatar body rotation last sent to clients
169 /// </value>
170 private Quaternion lastPhysRot = Quaternion.Identity;
171 159
172 // Position of agent's camera in world (region cordinates) 160 // Position of agent's camera in world (region cordinates)
173 protected Vector3 m_CameraCenter = Vector3.Zero; 161 protected Vector3 m_CameraCenter = Vector3.Zero;
@@ -297,6 +285,21 @@ namespace OpenSim.Region.Framework.Scenes
297 get { return Util.Axes2Rot(m_CameraAtAxis, m_CameraLeftAxis, m_CameraUpAxis); } 285 get { return Util.Axes2Rot(m_CameraAtAxis, m_CameraLeftAxis, m_CameraUpAxis); }
298 } 286 }
299 287
288 public Vector3 CameraAtAxis
289 {
290 get { return m_CameraAtAxis; }
291 }
292
293 public Vector3 CameraLeftAxis
294 {
295 get { return m_CameraLeftAxis; }
296 }
297
298 public Vector3 CameraUpAxis
299 {
300 get { return m_CameraUpAxis; }
301 }
302
300 public Vector3 Lookat 303 public Vector3 Lookat
301 { 304 {
302 get 305 get
@@ -431,7 +434,7 @@ namespace OpenSim.Region.Framework.Scenes
431 { 434 {
432 lock (m_scene.SyncRoot) 435 lock (m_scene.SyncRoot)
433 { 436 {
434 m_physicsActor.Position = new PhysicsVector(value.X, value.Y, value.Z); 437 m_physicsActor.Position = value;
435 } 438 }
436 } 439 }
437 catch (Exception e) 440 catch (Exception e)
@@ -471,7 +474,7 @@ namespace OpenSim.Region.Framework.Scenes
471 { 474 {
472 lock (m_scene.SyncRoot) 475 lock (m_scene.SyncRoot)
473 { 476 {
474 m_physicsActor.Velocity = new PhysicsVector(value.X, value.Y, value.Z); 477 m_physicsActor.Velocity = value;
475 } 478 }
476 } 479 }
477 catch (Exception e) 480 catch (Exception e)
@@ -869,14 +872,16 @@ namespace OpenSim.Region.Framework.Scenes
869 872
870 m_isChildAgent = false; 873 m_isChildAgent = false;
871 874
872 List<ScenePresence> AnimAgents = m_scene.GetScenePresences(); 875 ScenePresence[] animAgents = m_scene.GetScenePresences();
873 foreach (ScenePresence p in AnimAgents) 876 for (int i = 0; i < animAgents.Length; i++)
874 { 877 {
875 if (p != this) 878 ScenePresence presence = animAgents[i];
876 p.SendAnimPackToClient(ControllingClient); 879
880 if (presence != this)
881 presence.SendAnimPackToClient(ControllingClient);
877 } 882 }
878 m_scene.EventManager.TriggerOnMakeRootAgent(this);
879 883
884 m_scene.EventManager.TriggerOnMakeRootAgent(this);
880 } 885 }
881 886
882 /// <summary> 887 /// <summary>
@@ -1041,7 +1046,7 @@ namespace OpenSim.Region.Framework.Scenes
1041 m_avHeight = height; 1046 m_avHeight = height;
1042 if (PhysicsActor != null && !IsChildAgent) 1047 if (PhysicsActor != null && !IsChildAgent)
1043 { 1048 {
1044 PhysicsVector SetSize = new PhysicsVector(0.45f, 0.6f, m_avHeight); 1049 Vector3 SetSize = new Vector3(0.45f, 0.6f, m_avHeight);
1045 PhysicsActor.Size = SetSize; 1050 PhysicsActor.Size = SetSize;
1046 } 1051 }
1047 } 1052 }
@@ -1106,18 +1111,18 @@ namespace OpenSim.Region.Framework.Scenes
1106 CameraConstraintActive = true; 1111 CameraConstraintActive = true;
1107 //m_log.DebugFormat("[RAYCASTRESULT]: {0}, {1}, {2}, {3}", hitYN, collisionPoint, localid, distance); 1112 //m_log.DebugFormat("[RAYCASTRESULT]: {0}, {1}, {2}, {3}", hitYN, collisionPoint, localid, distance);
1108 1113
1109 Vector3 normal = Vector3.Normalize(new Vector3(0,0,collisionPoint.Z) - collisionPoint); 1114 Vector3 normal = Vector3.Normalize(new Vector3(0f, 0f, collisionPoint.Z) - collisionPoint);
1110 ControllingClient.SendCameraConstraint(new Vector4(normal.X, normal.Y, normal.Z, -1 * Vector3.Distance(new Vector3(0,0,collisionPoint.Z),collisionPoint))); 1115 ControllingClient.SendCameraConstraint(new Vector4(normal.X, normal.Y, normal.Z, -1 * Vector3.Distance(new Vector3(0,0,collisionPoint.Z),collisionPoint)));
1111 } 1116 }
1112 else 1117 else
1113 { 1118 {
1114 if (((Util.GetDistanceTo(lastPhysPos, AbsolutePosition) > 0.02) 1119 if ((m_pos - m_lastPosition).Length() > 0.02f ||
1115 || (Util.GetDistanceTo(m_lastVelocity, m_velocity) > 0.02) 1120 (m_velocity - m_lastVelocity).Length() > 0.02f ||
1116 || lastPhysRot != m_bodyRot)) 1121 m_bodyRot != m_lastRotation)
1117 { 1122 {
1118 if (CameraConstraintActive) 1123 if (CameraConstraintActive)
1119 { 1124 {
1120 ControllingClient.SendCameraConstraint(new Vector4(0, 0.5f, 0.9f, -3000f)); 1125 ControllingClient.SendCameraConstraint(new Vector4(0f, 0.5f, 0.9f, -3000f));
1121 CameraConstraintActive = false; 1126 CameraConstraintActive = false;
1122 } 1127 }
1123 } 1128 }
@@ -2356,6 +2361,9 @@ namespace OpenSim.Region.Framework.Scenes
2356 2361
2357 public override void Update() 2362 public override void Update()
2358 { 2363 {
2364 const float VELOCITY_TOLERANCE = 0.01f;
2365 const float POSITION_TOLERANCE = 10.0f;
2366
2359 SendPrimUpdates(); 2367 SendPrimUpdates();
2360 2368
2361 if (m_newCoarseLocations) 2369 if (m_newCoarseLocations)
@@ -2366,28 +2374,17 @@ namespace OpenSim.Region.Framework.Scenes
2366 2374
2367 if (m_isChildAgent == false) 2375 if (m_isChildAgent == false)
2368 { 2376 {
2369 if (m_newForce) // user movement 'forces' (ie commands to move) 2377 // Throw away duplicate or insignificant updates
2370 { 2378 if (m_bodyRot != m_lastRotation ||
2371 SendTerseUpdateToAllClients(); 2379 (m_velocity - m_lastVelocity).Length() > VELOCITY_TOLERANCE ||
2372 m_updateCount = 0; 2380 (m_pos - m_lastPosition).Length() > POSITION_TOLERANCE)
2373 }
2374 else if (m_movementflag != 0) // scripted movement (?)
2375 {
2376 m_updateCount++;
2377 if (m_updateCount > 3)
2378 {
2379 SendTerseUpdateToAllClients();
2380 m_updateCount = 0;
2381 }
2382 }
2383 else if ((Util.GetDistanceTo(lastPhysPos, AbsolutePosition) > 0.02)
2384 || (Util.GetDistanceTo(m_lastVelocity, m_velocity) > 0.02)
2385 || lastPhysRot != m_bodyRot)
2386 { 2381 {
2387 // Send Terse Update to all clients updates lastPhysPos and m_lastVelocity
2388 // doing the above assures us that we know what we sent the clients last
2389 SendTerseUpdateToAllClients(); 2382 SendTerseUpdateToAllClients();
2390 m_updateCount = 0; 2383
2384 // Update the "last" values
2385 m_lastPosition = m_pos;
2386 m_lastRotation = m_bodyRot;
2387 m_lastVelocity = m_velocity;
2391 } 2388 }
2392 2389
2393 // followed suggestion from mic bowman. reversed the two lines below. 2390 // followed suggestion from mic bowman. reversed the two lines below.
@@ -2417,7 +2414,7 @@ namespace OpenSim.Region.Framework.Scenes
2417 pos.Z -= m_appearance.HipOffset; 2414 pos.Z -= m_appearance.HipOffset;
2418 2415
2419 remoteClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_regionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId, 2416 remoteClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_regionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId,
2420 pos, m_velocity, Vector3.Zero, m_rotation, Vector4.Zero, m_uuid, null, GetUpdatePriority(remoteClient))); 2417 pos, m_velocity, Vector3.Zero, m_bodyRot, Vector4.UnitW, m_uuid, null, GetUpdatePriority(remoteClient)));
2421 2418
2422 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); 2419 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
2423 m_scene.StatsReporter.AddAgentUpdates(1); 2420 m_scene.StatsReporter.AddAgentUpdates(1);
@@ -2430,15 +2427,10 @@ namespace OpenSim.Region.Framework.Scenes
2430 public void SendTerseUpdateToAllClients() 2427 public void SendTerseUpdateToAllClients()
2431 { 2428 {
2432 m_perfMonMS = Environment.TickCount; 2429 m_perfMonMS = Environment.TickCount;
2433 2430
2434 m_scene.ForEachClient(SendTerseUpdateToClient); 2431 m_scene.ForEachClient(SendTerseUpdateToClient);
2435 2432
2436 m_lastVelocity = m_velocity;
2437 lastPhysPos = AbsolutePosition;
2438 lastPhysRot = m_bodyRot;
2439
2440 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); 2433 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
2441
2442 } 2434 }
2443 2435
2444 public void SendCoarseLocations() 2436 public void SendCoarseLocations()
@@ -2517,15 +2509,12 @@ namespace OpenSim.Region.Framework.Scenes
2517 if (m_appearance.Texture == null) 2509 if (m_appearance.Texture == null)
2518 return; 2510 return;
2519 2511
2520 // Note: because Quaternion is a struct, it can't be null
2521 Quaternion rot = m_bodyRot;
2522
2523 Vector3 pos = m_pos; 2512 Vector3 pos = m_pos;
2524 pos.Z -= m_appearance.HipOffset; 2513 pos.Z -= m_appearance.HipOffset;
2525 2514
2526 remoteAvatar.m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, 2515 remoteAvatar.m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid,
2527 LocalId, m_pos, m_appearance.Texture.GetBytes(), 2516 LocalId, pos, m_appearance.Texture.GetBytes(),
2528 m_parentID, rot)); 2517 m_parentID, m_bodyRot));
2529 m_scene.StatsReporter.AddAgentUpdates(1); 2518 m_scene.StatsReporter.AddAgentUpdates(1);
2530 } 2519 }
2531 2520
@@ -2536,9 +2525,12 @@ namespace OpenSim.Region.Framework.Scenes
2536 { 2525 {
2537 m_perfMonMS = Environment.TickCount; 2526 m_perfMonMS = Environment.TickCount;
2538 2527
2539 List<ScenePresence> avatars = m_scene.GetScenePresences(); 2528 ScenePresence[] avatars = m_scene.GetScenePresences();
2540 foreach (ScenePresence avatar in avatars) 2529
2530 for (int i = 0; i < avatars.Length; i++)
2541 { 2531 {
2532 ScenePresence avatar = avatars[i];
2533
2542 // only send if this is the root (children are only "listening posts" in a foreign region) 2534 // only send if this is the root (children are only "listening posts" in a foreign region)
2543 if (!IsChildAgent) 2535 if (!IsChildAgent)
2544 { 2536 {
@@ -2556,7 +2548,7 @@ namespace OpenSim.Region.Framework.Scenes
2556 } 2548 }
2557 } 2549 }
2558 2550
2559 m_scene.StatsReporter.AddAgentUpdates(avatars.Count); 2551 m_scene.StatsReporter.AddAgentUpdates(avatars.Length);
2560 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); 2552 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
2561 2553
2562 //SendAnimPack(); 2554 //SendAnimPack();
@@ -2588,14 +2580,11 @@ namespace OpenSim.Region.Framework.Scenes
2588 // the inventory arrives 2580 // the inventory arrives
2589 // m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); 2581 // m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance);
2590 2582
2591 // Note: because Quaternion is a struct, it can't be null
2592 Quaternion rot = m_bodyRot;
2593
2594 Vector3 pos = m_pos; 2583 Vector3 pos = m_pos;
2595 pos.Z -= m_appearance.HipOffset; 2584 pos.Z -= m_appearance.HipOffset;
2596 2585
2597 m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId, 2586 m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId,
2598 m_pos, m_appearance.Texture.GetBytes(), m_parentID, rot)); 2587 pos, m_appearance.Texture.GetBytes(), m_parentID, m_bodyRot));
2599 2588
2600 if (!m_isChildAgent) 2589 if (!m_isChildAgent)
2601 { 2590 {
@@ -2679,7 +2668,7 @@ namespace OpenSim.Region.Framework.Scenes
2679 { 2668 {
2680 if (m_scene.AssetService.Get(face.TextureID.ToString()) == null) 2669 if (m_scene.AssetService.Get(face.TextureID.ToString()) == null)
2681 { 2670 {
2682 m_log.Warn("[APPEARANCE]: Missing baked texture " + face.TextureID + " (" + (AppearanceManager.TextureIndex)j + ") for avatar " + this.Name); 2671 m_log.Warn("[APPEARANCE]: Missing baked texture " + face.TextureID + " (" + j + ") for avatar " + this.Name);
2683 this.ControllingClient.SendRebakeAvatarTextures(face.TextureID); 2672 this.ControllingClient.SendRebakeAvatarTextures(face.TextureID);
2684 } 2673 }
2685 } 2674 }
@@ -2700,9 +2689,11 @@ namespace OpenSim.Region.Framework.Scenes
2700 m_startAnimationSet = true; 2689 m_startAnimationSet = true;
2701 } 2690 }
2702 2691
2703 Quaternion rot = m_bodyRot; 2692 Vector3 pos = m_pos;
2693 pos.Z -= m_appearance.HipOffset;
2694
2704 m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId, 2695 m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId,
2705 m_pos, m_appearance.Texture.GetBytes(), m_parentID, rot)); 2696 pos, m_appearance.Texture.GetBytes(), m_parentID, m_bodyRot));
2706 2697
2707 } 2698 }
2708 2699
@@ -3300,7 +3291,6 @@ namespace OpenSim.Region.Framework.Scenes
3300 /// </summary> 3291 /// </summary>
3301 public override void UpdateMovement() 3292 public override void UpdateMovement()
3302 { 3293 {
3303 m_newForce = false;
3304 lock (m_forcesList) 3294 lock (m_forcesList)
3305 { 3295 {
3306 if (m_forcesList.Count > 0) 3296 if (m_forcesList.Count > 0)
@@ -3322,7 +3312,6 @@ namespace OpenSim.Region.Framework.Scenes
3322 // Ignoring this causes no movement to be sent to the physics engine... 3312 // Ignoring this causes no movement to be sent to the physics engine...
3323 // which when the scene is moving at 1 frame every 10 seconds, it doesn't really matter! 3313 // which when the scene is moving at 1 frame every 10 seconds, it doesn't really matter!
3324 } 3314 }
3325 m_newForce = true;
3326 3315
3327 m_forcesList.Clear(); 3316 m_forcesList.Clear();
3328 } 3317 }
@@ -3356,20 +3345,18 @@ namespace OpenSim.Region.Framework.Scenes
3356 3345
3357 PhysicsScene scene = m_scene.PhysicsScene; 3346 PhysicsScene scene = m_scene.PhysicsScene;
3358 3347
3359 PhysicsVector pVec = 3348 Vector3 pVec = AbsolutePosition;
3360 new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y,
3361 AbsolutePosition.Z);
3362 3349
3363 // Old bug where the height was in centimeters instead of meters 3350 // Old bug where the height was in centimeters instead of meters
3364 if (m_avHeight == 127.0f) 3351 if (m_avHeight == 127.0f)
3365 { 3352 {
3366 m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new PhysicsVector(0, 0, 1.56f), 3353 m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new Vector3(0f, 0f, 1.56f),
3367 isFlying); 3354 isFlying);
3368 } 3355 }
3369 else 3356 else
3370 { 3357 {
3371 m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, 3358 m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec,
3372 new PhysicsVector(0, 0, m_avHeight), isFlying); 3359 new Vector3(0f, 0f, m_avHeight), isFlying);
3373 } 3360 }
3374 scene.AddPhysicsActorTaint(m_physicsActor); 3361 scene.AddPhysicsActorTaint(m_physicsActor);
3375 //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; 3362 //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
@@ -3380,7 +3367,7 @@ namespace OpenSim.Region.Framework.Scenes
3380 3367
3381 } 3368 }
3382 3369
3383 private void OutOfBoundsCall(PhysicsVector pos) 3370 private void OutOfBoundsCall(Vector3 pos)
3384 { 3371 {
3385 //bool flying = m_physicsActor.Flying; 3372 //bool flying = m_physicsActor.Flying;
3386 //RemoveFromPhysicalScene(); 3373 //RemoveFromPhysicalScene();
@@ -3603,7 +3590,7 @@ namespace OpenSim.Region.Framework.Scenes
3603 */ 3590 */
3604 } 3591 }
3605 3592
3606 internal void PushForce(PhysicsVector impulse) 3593 internal void PushForce(Vector3 impulse)
3607 { 3594 {
3608 if (PhysicsActor != null) 3595 if (PhysicsActor != null)
3609 { 3596 {
@@ -3866,6 +3853,8 @@ namespace OpenSim.Region.Framework.Scenes
3866 return GetPriorityByDistance(client); 3853 return GetPriorityByDistance(client);
3867 case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance: 3854 case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance:
3868 return GetPriorityByDistance(client); 3855 return GetPriorityByDistance(client);
3856 case Scenes.Scene.UpdatePrioritizationSchemes.FrontBack:
3857 return GetPriorityByFrontBack(client);
3869 default: 3858 default:
3870 throw new InvalidOperationException("UpdatePrioritizationScheme not defined."); 3859 throw new InvalidOperationException("UpdatePrioritizationScheme not defined.");
3871 } 3860 }
@@ -3887,11 +3876,34 @@ namespace OpenSim.Region.Framework.Scenes
3887 return double.NaN; 3876 return double.NaN;
3888 } 3877 }
3889 3878
3879 private double GetPriorityByFrontBack(IClientAPI client)
3880 {
3881 ScenePresence presence = Scene.GetScenePresence(client.AgentId);
3882 if (presence != null)
3883 {
3884 return GetPriorityByFrontBack(presence.CameraPosition, presence.CameraAtAxis);
3885 }
3886 return double.NaN;
3887 }
3888
3890 private double GetPriorityByDistance(Vector3 position) 3889 private double GetPriorityByDistance(Vector3 position)
3891 { 3890 {
3892 return Vector3.Distance(AbsolutePosition, position); 3891 return Vector3.Distance(AbsolutePosition, position);
3893 } 3892 }
3894 3893
3894 private double GetPriorityByFrontBack(Vector3 camPosition, Vector3 camAtAxis)
3895 {
3896 // Distance
3897 double priority = Vector3.Distance(camPosition, AbsolutePosition);
3898
3899 // Plane equation
3900 float d = -Vector3.Dot(camPosition, camAtAxis);
3901 float p = Vector3.Dot(camAtAxis, AbsolutePosition) + d;
3902 if (p < 0.0f) priority *= 2.0f;
3903
3904 return priority;
3905 }
3906
3895 private double GetSOGUpdatePriority(SceneObjectGroup sog) 3907 private double GetSOGUpdatePriority(SceneObjectGroup sog)
3896 { 3908 {
3897 switch (Scene.UpdatePrioritizationScheme) 3909 switch (Scene.UpdatePrioritizationScheme)
@@ -3902,6 +3914,8 @@ namespace OpenSim.Region.Framework.Scenes
3902 return sog.GetPriorityByDistance((IsChildAgent) ? AbsolutePosition : CameraPosition); 3914 return sog.GetPriorityByDistance((IsChildAgent) ? AbsolutePosition : CameraPosition);
3903 case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance: 3915 case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance:
3904 return sog.GetPriorityBySimpleAngularDistance((IsChildAgent) ? AbsolutePosition : CameraPosition); 3916 return sog.GetPriorityBySimpleAngularDistance((IsChildAgent) ? AbsolutePosition : CameraPosition);
3917 case Scenes.Scene.UpdatePrioritizationSchemes.FrontBack:
3918 return sog.GetPriorityByFrontBack(CameraPosition, CameraAtAxis);
3905 default: 3919 default:
3906 throw new InvalidOperationException("UpdatePrioritizationScheme not defined"); 3920 throw new InvalidOperationException("UpdatePrioritizationScheme not defined");
3907 } 3921 }
@@ -3928,6 +3942,8 @@ namespace OpenSim.Region.Framework.Scenes
3928 case Scene.UpdatePrioritizationSchemes.Distance: 3942 case Scene.UpdatePrioritizationSchemes.Distance:
3929 case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance: 3943 case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance:
3930 return GetPriorityByDistance((IsChildAgent) ? AbsolutePosition : CameraPosition); 3944 return GetPriorityByDistance((IsChildAgent) ? AbsolutePosition : CameraPosition);
3945 case Scenes.Scene.UpdatePrioritizationSchemes.FrontBack:
3946 return GetPriorityByFrontBack(CameraPosition, CameraAtAxis);
3931 default: 3947 default:
3932 throw new InvalidOperationException("UpdatePrioritizationScheme not defined"); 3948 throw new InvalidOperationException("UpdatePrioritizationScheme not defined");
3933 } 3949 }