diff options
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/OdePlugin.cs')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 7fd59a0..eb97f41 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -287,6 +287,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
287 | private OdePrim cp1; | 287 | private OdePrim cp1; |
288 | private OdeCharacter cc2; | 288 | private OdeCharacter cc2; |
289 | private OdePrim cp2; | 289 | private OdePrim cp2; |
290 | private int tickCountFrameRun; | ||
291 | |||
292 | private int latertickcount=0; | ||
290 | //private int cStartStop = 0; | 293 | //private int cStartStop = 0; |
291 | //private string cDictKey = ""; | 294 | //private string cDictKey = ""; |
292 | 295 | ||
@@ -3123,6 +3126,22 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3123 | } | 3126 | } |
3124 | d.WorldExportDIF(world, fname, physics_logging_append_existing_logfile, prefix); | 3127 | d.WorldExportDIF(world, fname, physics_logging_append_existing_logfile, prefix); |
3125 | } | 3128 | } |
3129 | latertickcount = Util.EnvironmentTickCount() - tickCountFrameRun; | ||
3130 | |||
3131 | // OpenSimulator above does 10 fps. 10 fps = means that the main thread loop and physics | ||
3132 | // has a max of 100 ms to run theoretically. | ||
3133 | // If the main loop stalls, it calls Simulate later which makes the tick count ms larger. | ||
3134 | // If Physics stalls, it takes longer which makes the tick count ms larger. | ||
3135 | |||
3136 | if (latertickcount < 100) | ||
3137 | m_timeDilation = 1.0f; | ||
3138 | else | ||
3139 | { | ||
3140 | m_timeDilation = 100f / latertickcount; | ||
3141 | //m_timeDilation = Math.Min((Math.Max(100 - (Util.EnvironmentTickCount() - tickCountFrameRun), 1) / 100f), 1.0f); | ||
3142 | } | ||
3143 | |||
3144 | tickCountFrameRun = Util.EnvironmentTickCount(); | ||
3126 | } | 3145 | } |
3127 | 3146 | ||
3128 | return fps; | 3147 | return fps; |