* 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.
This commit is contained in:
Teravus Ovares
2007-12-12 06:58:55 +00:00
parent 83f727bb7c
commit 081f4403ea
10 changed files with 335 additions and 34 deletions

View File

@@ -118,8 +118,9 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
{
}
public override void Simulate(float timeStep)
public override float Simulate(float timeStep)
{
float fps = 0;
for (int i = 0; i < _actors.Count; ++i)
{
BasicActor actor = _actors[i];
@@ -164,6 +165,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
actor.Velocity.Z = 0;
}
}
return fps;
}
public override void GetResults()

View File

@@ -515,20 +515,26 @@ namespace OpenSim.Region.Physics.BulletXPlugin
{
}
public override void Simulate(float timeStep)
public override float Simulate(float timeStep)
{
float fps = 0;
lock (BulletXLock)
{
//Try to remove garbage
RemoveForgottenRigidBodies();
//End of remove
MoveAllObjects(timeStep);
fps = (timeStep * simulationSubSteps);
ddWorld.StepSimulation(timeStep, simulationSubSteps, timeStep);
//Extra Heightmap Validation: BulletX's HeightFieldTerrain somestimes doesn't work so fine.
ValidateHeightForAll();
//End heightmap validation.
UpdateKineticsForAll();
}
return fps;
}
private void MoveAllObjects(float timeStep)

View File

@@ -70,7 +70,7 @@ namespace OpenSim.Region.Physics.Manager
PhysicsVector size, Quaternion rotation, bool isPhysical);
public abstract void AddPhysicsActorTaint(PhysicsActor prim);
public abstract void Simulate(float timeStep);
public abstract float Simulate(float timeStep);
public abstract void GetResults();
@@ -126,11 +126,12 @@ namespace OpenSim.Region.Physics.Manager
{
}
public override void Simulate(float timeStep)
public override float Simulate(float timeStep)
{
m_workIndicator = (m_workIndicator + 1)%10;
//MainLog.Instance.SetStatus(m_workIndicator.ToString());
return 0f;
}
public override void GetResults()

View File

@@ -787,9 +787,10 @@ namespace OpenSim.Region.Physics.OdePlugin
}
}
public override void Simulate(float timeStep)
public override float Simulate(float timeStep)
{
float fps = 0;
step_time += timeStep;
@@ -800,32 +801,40 @@ namespace OpenSim.Region.Physics.OdePlugin
if (step_time >= m_SkipFramesAtms)
{
// Instead of trying to catch up, it'll do one physics frame only
step_time = ODE_STEPSIZE;
this.m_physicsiterations = 5;
if (step_time >= m_SkipFramesAtms)
{
// Instead of trying to catch up, it'll do one physics frame only
step_time = ODE_STEPSIZE;
this.m_physicsiterations = 5;
}
else
{
m_physicsiterations = 10;
}
lock (OdeLock)
{
// Process 10 frames if the sim is running normal..
// process 5 frames if the sim is running slow
try{
d.WorldSetQuickStepNumIterations(world, m_physicsiterations);
}
else
catch (System.StackOverflowException)
{
m_physicsiterations = 10;
MainLog.Instance.Error("PHYSICS", "The operating system wasn't able to allocate enough memory for the simulation. Restarting the sim.");
base.TriggerPhysicsBasedRestart();
}
lock (OdeLock)
{
// Process 10 frames if the sim is running normal..
// process 5 frames if the sim is running slow
try{
d.WorldSetQuickStepNumIterations(world, m_physicsiterations);
}
catch (System.StackOverflowException)
{
MainLog.Instance.Error("PHYSICS", "The operating system wasn't able to allocate enough memory for the simulation. Restarting the sim.");
base.TriggerPhysicsBasedRestart();
}
int i = 0;
// Figure out the Frames Per Second we're going at.
fps = (((step_time / ODE_STEPSIZE * m_physicsiterations)*2)* 10);
while (step_time > 0.0f)
{
foreach (OdeCharacter actor in _characters)
{
actor.Move(timeStep);
@@ -875,6 +884,7 @@ namespace OpenSim.Region.Physics.OdePlugin
}
}
}
return fps;
}
public override void GetResults()

View File

@@ -169,10 +169,12 @@ namespace OpenSim.Region.Physics.POSPlugin
}
public override void Simulate(float timeStep)
public override float Simulate(float timeStep)
{
float fps = 0;
for (int i = 0; i < _characters.Count; ++i)
{
fps++;
POSCharacter character = _characters[i];
float oldposX = character.Position.X;
@@ -286,6 +288,7 @@ namespace OpenSim.Region.Physics.POSPlugin
character._velocity.Z = (character.Position.Z - oldposZ) / timeStep;
}
}
return fps;
}
public override void GetResults()

View File

@@ -139,8 +139,9 @@ namespace OpenSim.Region.Physics.PhysXPlugin
{
}
public override void Simulate(float timeStep)
public override float Simulate(float timeStep)
{
float fps = 0f;
try
{
foreach (PhysXCharacter actor in _characters)
@@ -160,6 +161,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
{
Console.WriteLine(e.Message);
}
return fps;
}
public override void GetResults()