* Apply http://opensimulator.org/mantis/view.php?id=2775 with small tweaks
* This pushes an identifier for the OpenSim scene to the physics scene. This allows log messages from the physics scene to identify which OpenSim scene they relate to. * Thanks Gerhard0.6.1-post-fixes
parent
2e288fade1
commit
3b0db66b92
|
@ -518,16 +518,16 @@ namespace OpenSim
|
||||||
|
|
||||||
# region Setup methods
|
# region Setup methods
|
||||||
|
|
||||||
protected override PhysicsScene GetPhysicsScene()
|
protected override PhysicsScene GetPhysicsScene(string osSceneIdentifier)
|
||||||
{
|
{
|
||||||
return GetPhysicsScene(m_configSettings.PhysicsEngine, m_configSettings.MeshEngineName, m_config.Source);
|
return GetPhysicsScene(
|
||||||
|
m_configSettings.PhysicsEngine, m_configSettings.MeshEngineName, m_config.Source, osSceneIdentifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handler to supply the current status of this sim
|
/// Handler to supply the current status of this sim
|
||||||
///
|
|
||||||
/// Currently this is always OK if the simulator is still listening for connections on its HTTP service
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// Currently this is always OK if the simulator is still listening for connections on its HTTP service
|
||||||
protected class SimStatusHandler : IStreamedRequestHandler
|
protected class SimStatusHandler : IStreamedRequestHandler
|
||||||
{
|
{
|
||||||
public byte[] Handle(string path, Stream request,
|
public byte[] Handle(string path, Stream request,
|
||||||
|
|
|
@ -71,7 +71,17 @@ namespace OpenSim.Region.ClientStack
|
||||||
protected SceneManager m_sceneManager = new SceneManager();
|
protected SceneManager m_sceneManager = new SceneManager();
|
||||||
|
|
||||||
protected abstract void Initialize();
|
protected abstract void Initialize();
|
||||||
protected abstract PhysicsScene GetPhysicsScene();
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get a new physics scene.
|
||||||
|
/// </summary>
|
||||||
|
///
|
||||||
|
/// <param name="osSceneIdentifier">
|
||||||
|
/// The name of the OpenSim scene this physics scene is serving. This will be used in log messages.
|
||||||
|
/// </param>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected abstract PhysicsScene GetPhysicsScene(string osSceneIdentifier);
|
||||||
|
|
||||||
protected abstract StorageManager CreateStorageManager();
|
protected abstract StorageManager CreateStorageManager();
|
||||||
protected abstract ClientStackManager CreateClientStackManager();
|
protected abstract ClientStackManager CreateClientStackManager();
|
||||||
protected abstract Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
|
protected abstract Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
|
||||||
|
@ -99,13 +109,24 @@ namespace OpenSim.Region.ClientStack
|
||||||
m_httpServer.Start();
|
m_httpServer.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected PhysicsScene GetPhysicsScene(string engine, string meshEngine, IConfigSource config)
|
/// <summary>
|
||||||
|
/// Get a new physics scene.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="engine">The name of the physics engine to use</param>
|
||||||
|
/// <param name="meshEngine">The name of the mesh engine to use</param>
|
||||||
|
/// <param name="config">The configuration data to pass to the physics and mesh engines</param>
|
||||||
|
/// <param name="osSceneIdentifier">
|
||||||
|
/// The name of the OpenSim scene this physics scene is serving. This will be used in log messages.
|
||||||
|
/// </param>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected PhysicsScene GetPhysicsScene(
|
||||||
|
string engine, string meshEngine, IConfigSource config, string osSceneIdentifier)
|
||||||
{
|
{
|
||||||
PhysicsPluginManager physicsPluginManager;
|
PhysicsPluginManager physicsPluginManager;
|
||||||
physicsPluginManager = new PhysicsPluginManager();
|
physicsPluginManager = new PhysicsPluginManager();
|
||||||
physicsPluginManager.LoadPluginsFromAssemblies("Physics");
|
physicsPluginManager.LoadPluginsFromAssemblies("Physics");
|
||||||
|
|
||||||
return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config);
|
return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config, osSceneIdentifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -153,7 +174,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
|
|
||||||
scene.LoadWorldMap();
|
scene.LoadWorldMap();
|
||||||
|
|
||||||
scene.PhysicsScene = GetPhysicsScene();
|
scene.PhysicsScene = GetPhysicsScene(scene.RegionInfo.RegionName);
|
||||||
scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
|
scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
|
||||||
scene.PhysicsScene.SetWaterLevel((float)regionInfo.RegionSettings.WaterHeight);
|
scene.PhysicsScene.SetWaterLevel((float)regionInfo.RegionSettings.WaterHeight);
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests
|
||||||
|
|
||||||
PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager();
|
PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager();
|
||||||
physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll");
|
physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll");
|
||||||
testScene.PhysicsScene = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", configSource);
|
testScene.PhysicsScene = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", configSource, "test");
|
||||||
|
|
||||||
return testScene;
|
return testScene;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,9 +47,9 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PhysicsScene GetScene()
|
public PhysicsScene GetScene(string sceneIdentifier)
|
||||||
{
|
{
|
||||||
return new BasicScene();
|
return new BasicScene(sceneIdentifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetName()
|
public string GetName()
|
||||||
|
@ -67,8 +67,11 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||||
private List<BasicActor> _actors = new List<BasicActor>();
|
private List<BasicActor> _actors = new List<BasicActor>();
|
||||||
private float[] _heightMap;
|
private float[] _heightMap;
|
||||||
|
|
||||||
public BasicScene()
|
string sceneIdentifier;
|
||||||
|
|
||||||
|
public BasicScene(string _sceneIdentifier)
|
||||||
{
|
{
|
||||||
|
sceneIdentifier = _sceneIdentifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Initialise(IMesher meshmerizer, IConfigSource config)
|
public override void Initialise(IMesher meshmerizer, IConfigSource config)
|
||||||
|
|
|
@ -212,11 +212,11 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PhysicsScene GetScene()
|
public PhysicsScene GetScene(string sceneIdentifier)
|
||||||
{
|
{
|
||||||
if (_mScene == null)
|
if (_mScene == null)
|
||||||
{
|
{
|
||||||
_mScene = new BulletXScene();
|
_mScene = new BulletXScene(sceneIdentifier);
|
||||||
}
|
}
|
||||||
return (_mScene);
|
return (_mScene);
|
||||||
}
|
}
|
||||||
|
@ -493,6 +493,12 @@ namespace OpenSim.Region.Physics.BulletXPlugin
|
||||||
public IMesher mesher;
|
public IMesher mesher;
|
||||||
// private IConfigSource m_config;
|
// private IConfigSource m_config;
|
||||||
|
|
||||||
|
String identifier;
|
||||||
|
|
||||||
|
public BulletXScene(String sceneIdentifier)
|
||||||
|
{
|
||||||
|
identifier = sceneIdentifier;
|
||||||
|
}
|
||||||
|
|
||||||
public static float Gravity
|
public static float Gravity
|
||||||
{
|
{
|
||||||
|
|
|
@ -65,7 +65,7 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
/// <param name="meshEngineName"></param>
|
/// <param name="meshEngineName"></param>
|
||||||
/// <param name="config"></param>
|
/// <param name="config"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public PhysicsScene GetPhysicsScene(string physEngineName, string meshEngineName, IConfigSource config)
|
public PhysicsScene GetPhysicsScene(string physEngineName, string meshEngineName, IConfigSource config, string regionName)
|
||||||
{
|
{
|
||||||
if (String.IsNullOrEmpty(physEngineName))
|
if (String.IsNullOrEmpty(physEngineName))
|
||||||
{
|
{
|
||||||
|
@ -92,7 +92,7 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
if (_PhysPlugins.ContainsKey(physEngineName))
|
if (_PhysPlugins.ContainsKey(physEngineName))
|
||||||
{
|
{
|
||||||
m_log.Info("[PHYSICS]: creating " + physEngineName);
|
m_log.Info("[PHYSICS]: creating " + physEngineName);
|
||||||
PhysicsScene result = _PhysPlugins[physEngineName].GetScene();
|
PhysicsScene result = _PhysPlugins[physEngineName].GetScene(regionName);
|
||||||
result.Initialise(meshEngine, config);
|
result.Initialise(meshEngine, config);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -226,7 +226,7 @@ namespace OpenSim.Region.Physics.Manager
|
||||||
public interface IPhysicsPlugin
|
public interface IPhysicsPlugin
|
||||||
{
|
{
|
||||||
bool Init();
|
bool Init();
|
||||||
PhysicsScene GetScene();
|
PhysicsScene GetScene(String sceneIdentifier);
|
||||||
string GetName();
|
string GetName();
|
||||||
void Dispose();
|
void Dispose();
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
// Loading Zero Mesher
|
// Loading Zero Mesher
|
||||||
imp = new ZeroMesherPlugin();
|
imp = new ZeroMesherPlugin();
|
||||||
// Getting Physics Scene
|
// Getting Physics Scene
|
||||||
ps = cbt.GetScene();
|
ps = cbt.GetScene("test");
|
||||||
// Initializing Physics Scene.
|
// Initializing Physics Scene.
|
||||||
ps.Initialise(imp.GetMesher(),null);
|
ps.Initialise(imp.GetMesher(),null);
|
||||||
float[] _heightmap = new float[256 * 256];
|
float[] _heightmap = new float[256 * 256];
|
||||||
|
|
|
@ -66,7 +66,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PhysicsScene GetScene()
|
public PhysicsScene GetScene(String sceneIdentifier)
|
||||||
{
|
{
|
||||||
if (_mScene == null)
|
if (_mScene == null)
|
||||||
{
|
{
|
||||||
|
@ -74,7 +74,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
// http://opensimulator.org/mantis/view.php?id=2750).
|
// http://opensimulator.org/mantis/view.php?id=2750).
|
||||||
d.InitODE();
|
d.InitODE();
|
||||||
|
|
||||||
_mScene = new OdeScene(ode);
|
_mScene = new OdeScene(ode, sceneIdentifier);
|
||||||
}
|
}
|
||||||
return (_mScene);
|
return (_mScene);
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
public class OdeScene : PhysicsScene
|
public class OdeScene : PhysicsScene
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private ILog m_log;
|
||||||
// private Dictionary<string, sCollisionData> m_storedCollisions = new Dictionary<string, sCollisionData>();
|
// private Dictionary<string, sCollisionData> m_storedCollisions = new Dictionary<string, sCollisionData>();
|
||||||
|
|
||||||
CollisionLocker ode;
|
CollisionLocker ode;
|
||||||
|
@ -270,8 +270,11 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
/// Sets many properties that ODE requires to be stable
|
/// Sets many properties that ODE requires to be stable
|
||||||
/// These settings need to be tweaked 'exactly' right or weird stuff happens.
|
/// These settings need to be tweaked 'exactly' right or weird stuff happens.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public OdeScene(CollisionLocker dode)
|
public OdeScene(CollisionLocker dode, string sceneIdentifier)
|
||||||
{
|
{
|
||||||
|
m_log
|
||||||
|
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + sceneIdentifier);
|
||||||
|
|
||||||
OdeLock = new Object();
|
OdeLock = new Object();
|
||||||
ode = dode;
|
ode = dode;
|
||||||
nearCallback = near;
|
nearCallback = near;
|
||||||
|
|
|
@ -47,9 +47,9 @@ namespace OpenSim.Region.Physics.POSPlugin
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PhysicsScene GetScene()
|
public PhysicsScene GetScene(string sceneIdentifier)
|
||||||
{
|
{
|
||||||
return new POSScene();
|
return new POSScene(sceneIdentifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetName()
|
public string GetName()
|
||||||
|
|
|
@ -41,8 +41,11 @@ namespace OpenSim.Region.Physics.POSPlugin
|
||||||
private float[] _heightMap;
|
private float[] _heightMap;
|
||||||
private const float gravity = -9.8f;
|
private const float gravity = -9.8f;
|
||||||
|
|
||||||
public POSScene()
|
string sceneIdentifier;
|
||||||
|
|
||||||
|
public POSScene(String _sceneIdentifier)
|
||||||
{
|
{
|
||||||
|
sceneIdentifier = _sceneIdentifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Initialise(IMesher meshmerizer, IConfigSource config)
|
public override void Initialise(IMesher meshmerizer, IConfigSource config)
|
||||||
|
|
|
@ -51,11 +51,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PhysicsScene GetScene()
|
public PhysicsScene GetScene(string sceneIdentifier)
|
||||||
{
|
{
|
||||||
if (_mScene == null)
|
if (_mScene == null)
|
||||||
{
|
{
|
||||||
_mScene = new PhysXScene();
|
_mScene = new PhysXScene(sceneIdentifier);
|
||||||
}
|
}
|
||||||
return (_mScene);
|
return (_mScene);
|
||||||
}
|
}
|
||||||
|
@ -78,8 +78,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin
|
||||||
private NxPhysicsSDK mySdk;
|
private NxPhysicsSDK mySdk;
|
||||||
private NxScene scene;
|
private NxScene scene;
|
||||||
|
|
||||||
public PhysXScene()
|
string sceneIdentifier;
|
||||||
|
public PhysXScene(string _sceneIdentifier)
|
||||||
{
|
{
|
||||||
|
sceneIdentifier = _sceneIdentifier;
|
||||||
|
|
||||||
mySdk = NxPhysicsSDK.CreateSDK();
|
mySdk = NxPhysicsSDK.CreateSDK();
|
||||||
Console.WriteLine("Sdk created - now creating scene");
|
Console.WriteLine("Sdk created - now creating scene");
|
||||||
scene = mySdk.CreateScene();
|
scene = mySdk.CreateScene();
|
||||||
|
|
Loading…
Reference in New Issue