diff options
author | Justin Clark-Casey (justincc) | 2011-10-20 19:44:59 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-10-20 19:44:59 +0100 |
commit | 6837e44d0707e501795df2d690c6005f5ba1d591 (patch) | |
tree | cc1dff4dec765209d7e349c3f785f70cb7c454c0 /OpenSim/Region/Framework | |
parent | For now, stop passing timeStep into methods where it's not actually used. (diff) | |
download | opensim-SC-6837e44d0707e501795df2d690c6005f5ba1d591.zip opensim-SC-6837e44d0707e501795df2d690c6005f5ba1d591.tar.gz opensim-SC-6837e44d0707e501795df2d690c6005f5ba1d591.tar.bz2 opensim-SC-6837e44d0707e501795df2d690c6005f5ba1d591.tar.xz |
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.
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 16 |
1 files changed, 4 insertions, 12 deletions
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 | |||
161 | /// </remarks> | 161 | /// </remarks> |
162 | public float MinFrameTime { get; private set; } | 162 | public float MinFrameTime { get; private set; } |
163 | 163 | ||
164 | /// <summary> | ||
165 | /// The time of the last frame update. | ||
166 | /// </summary> | ||
167 | protected DateTime m_lastFrameUpdate = DateTime.UtcNow; | ||
168 | |||
169 | private int m_update_physics = 1; | 164 | private int m_update_physics = 1; |
170 | private int m_update_entitymovement = 1; | 165 | private int m_update_entitymovement = 1; |
171 | private int m_update_objects = 1; | 166 | private int m_update_objects = 1; |
@@ -1238,8 +1233,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1238 | } | 1233 | } |
1239 | 1234 | ||
1240 | public override void Update() | 1235 | public override void Update() |
1241 | { | 1236 | { |
1242 | TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastFrameUpdate; | ||
1243 | float physicsFPS = 0f; | 1237 | float physicsFPS = 0f; |
1244 | 1238 | ||
1245 | int maintc = Util.EnvironmentTickCount(); | 1239 | int maintc = Util.EnvironmentTickCount(); |
@@ -1299,7 +1293,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1299 | if (Frame % m_update_physics == 0) | 1293 | if (Frame % m_update_physics == 0) |
1300 | { | 1294 | { |
1301 | if (m_physics_enabled) | 1295 | if (m_physics_enabled) |
1302 | physicsFPS = m_sceneGraph.UpdatePhysics(Math.Max(SinceLastFrame.TotalSeconds, MinFrameTime)); | 1296 | physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameTime); |
1297 | |||
1303 | if (SynchronizeScene != null) | 1298 | if (SynchronizeScene != null) |
1304 | SynchronizeScene(this); | 1299 | SynchronizeScene(this); |
1305 | } | 1300 | } |
@@ -1385,6 +1380,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1385 | { | 1380 | { |
1386 | LoginsDisabled = false; | 1381 | LoginsDisabled = false; |
1387 | } | 1382 | } |
1383 | |||
1388 | m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo); | 1384 | m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo); |
1389 | } | 1385 | } |
1390 | else | 1386 | else |
@@ -1414,10 +1410,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1414 | { | 1410 | { |
1415 | m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); | 1411 | m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); |
1416 | } | 1412 | } |
1417 | finally | ||
1418 | { | ||
1419 | m_lastFrameUpdate = DateTime.UtcNow; | ||
1420 | } | ||
1421 | 1413 | ||
1422 | maintc = Util.EnvironmentTickCountSubtract(maintc); | 1414 | maintc = Util.EnvironmentTickCountSubtract(maintc); |
1423 | maintc = (int)(MinFrameTime * 1000) - maintc; | 1415 | maintc = (int)(MinFrameTime * 1000) - maintc; |