diff options
author | UbitUmarov | 2014-08-12 22:27:50 +0100 |
---|---|---|
committer | UbitUmarov | 2014-08-12 22:27:50 +0100 |
commit | b9224a70c488ac53726dcf53e18c718bbb9948d6 (patch) | |
tree | d2681e307d88aed7ad6631421f7f697be4ba7704 | |
parent | force AgentUpdate after CompleteAgentMovement to pass by significance test (diff) | |
download | opensim-SC-b9224a70c488ac53726dcf53e18c718bbb9948d6.zip opensim-SC-b9224a70c488ac53726dcf53e18c718bbb9948d6.tar.gz opensim-SC-b9224a70c488ac53726dcf53e18c718bbb9948d6.tar.bz2 opensim-SC-b9224a70c488ac53726dcf53e18c718bbb9948d6.tar.xz |
no need to go from cos into squared sin when just abs of cos is as good
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 89deafd..0b82ce9 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -5737,7 +5737,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5737 | #region Scene/Avatar | 5737 | #region Scene/Avatar |
5738 | 5738 | ||
5739 | // Threshold for body rotation to be a significant agent update | 5739 | // Threshold for body rotation to be a significant agent update |
5740 | private const float QDELTA = 0.000001f; | 5740 | // use the abs of cos |
5741 | private const float QDELTABody = 1.0f - 0.0001f; | ||
5742 | private const float QDELTAHead = 1.0f - 0.0001f; | ||
5741 | // Threshold for camera rotation to be a significant agent update | 5743 | // Threshold for camera rotation to be a significant agent update |
5742 | private const float VDELTA = 0.01f; | 5744 | private const float VDELTA = 0.01f; |
5743 | 5745 | ||
@@ -5760,17 +5762,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5760 | /// <param name='x'></param> | 5762 | /// <param name='x'></param> |
5761 | private bool CheckAgentMovementUpdateSignificance(AgentUpdatePacket.AgentDataBlock x) | 5763 | private bool CheckAgentMovementUpdateSignificance(AgentUpdatePacket.AgentDataBlock x) |
5762 | { | 5764 | { |
5763 | float qdelta1 = 1 - (float)Math.Pow(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation), 2); | 5765 | float qdelta1 = Math.Abs(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation)); |
5764 | //qdelta2 = 1 - (float)Math.Pow(Quaternion.Dot(x.HeadRotation, m_thisAgentUpdateArgs.HeadRotation), 2); | 5766 | //qdelta2 = Math.Abs(Quaternion.Dot(x.HeadRotation, m_thisAgentUpdateArgs.HeadRotation)); |
5765 | 5767 | ||
5766 | bool movementSignificant = | 5768 | bool movementSignificant = |
5767 | (x.ControlFlags != m_thisAgentUpdateArgs.ControlFlags) // significant if control flags changed | 5769 | (x.ControlFlags != m_thisAgentUpdateArgs.ControlFlags) // significant if control flags changed |
5768 | || (x.ControlFlags != (byte)AgentManager.ControlFlags.NONE) // significant if user supplying any movement update commands | 5770 | || (x.ControlFlags != (byte)AgentManager.ControlFlags.NONE) // significant if user supplying any movement update commands |
5769 | || (x.Flags != m_thisAgentUpdateArgs.Flags) // significant if Flags changed | 5771 | || (x.Flags != m_thisAgentUpdateArgs.Flags) // significant if Flags changed |
5770 | || (x.State != m_thisAgentUpdateArgs.State) // significant if Stats changed | 5772 | || (x.State != m_thisAgentUpdateArgs.State) // significant if Stats changed |
5771 | || (qdelta1 > QDELTA) // significant if body rotation above threshold | 5773 | || (qdelta1 < QDELTABody) // significant if body rotation above(below cos) threshold |
5772 | // Ignoring head rotation altogether, because it's not being used for anything interesting up the stack | 5774 | // Ignoring head rotation altogether, because it's not being used for anything interesting up the stack |
5773 | // || (qdelta2 > QDELTA * 10) // significant if head rotation above threshold | 5775 | // || (qdelta2 < QDELTAHead) // significant if head rotation above(below cos) threshold |
5774 | || (x.Far != m_thisAgentUpdateArgs.Far) // significant if far distance changed | 5776 | || (x.Far != m_thisAgentUpdateArgs.Far) // significant if far distance changed |
5775 | ; | 5777 | ; |
5776 | //if (movementSignificant) | 5778 | //if (movementSignificant) |