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.
remove-scene-viewer
Justin Clark-Casey (justincc) 2011-10-20 19:44:59 +01:00
parent b63ec987b0
commit 6837e44d07
1 changed files with 4 additions and 12 deletions

View File

@ -161,11 +161,6 @@ namespace OpenSim.Region.Framework.Scenes
/// </remarks>
public float MinFrameTime { get; private set; }
/// <summary>
/// The time of the last frame update.
/// </summary>
protected DateTime m_lastFrameUpdate = DateTime.UtcNow;
private int m_update_physics = 1;
private int m_update_entitymovement = 1;
private int m_update_objects = 1;
@ -1239,7 +1234,6 @@ 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<INeighbourService>(), 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;