From 11194209df8a29f5103e6e34104eae7834f3280a Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 31 Aug 2015 14:09:15 -0700 Subject: First commit where physics work as region module. Moved all physics dlls out of Physics and into bin directly, so they can be found by the module loader. Removed call to PhysicsPluginManager. --- .../BasicPhysics/BasicPhysicsScene.cs | 1 + OpenSim/Region/PhysicsModules/BulletS/BSScene.cs | 5 +++- .../BulletS/Tests/BulletSimTestsUtil.cs | 27 +++++++++++++++------- OpenSim/Region/PhysicsModules/Ode/OdeScene.cs | 2 ++ OpenSim/Region/PhysicsModules/POS/POSScene.cs | 2 ++ .../PhysicsModules/SharedBase/PhysicsScene.cs | 8 +++++++ 6 files changed, 36 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/PhysicsModules') diff --git a/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs index 5ec0f85..f7760c5 100644 --- a/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs +++ b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs @@ -93,6 +93,7 @@ namespace OpenSim.Region.PhysicsModule.BasicPhysics scene.RegisterModuleInterface(this); m_regionExtent = new Vector3(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, scene.RegionInfo.RegionSizeZ); + base.Initialise(scene.PhysicsRequestAsset, scene.Heightmap.GetFloatsSerialised(), (float)scene.RegionInfo.RegionSettings.WaterHeight); } diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs b/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs index 26af343..b412561 100644 --- a/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs @@ -248,7 +248,10 @@ namespace OpenSim.Region.PhysicsModule.BulletS scene.RegisterModuleInterface(this); Vector3 extent = new Vector3(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, scene.RegionInfo.RegionSizeZ); - Initialise(m_Config, extent); + Initialise(m_Config, extent); + + base.Initialise(scene.PhysicsRequestAsset, scene.Heightmap.GetFloatsSerialised(), (float)scene.RegionInfo.RegionSettings.WaterHeight); + } public void RemoveRegion(Scene scene) diff --git a/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTestsUtil.cs b/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTestsUtil.cs index 34c0571..d86c841 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTestsUtil.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTestsUtil.cs @@ -35,6 +35,7 @@ using Nini.Config; using OpenSim.Framework; using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Region.PhysicsModules.Meshing; +using OpenSim.Region.Framework.Interfaces; using OpenMetaverse; @@ -78,22 +79,32 @@ public static class BulletSimTestsUtil bulletSimConfig.Set("VehicleLoggingEnabled","True"); } - PhysicsPluginManager physicsPluginManager; - physicsPluginManager = new PhysicsPluginManager(); - physicsPluginManager.LoadPluginsFromAssemblies("Physics"); - Vector3 regionExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight); - PhysicsScene pScene = physicsPluginManager.GetPhysicsScene( - "BulletSim", "Meshmerizer", openSimINI, "BSTestRegion", regionExtent); + //PhysicsScene pScene = physicsPluginManager.GetPhysicsScene( + // "BulletSim", "Meshmerizer", openSimINI, "BSTestRegion", regionExtent); + RegionInfo info = new RegionInfo(); + info.RegionName = "BSTestRegion"; + info.RegionSizeX = info.RegionSizeY = info.RegionSizeZ = Constants.RegionSize; + OpenSim.Region.Framework.Scenes.Scene scene = new OpenSim.Region.Framework.Scenes.Scene(info); + + IMesher mesher = new OpenSim.Region.PhysicsModules.Meshing.Meshmerizer(); + INonSharedRegionModule mod = mesher as INonSharedRegionModule; + mod.Initialise(openSimINI); + mod.AddRegion(scene); + mod.RegionLoaded(scene); - BSScene bsScene = pScene as BSScene; + BSScene pScene = new BSScene(); + mod = (pScene as INonSharedRegionModule); + mod.Initialise(openSimINI); + mod.AddRegion(scene); + mod.RegionLoaded(scene); // Since the asset requestor is not initialized, any mesh or sculptie will be a cube. // In the future, add a fake asset fetcher to get meshes and sculpts. // bsScene.RequestAssetMethod = ???; - return bsScene; + return pScene; } } diff --git a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs index 3616200..f090953 100644 --- a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs +++ b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs @@ -585,6 +585,8 @@ namespace OpenSim.Region.PhysicsModule.ODE Vector3 extent = new Vector3(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, scene.RegionInfo.RegionSizeZ); Initialise(); InitialiseFromConfig(m_config); + base.Initialise(scene.PhysicsRequestAsset, scene.Heightmap.GetFloatsSerialised(), (float)scene.RegionInfo.RegionSettings.WaterHeight); + } public void RemoveRegion(Scene scene) diff --git a/OpenSim/Region/PhysicsModules/POS/POSScene.cs b/OpenSim/Region/PhysicsModules/POS/POSScene.cs index 915fa8c..beaa177 100644 --- a/OpenSim/Region/PhysicsModules/POS/POSScene.cs +++ b/OpenSim/Region/PhysicsModules/POS/POSScene.cs @@ -85,6 +85,8 @@ namespace OpenSim.Region.PhysicsModule.POS PhysicsSceneName = EngineType + "/" + scene.RegionInfo.RegionName; scene.RegisterModuleInterface(this); + base.Initialise(scene.PhysicsRequestAsset, scene.Heightmap.GetFloatsSerialised(), (float)scene.RegionInfo.RegionSettings.WaterHeight); + } public void RemoveRegion(Scene scene) diff --git a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs index 247f355..32691fc 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs @@ -117,6 +117,14 @@ namespace OpenSim.Region.PhysicsModules.SharedBase public RequestAssetDelegate RequestAssetMethod { get; set; } + protected void Initialise(RequestAssetDelegate m, float[] terrain, float waterHeight) + { + RequestAssetMethod = m; + SetTerrain(terrain); + SetWaterLevel(waterHeight); + + } + public virtual void TriggerPhysicsBasedRestart() { physicsCrash handler = OnPhysicsCrash; -- cgit v1.1