From 3919c805054e6ce240c72436414ecee18a6c2947 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 20 Jul 2013 13:42:39 -0700 Subject: A couple of small optimizations over the previous commit --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden/UDP') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 6c58aac..2907580 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -5587,6 +5587,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// public bool CheckAgentUpdateSignificance(AgentUpdatePacket.AgentDataBlock x) { + // Compute these only once, when this function is called from down below + qdelta1 = 1 - (float)Math.Pow(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation), 2); + //qdelta2 = 1 - (float)Math.Pow(Quaternion.Dot(x.HeadRotation, m_thisAgentUpdateArgs.HeadRotation), 2); + vdelta1 = Vector3.Distance(x.CameraAtAxis, m_thisAgentUpdateArgs.CameraAtAxis); + vdelta2 = Vector3.Distance(x.CameraCenter, m_thisAgentUpdateArgs.CameraCenter); + vdelta3 = Vector3.Distance(x.CameraLeftAxis, m_thisAgentUpdateArgs.CameraLeftAxis); + vdelta4 = Vector3.Distance(x.CameraUpAxis, m_thisAgentUpdateArgs.CameraUpAxis); + return CheckAgentMovementUpdateSignificance(x) || CheckAgentCameraUpdateSignificance(x); } @@ -5596,10 +5604,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Can only be called by one thread at a time /// /// - public bool CheckAgentMovementUpdateSignificance(AgentUpdatePacket.AgentDataBlock x) + private bool CheckAgentMovementUpdateSignificance(AgentUpdatePacket.AgentDataBlock x) { - qdelta1 = 1 - (float)Math.Pow(Quaternion.Dot(x.BodyRotation, m_thisAgentUpdateArgs.BodyRotation), 2); - qdelta2 = 1 - (float)Math.Pow(Quaternion.Dot(x.HeadRotation, m_thisAgentUpdateArgs.HeadRotation), 2); if ( (qdelta1 > QDELTA) || // Ignoring head rotation altogether, because it's not being used for anything interesting up the stack @@ -5626,12 +5632,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Can only be called by one thread at a time /// /// - public bool CheckAgentCameraUpdateSignificance(AgentUpdatePacket.AgentDataBlock x) + private bool CheckAgentCameraUpdateSignificance(AgentUpdatePacket.AgentDataBlock x) { - vdelta1 = Vector3.Distance(x.CameraAtAxis, m_thisAgentUpdateArgs.CameraAtAxis); - vdelta2 = Vector3.Distance(x.CameraCenter, m_thisAgentUpdateArgs.CameraCenter); - vdelta3 = Vector3.Distance(x.CameraLeftAxis, m_thisAgentUpdateArgs.CameraLeftAxis); - vdelta4 = Vector3.Distance(x.CameraUpAxis, m_thisAgentUpdateArgs.CameraUpAxis); if ( /* These 4 are the worst offenders! * With Singularity, there is a bug where sometimes the spam on these doesn't stop */ -- cgit v1.1