found core hack to fix modules interdependencies RegionLoaded is not that obvius

avinationmerge
UbitUmarov 2015-09-09 17:55:46 +01:00
parent 8571736ff3
commit e1a8125b4f
2 changed files with 38 additions and 25 deletions

View File

@ -78,10 +78,19 @@ namespace OpenSim.Region.PhysicsModule.UbitOde
public void RemoveRegion(Scene scene) public void RemoveRegion(Scene scene)
{ {
if (!m_Enabled || m_scene == null)
return;
m_scene.Dispose();
m_scene = null;
} }
public void RegionLoaded(Scene scene) public void RegionLoaded(Scene scene)
{ {
if (!m_Enabled || m_scene == null)
return;
m_scene.RegionLoaded();
} }
#endregion #endregion
} }

View File

@ -312,19 +312,21 @@ namespace OpenSim.Region.PhysicsModule.UbitOde
private ODERayCastRequestManager m_rayCastManager; private ODERayCastRequestManager m_rayCastManager;
public ODEMeshWorker m_meshWorker; public ODEMeshWorker m_meshWorker;
/* maybe needed if ode uses tls /* maybe needed if ode uses tls
private void checkThread() private void checkThread()
{ {
int th = Thread.CurrentThread.ManagedThreadId;
if(th != threadid)
{
threadid = th;
d.AllocateODEDataForThread(~0U);
}
}
*/
IConfig physicsconfig = null;
int th = Thread.CurrentThread.ManagedThreadId;
if(th != threadid)
{
threadid = th;
d.AllocateODEDataForThread(~0U);
}
}
*/
public ODEScene(Scene pscene, IConfigSource psourceconfig, string pname, bool podeUbitLib) public ODEScene(Scene pscene, IConfigSource psourceconfig, string pname, bool podeUbitLib)
{ {
OdeLock = new Object(); OdeLock = new Object();
@ -336,6 +338,19 @@ namespace OpenSim.Region.PhysicsModule.UbitOde
m_odeUbitLib = podeUbitLib; m_odeUbitLib = podeUbitLib;
m_frameWorkScene = pscene; m_frameWorkScene = pscene;
m_frameWorkScene.RegisterModuleInterface<PhysicsScene>(this);
Initialization();
base.Initialise(m_frameWorkScene.PhysicsRequestAsset,
(m_frameWorkScene.Heightmap != null ? m_frameWorkScene.Heightmap.GetFloatsSerialised() : new float[m_frameWorkScene.RegionInfo.RegionSizeX * m_frameWorkScene.RegionInfo.RegionSizeY]),
(float)m_frameWorkScene.RegionInfo.RegionSettings.WaterHeight);
}
// core hack this just means all modules where loaded
// so now we can look for dependencies
public void RegionLoaded()
{
mesher = m_frameWorkScene.RequestModuleInterface<IMesher>(); mesher = m_frameWorkScene.RequestModuleInterface<IMesher>();
if (mesher == null) if (mesher == null)
{ {
@ -343,18 +358,9 @@ namespace OpenSim.Region.PhysicsModule.UbitOde
return; return;
} }
m_frameWorkScene.RegisterModuleInterface<PhysicsScene>(this); m_meshWorker = new ODEMeshWorker(this, m_log, mesher, physicsconfig);
Initialization();
base.Initialise(m_frameWorkScene.PhysicsRequestAsset,
(m_frameWorkScene.Heightmap != null ? m_frameWorkScene.Heightmap.GetFloatsSerialised() : new float[m_frameWorkScene.RegionInfo.RegionSizeX * m_frameWorkScene.RegionInfo.RegionSizeY]),
(float)m_frameWorkScene.RegionInfo.RegionSettings.WaterHeight);
m_frameWorkScene.PhysicsEnabled = true; m_frameWorkScene.PhysicsEnabled = true;
} }
/// <summary> /// <summary>
/// Initiailizes the scene /// Initiailizes the scene
/// Sets many properties that ODE requires to be stable /// Sets many properties that ODE requires to be stable
@ -454,7 +460,7 @@ namespace OpenSim.Region.PhysicsModule.UbitOde
int contactsPerCollision = 80; int contactsPerCollision = 80;
IConfig physicsconfig = null; physicsconfig = null;
if (m_config != null) if (m_config != null)
{ {
@ -505,8 +511,6 @@ namespace OpenSim.Region.PhysicsModule.UbitOde
d.WorldSetContactSurfaceLayer(world, contactsurfacelayer); d.WorldSetContactSurfaceLayer(world, contactsurfacelayer);
d.WorldSetContactMaxCorrectingVel(world, 60.0f); d.WorldSetContactMaxCorrectingVel(world, 60.0f);
m_meshWorker = new ODEMeshWorker(this, m_log, mesher, physicsconfig);
HalfOdeStep = ODE_STEPSIZE * 0.5f; HalfOdeStep = ODE_STEPSIZE * 0.5f;
odetimestepMS = (int)(1000.0f * ODE_STEPSIZE + 0.5f); odetimestepMS = (int)(1000.0f * ODE_STEPSIZE + 0.5f);