aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorUbitUmarov2016-10-05 13:17:23 +0100
committerUbitUmarov2016-10-05 13:17:23 +0100
commit8a3958ad048535ad4f8a752cbd71d9114e53a42b (patch)
tree111826405ab3795c1aece111bf4f2f08920fed68 /OpenSim/Region
parentminor cleanup (diff)
downloadopensim-SC-8a3958ad048535ad4f8a752cbd71d9114e53a42b.zip
opensim-SC-8a3958ad048535ad4f8a752cbd71d9114e53a42b.tar.gz
opensim-SC-8a3958ad048535ad4f8a752cbd71d9114e53a42b.tar.bz2
opensim-SC-8a3958ad048535ad4f8a752cbd71d9114e53a42b.tar.xz
dont let ignored AgentUpdates change their throttles. Apply respective movement to physics on the handling thread, not heartbeat, avoiding missing transitions that should get into physics. Make some usefull sp state flags visible everywhere
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs87
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs49
2 files changed, 76 insertions, 60 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 8194260..2650be4 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -909,7 +909,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
909 public void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look) 909 public void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look)
910 { 910 {
911 m_thisAgentUpdateArgs.CameraAtAxis.X = float.MinValue; 911 m_thisAgentUpdateArgs.CameraAtAxis.X = float.MinValue;
912 m_thisAgentUpdateArgs.ControlFlags = uint.MaxValue; 912// m_thisAgentUpdateArgs.ControlFlags = uint.MaxValue;
913 m_thisAgentUpdateArgs.ControlFlags = 0;
913 914
914 AgentMovementCompletePacket mov = (AgentMovementCompletePacket)PacketPool.Instance.GetPacket(PacketType.AgentMovementComplete); 915 AgentMovementCompletePacket mov = (AgentMovementCompletePacket)PacketPool.Instance.GetPacket(PacketType.AgentMovementComplete);
915 mov.SimData.ChannelVersion = m_channelVersion; 916 mov.SimData.ChannelVersion = m_channelVersion;
@@ -6196,27 +6197,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6196 /// <param name='x'></param> 6197 /// <param name='x'></param>
6197 private bool CheckAgentMovementUpdateSignificance(AgentUpdatePacket.AgentDataBlock x) 6198 private bool CheckAgentMovementUpdateSignificance(AgentUpdatePacket.AgentDataBlock x)
6198 { 6199 {
6199 float qdelta1 = Math.Abs(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation)); 6200 if(
6200 //qdelta2 = Math.Abs(Quaternion.Dot(x.HeadRotation, m_thisAgentUpdateArgs.HeadRotation));
6201
6202 bool movementSignificant =
6203 (x.ControlFlags != m_thisAgentUpdateArgs.ControlFlags) // significant if control flags changed 6201 (x.ControlFlags != m_thisAgentUpdateArgs.ControlFlags) // significant if control flags changed
6204 || (x.ControlFlags != (byte)AgentManager.ControlFlags.NONE) // significant if user supplying any movement update commands 6202 || ((x.ControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0 &&
6203 (x.ControlFlags & 0x3f8dfff) != 0) // we need to rotate the av on fly
6205 || (x.Flags != m_thisAgentUpdateArgs.Flags) // significant if Flags changed 6204 || (x.Flags != m_thisAgentUpdateArgs.Flags) // significant if Flags changed
6206 || (x.State != m_thisAgentUpdateArgs.State) // significant if Stats changed 6205 || (x.State != m_thisAgentUpdateArgs.State) // significant if Stats changed
6207 || (qdelta1 < QDELTABody) // significant if body rotation above(below cos) threshold
6208 // Ignoring head rotation altogether, because it's not being used for anything interesting up the stack
6209 // || (qdelta2 < QDELTAHead) // significant if head rotation above(below cos) threshold
6210 || (Math.Abs(x.Far - m_thisAgentUpdateArgs.Far) >= 32) // significant if far distance changed 6206 || (Math.Abs(x.Far - m_thisAgentUpdateArgs.Far) >= 32) // significant if far distance changed
6211 ; 6207 )
6212 //if (movementSignificant) 6208 return true;
6213 //{ 6209
6214 //m_log.DebugFormat("[LLCLIENTVIEW]: Bod {0} {1}", 6210 float qdelta1 = Math.Abs(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation));
6215 // qdelta1, qdelta2); 6211 //qdelta2 = Math.Abs(Quaternion.Dot(x.HeadRotation, m_thisAgentUpdateArgs.HeadRotation));
6216 //m_log.DebugFormat("[LLCLIENTVIEW]: St {0} {1} {2} {3}", 6212
6217 // x.ControlFlags, x.Flags, x.Far, x.State); 6213 if(
6218 //} 6214 qdelta1 < QDELTABody // significant if body rotation above(below cos) threshold
6219 return movementSignificant; 6215 // Ignoring head rotation altogether, because it's not being used for anything interesting up the stack
6216 // || qdelta2 < QDELTAHead // significant if head rotation above(below cos) threshold
6217 )
6218 return true;
6219
6220 return false;
6220 } 6221 }
6221 6222
6222 /// <summary> 6223 /// <summary>
@@ -6227,33 +6228,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6227 /// <param name='x'></param> 6228 /// <param name='x'></param>
6228 private bool CheckAgentCameraUpdateSignificance(AgentUpdatePacket.AgentDataBlock x) 6229 private bool CheckAgentCameraUpdateSignificance(AgentUpdatePacket.AgentDataBlock x)
6229 { 6230 {
6230 float vdelta1 = Vector3.Distance(x.CameraAtAxis, m_thisAgentUpdateArgs.CameraAtAxis); 6231 float vdelta = Vector3.Distance(x.CameraAtAxis, m_thisAgentUpdateArgs.CameraAtAxis);
6231 float vdelta2 = Vector3.Distance(x.CameraCenter, m_thisAgentUpdateArgs.CameraCenter); 6232 if((vdelta > VDELTA))
6232 float vdelta3 = Vector3.Distance(x.CameraLeftAxis, m_thisAgentUpdateArgs.CameraLeftAxis); 6233 return true;
6233 float vdelta4 = Vector3.Distance(x.CameraUpAxis, m_thisAgentUpdateArgs.CameraUpAxis); 6234
6235 vdelta = Vector3.Distance(x.CameraCenter, m_thisAgentUpdateArgs.CameraCenter);
6236 if((vdelta > VDELTA))
6237 return true;
6234 6238
6235 bool cameraSignificant = 6239 vdelta = Vector3.Distance(x.CameraLeftAxis, m_thisAgentUpdateArgs.CameraLeftAxis);
6236 (vdelta1 > VDELTA) || 6240 if((vdelta > VDELTA))
6237 (vdelta2 > VDELTA) || 6241 return true;
6238 (vdelta3 > VDELTA) ||
6239 (vdelta4 > VDELTA)
6240 ;
6241 6242
6242 //if (cameraSignificant) 6243 vdelta = Vector3.Distance(x.CameraUpAxis, m_thisAgentUpdateArgs.CameraUpAxis);
6243 //{ 6244 if((vdelta > VDELTA))
6244 //m_log.DebugFormat("[LLCLIENTVIEW]: Cam1 {0} {1}", 6245 return true;
6245 // x.CameraAtAxis, x.CameraCenter);
6246 //m_log.DebugFormat("[LLCLIENTVIEW]: Cam2 {0} {1}",
6247 // x.CameraLeftAxis, x.CameraUpAxis);
6248 //}
6249 6246
6250 return cameraSignificant; 6247 return false;
6251 } 6248 }
6252 6249
6253 private bool HandleAgentUpdate(IClientAPI sender, Packet packet) 6250 private bool HandleAgentUpdate(IClientAPI sender, Packet packet)
6254 { 6251 {
6255 // We got here, which means that something in agent update was significant
6256
6257 AgentUpdatePacket agentUpdate = (AgentUpdatePacket)packet; 6252 AgentUpdatePacket agentUpdate = (AgentUpdatePacket)packet;
6258 AgentUpdatePacket.AgentDataBlock x = agentUpdate.AgentData; 6253 AgentUpdatePacket.AgentDataBlock x = agentUpdate.AgentData;
6259 6254
@@ -6264,10 +6259,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6264 } 6259 }
6265 6260
6266 TotalAgentUpdates++; 6261 TotalAgentUpdates++;
6262 // dont let ignored updates pollute this throttles
6263 if(SceneAgent == null || SceneAgent.IsChildAgent || SceneAgent.IsInTransit)
6264 {
6265 // throttle reset is done at MoveAgentIntoRegion()
6266 // called by scenepresence on completemovement
6267 PacketPool.Instance.ReturnPacket(packet);
6268 return true;
6269 }
6267 6270
6268 bool movement = CheckAgentMovementUpdateSignificance(x); 6271 bool movement = CheckAgentMovementUpdateSignificance(x);
6269 bool camera = CheckAgentCameraUpdateSignificance(x); 6272 bool camera = CheckAgentCameraUpdateSignificance(x);
6270 6273
6271 // Was there a significant movement/state change? 6274 // Was there a significant movement/state change?
6272 if (movement) 6275 if (movement)
6273 { 6276 {
@@ -6276,7 +6279,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6276 m_thisAgentUpdateArgs.Far = x.Far; 6279 m_thisAgentUpdateArgs.Far = x.Far;
6277 m_thisAgentUpdateArgs.Flags = x.Flags; 6280 m_thisAgentUpdateArgs.Flags = x.Flags;
6278 m_thisAgentUpdateArgs.HeadRotation = x.HeadRotation; 6281 m_thisAgentUpdateArgs.HeadRotation = x.HeadRotation;
6279// m_thisAgentUpdateArgs.SessionID = x.SessionID;
6280 m_thisAgentUpdateArgs.State = x.State; 6282 m_thisAgentUpdateArgs.State = x.State;
6281 6283
6282 UpdateAgent handlerAgentUpdate = OnAgentUpdate; 6284 UpdateAgent handlerAgentUpdate = OnAgentUpdate;
@@ -6287,9 +6289,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6287 6289
6288 if (handlerAgentUpdate != null) 6290 if (handlerAgentUpdate != null)
6289 OnAgentUpdate(this, m_thisAgentUpdateArgs); 6291 OnAgentUpdate(this, m_thisAgentUpdateArgs);
6290 6292
6291 handlerAgentUpdate = null;
6292 handlerPreAgentUpdate = null;
6293 } 6293 }
6294 6294
6295 // Was there a significant camera(s) change? 6295 // Was there a significant camera(s) change?
@@ -6305,7 +6305,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6305 if (handlerAgentCameraUpdate != null) 6305 if (handlerAgentCameraUpdate != null)
6306 handlerAgentCameraUpdate(this, m_thisAgentUpdateArgs); 6306 handlerAgentCameraUpdate(this, m_thisAgentUpdateArgs);
6307 6307
6308 handlerAgentCameraUpdate = null;
6309 } 6308 }
6310 6309
6311 PacketPool.Instance.ReturnPacket(packet); 6310 PacketPool.Instance.ReturnPacket(packet);
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index bb6e89b..6f4d6c3 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -281,7 +281,9 @@ namespace OpenSim.Region.Framework.Scenes
281 281
282 private bool m_followCamAuto = false; 282 private bool m_followCamAuto = false;
283 283
284 private Vector3? m_forceToApply; 284// private object m_forceToApplyLock = new object();
285// private bool m_forceToApplyValid;
286// private Vector3 m_forceToApply;
285 private int m_userFlags; 287 private int m_userFlags;
286 public int UserFlags 288 public int UserFlags
287 { 289 {
@@ -582,11 +584,11 @@ namespace OpenSim.Region.Framework.Scenes
582 { 584 {
583 get 585 get
584 { 586 {
585 return m_drawDistance; 587 return m_drawDistance;
586 } 588 }
587 set 589 set
588 { 590 {
589 m_drawDistance = Util.Clamp(value, 32f, m_scene.MaxDrawDistance); 591 m_drawDistance = Util.Clamp(value, 32f, m_scene.MaxDrawDistance);
590 } 592 }
591 } 593 }
592 594
@@ -594,7 +596,7 @@ namespace OpenSim.Region.Framework.Scenes
594 { 596 {
595 get 597 get
596 { 598 {
597 return Util.Clamp(m_drawDistance, 32f, m_scene.MaxRegionViewDistance); 599 return Util.Clamp(m_drawDistance, 32f, m_scene.MaxRegionViewDistance);
598 } 600 }
599 } 601 }
600 602
@@ -2120,6 +2122,7 @@ namespace OpenSim.Region.Framework.Scenes
2120 if (haveAnims) 2122 if (haveAnims)
2121 SendAnimPackToAgent(this, animIDs, animseqs, animsobjs); 2123 SendAnimPackToAgent(this, animIDs, animseqs, animsobjs);
2122 2124
2125
2123 // we should be able to receive updates, etc 2126 // we should be able to receive updates, etc
2124 // so release them 2127 // so release them
2125 m_inTransit = false; 2128 m_inTransit = false;
@@ -2238,6 +2241,9 @@ namespace OpenSim.Region.Framework.Scenes
2238 } 2241 }
2239 finally 2242 finally
2240 { 2243 {
2244 haveGroupInformation = false;
2245 gotCrossUpdate = false;
2246 crossingFlags = 0;
2241 m_inTransit = false; 2247 m_inTransit = false;
2242 } 2248 }
2243 // if hide force a check 2249 // if hide force a check
@@ -2247,9 +2253,6 @@ namespace OpenSim.Region.Framework.Scenes
2247 // m_currentParcelHide = newhide; 2253 // m_currentParcelHide = newhide;
2248 // } 2254 // }
2249 2255
2250 haveGroupInformation = false;
2251 gotCrossUpdate = false;
2252 crossingFlags = 0;
2253 2256
2254 m_scene.EventManager.OnRegionHeartbeatEnd += RegionHeartbeatEnd; 2257 m_scene.EventManager.OnRegionHeartbeatEnd += RegionHeartbeatEnd;
2255 2258
@@ -3006,7 +3009,8 @@ namespace OpenSim.Region.Framework.Scenes
3006 3009
3007 MovingToTarget = false; 3010 MovingToTarget = false;
3008// MoveToPositionTarget = Vector3.Zero; 3011// MoveToPositionTarget = Vector3.Zero;
3009 m_forceToApply = null; // cancel possible last action 3012// lock(m_forceToApplyLock)
3013// m_forceToApplyValid = false; // cancel possible last action
3010 3014
3011 // We need to reset the control flag as the ScenePresenceAnimator uses this to determine the correct 3015 // We need to reset the control flag as the ScenePresenceAnimator uses this to determine the correct
3012 // resting animation (e.g. hover or stand). NPCs don't have a client that will quickly reset this flag. 3016 // resting animation (e.g. hover or stand). NPCs don't have a client that will quickly reset this flag.
@@ -3638,8 +3642,14 @@ namespace OpenSim.Region.Framework.Scenes
3638 } 3642 }
3639 3643
3640 // m_log.DebugFormat("[SCENE PRESENCE]: Setting force to apply to {0} for {1}", direc, Name); 3644 // m_log.DebugFormat("[SCENE PRESENCE]: Setting force to apply to {0} for {1}", direc, Name);
3641 3645/*
3642 m_forceToApply = direc; 3646 lock(m_forceToApplyLock)
3647 {
3648 m_forceToApply = direc;
3649 m_forceToApplyValid = true;
3650 }
3651*/
3652 Velocity = direc;
3643 Animator.UpdateMovementAnimations(); 3653 Animator.UpdateMovementAnimations();
3644 } 3654 }
3645 3655
@@ -4734,17 +4744,21 @@ namespace OpenSim.Region.Framework.Scenes
4734 /// </summary> 4744 /// </summary>
4735 public void UpdateMovement() 4745 public void UpdateMovement()
4736 { 4746 {
4747/*
4737 if (IsInTransit) 4748 if (IsInTransit)
4738 return; 4749 return;
4739 if (m_forceToApply.HasValue)
4740 {
4741 Vector3 force = m_forceToApply.Value;
4742 4750
4743 Velocity = force; 4751 lock(m_forceToApplyLock)
4752 {
4753 if (m_forceToApplyValid)
4754 {
4755 Velocity = m_forceToApply;
4744 4756
4745 m_forceToApply = null; 4757 m_forceToApplyValid = false;
4746 TriggerScenePresenceUpdated(); 4758 TriggerScenePresenceUpdated();
4759 }
4747 } 4760 }
4761*/
4748 } 4762 }
4749 4763
4750 /// <summary> 4764 /// <summary>
@@ -4767,6 +4781,9 @@ namespace OpenSim.Region.Framework.Scenes
4767// Appearance.SetHeight(); 4781// Appearance.SetHeight();
4768 Appearance.SetSize(new Vector3(0.45f,0.6f,1.9f)); 4782 Appearance.SetSize(new Vector3(0.45f,0.6f,1.9f));
4769 4783
4784// lock(m_forceToApplyLock)
4785// m_forceToApplyValid = false;
4786
4770 PhysicsScene scene = m_scene.PhysicsScene; 4787 PhysicsScene scene = m_scene.PhysicsScene;
4771 Vector3 pVec = AbsolutePosition; 4788 Vector3 pVec = AbsolutePosition;
4772 4789