diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index b288c8a..1acd607 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -140,8 +140,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
140 | protected IDialogModule m_dialogModule; | 140 | protected IDialogModule m_dialogModule; |
141 | protected IEntityTransferModule m_teleportModule; | 141 | protected IEntityTransferModule m_teleportModule; |
142 | protected ICapabilitiesModule m_capsModule; | 142 | protected ICapabilitiesModule m_capsModule; |
143 | // Central Update Loop | ||
144 | protected int m_fps = 10; | ||
145 | 143 | ||
146 | /// <summary> | 144 | /// <summary> |
147 | /// Current scene frame number | 145 | /// Current scene frame number |
@@ -152,8 +150,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
152 | protected set; | 150 | protected set; |
153 | } | 151 | } |
154 | 152 | ||
155 | protected float m_timespan = 0.089f; | 153 | /// <summary> |
156 | protected DateTime m_lastupdate = DateTime.UtcNow; | 154 | /// The minimum length of time in seconds that will be taken for a scene frame. If the frame takes less time then we |
155 | /// will sleep for the remaining period. | ||
156 | /// </summary> | ||
157 | /// <remarks> | ||
158 | /// One can tweak this number to experiment. One current effect of reducing it is to make avatar animations | ||
159 | /// occur too quickly (viewer 1) or with even more slide (viewer 2). | ||
160 | /// </remarks> | ||
161 | protected float m_minFrameTimespan = 0.089f; | ||
162 | |||
163 | /// <summary> | ||
164 | /// The time of the last frame update. | ||
165 | /// </summary> | ||
166 | protected DateTime m_lastFrameUpdate = DateTime.UtcNow; | ||
157 | 167 | ||
158 | // TODO: Possibly stop other classes being able to manipulate this directly. | 168 | // TODO: Possibly stop other classes being able to manipulate this directly. |
159 | private SceneGraph m_sceneGraph; | 169 | private SceneGraph m_sceneGraph; |
@@ -1236,7 +1246,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1236 | 1246 | ||
1237 | public override void Update() | 1247 | public override void Update() |
1238 | { | 1248 | { |
1239 | TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastupdate; | 1249 | TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastFrameUpdate; |
1240 | float physicsFPS = 0f; | 1250 | float physicsFPS = 0f; |
1241 | 1251 | ||
1242 | int maintc = Util.EnvironmentTickCount(); | 1252 | int maintc = Util.EnvironmentTickCount(); |
@@ -1288,7 +1298,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1288 | if (Frame % m_update_physics == 0) | 1298 | if (Frame % m_update_physics == 0) |
1289 | { | 1299 | { |
1290 | if (m_physics_enabled) | 1300 | if (m_physics_enabled) |
1291 | physicsFPS = m_sceneGraph.UpdatePhysics(Math.Max(SinceLastFrame.TotalSeconds, m_timespan)); | 1301 | physicsFPS = m_sceneGraph.UpdatePhysics(Math.Max(SinceLastFrame.TotalSeconds, m_minFrameTimespan)); |
1292 | if (SynchronizeScene != null) | 1302 | if (SynchronizeScene != null) |
1293 | SynchronizeScene(this); | 1303 | SynchronizeScene(this); |
1294 | } | 1304 | } |
@@ -1411,11 +1421,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1411 | } | 1421 | } |
1412 | finally | 1422 | finally |
1413 | { | 1423 | { |
1414 | m_lastupdate = DateTime.UtcNow; | 1424 | m_lastFrameUpdate = DateTime.UtcNow; |
1415 | } | 1425 | } |
1416 | 1426 | ||
1417 | maintc = Util.EnvironmentTickCountSubtract(maintc); | 1427 | maintc = Util.EnvironmentTickCountSubtract(maintc); |
1418 | maintc = (int)(m_timespan * 1000) - maintc; | 1428 | maintc = (int)(m_minFrameTimespan * 1000) - maintc; |
1419 | 1429 | ||
1420 | 1430 | ||
1421 | m_lastUpdate = Util.EnvironmentTickCount(); | 1431 | m_lastUpdate = Util.EnvironmentTickCount(); |