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.
0.7.2-post-fixes
Justin Clark-Casey (justincc) 2011-10-20 19:44:59 +01:00
parent 4ecd3fbff1
commit 299cc2d12d
1 changed files with 4 additions and 12 deletions

View File

@ -157,11 +157,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;
@ -1195,8 +1190,7 @@ namespace OpenSim.Region.Framework.Scenes
}
public override void Update()
{
TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastFrameUpdate;
{
float physicsFPS = 0f;
int maintc = Util.EnvironmentTickCount();
@ -1256,7 +1250,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);
}
@ -1342,6 +1337,7 @@ namespace OpenSim.Region.Framework.Scenes
{
LoginsDisabled = false;
}
m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo);
}
else
@ -1371,10 +1367,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;