ubode version now has form managed-unmanaged versions (osGetPhysicsEngineName())

This commit is contained in:
UbitUmarov
2021-12-03 20:31:35 +00:00
parent ee0d6b4507
commit b5d67d08a7
2 changed files with 35 additions and 24 deletions

View File

@@ -15,13 +15,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static Dictionary<Scene, ODEScene> m_scenes = new Dictionary<Scene, ODEScene>();
private bool m_Enabled = false;
ODEScene m_odeScene = null;
private IConfigSource m_config;
private bool OSOdeLib;
private string m_libVersion = string.Empty;
private bool m_Enabled = false;
#region INonSharedRegionModule
#region INonSharedRegionModule
public string Name
{
@@ -55,7 +55,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
throw new Exception("Invalid physics meshing option");
}
m_Enabled = true;
if (Util.IsWindows())
Util.LoadArchSpecificWindowsDll("ode.dll");
@@ -63,14 +62,36 @@ namespace OpenSim.Region.PhysicsModule.ubOde
SafeNativeMethods.InitODE();
string ode_config = SafeNativeMethods.GetConfiguration();
if (ode_config == null || ode_config == "" || !ode_config.Contains("ODE_OPENSIM"))
if (string.IsNullOrEmpty(ode_config))
{
m_log.Error("[ubODE] Native ode library version not supported");
m_Enabled = false;
return;
}
int indx = ode_config.IndexOf("ODE_OPENSIM");
if (indx < 0)
{
m_log.Error("[ubODE] Native ode library version not supported");
return;
}
indx += 12;
if (indx >= ode_config.Length)
{
m_log.Error("[ubODE] Native ode library version not supported");
return;
}
m_libVersion = ode_config.Substring(indx);
if (string.IsNullOrEmpty(m_libVersion))
{
m_log.Error("[ubODE] Native ode library version not supported");
return;
}
m_libVersion.Trim();
if(m_libVersion.StartsWith("OS"))
m_libVersion = m_libVersion.Substring(2);
m_log.InfoFormat("[ubODE] ode library configuration: {0}", ode_config);
OSOdeLib = true;
m_Enabled = true;
}
}
}
@@ -84,10 +105,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
if (!m_Enabled)
return;
if(m_scenes.ContainsKey(scene)) // ???
return;
ODEScene newodescene = new ODEScene(scene, m_config, Name, Version, OSOdeLib);
m_scenes[scene] = newodescene;
m_odeScene = new ODEScene(scene, m_config, Name, Version + "-" + m_libVersion);
}
public void RemoveRegion(Scene scene)
@@ -98,8 +116,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
// a odescene.dispose is called later directly by scene.cs
// since it is seen as a module interface
if(m_scenes.ContainsKey(scene))
m_scenes.Remove(scene);
m_odeScene = null;
}
public void RegionLoaded(Scene scene)
@@ -107,10 +124,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
if (!m_Enabled)
return;
if(m_scenes.ContainsKey(scene))
{
m_scenes[scene].RegionLoaded();
}
if(m_odeScene != null)
m_odeScene.RegionLoaded();
}
#endregion

View File

@@ -167,7 +167,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public bool m_OSOdeLib = false;
public Scene m_frameWorkScene = null;
// private int threadid = 0;
@@ -311,15 +310,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
IConfig physicsconfig = null;
public ODEScene(Scene pscene, IConfigSource psourceconfig, string pname, string pversion, bool pOSOdeLib)
public ODEScene(Scene pscene, IConfigSource psourceconfig, string pname, string pversion)
{
EngineType = pname;
PhysicsSceneName = EngineType + "/" + pscene.RegionInfo.RegionName;
EngineName = pname + " " + pversion;
m_config = psourceconfig;
m_OSOdeLib = pOSOdeLib;
// m_OSOdeLib = false; //debug
m_frameWorkScene = pscene;