From 0c466b28bbfeac8a4e0c3c61038290621c4f9f4f Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Tue, 27 Oct 2009 16:24:43 -0700 Subject: Move the calculation of time dilation from the scene to the physics engine. The scene is still the one reporting dilation so this does not break the API or remove flexibility, but it gets the calculation happening in the right place for the normal OpenSim usage. The actual calculation of physics time dilation probably needs tweaking --- OpenSim/Region/Framework/Scenes/Scene.cs | 19 ++++++------------- OpenSim/Region/Framework/Scenes/SceneBase.cs | 3 +-- 2 files changed, 7 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 7c3875d..3b8cd1e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -135,6 +135,11 @@ namespace OpenSim.Region.Framework.Scenes protected SceneCommunicationService m_sceneGridService; public bool loginsdisabled = true; + public float TimeDilation + { + get { return m_sceneGraph.PhysicsScene.TimeDilation; } + } + public SceneCommunicationService SceneGridService { get { return m_sceneGridService; } @@ -1094,7 +1099,7 @@ namespace OpenSim.Region.Framework.Scenes // if (m_frame%m_update_avatars == 0) // UpdateInWorldTime(); StatsReporter.AddPhysicsFPS(physicsFPS); - StatsReporter.AddTimeDilation(m_timedilation); + StatsReporter.AddTimeDilation(TimeDilation); StatsReporter.AddFPS(1); StatsReporter.AddInPackets(0); StatsReporter.SetRootAgents(m_sceneGraph.GetRootAgentCount()); @@ -1141,18 +1146,6 @@ namespace OpenSim.Region.Framework.Scenes } finally { - //updateLock.ReleaseMutex(); - // Get actual time dilation - float tmpval = (m_timespan / (float)SinceLastFrame.TotalSeconds); - - // If actual time dilation is greater then one, we're catching up, so subtract - // the amount that's greater then 1 from the time dilation - if (tmpval > 1.0) - { - tmpval = tmpval - (tmpval - 1.0f); - } - m_timedilation = tmpval; - m_lastupdate = DateTime.UtcNow; } maintc = Environment.TickCount - maintc; diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index 82731d1..1547f9a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs @@ -106,9 +106,8 @@ namespace OpenSim.Region.Framework.Scenes public float TimeDilation { - get { return m_timedilation; } + get { return 1.0f; } } - protected float m_timedilation = 1.0f; protected ulong m_regionHandle; protected string m_regionName; -- cgit v1.1