* 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 Gerhard
0.6.1-post-fixes
Justin Clarke Casey 2008-12-15 18:39:54 +00:00
parent 2e288fade1
commit 3b0db66b92
11 changed files with 68 additions and 29 deletions

View File

@ -518,16 +518,16 @@ namespace OpenSim
# 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>
/// 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>
/// Currently this is always OK if the simulator is still listening for connections on its HTTP service
protected class SimStatusHandler : IStreamedRequestHandler
{
public byte[] Handle(string path, Stream request,

View File

@ -71,7 +71,17 @@ namespace OpenSim.Region.ClientStack
protected SceneManager m_sceneManager = new SceneManager();
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 ClientStackManager CreateClientStackManager();
protected abstract Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
@ -99,13 +109,24 @@ namespace OpenSim.Region.ClientStack
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 = new PhysicsPluginManager();
physicsPluginManager.LoadPluginsFromAssemblies("Physics");
return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config);
return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config, osSceneIdentifier);
}
/// <summary>
@ -153,7 +174,7 @@ namespace OpenSim.Region.ClientStack
scene.LoadWorldMap();
scene.PhysicsScene = GetPhysicsScene();
scene.PhysicsScene = GetPhysicsScene(scene.RegionInfo.RegionName);
scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
scene.PhysicsScene.SetWaterLevel((float)regionInfo.RegionSettings.WaterHeight);

View File

@ -71,7 +71,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests
PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager();
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;
}

View File

@ -47,9 +47,9 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
return true;
}
public PhysicsScene GetScene()
public PhysicsScene GetScene(string sceneIdentifier)
{
return new BasicScene();
return new BasicScene(sceneIdentifier);
}
public string GetName()
@ -67,8 +67,11 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
private List<BasicActor> _actors = new List<BasicActor>();
private float[] _heightMap;
public BasicScene()
string sceneIdentifier;
public BasicScene(string _sceneIdentifier)
{
sceneIdentifier = _sceneIdentifier;
}
public override void Initialise(IMesher meshmerizer, IConfigSource config)

View File

@ -212,11 +212,11 @@ namespace OpenSim.Region.Physics.BulletXPlugin
return true;
}
public PhysicsScene GetScene()
public PhysicsScene GetScene(string sceneIdentifier)
{
if (_mScene == null)
{
_mScene = new BulletXScene();
_mScene = new BulletXScene(sceneIdentifier);
}
return (_mScene);
}
@ -493,6 +493,12 @@ namespace OpenSim.Region.Physics.BulletXPlugin
public IMesher mesher;
// private IConfigSource m_config;
String identifier;
public BulletXScene(String sceneIdentifier)
{
identifier = sceneIdentifier;
}
public static float Gravity
{

View File

@ -65,7 +65,7 @@ namespace OpenSim.Region.Physics.Manager
/// <param name="meshEngineName"></param>
/// <param name="config"></param>
/// <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))
{
@ -92,7 +92,7 @@ namespace OpenSim.Region.Physics.Manager
if (_PhysPlugins.ContainsKey(physEngineName))
{
m_log.Info("[PHYSICS]: creating " + physEngineName);
PhysicsScene result = _PhysPlugins[physEngineName].GetScene();
PhysicsScene result = _PhysPlugins[physEngineName].GetScene(regionName);
result.Initialise(meshEngine, config);
return result;
}
@ -226,7 +226,7 @@ namespace OpenSim.Region.Physics.Manager
public interface IPhysicsPlugin
{
bool Init();
PhysicsScene GetScene();
PhysicsScene GetScene(String sceneIdentifier);
string GetName();
void Dispose();
}

View File

@ -49,7 +49,7 @@ namespace OpenSim.Region.Physics.OdePlugin
// Loading Zero Mesher
imp = new ZeroMesherPlugin();
// Getting Physics Scene
ps = cbt.GetScene();
ps = cbt.GetScene("test");
// Initializing Physics Scene.
ps.Initialise(imp.GetMesher(),null);
float[] _heightmap = new float[256 * 256];

View File

@ -66,7 +66,7 @@ namespace OpenSim.Region.Physics.OdePlugin
return true;
}
public PhysicsScene GetScene()
public PhysicsScene GetScene(String sceneIdentifier)
{
if (_mScene == null)
{
@ -74,7 +74,7 @@ namespace OpenSim.Region.Physics.OdePlugin
// http://opensimulator.org/mantis/view.php?id=2750).
d.InitODE();
_mScene = new OdeScene(ode);
_mScene = new OdeScene(ode, sceneIdentifier);
}
return (_mScene);
}
@ -123,7 +123,7 @@ namespace OpenSim.Region.Physics.OdePlugin
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>();
CollisionLocker ode;
@ -270,8 +270,11 @@ namespace OpenSim.Region.Physics.OdePlugin
/// Sets many properties that ODE requires to be stable
/// These settings need to be tweaked 'exactly' right or weird stuff happens.
/// </summary>
public OdeScene(CollisionLocker dode)
public OdeScene(CollisionLocker dode, string sceneIdentifier)
{
m_log
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + sceneIdentifier);
OdeLock = new Object();
ode = dode;
nearCallback = near;

View File

@ -47,9 +47,9 @@ namespace OpenSim.Region.Physics.POSPlugin
return true;
}
public PhysicsScene GetScene()
public PhysicsScene GetScene(string sceneIdentifier)
{
return new POSScene();
return new POSScene(sceneIdentifier);
}
public string GetName()

View File

@ -41,8 +41,11 @@ namespace OpenSim.Region.Physics.POSPlugin
private float[] _heightMap;
private const float gravity = -9.8f;
public POSScene()
string sceneIdentifier;
public POSScene(String _sceneIdentifier)
{
sceneIdentifier = _sceneIdentifier;
}
public override void Initialise(IMesher meshmerizer, IConfigSource config)

View File

@ -51,11 +51,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin
return true;
}
public PhysicsScene GetScene()
public PhysicsScene GetScene(string sceneIdentifier)
{
if (_mScene == null)
{
_mScene = new PhysXScene();
_mScene = new PhysXScene(sceneIdentifier);
}
return (_mScene);
}
@ -78,8 +78,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin
private NxPhysicsSDK mySdk;
private NxScene scene;
public PhysXScene()
string sceneIdentifier;
public PhysXScene(string _sceneIdentifier)
{
sceneIdentifier = _sceneIdentifier;
mySdk = NxPhysicsSDK.CreateSDK();
Console.WriteLine("Sdk created - now creating scene");
scene = mySdk.CreateScene();