diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 119 |
1 files changed, 63 insertions, 56 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 4c3bc67..4c62127 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -150,8 +150,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
150 | /// Movement updates for agents in neighboring regions are sent directly to clients. | 150 | /// Movement updates for agents in neighboring regions are sent directly to clients. |
151 | /// This value only affects how often agent positions are sent to neighbor regions | 151 | /// This value only affects how often agent positions are sent to neighbor regions |
152 | /// for things such as distance-based update prioritization | 152 | /// for things such as distance-based update prioritization |
153 | /// this are the square of real distances | ||
153 | /// </summary> | 154 | /// </summary> |
154 | public static readonly float SIGNIFICANT_MOVEMENT = 2.0f; | 155 | public static readonly float MOVEMENT = .25f; |
156 | public static readonly float SIGNIFICANT_MOVEMENT = 16.0f; | ||
157 | public static readonly float CHILDUPDATES_MOVEMENT = 100.0f; | ||
158 | public static readonly float CHILDUPDATES_TIME = 10000f; // min time between child updates (ms) | ||
155 | 159 | ||
156 | private UUID m_previusParcelUUID = UUID.Zero; | 160 | private UUID m_previusParcelUUID = UUID.Zero; |
157 | private UUID m_currentParcelUUID = UUID.Zero; | 161 | private UUID m_currentParcelUUID = UUID.Zero; |
@@ -189,6 +193,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
189 | 193 | ||
190 | public void sitSOGmoved() | 194 | public void sitSOGmoved() |
191 | { | 195 | { |
196 | /* | ||
192 | if (IsDeleted || !IsSatOnObject) | 197 | if (IsDeleted || !IsSatOnObject) |
193 | //what me? nahh | 198 | //what me? nahh |
194 | return; | 199 | return; |
@@ -201,6 +206,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
201 | UUID parcelID = land.LandData.GlobalID; | 206 | UUID parcelID = land.LandData.GlobalID; |
202 | if (m_currentParcelUUID != parcelID) | 207 | if (m_currentParcelUUID != parcelID) |
203 | currentParcelUUID = parcelID; | 208 | currentParcelUUID = parcelID; |
209 | */ | ||
204 | } | 210 | } |
205 | 211 | ||
206 | 212 | ||
@@ -325,6 +331,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
325 | 331 | ||
326 | private float m_sitAvatarHeight = 2.0f; | 332 | private float m_sitAvatarHeight = 2.0f; |
327 | 333 | ||
334 | private bool childUpdatesActive = false; | ||
335 | private int lastChildUpdatesTime; | ||
328 | private Vector3 m_lastChildAgentUpdatePosition; | 336 | private Vector3 m_lastChildAgentUpdatePosition; |
329 | // private Vector3 m_lastChildAgentUpdateCamPosition; | 337 | // private Vector3 m_lastChildAgentUpdateCamPosition; |
330 | 338 | ||
@@ -417,6 +425,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
417 | /// Position at which a significant movement was made | 425 | /// Position at which a significant movement was made |
418 | /// </summary> | 426 | /// </summary> |
419 | private Vector3 posLastSignificantMove; | 427 | private Vector3 posLastSignificantMove; |
428 | private Vector3 posLastMove; | ||
420 | 429 | ||
421 | #region For teleports and crossings callbacks | 430 | #region For teleports and crossings callbacks |
422 | 431 | ||
@@ -1021,9 +1030,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1021 | 1030 | ||
1022 | m_scriptEngines = m_scene.RequestModuleInterfaces<IScriptModule>(); | 1031 | m_scriptEngines = m_scene.RequestModuleInterfaces<IScriptModule>(); |
1023 | 1032 | ||
1024 | AbsolutePosition = posLastSignificantMove = CameraPosition = | 1033 | AbsolutePosition = posLastMove = posLastSignificantMove = CameraPosition = |
1025 | m_lastCameraPosition = ControllingClient.StartPos; | 1034 | m_lastCameraPosition = ControllingClient.StartPos; |
1026 | 1035 | ||
1036 | childUpdatesActive = true; // disable it for now | ||
1037 | |||
1027 | m_reprioritization_timer = new Timer(world.ReprioritizationInterval); | 1038 | m_reprioritization_timer = new Timer(world.ReprioritizationInterval); |
1028 | m_reprioritization_timer.Elapsed += new ElapsedEventHandler(Reprioritize); | 1039 | m_reprioritization_timer.Elapsed += new ElapsedEventHandler(Reprioritize); |
1029 | m_reprioritization_timer.AutoReset = false; | 1040 | m_reprioritization_timer.AutoReset = false; |
@@ -2024,6 +2035,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2024 | { | 2035 | { |
2025 | m_agentTransfer.EnableChildAgents(this); | 2036 | m_agentTransfer.EnableChildAgents(this); |
2026 | } | 2037 | } |
2038 | // let updates be sent, with some delay | ||
2039 | lastChildUpdatesTime = Util.EnvironmentTickCount() + 10000; | ||
2040 | childUpdatesActive = false; // allow them | ||
2027 | } | 2041 | } |
2028 | } | 2042 | } |
2029 | 2043 | ||
@@ -2502,7 +2516,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2502 | if ((State & (uint)AgentState.Editing) != 0) | 2516 | if ((State & (uint)AgentState.Editing) != 0) |
2503 | SendAgentTerseUpdate(this); | 2517 | SendAgentTerseUpdate(this); |
2504 | 2518 | ||
2505 | m_scene.EventManager.TriggerOnClientMovement(this); | 2519 | // m_scene.EventManager.TriggerOnClientMovement(this); |
2506 | } | 2520 | } |
2507 | 2521 | ||
2508 | 2522 | ||
@@ -3464,7 +3478,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3464 | if (Appearance.AvatarSize != m_lastSize && !IsLoggingIn) | 3478 | if (Appearance.AvatarSize != m_lastSize && !IsLoggingIn) |
3465 | SendAvatarDataToAllAgents(); | 3479 | SendAvatarDataToAllAgents(); |
3466 | 3480 | ||
3467 | if (!Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) || | 3481 | if (!IsSatOnObject || |
3482 | !Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) || | ||
3468 | !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || | 3483 | !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || |
3469 | !m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE)) | 3484 | !m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE)) |
3470 | { | 3485 | { |
@@ -3865,63 +3880,55 @@ namespace OpenSim.Region.Framework.Scenes | |||
3865 | /// </summary> | 3880 | /// </summary> |
3866 | protected void CheckForSignificantMovement() | 3881 | protected void CheckForSignificantMovement() |
3867 | { | 3882 | { |
3868 | if (Util.GetDistanceTo(AbsolutePosition, posLastSignificantMove) > SIGNIFICANT_MOVEMENT) | 3883 | Vector3 pos = AbsolutePosition; |
3884 | |||
3885 | Vector3 diff = pos - posLastMove; | ||
3886 | if (diff.LengthSquared() > MOVEMENT) | ||
3869 | { | 3887 | { |
3870 | posLastSignificantMove = AbsolutePosition; | 3888 | posLastMove = pos; |
3889 | m_scene.EventManager.TriggerOnClientMovement(this); | ||
3890 | } | ||
3891 | |||
3892 | diff = pos - posLastSignificantMove; | ||
3893 | if (diff.LengthSquared() > SIGNIFICANT_MOVEMENT) | ||
3894 | { | ||
3895 | posLastSignificantMove = pos; | ||
3871 | m_scene.EventManager.TriggerSignificantClientMovement(this); | 3896 | m_scene.EventManager.TriggerSignificantClientMovement(this); |
3872 | } | 3897 | } |
3873 | 3898 | ||
3874 | // Minimum Draw distance is 64 meters, the Radius of the draw distance sphere is 32m | 3899 | if(!childUpdatesActive) |
3875 | if (Util.GetDistanceTo(AbsolutePosition, m_lastChildAgentUpdatePosition) >= Scene.ChildReprioritizationDistance) | ||
3876 | { | 3900 | { |
3877 | m_lastChildAgentUpdatePosition = AbsolutePosition; | 3901 | int tdiff = Util.EnvironmentTickCountSubtract(lastChildUpdatesTime); |
3878 | // m_lastChildAgentUpdateCamPosition = CameraPosition; | 3902 | if(tdiff > CHILDUPDATES_TIME) |
3879 | 3903 | { | |
3880 | /* cadu is not used | 3904 | diff = pos - m_lastChildAgentUpdatePosition; |
3881 | ChildAgentDataUpdate cadu = new ChildAgentDataUpdate(); | 3905 | if (diff.LengthSquared() > CHILDUPDATES_MOVEMENT) |
3882 | cadu.ActiveGroupID = UUID.Zero.Guid; | 3906 | { |
3883 | cadu.AgentID = UUID.Guid; | 3907 | childUpdatesActive = true; |
3884 | cadu.alwaysrun = SetAlwaysRun; | 3908 | m_lastChildAgentUpdatePosition = pos; |
3885 | cadu.AVHeight = Appearance.AvatarHeight; | 3909 | // m_lastChildAgentUpdateCamPosition = CameraPosition; |
3886 | cadu.cameraPosition = CameraPosition; | 3910 | |
3887 | cadu.drawdistance = DrawDistance; | 3911 | AgentPosition agentpos = new AgentPosition(); |
3888 | cadu.GroupAccess = 0; | 3912 | agentpos.AgentID = new UUID(UUID.Guid); |
3889 | cadu.Position = AbsolutePosition; | 3913 | agentpos.SessionID = ControllingClient.SessionId; |
3890 | cadu.regionHandle = RegionHandle; | 3914 | agentpos.Size = Appearance.AvatarSize; |
3891 | 3915 | agentpos.Center = CameraPosition; | |
3892 | // Throttles | 3916 | agentpos.Far = DrawDistance; |
3893 | float multiplier = 1; | 3917 | agentpos.Position = AbsolutePosition; |
3894 | 3918 | agentpos.Velocity = Velocity; | |
3895 | int childRegions = KnownRegionCount; | 3919 | agentpos.RegionHandle = RegionHandle; |
3896 | if (childRegions != 0) | 3920 | agentpos.Throttles = ControllingClient.GetThrottlesPacked(1); |
3897 | multiplier = 1f / childRegions; | 3921 | |
3898 | 3922 | // Let's get this out of the update loop | |
3899 | // Minimum throttle for a child region is 1/4 of the root region throttle | 3923 | Util.FireAndForget( |
3900 | if (multiplier <= 0.25f) | 3924 | o => |
3901 | multiplier = 0.25f; | 3925 | { |
3902 | 3926 | m_scene.SendOutChildAgentUpdates(agentpos, this); | |
3903 | cadu.throttles = ControllingClient.GetThrottlesPacked(multiplier); | 3927 | lastChildUpdatesTime = Util.EnvironmentTickCount(); |
3904 | cadu.Velocity = Velocity; | 3928 | childUpdatesActive= false; |
3905 | */ | 3929 | }, null, "ScenePresence.SendOutChildAgentUpdates"); |
3906 | AgentPosition agentpos = new AgentPosition(); | 3930 | } |
3907 | // agentpos.CopyFrom(cadu, ControllingClient.SessionId); | 3931 | } |
3908 | |||
3909 | agentpos.AgentID = new UUID(UUID.Guid); | ||
3910 | agentpos.SessionID = ControllingClient.SessionId; | ||
3911 | |||
3912 | agentpos.Size = Appearance.AvatarSize; | ||
3913 | |||
3914 | agentpos.Center = CameraPosition; | ||
3915 | agentpos.Far = DrawDistance; | ||
3916 | agentpos.Position = AbsolutePosition; | ||
3917 | agentpos.Velocity = Velocity; | ||
3918 | agentpos.RegionHandle = RegionHandle; | ||
3919 | agentpos.Throttles = ControllingClient.GetThrottlesPacked(1); | ||
3920 | |||
3921 | |||
3922 | // Let's get this out of the update loop | ||
3923 | Util.FireAndForget( | ||
3924 | o => m_scene.SendOutChildAgentUpdates(agentpos, this), null, "ScenePresence.SendOutChildAgentUpdates"); | ||
3925 | } | 3932 | } |
3926 | } | 3933 | } |
3927 | 3934 | ||