diff options
author | Teravus Ovares | 2007-12-12 06:58:55 +0000 |
---|---|---|
committer | Teravus Ovares | 2007-12-12 06:58:55 +0000 |
commit | 081f4403ea2a2f8352d480910052bf5032e2e4a5 (patch) | |
tree | 9eeda0d127f84b1e0538ac834e7921a074b6503e /OpenSim/Region/Physics | |
parent | * Patch from justincc to fix Inconsistent automatic mysql table creation - se... (diff) | |
download | opensim-SC-081f4403ea2a2f8352d480910052bf5032e2e4a5.zip opensim-SC-081f4403ea2a2f8352d480910052bf5032e2e4a5.tar.gz opensim-SC-081f4403ea2a2f8352d480910052bf5032e2e4a5.tar.bz2 opensim-SC-081f4403ea2a2f8352d480910052bf5032e2e4a5.tar.xz |
* Added some simstats to fill the simulator pane of the Statistics monitor.
* I stress, this is an initial implementation and the Agents(Child and Root) are definately obviously incorrect.
Diffstat (limited to 'OpenSim/Region/Physics')
6 files changed, 51 insertions, 27 deletions
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs index 6b647b1..df3ebb9 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs | |||
@@ -118,8 +118,9 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
118 | { | 118 | { |
119 | 119 | ||
120 | } | 120 | } |
121 | public override void Simulate(float timeStep) | 121 | public override float Simulate(float timeStep) |
122 | { | 122 | { |
123 | float fps = 0; | ||
123 | for (int i = 0; i < _actors.Count; ++i) | 124 | for (int i = 0; i < _actors.Count; ++i) |
124 | { | 125 | { |
125 | BasicActor actor = _actors[i]; | 126 | BasicActor actor = _actors[i]; |
@@ -164,6 +165,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
164 | actor.Velocity.Z = 0; | 165 | actor.Velocity.Z = 0; |
165 | } | 166 | } |
166 | } | 167 | } |
168 | return fps; | ||
167 | } | 169 | } |
168 | 170 | ||
169 | public override void GetResults() | 171 | public override void GetResults() |
diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs index 4b1043a..1760e50 100644 --- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs +++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs | |||
@@ -515,20 +515,26 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
515 | { | 515 | { |
516 | 516 | ||
517 | } | 517 | } |
518 | public override void Simulate(float timeStep) | 518 | public override float Simulate(float timeStep) |
519 | { | 519 | { |
520 | float fps = 0; | ||
520 | lock (BulletXLock) | 521 | lock (BulletXLock) |
521 | { | 522 | { |
522 | //Try to remove garbage | 523 | //Try to remove garbage |
523 | RemoveForgottenRigidBodies(); | 524 | RemoveForgottenRigidBodies(); |
524 | //End of remove | 525 | //End of remove |
525 | MoveAllObjects(timeStep); | 526 | MoveAllObjects(timeStep); |
527 | |||
528 | |||
529 | fps = (timeStep * simulationSubSteps); | ||
530 | |||
526 | ddWorld.StepSimulation(timeStep, simulationSubSteps, timeStep); | 531 | ddWorld.StepSimulation(timeStep, simulationSubSteps, timeStep); |
527 | //Extra Heightmap Validation: BulletX's HeightFieldTerrain somestimes doesn't work so fine. | 532 | //Extra Heightmap Validation: BulletX's HeightFieldTerrain somestimes doesn't work so fine. |
528 | ValidateHeightForAll(); | 533 | ValidateHeightForAll(); |
529 | //End heightmap validation. | 534 | //End heightmap validation. |
530 | UpdateKineticsForAll(); | 535 | UpdateKineticsForAll(); |
531 | } | 536 | } |
537 | return fps; | ||
532 | } | 538 | } |
533 | 539 | ||
534 | private void MoveAllObjects(float timeStep) | 540 | private void MoveAllObjects(float timeStep) |
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs index 71cba22..c63a66d 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs | |||
@@ -70,7 +70,7 @@ namespace OpenSim.Region.Physics.Manager | |||
70 | PhysicsVector size, Quaternion rotation, bool isPhysical); | 70 | PhysicsVector size, Quaternion rotation, bool isPhysical); |
71 | public abstract void AddPhysicsActorTaint(PhysicsActor prim); | 71 | public abstract void AddPhysicsActorTaint(PhysicsActor prim); |
72 | 72 | ||
73 | public abstract void Simulate(float timeStep); | 73 | public abstract float Simulate(float timeStep); |
74 | 74 | ||
75 | public abstract void GetResults(); | 75 | public abstract void GetResults(); |
76 | 76 | ||
@@ -126,11 +126,12 @@ namespace OpenSim.Region.Physics.Manager | |||
126 | { | 126 | { |
127 | 127 | ||
128 | } | 128 | } |
129 | public override void Simulate(float timeStep) | 129 | public override float Simulate(float timeStep) |
130 | { | 130 | { |
131 | m_workIndicator = (m_workIndicator + 1)%10; | 131 | m_workIndicator = (m_workIndicator + 1)%10; |
132 | 132 | ||
133 | //MainLog.Instance.SetStatus(m_workIndicator.ToString()); | 133 | //MainLog.Instance.SetStatus(m_workIndicator.ToString()); |
134 | return 0f; | ||
134 | } | 135 | } |
135 | 136 | ||
136 | public override void GetResults() | 137 | public override void GetResults() |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 5234cd3..a765878 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -787,9 +787,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
787 | } | 787 | } |
788 | } | 788 | } |
789 | 789 | ||
790 | public override void Simulate(float timeStep) | 790 | public override float Simulate(float timeStep) |
791 | { | 791 | { |
792 | 792 | float fps = 0; | |
793 | |||
793 | step_time += timeStep; | 794 | step_time += timeStep; |
794 | 795 | ||
795 | 796 | ||
@@ -800,32 +801,40 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
800 | 801 | ||
801 | 802 | ||
802 | 803 | ||
803 | if (step_time >= m_SkipFramesAtms) | 804 | if (step_time >= m_SkipFramesAtms) |
804 | { | 805 | { |
805 | // Instead of trying to catch up, it'll do one physics frame only | 806 | // Instead of trying to catch up, it'll do one physics frame only |
806 | step_time = ODE_STEPSIZE; | 807 | step_time = ODE_STEPSIZE; |
807 | this.m_physicsiterations = 5; | 808 | this.m_physicsiterations = 5; |
809 | } | ||
810 | else | ||
811 | { | ||
812 | m_physicsiterations = 10; | ||
813 | } | ||
814 | lock (OdeLock) | ||
815 | { | ||
816 | // Process 10 frames if the sim is running normal.. | ||
817 | // process 5 frames if the sim is running slow | ||
818 | try{ | ||
819 | d.WorldSetQuickStepNumIterations(world, m_physicsiterations); | ||
808 | } | 820 | } |
809 | else | 821 | catch (System.StackOverflowException) |
810 | { | 822 | { |
811 | m_physicsiterations = 10; | 823 | MainLog.Instance.Error("PHYSICS", "The operating system wasn't able to allocate enough memory for the simulation. Restarting the sim."); |
824 | base.TriggerPhysicsBasedRestart(); | ||
812 | } | 825 | } |
813 | lock (OdeLock) | ||
814 | { | ||
815 | // Process 10 frames if the sim is running normal.. | ||
816 | // process 5 frames if the sim is running slow | ||
817 | try{ | ||
818 | d.WorldSetQuickStepNumIterations(world, m_physicsiterations); | ||
819 | } | ||
820 | catch (System.StackOverflowException) | ||
821 | { | ||
822 | MainLog.Instance.Error("PHYSICS", "The operating system wasn't able to allocate enough memory for the simulation. Restarting the sim."); | ||
823 | base.TriggerPhysicsBasedRestart(); | ||
824 | } | ||
825 | 826 | ||
826 | int i = 0; | 827 | int i = 0; |
828 | |||
829 | |||
830 | // Figure out the Frames Per Second we're going at. | ||
831 | |||
832 | fps = (((step_time / ODE_STEPSIZE * m_physicsiterations)*2)* 10); | ||
833 | |||
834 | |||
827 | while (step_time > 0.0f) | 835 | while (step_time > 0.0f) |
828 | { | 836 | { |
837 | |||
829 | foreach (OdeCharacter actor in _characters) | 838 | foreach (OdeCharacter actor in _characters) |
830 | { | 839 | { |
831 | actor.Move(timeStep); | 840 | actor.Move(timeStep); |
@@ -875,6 +884,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
875 | } | 884 | } |
876 | } | 885 | } |
877 | } | 886 | } |
887 | return fps; | ||
878 | } | 888 | } |
879 | 889 | ||
880 | public override void GetResults() | 890 | public override void GetResults() |
diff --git a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs index 4355c5e..efc30fe 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs | |||
@@ -169,10 +169,12 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
169 | 169 | ||
170 | } | 170 | } |
171 | 171 | ||
172 | public override void Simulate(float timeStep) | 172 | public override float Simulate(float timeStep) |
173 | { | 173 | { |
174 | float fps = 0; | ||
174 | for (int i = 0; i < _characters.Count; ++i) | 175 | for (int i = 0; i < _characters.Count; ++i) |
175 | { | 176 | { |
177 | fps++; | ||
176 | POSCharacter character = _characters[i]; | 178 | POSCharacter character = _characters[i]; |
177 | 179 | ||
178 | float oldposX = character.Position.X; | 180 | float oldposX = character.Position.X; |
@@ -286,6 +288,7 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
286 | character._velocity.Z = (character.Position.Z - oldposZ) / timeStep; | 288 | character._velocity.Z = (character.Position.Z - oldposZ) / timeStep; |
287 | } | 289 | } |
288 | } | 290 | } |
291 | return fps; | ||
289 | } | 292 | } |
290 | 293 | ||
291 | public override void GetResults() | 294 | public override void GetResults() |
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs index 5d22eeb..bc28626 100644 --- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs +++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs | |||
@@ -139,8 +139,9 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
139 | { | 139 | { |
140 | 140 | ||
141 | } | 141 | } |
142 | public override void Simulate(float timeStep) | 142 | public override float Simulate(float timeStep) |
143 | { | 143 | { |
144 | float fps = 0f; | ||
144 | try | 145 | try |
145 | { | 146 | { |
146 | foreach (PhysXCharacter actor in _characters) | 147 | foreach (PhysXCharacter actor in _characters) |
@@ -160,6 +161,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
160 | { | 161 | { |
161 | Console.WriteLine(e.Message); | 162 | Console.WriteLine(e.Message); |
162 | } | 163 | } |
164 | return fps; | ||
163 | } | 165 | } |
164 | 166 | ||
165 | public override void GetResults() | 167 | public override void GetResults() |