* Refactored IConfigSource into Physics plug-ins and Scene. We can get rid of some of the parameters we pass to it's constructor now like, 'm_allowPhysicalPrim', 'seeIntoOtherRegions', etc.. so on

* The main purpose of this is to provide configuration options for ODE and other physics plug-ins that are advanced enough to be able to be configured.
0.6.0-stable
Teravus Ovares 2008-05-14 23:15:25 +00:00
parent e246d6e515
commit 2a988f187e
14 changed files with 49 additions and 19 deletions

View File

@ -29,6 +29,7 @@ using System.Reflection;
using System.Threading;
using log4net;
using Mono.Addins;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Framework.RegionLoader.Filesystem;
using OpenSim.Framework.RegionLoader.Web;

View File

@ -31,6 +31,7 @@ using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Servers;
using OpenSim.Region.Environment;
using OpenSim.Region.Environment.Scenes;
using Nini.Config;
namespace OpenSim.Grid.ScriptServer
{
@ -39,11 +40,12 @@ namespace OpenSim.Grid.ScriptServer
public FakeScene(RegionInfo regInfo, AgentCircuitManager authen,
CommunicationsManager commsMan, SceneCommunicationService sceneGridService,
AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer,
ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, bool sendTasksToChild)
ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, bool sendTasksToChild, IConfigSource config)
: base(
regInfo, authen, commsMan, sceneGridService, assetCach, storeManager, httpServer,
moduleLoader, dumpAssetsToFile, physicalPrim, sendTasksToChild)
moduleLoader, dumpAssetsToFile, physicalPrim, sendTasksToChild, config)
{
}
// What does a scene have to do? :P

View File

@ -96,6 +96,8 @@ namespace OpenSim
protected List<IApplicationPlugin> m_plugins = new List<IApplicationPlugin>();
protected IConfigSource m_finalConfig = null;
protected IniConfigSource m_config;
public IniConfigSource ConfigSource
@ -309,10 +311,10 @@ namespace OpenSim
m_dumpAssetsToFile = standaloneConfig.GetBoolean("dump_assets_to_file", false);
}
//if (!m_sandbox)
//m_SendChildAgentTaskData = false;
m_networkServersInfo.loadFromConfiguration(m_config);
}
private ManualResetEvent WorldHasComeToAnEnd = new ManualResetEvent(false);
@ -622,7 +624,8 @@ namespace OpenSim
return
new Scene(regionInfo, circuitManager, m_commsManager, sceneGridService, m_assetCache,
storageManager, m_httpServer,
m_moduleLoader, m_dumpAssetsToFile, m_physicalPrim, m_see_into_region_from_neighbor);
m_moduleLoader, m_dumpAssetsToFile, m_physicalPrim, m_see_into_region_from_neighbor, m_config);
}
public void handleRestartRegion(RegionInfo whichRegion)
@ -668,7 +671,7 @@ namespace OpenSim
protected override PhysicsScene GetPhysicsScene()
{
return GetPhysicsScene(m_physicsEngine, m_meshEngineName);
return GetPhysicsScene(m_physicsEngine, m_meshEngineName, m_config);
}
/// <summary>

View File

@ -30,6 +30,7 @@ using System.Net;
using System.Reflection;
using libsecondlife;
using log4net;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache;
@ -99,12 +100,12 @@ namespace OpenSim.Region.ClientStack
protected abstract PhysicsScene GetPhysicsScene();
protected abstract StorageManager CreateStorageManager(string connectionstring);
protected PhysicsScene GetPhysicsScene(string engine, string meshEngine)
protected PhysicsScene GetPhysicsScene(string engine, string meshEngine, IConfigSource config)
{
PhysicsPluginManager physicsPluginManager;
physicsPluginManager = new PhysicsPluginManager();
physicsPluginManager.LoadPlugins();
return physicsPluginManager.GetPhysicsScene(engine, meshEngine);
return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config);
}
protected Scene SetupScene(RegionInfo regionInfo, out IClientNetworkServer clientServer)

View File

