Make physics engines finish internal representation of loaded prims before starting simulation so it does start for all at same time. Currently only in use by ubOde

avinationmerge
UbitUmarov 2015-10-22 17:34:28 +01:00
parent 7aaa84515f
commit 7cb6ecb9f5
4 changed files with 13 additions and 6 deletions

View File

@ -1523,8 +1523,8 @@ namespace OpenSim.Region.Framework.Scenes
m_heartbeatThread = null; m_heartbeatThread = null;
} }
// m_sceneGraph.PreparePhysicsSimulation(); // tell physics to finish building actor
m_sceneGraph.ProcessPhysicsPreSimulation();
m_heartbeatThread m_heartbeatThread
= WorkManager.StartThread( = WorkManager.StartThread(

View File

@ -222,6 +222,12 @@ namespace OpenSim.Region.Framework.Scenes
return PhysicsScene.Simulate((float)elapsed); return PhysicsScene.Simulate((float)elapsed);
} }
protected internal void ProcessPhysicsPreSimulation()
{
if(PhysicsScene != null)
PhysicsScene.ProcessPreSimulation();
}
protected internal void UpdateScenePresenceMovement() protected internal void UpdateScenePresenceMovement()
{ {
ForEachScenePresence(delegate(ScenePresence presence) ForEachScenePresence(delegate(ScenePresence presence)

View File

@ -290,7 +290,7 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
public abstract void AddPhysicsActorTaint(PhysicsActor prim); public abstract void AddPhysicsActorTaint(PhysicsActor prim);
public virtual void PrepareSimulation() { } public virtual void ProcessPreSimulation() { }
/// <summary> /// <summary>
/// Perform a simulation of the current physics scene over the given timestep. /// Perform a simulation of the current physics scene over the given timestep.

View File

@ -1526,7 +1526,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
} }
// does all pending changes generated during region load process // does all pending changes generated during region load process
public override void PrepareSimulation() public override void ProcessPreSimulation()
{ {
lock (OdeLock) lock (OdeLock)
{ {
@ -1541,7 +1541,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
int donechanges = 0; int donechanges = 0;
if (ChangesQueue.Count > 0) if (ChangesQueue.Count > 0)
{ {
m_log.InfoFormat("[ODE] start processing pending actor operations"); m_log.InfoFormat("[ubOde] start processing pending actor operations");
int tstart = Util.EnvironmentTickCount(); int tstart = Util.EnvironmentTickCount();
while (ChangesQueue.Dequeue(out item)) while (ChangesQueue.Dequeue(out item))
@ -1564,8 +1564,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde
donechanges++; donechanges++;
} }
int time = Util.EnvironmentTickCountSubtract(tstart); int time = Util.EnvironmentTickCountSubtract(tstart);
m_log.InfoFormat("[ODE] finished {0} operations in {1}ms", donechanges, time); m_log.InfoFormat("[ubOde] finished {0} operations in {1}ms", donechanges, time);
} }
m_log.InfoFormat("[ubOde] {0} prim actors loaded",_prims.Count);
} }
} }