aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs33
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs44
3 files changed, 78 insertions, 3 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index d5e3445..ee848bb 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -61,6 +61,7 @@ namespace OpenSim.Region.Framework.Scenes
61 Time = 0, 61 Time = 0,
62 Distance = 1, 62 Distance = 1,
63 SimpleAngularDistance = 2, 63 SimpleAngularDistance = 2,
64 FrontBack = 3,
64 } 65 }
65 66
66 public delegate void SynchronizeSceneHandler(Scene scene); 67 public delegate void SynchronizeSceneHandler(Scene scene);
@@ -540,6 +541,9 @@ namespace OpenSim.Region.Framework.Scenes
540 case "simpleangulardistance": 541 case "simpleangulardistance":
541 m_update_prioritization_scheme = UpdatePrioritizationSchemes.SimpleAngularDistance; 542 m_update_prioritization_scheme = UpdatePrioritizationSchemes.SimpleAngularDistance;
542 break; 543 break;
544 case "frontback":
545 m_update_prioritization_scheme = UpdatePrioritizationSchemes.FrontBack;
546 break;
543 default: 547 default:
544 m_log.Warn("[SCENE]: UpdatePrioritizationScheme was not recognized, setting to default settomg of Time"); 548 m_log.Warn("[SCENE]: UpdatePrioritizationScheme was not recognized, setting to default settomg of Time");
545 m_update_prioritization_scheme = UpdatePrioritizationSchemes.Time; 549 m_update_prioritization_scheme = UpdatePrioritizationSchemes.Time;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 4f19761..dd8da20 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -493,8 +493,8 @@ namespace OpenSim.Region.Framework.Scenes
493 493
494 public Vector3 GroupScale() 494 public Vector3 GroupScale()
495 { 495 {
496 Vector3 minScale = new Vector3(Constants.RegionSize,Constants.RegionSize,Constants.RegionSize); 496 Vector3 minScale = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionSize);
497 Vector3 maxScale = new Vector3(0f,0f,0f); 497 Vector3 maxScale = Vector3.Zero;
498 Vector3 finalScale = new Vector3(0.5f, 0.5f, 0.5f); 498 Vector3 finalScale = new Vector3(0.5f, 0.5f, 0.5f);
499 499
500 lock (m_parts) 500 lock (m_parts)
@@ -577,7 +577,6 @@ namespace OpenSim.Region.Framework.Scenes
577 { 577 {
578 foreach (SceneObjectPart part in m_parts.Values) 578 foreach (SceneObjectPart part in m_parts.Values)
579 { 579 {
580
581 Vector3 worldPos = part.GetWorldPosition(); 580 Vector3 worldPos = part.GetWorldPosition();
582 Vector3 offset = worldPos - AbsolutePosition; 581 Vector3 offset = worldPos - AbsolutePosition;
583 Quaternion worldRot; 582 Quaternion worldRot;
@@ -3366,6 +3365,8 @@ namespace OpenSim.Region.Framework.Scenes
3366 return GetPriorityByDistance(client); 3365 return GetPriorityByDistance(client);
3367 case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance: 3366 case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance:
3368 return GetPriorityBySimpleAngularDistance(client); 3367 return GetPriorityBySimpleAngularDistance(client);
3368 case Scenes.Scene.UpdatePrioritizationSchemes.FrontBack:
3369 return GetPriorityByFrontBack(client);
3369 default: 3370 default:
3370 throw new InvalidOperationException("UpdatePrioritizationScheme not defined"); 3371 throw new InvalidOperationException("UpdatePrioritizationScheme not defined");
3371 } 3372 }
@@ -3398,6 +3399,16 @@ namespace OpenSim.Region.Framework.Scenes
3398 return double.NaN; 3399 return double.NaN;
3399 } 3400 }
3400 3401
3402 private double GetPriorityByFrontBack(IClientAPI client)
3403 {
3404 ScenePresence presence = Scene.GetScenePresence(client.AgentId);
3405 if (presence != null)
3406 {
3407 return GetPriorityByFrontBack(presence.CameraPosition, presence.CameraAtAxis);
3408 }
3409 return double.NaN;
3410 }
3411
3401 public double GetPriorityByDistance(Vector3 position) 3412 public double GetPriorityByDistance(Vector3 position)
3402 { 3413 {
3403 return Vector3.Distance(AbsolutePosition, position); 3414 return Vector3.Distance(AbsolutePosition, position);
@@ -3427,5 +3438,21 @@ namespace OpenSim.Region.Framework.Scenes
3427 else 3438 else
3428 return double.MinValue; 3439 return double.MinValue;
3429 } 3440 }
3441
3442 public double GetPriorityByFrontBack(Vector3 camPosition, Vector3 camAtAxis)
3443 {
3444 // Distance
3445 double priority = Vector3.Distance(camPosition, AbsolutePosition);
3446
3447 // Scale
3448 //priority -= GroupScale().Length();
3449
3450 // Plane equation
3451 float d = -Vector3.Dot(camPosition, camAtAxis);
3452 float p = Vector3.Dot(camAtAxis, AbsolutePosition) + d;
3453 if (p < 0.0f) priority *= 2.0f;
3454
3455 return priority;
3456 }
3430 } 3457 }
3431} 3458}
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 77706ac..a610e42 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -297,6 +297,21 @@ namespace OpenSim.Region.Framework.Scenes
297 get { return Util.Axes2Rot(m_CameraAtAxis, m_CameraLeftAxis, m_CameraUpAxis); } 297 get { return Util.Axes2Rot(m_CameraAtAxis, m_CameraLeftAxis, m_CameraUpAxis); }
298 } 298 }
299 299
300 public Vector3 CameraAtAxis
301 {
302 get { return m_CameraAtAxis; }
303 }
304
305 public Vector3 CameraLeftAxis
306 {
307 get { return m_CameraLeftAxis; }
308 }
309
310 public Vector3 CameraUpAxis
311 {
312 get { return m_CameraUpAxis; }
313 }
314
300 public Vector3 Lookat 315 public Vector3 Lookat
301 { 316 {
302 get 317 get
@@ -3867,6 +3882,8 @@ namespace OpenSim.Region.Framework.Scenes
3867 return GetPriorityByDistance(client); 3882 return GetPriorityByDistance(client);
3868 case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance: 3883 case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance:
3869 return GetPriorityByDistance(client); 3884 return GetPriorityByDistance(client);
3885 case Scenes.Scene.UpdatePrioritizationSchemes.FrontBack:
3886 return GetPriorityByFrontBack(client);
3870 default: 3887 default:
3871 throw new InvalidOperationException("UpdatePrioritizationScheme not defined."); 3888 throw new InvalidOperationException("UpdatePrioritizationScheme not defined.");
3872 } 3889 }
@@ -3888,11 +3905,34 @@ namespace OpenSim.Region.Framework.Scenes
3888 return double.NaN; 3905 return double.NaN;
3889 } 3906 }
3890 3907
3908 private double GetPriorityByFrontBack(IClientAPI client)
3909 {
3910 ScenePresence presence = Scene.GetScenePresence(client.AgentId);
3911 if (presence != null)
3912 {
3913 return GetPriorityByFrontBack(presence.CameraPosition, presence.CameraAtAxis);
3914 }
3915 return double.NaN;
3916 }
3917
3891 private double GetPriorityByDistance(Vector3 position) 3918 private double GetPriorityByDistance(Vector3 position)
3892 { 3919 {
3893 return Vector3.Distance(AbsolutePosition, position); 3920 return Vector3.Distance(AbsolutePosition, position);
3894 } 3921 }
3895 3922
3923 private double GetPriorityByFrontBack(Vector3 camPosition, Vector3 camAtAxis)
3924 {
3925 // Distance
3926 double priority = Vector3.Distance(camPosition, AbsolutePosition);
3927
3928 // Plane equation
3929 float d = -Vector3.Dot(camPosition, camAtAxis);
3930 float p = Vector3.Dot(camAtAxis, AbsolutePosition) + d;
3931 if (p < 0.0f) priority *= 2.0f;
3932
3933 return priority;
3934 }
3935
3896 private double GetSOGUpdatePriority(SceneObjectGroup sog) 3936 private double GetSOGUpdatePriority(SceneObjectGroup sog)
3897 { 3937 {
3898 switch (Scene.UpdatePrioritizationScheme) 3938 switch (Scene.UpdatePrioritizationScheme)
@@ -3903,6 +3943,8 @@ namespace OpenSim.Region.Framework.Scenes
3903 return sog.GetPriorityByDistance((IsChildAgent) ? AbsolutePosition : CameraPosition); 3943 return sog.GetPriorityByDistance((IsChildAgent) ? AbsolutePosition : CameraPosition);
3904 case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance: 3944 case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance:
3905 return sog.GetPriorityBySimpleAngularDistance((IsChildAgent) ? AbsolutePosition : CameraPosition); 3945 return sog.GetPriorityBySimpleAngularDistance((IsChildAgent) ? AbsolutePosition : CameraPosition);
3946 case Scenes.Scene.UpdatePrioritizationSchemes.FrontBack:
3947 return sog.GetPriorityByFrontBack(CameraPosition, CameraAtAxis);
3906 default: 3948 default:
3907 throw new InvalidOperationException("UpdatePrioritizationScheme not defined"); 3949 throw new InvalidOperationException("UpdatePrioritizationScheme not defined");
3908 } 3950 }
@@ -3929,6 +3971,8 @@ namespace OpenSim.Region.Framework.Scenes
3929 case Scene.UpdatePrioritizationSchemes.Distance: 3971 case Scene.UpdatePrioritizationSchemes.Distance:
3930 case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance: 3972 case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance:
3931 return GetPriorityByDistance((IsChildAgent) ? AbsolutePosition : CameraPosition); 3973 return GetPriorityByDistance((IsChildAgent) ? AbsolutePosition : CameraPosition);
3974 case Scenes.Scene.UpdatePrioritizationSchemes.FrontBack:
3975 return GetPriorityByFrontBack(CameraPosition, CameraAtAxis);
3932 default: 3976 default:
3933 throw new InvalidOperationException("UpdatePrioritizationScheme not defined"); 3977 throw new InvalidOperationException("UpdatePrioritizationScheme not defined");
3934 } 3978 }