diff options
author | John Hurliman | 2009-10-27 16:24:43 -0700 |
---|---|---|
committer | John Hurliman | 2009-10-27 16:24:43 -0700 |
commit | 0c466b28bbfeac8a4e0c3c61038290621c4f9f4f (patch) | |
tree | 1647b1d98633d0f0e1aad4963522d5ed250e04ef /OpenSim/Region | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC-0c466b28bbfeac8a4e0c3c61038290621c4f9f4f.zip opensim-SC-0c466b28bbfeac8a4e0c3c61038290621c4f9f4f.tar.gz opensim-SC-0c466b28bbfeac8a4e0c3c61038290621c4f9f4f.tar.bz2 opensim-SC-0c466b28bbfeac8a4e0c3c61038290621c4f9f4f.tar.xz |
Move the calculation of time dilation from the scene to the physics engine. The scene is still the one reporting dilation so this does not break the API or remove flexibility, but it gets the calculation happening in the right place for the normal OpenSim usage. The actual calculation of physics time dilation probably needs tweaking
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 19 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneBase.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Manager/PhysicsScene.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 11 |
4 files changed, 21 insertions, 17 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 7c3875d..3b8cd1e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -135,6 +135,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
135 | protected SceneCommunicationService m_sceneGridService; | 135 | protected SceneCommunicationService m_sceneGridService; |
136 | public bool loginsdisabled = true; | 136 | public bool loginsdisabled = true; |
137 | 137 | ||
138 | public float TimeDilation | ||
139 | { | ||
140 | get { return m_sceneGraph.PhysicsScene.TimeDilation; } | ||
141 | } | ||
142 | |||
138 | public SceneCommunicationService SceneGridService | 143 | public SceneCommunicationService SceneGridService |
139 | { | 144 | { |
140 | get { return m_sceneGridService; } | 145 | get { return m_sceneGridService; } |
@@ -1094,7 +1099,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1094 | // if (m_frame%m_update_avatars == 0) | 1099 | // if (m_frame%m_update_avatars == 0) |
1095 | // UpdateInWorldTime(); | 1100 | // UpdateInWorldTime(); |
1096 | StatsReporter.AddPhysicsFPS(physicsFPS); | 1101 | StatsReporter.AddPhysicsFPS(physicsFPS); |
1097 | StatsReporter.AddTimeDilation(m_timedilation); | 1102 | StatsReporter.AddTimeDilation(TimeDilation); |
1098 | StatsReporter.AddFPS(1); | 1103 | StatsReporter.AddFPS(1); |
1099 | StatsReporter.AddInPackets(0); | 1104 | StatsReporter.AddInPackets(0); |
1100 | StatsReporter.SetRootAgents(m_sceneGraph.GetRootAgentCount()); | 1105 | StatsReporter.SetRootAgents(m_sceneGraph.GetRootAgentCount()); |
@@ -1141,18 +1146,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1141 | } | 1146 | } |
1142 | finally | 1147 | finally |
1143 | { | 1148 | { |
1144 | //updateLock.ReleaseMutex(); | ||
1145 | // Get actual time dilation | ||
1146 | float tmpval = (m_timespan / (float)SinceLastFrame.TotalSeconds); | ||
1147 | |||
1148 | // If actual time dilation is greater then one, we're catching up, so subtract | ||
1149 | // the amount that's greater then 1 from the time dilation | ||
1150 | if (tmpval > 1.0) | ||
1151 | { | ||
1152 | tmpval = tmpval - (tmpval - 1.0f); | ||
1153 | } | ||
1154 | m_timedilation = tmpval; | ||
1155 | |||
1156 | m_lastupdate = DateTime.UtcNow; | 1149 | m_lastupdate = DateTime.UtcNow; |
1157 | } | 1150 | } |
1158 | maintc = Environment.TickCount - maintc; | 1151 | maintc = Environment.TickCount - maintc; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index 82731d1..1547f9a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs | |||
@@ -106,9 +106,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
106 | 106 | ||
107 | public float TimeDilation | 107 | public float TimeDilation |
108 | { | 108 | { |
109 | get { return m_timedilation; } | 109 | get { return 1.0f; } |
110 | } | 110 | } |
111 | protected float m_timedilation = 1.0f; | ||
112 | 111 | ||
113 | protected ulong m_regionHandle; | 112 | protected ulong m_regionHandle; |
114 | protected string m_regionName; | 113 | protected string m_regionName; |
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs index bb0d18e..6d515e9 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs | |||
@@ -75,6 +75,11 @@ namespace OpenSim.Region.Physics.Manager | |||
75 | public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, | 75 | public abstract PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, |
76 | Vector3 size, Quaternion rotation, bool isPhysical); | 76 | Vector3 size, Quaternion rotation, bool isPhysical); |
77 | 77 | ||
78 | public virtual float TimeDilation | ||
79 | { | ||
80 | get { return 1.0f; } | ||
81 | } | ||
82 | |||
78 | public virtual bool SupportsNINJAJoints | 83 | public virtual bool SupportsNINJAJoints |
79 | { | 84 | { |
80 | get { return false; } | 85 | get { return false; } |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 2f42646..9e36020 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -159,6 +159,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
159 | 159 | ||
160 | private float ODE_STEPSIZE = 0.020f; | 160 | private float ODE_STEPSIZE = 0.020f; |
161 | private float metersInSpace = 29.9f; | 161 | private float metersInSpace = 29.9f; |
162 | private float m_timeDilation = 1.0f; | ||
162 | 163 | ||
163 | public float gravityx = 0f; | 164 | public float gravityx = 0f; |
164 | public float gravityy = 0f; | 165 | public float gravityy = 0f; |
@@ -1750,6 +1751,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1750 | return result; | 1751 | return result; |
1751 | } | 1752 | } |
1752 | 1753 | ||
1754 | public override float TimeDilation | ||
1755 | { | ||
1756 | get { return m_timeDilation; } | ||
1757 | } | ||
1758 | |||
1753 | public override bool SupportsNINJAJoints | 1759 | public override bool SupportsNINJAJoints |
1754 | { | 1760 | { |
1755 | get { return m_NINJA_physics_joints_enabled; } | 1761 | get { return m_NINJA_physics_joints_enabled; } |
@@ -2657,8 +2663,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2657 | 2663 | ||
2658 | // Figure out the Frames Per Second we're going at. | 2664 | // Figure out the Frames Per Second we're going at. |
2659 | //(step_time == 0.004f, there's 250 of those per second. Times the step time/step size | 2665 | //(step_time == 0.004f, there's 250 of those per second. Times the step time/step size |
2660 | 2666 | ||
2661 | fps = (step_time/ODE_STEPSIZE) * 1000; | 2667 | fps = (step_time / ODE_STEPSIZE) * 1000; |
2668 | m_timeDilation = (step_time / ODE_STEPSIZE) / (0.09375f / ODE_STEPSIZE); | ||
2662 | 2669 | ||
2663 | step_time = 0.09375f; | 2670 | step_time = 0.09375f; |
2664 | 2671 | ||