From 134d4300f0b6e9b0df0326cfe0b5df9f41f42865 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 31 Aug 2015 13:02:51 -0700 Subject: All physics plugins are now region modules. Compiles but doesn't run. --- .../BasicPhysics/BasicPhysicsScene.cs | 61 ++++++++++++++++++---- 1 file changed, 52 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs') diff --git a/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs index 8b9e65a..5ec0f85 100644 --- a/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs +++ b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs @@ -28,9 +28,12 @@ using System; using System.Collections.Generic; using Nini.Config; +using Mono.Addins; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Region.PhysicsModules.SharedBase; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Interfaces; namespace OpenSim.Region.PhysicsModule.BasicPhysics { @@ -41,32 +44,71 @@ namespace OpenSim.Region.PhysicsModule.BasicPhysics /// Not useful for anything at the moment apart from some regression testing in other components where some form /// of physics plugin is needed. /// - public class BasicScene : PhysicsScene + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BasicPhysicsScene")] + public class BasicScene : PhysicsScene, INonSharedRegionModule { private List _actors = new List(); private List _prims = new List(); private float[] _heightMap; private Vector3 m_regionExtent; + private bool m_Enabled = false; + //protected internal string sceneIdentifier; + #region INonSharedRegionModule + public string Name + { + get { return "basicphysics"; } + } - public BasicScene(string engineType, string _sceneIdentifier) + public Type ReplaceableInterface { - EngineType = engineType; - Name = EngineType + "/" + _sceneIdentifier; - //sceneIdentifier = _sceneIdentifier; + get { return null; } } - public override void Initialise(IMesher meshmerizer, IConfigSource config) + public void Initialise(IConfigSource source) { - throw new Exception("Should not be called."); + // TODO: Move this out of Startup + IConfig config = source.Configs["Startup"]; + if (config != null) + { + string physics = config.GetString("physics", string.Empty); + if (physics == Name) + m_Enabled = true; + } + } - public override void Initialise(IMesher meshmerizer, IConfigSource config, Vector3 regionExtent) + public void Close() { - m_regionExtent = regionExtent; } + public void AddRegion(Scene scene) + { + if (!m_Enabled) + return; + + EngineType = Name; + PhysicsSceneName = EngineType + "/" + scene.RegionInfo.RegionName; + + scene.RegisterModuleInterface(this); + m_regionExtent = new Vector3(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, scene.RegionInfo.RegionSizeZ); + + } + + public void RemoveRegion(Scene scene) + { + if (!m_Enabled) + return; + } + + public void RegionLoaded(Scene scene) + { + if (!m_Enabled) + return; + } + #endregion + public override void Dispose() {} public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, @@ -206,5 +248,6 @@ namespace OpenSim.Region.PhysicsModule.BasicPhysics Dictionary returncolliders = new Dictionary(); return returncolliders; } + } } -- cgit v1.1