diff options
author | UbitUmarov | 2017-07-13 20:21:18 +0100 |
---|---|---|
committer | UbitUmarov | 2017-07-13 20:21:18 +0100 |
commit | 8b16131206818329e973faec3a9861fca37f0073 (patch) | |
tree | d2fa5fde6441f83e2396bd5893f9c6fd368f5cdd /OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs | |
parent | update libomv fixing EnUsCulture (diff) | |
download | opensim-SC-8b16131206818329e973faec3a9861fca37f0073.zip opensim-SC-8b16131206818329e973faec3a9861fca37f0073.tar.gz opensim-SC-8b16131206818329e973faec3a9861fca37f0073.tar.bz2 opensim-SC-8b16131206818329e973faec3a9861fca37f0073.tar.xz |
add Util.GetTimeStamp() that returns the stamp in seconds; use it on ubOde; separed land collsions dispatch from the others...
Diffstat (limited to 'OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs')
-rw-r--r-- | OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs index 5758e0a..004ee7f 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs | |||
@@ -203,8 +203,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
203 | private float metersInSpace = 25.6f; | 203 | private float metersInSpace = 25.6f; |
204 | private float m_timeDilation = 1.0f; | 204 | private float m_timeDilation = 1.0f; |
205 | 205 | ||
206 | private DateTime m_lastframe; | 206 | private double m_lastframe; |
207 | private DateTime m_lastMeshExpire; | 207 | private double m_lastMeshExpire; |
208 | 208 | ||
209 | public float gravityx = 0f; | 209 | public float gravityx = 0f; |
210 | public float gravityy = 0f; | 210 | public float gravityy = 0f; |
@@ -629,8 +629,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
629 | staticPrimspaceOffRegion[i] = newspace; | 629 | staticPrimspaceOffRegion[i] = newspace; |
630 | } | 630 | } |
631 | 631 | ||
632 | m_lastframe = DateTime.UtcNow; | 632 | m_lastframe = Util.GetTimeStamp(); |
633 | m_lastMeshExpire = m_lastframe; | 633 | m_lastMeshExpire = m_lastframe; |
634 | step_time = -1; | ||
634 | } | 635 | } |
635 | 636 | ||
636 | internal void waitForSpaceUnlock(IntPtr space) | 637 | internal void waitForSpaceUnlock(IntPtr space) |
@@ -1625,6 +1626,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1625 | } | 1626 | } |
1626 | m_log.InfoFormat("[ubOde] {0} prim actors loaded",_prims.Count); | 1627 | m_log.InfoFormat("[ubOde] {0} prim actors loaded",_prims.Count); |
1627 | } | 1628 | } |
1629 | m_lastframe = Util.GetTimeStamp() + 0.5; | ||
1630 | step_time = -0.5f; | ||
1628 | } | 1631 | } |
1629 | 1632 | ||
1630 | /// <summary> | 1633 | /// <summary> |
@@ -1638,13 +1641,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1638 | /// <returns></returns> | 1641 | /// <returns></returns> |
1639 | public override float Simulate(float reqTimeStep) | 1642 | public override float Simulate(float reqTimeStep) |
1640 | { | 1643 | { |
1641 | DateTime now = DateTime.UtcNow; | 1644 | double now = Util.GetTimeStamp(); |
1642 | TimeSpan timedif = now - m_lastframe; | 1645 | double timeStep = now - m_lastframe; |
1643 | float timeStep = (float)timedif.TotalSeconds; | ||
1644 | m_lastframe = now; | 1646 | m_lastframe = now; |
1645 | 1647 | ||
1646 | // acumulate time so we can reduce error | 1648 | // acumulate time so we can reduce error |
1647 | step_time += timeStep; | 1649 | step_time += (float)timeStep; |
1648 | 1650 | ||
1649 | if (step_time < HalfOdeStep) | 1651 | if (step_time < HalfOdeStep) |
1650 | return 0; | 1652 | return 0; |
@@ -1853,14 +1855,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1853 | } | 1855 | } |
1854 | } | 1856 | } |
1855 | 1857 | ||
1856 | timedif = now - m_lastMeshExpire; | ||
1857 | |||
1858 | if (timedif.Seconds > 10) | ||
1859 | { | ||
1860 | mesher.ExpireReleaseMeshs(); | ||
1861 | m_lastMeshExpire = now; | ||
1862 | } | ||
1863 | |||
1864 | // information block for in debug breakpoint only | 1858 | // information block for in debug breakpoint only |
1865 | /* | 1859 | /* |
1866 | int ntopactivegeoms = d.SpaceGetNumGeoms(ActiveSpace); | 1860 | int ntopactivegeoms = d.SpaceGetNumGeoms(ActiveSpace); |
@@ -1940,7 +1934,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1940 | // if we lag too much skip frames | 1934 | // if we lag too much skip frames |
1941 | m_timeDilation = 0.0f; | 1935 | m_timeDilation = 0.0f; |
1942 | step_time = 0; | 1936 | step_time = 0; |
1943 | m_lastframe = DateTime.UtcNow; // skip also the time lost | 1937 | m_lastframe = Util.GetTimeStamp(); // skip also the time lost |
1944 | } | 1938 | } |
1945 | else | 1939 | else |
1946 | { | 1940 | { |
@@ -1948,6 +1942,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1948 | if (m_timeDilation > 1) | 1942 | if (m_timeDilation > 1) |
1949 | m_timeDilation = 1; | 1943 | m_timeDilation = 1; |
1950 | } | 1944 | } |
1945 | |||
1946 | if (m_timeDilation == 1 && now - m_lastMeshExpire > 30) | ||
1947 | { | ||
1948 | mesher.ExpireReleaseMeshs(); | ||
1949 | m_lastMeshExpire = now; | ||
1950 | } | ||
1951 | |||
1952 | |||
1951 | } | 1953 | } |
1952 | 1954 | ||
1953 | return fps; | 1955 | return fps; |