@ -43,6 +43,7 @@ using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Modules.World.Terrain;
using OpenSim.Region.Environment.Scenes.Scripting;
using OpenSim.Region.Physics.Manager;
using Nini.Config;
using Caps=OpenSim.Framework.Communications.Capabilities.Caps;
using Image=System.Drawing.Image;
using Timer=System.Timers.Timer;
@ -115,6 +116,7 @@ namespace OpenSim.Region.Environment.Scenes
protected IWorldComm m_worldCommModule;
protected IAvatarFactory m_AvatarFactory;
protected IScenePermissions m_permissions;
protected IConfigSource m_config;
// Central Update Loop
@ -135,6 +137,7 @@ namespace OpenSim.Region.Environment.Scenes
private int m_update_terrain = 50;
private int m_update_land = 1;
private int frameMS = 0;
private int physicsMS2 = 0;
private int physicsMS = 0;
@ -223,8 +226,9 @@ namespace OpenSim.Region.Environment.Scenes
public Scene(RegionInfo regInfo, AgentCircuitManager authen,
CommunicationsManager commsMan, SceneCommunicationService sceneGridService,
AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer,
ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, bool SeeIntoRegionFromNeighbor)
ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, bool SeeIntoRegionFromNeighbor, IConfigSource config)
{
m_config = config;
updateLock = new Mutex(false);
m_moduleLoader = moduleLoader;
m_authenticateHandler = authen;

View File

@ -27,6 +27,7 @@
using System.Collections.Generic;
using Axiom.Math;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Region.Physics.Manager;
@ -70,7 +71,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
{
}
public override void Initialise(IMesher meshmerizer)
public override void Initialise(IMesher meshmerizer, IConfigSource config)
{
// Does nothing right now
}

View File

@ -34,6 +34,7 @@ using OpenSim.Framework;
using OpenSim.Region.Physics.Manager;
using XnaDevRu.BulletX;
using XnaDevRu.BulletX.Dynamics;
using Nini.Config;
using AxiomQuaternion = Axiom.Math.Quaternion;
#endregion
@ -483,6 +484,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
internal Dictionary<RigidBody, BulletXPrim> _prims = new Dictionary<RigidBody, BulletXPrim>();
public IMesher mesher;
private IConfigSource m_config;
public static float Gravity
@ -536,9 +538,10 @@ namespace OpenSim.Region.Physics.BulletXPlugin
//this._heightmap = new float[65536];
}
public override void Initialise(IMesher meshmerizer)
public override void Initialise(IMesher meshmerizer, IConfigSource config)
{
mesher = meshmerizer;
m_config = config;
}
public override void Dispose()

View File

@ -29,6 +29,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using Nini.Config;
using log4net;
namespace OpenSim.Region.Physics.Manager
@ -47,7 +48,7 @@ namespace OpenSim.Region.Physics.Manager
{
}
public PhysicsScene GetPhysicsScene(string physEngineName, string meshEngineName)
public PhysicsScene GetPhysicsScene(string physEngineName, string meshEngineName, IConfigSource config)
{
if (String.IsNullOrEmpty(physEngineName))
{
@ -75,7 +76,7 @@ namespace OpenSim.Region.Physics.Manager
{
m_log.Info("[PHYSICS]: creating " + physEngineName);
PhysicsScene result = _PhysPlugins[physEngineName].GetScene();
result.Initialise(meshEngine);
result.Initialise(meshEngine, config);
return result;
}
else

View File

@ -28,6 +28,7 @@
using System.Reflection;
using Axiom.Math;
using log4net;
using Nini.Config;
using OpenSim.Framework;
namespace OpenSim.Region.Physics.Manager
@ -58,7 +59,7 @@ namespace OpenSim.Region.Physics.Manager
}
public abstract void Initialise(IMesher meshmerizer);
public abstract void Initialise(IMesher meshmerizer, IConfigSource config);
public abstract PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size);
@ -92,7 +93,7 @@ namespace OpenSim.Region.Physics.Manager
private static int m_workIndicator;
public override void Initialise(IMesher meshmerizer)
public override void Initialise(IMesher meshmerizer, IConfigSource config)
{
// Does nothing right now
}

View File

