aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
diff options
context:
space:
mode:
authorUbitUmarov2016-10-05 13:17:23 +0100
committerUbitUmarov2016-10-05 13:17:23 +0100
commit8a3958ad048535ad4f8a752cbd71d9114e53a42b (patch)
tree111826405ab3795c1aece111bf4f2f08920fed68 /OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
parentminor cleanup (diff)
downloadopensim-SC_OLD-8a3958ad048535ad4f8a752cbd71d9114e53a42b.zip
opensim-SC_OLD-8a3958ad048535ad4f8a752cbd71d9114e53a42b.tar.gz
opensim-SC_OLD-8a3958ad048535ad4f8a752cbd71d9114e53a42b.tar.bz2
opensim-SC_OLD-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 'OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs87
1 files changed, 43 insertions, 44 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);