diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 81 |
1 files changed, 48 insertions, 33 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index aa742ef..59d1c69 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -856,6 +856,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
856 | 856 | ||
857 | public void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look) | 857 | public void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look) |
858 | { | 858 | { |
859 | m_thisAgentUpdateArgs.CameraAtAxis.X = float.MinValue; | ||
860 | m_thisAgentUpdateArgs.ControlFlags = uint.MaxValue; | ||
861 | |||
859 | AgentMovementCompletePacket mov = (AgentMovementCompletePacket)PacketPool.Instance.GetPacket(PacketType.AgentMovementComplete); | 862 | AgentMovementCompletePacket mov = (AgentMovementCompletePacket)PacketPool.Instance.GetPacket(PacketType.AgentMovementComplete); |
860 | mov.SimData.ChannelVersion = m_channelVersion; | 863 | mov.SimData.ChannelVersion = m_channelVersion; |
861 | mov.AgentData.SessionID = m_sessionId; | 864 | mov.AgentData.SessionID = m_sessionId; |
@@ -5734,7 +5737,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5734 | #region Scene/Avatar | 5737 | #region Scene/Avatar |
5735 | 5738 | ||
5736 | // Threshold for body rotation to be a significant agent update | 5739 | // Threshold for body rotation to be a significant agent update |
5737 | 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; | ||
5738 | // Threshold for camera rotation to be a significant agent update | 5743 | // Threshold for camera rotation to be a significant agent update |
5739 | private const float VDELTA = 0.01f; | 5744 | private const float VDELTA = 0.01f; |
5740 | 5745 | ||
@@ -5757,18 +5762,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5757 | /// <param name='x'></param> | 5762 | /// <param name='x'></param> |
5758 | private bool CheckAgentMovementUpdateSignificance(AgentUpdatePacket.AgentDataBlock x) | 5763 | private bool CheckAgentMovementUpdateSignificance(AgentUpdatePacket.AgentDataBlock x) |
5759 | { | 5764 | { |
5760 | 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)); |
5761 | //qdelta2 = 1 - (float)Math.Pow(Quaternion.Dot(x.HeadRotation, m_thisAgentUpdateArgs.HeadRotation), 2); | 5766 | //qdelta2 = Math.Abs(Quaternion.Dot(x.HeadRotation, m_thisAgentUpdateArgs.HeadRotation)); |
5762 | 5767 | ||
5763 | bool movementSignificant = | 5768 | bool movementSignificant = |
5764 | (qdelta1 > QDELTA) // significant if body rotation above threshold | 5769 | (x.ControlFlags != m_thisAgentUpdateArgs.ControlFlags) // significant if control flags changed |
5765 | // Ignoring head rotation altogether, because it's not being used for anything interesting up the stack | ||
5766 | // || (qdelta2 > QDELTA * 10) // significant if head rotation above threshold | ||
5767 | || (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.Far != m_thisAgentUpdateArgs.Far) // significant if far distance changed | ||
5770 | || (x.Flags != m_thisAgentUpdateArgs.Flags) // significant if Flags changed | 5771 | || (x.Flags != m_thisAgentUpdateArgs.Flags) // significant if Flags changed |
5771 | || (x.State != m_thisAgentUpdateArgs.State) // significant if Stats changed | 5772 | || (x.State != m_thisAgentUpdateArgs.State) // significant if Stats changed |
5773 | || (qdelta1 < QDELTABody) // significant if body rotation above(below cos) threshold | ||
5774 | // Ignoring head rotation altogether, because it's not being used for anything interesting up the stack | ||
5775 | // || (qdelta2 < QDELTAHead) // significant if head rotation above(below cos) threshold | ||
5776 | || (x.Far != m_thisAgentUpdateArgs.Far) // significant if far distance changed | ||
5772 | ; | 5777 | ; |
5773 | //if (movementSignificant) | 5778 | //if (movementSignificant) |
5774 | //{ | 5779 | //{ |
@@ -5811,55 +5816,63 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5811 | return cameraSignificant; | 5816 | return cameraSignificant; |
5812 | } | 5817 | } |
5813 | 5818 | ||
5814 | private bool HandleAgentUpdate(IClientAPI sener, Packet packet) | 5819 | private bool HandleAgentUpdate(IClientAPI sender, Packet packet) |
5815 | { | 5820 | { |
5816 | // We got here, which means that something in agent update was significant | 5821 | // We got here, which means that something in agent update was significant |
5817 | 5822 | ||
5818 | AgentUpdatePacket agentUpdate = (AgentUpdatePacket)packet; | 5823 | AgentUpdatePacket agentUpdate = (AgentUpdatePacket)packet; |
5819 | AgentUpdatePacket.AgentDataBlock x = agentUpdate.AgentData; | 5824 | AgentUpdatePacket.AgentDataBlock x = agentUpdate.AgentData; |
5820 | 5825 | ||
5821 | if (x.AgentID != AgentId || x.SessionID != SessionId) | 5826 | if (x.AgentID != AgentId || x.SessionID != SessionId) |
5827 | { | ||
5828 | PacketPool.Instance.ReturnPacket(packet); | ||
5822 | return false; | 5829 | return false; |
5830 | } | ||
5831 | |||
5832 | TotalAgentUpdates++; | ||
5823 | 5833 | ||
5824 | // Before we update the current m_thisAgentUpdateArgs, let's check this again | ||
5825 | // to see what exactly changed | ||
5826 | bool movement = CheckAgentMovementUpdateSignificance(x); | 5834 | bool movement = CheckAgentMovementUpdateSignificance(x); |
5827 | bool camera = CheckAgentCameraUpdateSignificance(x); | 5835 | bool camera = CheckAgentCameraUpdateSignificance(x); |
5828 | 5836 | ||
5829 | m_thisAgentUpdateArgs.AgentID = x.AgentID; | ||
5830 | m_thisAgentUpdateArgs.BodyRotation = x.BodyRotation; | ||
5831 | m_thisAgentUpdateArgs.CameraAtAxis = x.CameraAtAxis; | ||
5832 | m_thisAgentUpdateArgs.CameraCenter = x.CameraCenter; | ||
5833 | m_thisAgentUpdateArgs.CameraLeftAxis = x.CameraLeftAxis; | ||
5834 | m_thisAgentUpdateArgs.CameraUpAxis = x.CameraUpAxis; | ||
5835 | m_thisAgentUpdateArgs.ControlFlags = x.ControlFlags; | ||
5836 | m_thisAgentUpdateArgs.Far = x.Far; | ||
5837 | m_thisAgentUpdateArgs.Flags = x.Flags; | ||
5838 | m_thisAgentUpdateArgs.HeadRotation = x.HeadRotation; | ||
5839 | m_thisAgentUpdateArgs.SessionID = x.SessionID; | ||
5840 | m_thisAgentUpdateArgs.State = x.State; | ||
5841 | |||
5842 | UpdateAgent handlerAgentUpdate = OnAgentUpdate; | ||
5843 | UpdateAgent handlerPreAgentUpdate = OnPreAgentUpdate; | ||
5844 | UpdateAgent handlerAgentCameraUpdate = OnAgentCameraUpdate; | ||
5845 | |||
5846 | // Was there a significant movement/state change? | 5837 | // Was there a significant movement/state change? |
5847 | if (movement) | 5838 | if (movement) |
5848 | { | 5839 | { |
5840 | m_thisAgentUpdateArgs.BodyRotation = x.BodyRotation; | ||
5841 | m_thisAgentUpdateArgs.ControlFlags = x.ControlFlags; | ||
5842 | m_thisAgentUpdateArgs.Far = x.Far; | ||
5843 | m_thisAgentUpdateArgs.Flags = x.Flags; | ||
5844 | m_thisAgentUpdateArgs.HeadRotation = x.HeadRotation; | ||
5845 | // m_thisAgentUpdateArgs.SessionID = x.SessionID; | ||
5846 | m_thisAgentUpdateArgs.State = x.State; | ||
5847 | |||
5848 | UpdateAgent handlerAgentUpdate = OnAgentUpdate; | ||
5849 | UpdateAgent handlerPreAgentUpdate = OnPreAgentUpdate; | ||
5850 | |||
5849 | if (handlerPreAgentUpdate != null) | 5851 | if (handlerPreAgentUpdate != null) |
5850 | OnPreAgentUpdate(this, m_thisAgentUpdateArgs); | 5852 | OnPreAgentUpdate(this, m_thisAgentUpdateArgs); |
5851 | 5853 | ||
5852 | if (handlerAgentUpdate != null) | 5854 | if (handlerAgentUpdate != null) |
5853 | OnAgentUpdate(this, m_thisAgentUpdateArgs); | 5855 | OnAgentUpdate(this, m_thisAgentUpdateArgs); |
5856 | |||
5857 | handlerAgentUpdate = null; | ||
5858 | handlerPreAgentUpdate = null; | ||
5854 | } | 5859 | } |
5860 | |||
5855 | // Was there a significant camera(s) change? | 5861 | // Was there a significant camera(s) change? |
5856 | if (camera) | 5862 | if (camera) |
5863 | { | ||
5864 | m_thisAgentUpdateArgs.CameraAtAxis = x.CameraAtAxis; | ||
5865 | m_thisAgentUpdateArgs.CameraCenter = x.CameraCenter; | ||
5866 | m_thisAgentUpdateArgs.CameraLeftAxis = x.CameraLeftAxis; | ||
5867 | m_thisAgentUpdateArgs.CameraUpAxis = x.CameraUpAxis; | ||
5868 | |||
5869 | UpdateAgent handlerAgentCameraUpdate = OnAgentCameraUpdate; | ||
5870 | |||
5857 | if (handlerAgentCameraUpdate != null) | 5871 | if (handlerAgentCameraUpdate != null) |
5858 | handlerAgentCameraUpdate(this, m_thisAgentUpdateArgs); | 5872 | handlerAgentCameraUpdate(this, m_thisAgentUpdateArgs); |
5859 | 5873 | ||
5860 | handlerAgentUpdate = null; | 5874 | handlerAgentCameraUpdate = null; |
5861 | handlerPreAgentUpdate = null; | 5875 | } |
5862 | handlerAgentCameraUpdate = null; | ||
5863 | 5876 | ||
5864 | PacketPool.Instance.ReturnPacket(packet); | 5877 | PacketPool.Instance.ReturnPacket(packet); |
5865 | 5878 | ||
@@ -6745,8 +6758,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6745 | return true; | 6758 | return true; |
6746 | } | 6759 | } |
6747 | 6760 | ||
6748 | private bool HandleCompleteAgentMovement(IClientAPI sender, Packet Pack) | 6761 | private bool HandleCompleteAgentMovement(IClientAPI sender, Packet Pack) |
6749 | { | 6762 | { |
6763 | m_log.DebugFormat("[LLClientView] HandleCompleteAgentMovement"); | ||
6764 | |||
6750 | Action<IClientAPI, bool> handlerCompleteMovementToRegion = OnCompleteMovementToRegion; | 6765 | Action<IClientAPI, bool> handlerCompleteMovementToRegion = OnCompleteMovementToRegion; |
6751 | if (handlerCompleteMovementToRegion != null) | 6766 | if (handlerCompleteMovementToRegion != null) |
6752 | { | 6767 | { |