@ -27,6 +27,7 @@
using System;
using Axiom.Math;
using Nini.Config;
using NUnit.Framework;
using OpenSim.Framework;
using OpenSim.Region.Physics.Manager;
@ -50,7 +51,7 @@ namespace OpenSim.Region.Physics.OdePlugin
// Getting Physics Scene
ps = cbt.GetScene();
// Initializing Physics Scene.
ps.Initialise(imp.GetMesher());
ps.Initialise(imp.GetMesher(),null);
float[] _heightmap = new float[256 * 256];
for (int i = 0; i<(256*256);i++)
{

View File

@ -32,6 +32,7 @@ using System.Runtime.InteropServices;
using System.Threading;
using Axiom.Math;
using log4net;
using Nini.Config;
using Ode.NET;
using OpenSim.Framework;
using OpenSim.Region.Physics.Manager;
@ -193,6 +194,8 @@ namespace OpenSim.Region.Physics.OdePlugin
public IMesher mesher;
private IConfigSource m_config;
/// <summary>
/// Initiailizes the scene
@ -286,9 +289,10 @@ namespace OpenSim.Region.Physics.OdePlugin
// Initialize the mesh plugin
public override void Initialise(IMesher meshmerizer)
public override void Initialise(IMesher meshmerizer, IConfigSource config)
{
mesher = meshmerizer;
m_config = config;
}
internal void waitForSpaceUnlock(IntPtr space)

View File

@ -28,6 +28,7 @@
using System;
using System.Collections.Generic;
using Axiom.Math;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Region.Physics.Manager;
@ -73,7 +74,7 @@ namespace OpenSim.Region.Physics.POSPlugin
{
}
public override void Initialise(IMesher meshmerizer)
public override void Initialise(IMesher meshmerizer, IConfigSource config)
{
// Does nothing right now
}

View File

@ -27,6 +27,7 @@
using System;
using System.Collections.Generic;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Region.Physics.Manager;
using PhysXWrapper;
@ -84,7 +85,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
scene = mySdk.CreateScene();
}
public override void Initialise(IMesher meshmerizer)
public override void Initialise(IMesher meshmerizer, IConfigSource config)
{
// Does nothing right now
}

View File

@ -505,6 +505,7 @@
<ReferencePath>../../../../bin/</ReferencePath>
<Reference name="System" localCopy="false"/>
<Reference name="Axiom.MathLib.dll" localCopy="false"/>
<Reference name="Nini.dll" />
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Region.Physics.Manager" localCopy="false"/>
<Files>
@ -527,6 +528,7 @@
<ReferencePath>../../../../bin/</ReferencePath>
<Reference name="System" localCopy="false"/>
<Reference name="Axiom.MathLib.dll" localCopy="false"/>
<Reference name="Nini.dll" />
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Region.Physics.Manager" localCopy="false"/>
<Files>
@ -550,6 +552,7 @@
<Reference name="System" localCopy="false"/>
<Reference name="libsecondlife.dll"/>
<Reference name="Axiom.MathLib.dll" localCopy="false"/>
<Reference name="Nini.dll" />
<Reference name="PhysX_Wrapper_Dotnet.dll" localCopy="false"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Region.Physics.Manager" localCopy="false"/>
@ -574,6 +577,7 @@
<Reference name="System" localCopy="false"/>
<Reference name="Axiom.MathLib.dll" localCopy="false"/>
<Reference name="libsecondlife.dll"/>
<Reference name="Nini.dll" />
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Region.Physics.Manager" localCopy="false"/>
@ -602,6 +606,7 @@
<Reference name="System" localCopy="false"/>
<Reference name="libsecondlife.dll"/>
<Reference name="Axiom.MathLib.dll" localCopy="false"/>
<Reference name="Nini.dll" />
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Console" localCopy="false"/>
<Reference name="OpenSim.Region.Physics.Manager" localCopy="false"/>
@ -630,6 +635,7 @@
<Reference name="System" localCopy="false"/>
<Reference name="System.Drawing"/>
<Reference name="libsecondlife.dll"/>
<Reference name="Nini.dll" />
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Region.Physics.Manager" localCopy="false"/>