From 0af2fafddf36009ffe470da106dc6d0ceb3ced10 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 19 Aug 2015 11:04:28 +0100 Subject: add missing regionExtent setup and Scene physicsscene configuration ( not exactly as core) --- OpenSim/Region/Application/OpenSimBase.cs | 9 +++++---- OpenSim/Region/ClientStack/RegionApplicationBase.cs | 8 ++++---- OpenSim/Region/Framework/Scenes/Scene.cs | 6 ++++-- OpenSim/Tests/Common/Helpers/SceneHelpers.cs | 14 ++++++++------ OpenSim/Tests/Common/Mock/TestScene.cs | 5 +++-- 5 files changed, 24 insertions(+), 18 deletions(-) diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index f663c77..e8cf7cc 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -767,7 +767,6 @@ namespace OpenSim clientServer = clientNetworkServers; scene.LoadWorldMap(); - scene.PhysicsScene = GetPhysicsScene(scene.RegionInfo.RegionName); scene.PhysicsScene.RequestAssetMethod = scene.PhysicsRequestAsset; scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); scene.PhysicsScene.SetWaterLevel((float) regionInfo.RegionSettings.WaterHeight); @@ -783,10 +782,12 @@ namespace OpenSim protected override Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, IEstateDataService estateDataService, AgentCircuitManager circuitManager) { + Vector3 regionExtent = new Vector3(regionInfo.RegionSizeX, regionInfo.RegionSizeY, regionInfo.RegionSizeZ); + PhysicsScene physicsScene = GetPhysicsScene(regionInfo.RegionName, regionExtent); SceneCommunicationService sceneGridService = new SceneCommunicationService(); return new Scene( - regionInfo, circuitManager, sceneGridService, + regionInfo, circuitManager, physicsScene, sceneGridService, simDataService, estateDataService, Config, m_version); } @@ -829,10 +830,10 @@ namespace OpenSim # region Setup methods - protected override PhysicsScene GetPhysicsScene(string osSceneIdentifier) + protected override PhysicsScene GetPhysicsScene(string osSceneIdentifier, Vector3 regionExtent) { return GetPhysicsScene( - m_configSettings.PhysicsEngine, m_configSettings.MeshEngineName, Config, osSceneIdentifier); + m_configSettings.PhysicsEngine, m_configSettings.MeshEngineName, Config, osSceneIdentifier, regionExtent); } /// diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index 287c278..982646e 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs @@ -69,7 +69,7 @@ namespace OpenSim.Region.ClientStack /// The name of the OpenSim scene this physics scene is serving. This will be used in log messages. /// /// - protected abstract PhysicsScene GetPhysicsScene(string osSceneIdentifier); + protected abstract PhysicsScene GetPhysicsScene(string osSceneIdentifier, Vector3 regionExtent); protected abstract ClientStackManager CreateClientStackManager(); protected abstract Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, IEstateDataService estateDataService, AgentCircuitManager circuitManager); @@ -135,13 +135,13 @@ namespace OpenSim.Region.ClientStack /// /// protected PhysicsScene GetPhysicsScene( - string engine, string meshEngine, IConfigSource config, string osSceneIdentifier) + string engine, string meshEngine, IConfigSource config, string osSceneIdentifier, Vector3 regionExtent) { PhysicsPluginManager physicsPluginManager; physicsPluginManager = new PhysicsPluginManager(); physicsPluginManager.LoadPluginsFromAssemblies("Physics"); - - return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config, osSceneIdentifier); + + return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config, osSceneIdentifier, regionExtent); } } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 46c9048..fa5d021 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -760,7 +760,7 @@ namespace OpenSim.Region.Framework.Scenes #region Constructors - public Scene(RegionInfo regInfo, AgentCircuitManager authen, + public Scene(RegionInfo regInfo, AgentCircuitManager authen, PhysicsScene physicsScene, SceneCommunicationService sceneGridService, ISimulationDataService simDataService, IEstateDataService estateDataService, IConfigSource config, string simulatorVersion) @@ -840,6 +840,7 @@ namespace OpenSim.Region.Framework.Scenes new EventManager.LandObjectRemoved(simDataService.RemoveLandObject); m_sceneGraph = new SceneGraph(this); + m_sceneGraph.PhysicsScene = physicsScene; // If the scene graph has an Unrecoverable error, restart this sim. // Currently the only thing that causes it to happen is two kinds of specific @@ -1075,7 +1076,8 @@ namespace OpenSim.Region.Framework.Scenes { PhysicalPrims = true; CollidablePrims = true; - PhysicsEnabled = true; + // this is done above acording to config + // PhysicsEnabled = true; PeriodicBackup = true; UseBackup = true; diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index 4cdfe98..d36e42e 100644 --- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs @@ -138,8 +138,15 @@ namespace OpenSim.Tests.Common SceneCommunicationService scs = new SceneCommunicationService(); + PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); + physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll"); + Vector3 regionExtent = new Vector3(regInfo.RegionSizeX, regInfo.RegionSizeY, regInfo.RegionSizeZ); + PhysicsScene physicsScene + = physicsPluginManager.GetPhysicsScene( + "basicphysics", "ZeroMesher", new IniConfigSource(), "test", regionExtent); + TestScene testScene = new TestScene( - regInfo, m_acm, scs, m_simDataService, m_estateDataService, configSource, null); + regInfo, m_acm, physicsScene, scs, m_simDataService, m_estateDataService, configSource, null); INonSharedRegionModule godsModule = new GodsModule(); godsModule.Initialise(new IniConfigSource()); @@ -184,11 +191,6 @@ namespace OpenSim.Tests.Common testScene.LandChannel = new TestLandChannel(testScene); testScene.LoadWorldMap(); - PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); - physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll"); - testScene.PhysicsScene - = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", new IniConfigSource(), "test"); - testScene.RegionInfo.EstateSettings = new EstateSettings(); testScene.LoginsEnabled = true; testScene.RegisterRegionWithGrid(); diff --git a/OpenSim/Tests/Common/Mock/TestScene.cs b/OpenSim/Tests/Common/Mock/TestScene.cs index a7e0dfb..53a311e 100644 --- a/OpenSim/Tests/Common/Mock/TestScene.cs +++ b/OpenSim/Tests/Common/Mock/TestScene.cs @@ -33,16 +33,17 @@ using OpenSim.Framework.Servers; using OpenSim.Region.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Physics.Manager; namespace OpenSim.Tests.Common.Mock { public class TestScene : Scene { public TestScene( - RegionInfo regInfo, AgentCircuitManager authen, + RegionInfo regInfo, AgentCircuitManager authen, PhysicsScene physicsScene, SceneCommunicationService sceneGridService, ISimulationDataService simDataService, IEstateDataService estateDataService, IConfigSource config, string simulatorVersion) - : base(regInfo, authen, sceneGridService, simDataService, estateDataService, + : base(regInfo, authen, physicsScene, sceneGridService, simDataService, estateDataService, config, simulatorVersion) { } -- cgit v1.1