aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
diff options
context:
space:
mode:
authorMelanie2010-05-21 21:16:04 +0100
committerMelanie2010-05-21 21:16:04 +0100
commit297bcb5c3d462128c5c81f35aa7a574e567583d5 (patch)
treebe7744848c474a8241f1d1c0e1f0114cfb824e16 /OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
parentMerge branch 'master' into careminster-presence-refactor (diff)
parentMerge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff)
downloadopensim-SC-297bcb5c3d462128c5c81f35aa7a574e567583d5.zip
opensim-SC-297bcb5c3d462128c5c81f35aa7a574e567583d5.tar.gz
opensim-SC-297bcb5c3d462128c5c81f35aa7a574e567583d5.tar.bz2
opensim-SC-297bcb5c3d462128c5c81f35aa7a574e567583d5.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs103
1 files changed, 2 insertions, 101 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index a4b8944..cee2be3 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -3841,107 +3841,6 @@ namespace OpenSim.Region.Framework.Scenes
3841 3841
3842 SetFromItemID(uuid); 3842 SetFromItemID(uuid);
3843 } 3843 }
3844 #endregion
3845
3846 public double GetUpdatePriority(IClientAPI client)
3847 {
3848 switch (Scene.UpdatePrioritizationScheme)
3849 {
3850 case Scene.UpdatePrioritizationSchemes.Time:
3851 return GetPriorityByTime();
3852 case Scene.UpdatePrioritizationSchemes.Distance:
3853 return GetPriorityByDistance(client);
3854 case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance:
3855 return GetPriorityBySimpleAngularDistance(client);
3856 case Scenes.Scene.UpdatePrioritizationSchemes.FrontBack:
3857 return GetPriorityByFrontBack(client);
3858 default:
3859 throw new InvalidOperationException("UpdatePrioritizationScheme not defined");
3860 }
3861 }
3862
3863 private double GetPriorityByTime()
3864 {
3865 return DateTime.Now.ToOADate();
3866 }
3867
3868 private double GetPriorityByDistance(IClientAPI client)
3869 {
3870 ScenePresence presence = Scene.GetScenePresence(client.AgentId);
3871 if (presence != null)
3872 {
3873 return GetPriorityByDistance((presence.IsChildAgent) ?
3874 presence.AbsolutePosition : presence.CameraPosition);
3875 }
3876 return double.NaN;
3877 }
3878
3879 private double GetPriorityBySimpleAngularDistance(IClientAPI client)
3880 {
3881 ScenePresence presence = Scene.GetScenePresence(client.AgentId);
3882 if (presence != null)
3883 {
3884 return GetPriorityBySimpleAngularDistance((presence.IsChildAgent) ?
3885 presence.AbsolutePosition : presence.CameraPosition);
3886 }
3887 return double.NaN;
3888 }
3889
3890 private double GetPriorityByFrontBack(IClientAPI client)
3891 {
3892 ScenePresence presence = Scene.GetScenePresence(client.AgentId);
3893 if (presence != null)
3894 {
3895 return GetPriorityByFrontBack(presence.CameraPosition, presence.CameraAtAxis);
3896 }
3897 return double.NaN;
3898 }
3899
3900 public double GetPriorityByDistance(Vector3 position)
3901 {
3902 return Vector3.Distance(AbsolutePosition, position);
3903 }
3904
3905 public double GetPriorityBySimpleAngularDistance(Vector3 position)
3906 {
3907 double distance = Vector3.Distance(position, AbsolutePosition);
3908 if (distance >= double.Epsilon)
3909 {
3910 float height;
3911 Vector3 box = GetAxisAlignedBoundingBox(out height);
3912
3913 double angle = box.X / distance;
3914 double max = angle;
3915
3916 angle = box.Y / distance;
3917 if (max < angle)
3918 max = angle;
3919
3920 angle = box.Z / distance;
3921 if (max < angle)
3922 max = angle;
3923
3924 return -max;
3925 }
3926 else
3927 return double.MinValue;
3928 }
3929
3930 public double GetPriorityByFrontBack(Vector3 camPosition, Vector3 camAtAxis)
3931 {
3932 // Distance
3933 double priority = Vector3.Distance(camPosition, AbsolutePosition);
3934
3935 // Scale
3936 //priority -= GroupScale().Length();
3937
3938 // Plane equation
3939 float d = -Vector3.Dot(camPosition, camAtAxis);
3940 float p = Vector3.Dot(camAtAxis, AbsolutePosition) + d;
3941 if (p < 0.0f) priority *= 2.0f;
3942
3943 return priority;
3944 }
3945 3844
3946 public void ResetOwnerChangeFlag() 3845 public void ResetOwnerChangeFlag()
3947 { 3846 {
@@ -3950,5 +3849,7 @@ namespace OpenSim.Region.Framework.Scenes
3950 part.ResetOwnerChangeFlag(); 3849 part.ResetOwnerChangeFlag();
3951 }); 3850 });
3952 } 3851 }
3852
3853 #endregion
3953 } 3854 }
3954} 3855}