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
parent
4ecd3fbff1
commit
299cc2d12d
|
@ -157,11 +157,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public float MinFrameTime { get; private set; }
|
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_physics = 1;
|
||||||
private int m_update_entitymovement = 1;
|
private int m_update_entitymovement = 1;
|
||||||
private int m_update_objects = 1;
|
private int m_update_objects = 1;
|
||||||
|
@ -1195,8 +1190,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update()
|
public override void Update()
|
||||||
{
|
{
|
||||||
TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastFrameUpdate;
|
|
||||||
float physicsFPS = 0f;
|
float physicsFPS = 0f;
|
||||||
|
|
||||||
int maintc = Util.EnvironmentTickCount();
|
int maintc = Util.EnvironmentTickCount();
|
||||||
|
@ -1256,7 +1250,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (Frame % m_update_physics == 0)
|
if (Frame % m_update_physics == 0)
|
||||||
{
|
{
|
||||||
if (m_physics_enabled)
|
if (m_physics_enabled)
|
||||||
physicsFPS = m_sceneGraph.UpdatePhysics(Math.Max(SinceLastFrame.TotalSeconds, MinFrameTime));
|
physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameTime);
|
||||||
|
|
||||||
if (SynchronizeScene != null)
|
if (SynchronizeScene != null)
|
||||||
SynchronizeScene(this);
|
SynchronizeScene(this);
|
||||||
}
|
}
|
||||||
|
@ -1342,6 +1337,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
LoginsDisabled = false;
|
LoginsDisabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo);
|
m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1371,10 +1367,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
|
m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
m_lastFrameUpdate = DateTime.UtcNow;
|
|
||||||
}
|
|
||||||
|
|
||||||
maintc = Util.EnvironmentTickCountSubtract(maintc);
|
maintc = Util.EnvironmentTickCountSubtract(maintc);
|
||||||
maintc = (int)(MinFrameTime * 1000) - maintc;
|
maintc = (int)(MinFrameTime * 1000) - maintc;
|
||||||
|
|
Loading…
Reference in New Issue