From 6837e44d0707e501795df2d690c6005f5ba1d591 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 20 Oct 2011 19:44:59 +0100
Subject: Pass PhysicsScene.Simulate() only the MinFrameTime rather than the
useless Math.Max(SinceLastFrame.TotalSeconds, MinFrameTime)
SinceLastFrame was calculating the interval between any sleep that had occurred to pad out the frame time and the start of the next frame.
This would usually be below MinFrameTime but occasionally if the sleep was long it would be above, often due to the time required to update the watchdog.
This doesn't appear to play much practical role right now.
ODE was actually ignoring it entirely. Bullet might be helped slightly by receiving a non-varying value.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 64ed6c7..2a25b2b 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -161,11 +161,6 @@ namespace OpenSim.Region.Framework.Scenes
///
public float MinFrameTime { get; private set; }
- ///
- /// The time of the last frame update.
- ///
- protected DateTime m_lastFrameUpdate = DateTime.UtcNow;
-
private int m_update_physics = 1;
private int m_update_entitymovement = 1;
private int m_update_objects = 1;
@@ -1238,8 +1233,7 @@ namespace OpenSim.Region.Framework.Scenes
}
public override void Update()
- {
- TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastFrameUpdate;
+ {
float physicsFPS = 0f;
int maintc = Util.EnvironmentTickCount();
@@ -1299,7 +1293,8 @@ namespace OpenSim.Region.Framework.Scenes
if (Frame % m_update_physics == 0)
{
if (m_physics_enabled)
- physicsFPS = m_sceneGraph.UpdatePhysics(Math.Max(SinceLastFrame.TotalSeconds, MinFrameTime));
+ physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameTime);
+
if (SynchronizeScene != null)
SynchronizeScene(this);
}
@@ -1385,6 +1380,7 @@ namespace OpenSim.Region.Framework.Scenes
{
LoginsDisabled = false;
}
+
m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface(), RegionInfo);
}
else
@@ -1414,10 +1410,6 @@ namespace OpenSim.Region.Framework.Scenes
{
m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
}
- finally
- {
- m_lastFrameUpdate = DateTime.UtcNow;
- }
maintc = Util.EnvironmentTickCountSubtract(maintc);
maintc = (int)(MinFrameTime * 1000) - maintc;
--
cgit v1.1