Allow the "debug scene set physics false|true" command to work when bulletsim physics is running in a separate thread.
This will also allow the "disable physics" setting in the region debug viewer dialog to work in this circumstance.0.8-extended
parent
8938bc6905
commit
01bd3a8632
|
@ -734,8 +734,6 @@ namespace OpenSim
|
|||
clientServer = clientNetworkServers;
|
||||
scene.LoadWorldMap();
|
||||
|
||||
Vector3 regionExtent = new Vector3(regionInfo.RegionSizeX, regionInfo.RegionSizeY, regionInfo.RegionSizeZ);
|
||||
scene.PhysicsScene = GetPhysicsScene(scene.RegionInfo.RegionName, regionExtent);
|
||||
scene.PhysicsScene.RequestAssetMethod = scene.PhysicsRequestAsset;
|
||||
scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
|
||||
scene.PhysicsScene.SetWaterLevel((float) regionInfo.RegionSettings.WaterHeight);
|
||||
|
@ -751,10 +749,13 @@ 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);
|
||||
}
|
||||
|
|
|
@ -159,7 +159,7 @@ namespace OpenSim.Region.CoreModules.Framework.Library
|
|||
}
|
||||
|
||||
RegionInfo regInfo = new RegionInfo();
|
||||
Scene m_MockScene = new Scene(regInfo);
|
||||
Scene m_MockScene = new Scene(regInfo, null);
|
||||
LocalInventoryService invService = new LocalInventoryService(lib);
|
||||
m_MockScene.RegisterModuleInterface<IInventoryService>(invService);
|
||||
m_MockScene.RegisterModuleInterface<IAssetService>(m_Scene.AssetService);
|
||||
|
|
|
@ -85,7 +85,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
|
|||
r1.ExternalHostName = "127.0.0.1";
|
||||
r1.HttpPort = 9001;
|
||||
r1.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0);
|
||||
Scene s = new Scene(new RegionInfo());
|
||||
Scene s = new Scene(new RegionInfo(), null);
|
||||
s.RegionInfo.RegionID = r1.RegionID;
|
||||
m_LocalConnector.AddRegion(s);
|
||||
|
||||
|
@ -97,7 +97,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
|
|||
r2.ExternalHostName = "127.0.0.1";
|
||||
r2.HttpPort = 9002;
|
||||
r2.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0);
|
||||
s = new Scene(new RegionInfo());
|
||||
s = new Scene(new RegionInfo(), null);
|
||||
s.RegionInfo.RegionID = r2.RegionID;
|
||||
m_LocalConnector.AddRegion(s);
|
||||
|
||||
|
@ -109,7 +109,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
|
|||
r3.ExternalHostName = "127.0.0.1";
|
||||
r3.HttpPort = 9003;
|
||||
r3.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0);
|
||||
s = new Scene(new RegionInfo());
|
||||
s = new Scene(new RegionInfo(), null);
|
||||
s.RegionInfo.RegionID = r3.RegionID;
|
||||
m_LocalConnector.AddRegion(s);
|
||||
|
||||
|
@ -121,7 +121,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
|
|||
r4.ExternalHostName = "127.0.0.1";
|
||||
r4.HttpPort = 9004;
|
||||
r4.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0);
|
||||
s = new Scene(new RegionInfo());
|
||||
s = new Scene(new RegionInfo(), null);
|
||||
s.RegionInfo.RegionID = r4.RegionID;
|
||||
m_LocalConnector.AddRegion(s);
|
||||
|
||||
|
|
|
@ -103,7 +103,29 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <summary>
|
||||
/// If false then physical objects are disabled, though collisions will continue as normal.
|
||||
/// </summary>
|
||||
public bool PhysicsEnabled { get; set; }
|
||||
public bool PhysicsEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_physicsEnabled;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
m_physicsEnabled = value;
|
||||
|
||||
if (PhysicsScene != null)
|
||||
{
|
||||
IPhysicsParameters physScene = PhysicsScene as IPhysicsParameters;
|
||||
|
||||
if (physScene != null)
|
||||
physScene.SetPhysicsParameter(
|
||||
"Active", m_physicsEnabled.ToString(), PhysParameterEntry.APPLY_TO_NONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool m_physicsEnabled;
|
||||
|
||||
/// <summary>
|
||||
/// If false then scripts are not enabled on the smiulator
|
||||
|
@ -712,11 +734,11 @@ 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)
|
||||
: this(regInfo)
|
||||
: this(regInfo, physicsScene)
|
||||
{
|
||||
m_config = config;
|
||||
MinFrameTime = 0.089f;
|
||||
|
@ -789,21 +811,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
EventManager.OnLandObjectRemoved +=
|
||||
new EventManager.LandObjectRemoved(simDataService.RemoveLandObject);
|
||||
|
||||
m_sceneGraph = new SceneGraph(this);
|
||||
|
||||
// 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
|
||||
// Physics based crashes.
|
||||
//
|
||||
// Out of memory
|
||||
// Operating system has killed the plugin
|
||||
m_sceneGraph.UnRecoverableError
|
||||
+= () =>
|
||||
{
|
||||
m_log.ErrorFormat("[SCENE]: Restarting region {0} due to unrecoverable physics crash", Name);
|
||||
RestartNow();
|
||||
};
|
||||
|
||||
RegisterDefaultSceneEvents();
|
||||
|
||||
// XXX: Don't set the public property since we don't want to activate here. This needs to be handled
|
||||
|
@ -1014,8 +1021,24 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats;
|
||||
}
|
||||
|
||||
public Scene(RegionInfo regInfo) : base(regInfo)
|
||||
public Scene(RegionInfo regInfo, PhysicsScene physicsScene) : base(regInfo)
|
||||
{
|
||||
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
|
||||
// Physics based crashes.
|
||||
//
|
||||
// Out of memory
|
||||
// Operating system has killed the plugin
|
||||
m_sceneGraph.UnRecoverableError
|
||||
+= () =>
|
||||
{
|
||||
m_log.ErrorFormat("[SCENE]: Restarting region {0} due to unrecoverable physics crash", Name);
|
||||
RestartNow();
|
||||
};
|
||||
|
||||
PhysicalPrims = true;
|
||||
CollidablePrims = true;
|
||||
PhysicsEnabled = true;
|
||||
|
|
|
@ -54,6 +54,14 @@ public static class BSParam
|
|||
// ===================
|
||||
// From:
|
||||
|
||||
/// <summary>
|
||||
/// Set whether physics is active or not.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Can be enabled and disabled to start and stop physics.
|
||||
/// </remarks>
|
||||
public static bool Active { get; private set; }
|
||||
|
||||
public static bool UseSeparatePhysicsThread { get; private set; }
|
||||
public static float PhysicsTimeStep { get; private set; }
|
||||
|
||||
|
@ -373,6 +381,8 @@ public static class BSParam
|
|||
// v = value (appropriate type)
|
||||
private static ParameterDefnBase[] ParameterDefinitions =
|
||||
{
|
||||
new ParameterDefn<bool>("Active", "If 'true', false then physics is not active",
|
||||
false ),
|
||||
new ParameterDefn<bool>("UseSeparatePhysicsThread", "If 'true', the physics engine runs independent from the simulator heartbeat",
|
||||
false ),
|
||||
new ParameterDefn<float>("PhysicsTimeStep", "If separate thread, seconds to simulate each interval",
|
||||
|
|
|
@ -821,7 +821,10 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
|
|||
while (m_initialized)
|
||||
{
|
||||
int beginSimulationRealtimeMS = Util.EnvironmentTickCount();
|
||||
DoPhysicsStep(BSParam.PhysicsTimeStep);
|
||||
|
||||
if (BSParam.Active)
|
||||
DoPhysicsStep(BSParam.PhysicsTimeStep);
|
||||
|
||||
int simulationRealtimeMS = Util.EnvironmentTickCountSubtract(beginSimulationRealtimeMS);
|
||||
int simulationTimeVsRealtimeDifferenceMS = ((int)(BSParam.PhysicsTimeStep*1000f)) - simulationRealtimeMS;
|
||||
|
||||
|
|
|
@ -151,8 +151,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, SimDataService, m_estateDataService, configSource, null);
|
||||
regInfo, m_acm, physicsScene, scs, SimDataService, m_estateDataService, configSource, null);
|
||||
|
||||
INonSharedRegionModule godsModule = new GodsModule();
|
||||
godsModule.Initialise(new IniConfigSource());
|
||||
|
@ -197,12 +204,6 @@ namespace OpenSim.Tests.Common
|
|||
testScene.LandChannel = new TestLandChannel(testScene);
|
||||
testScene.LoadWorldMap();
|
||||
|
||||
PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager();
|
||||
physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll");
|
||||
Vector3 regionExtent = new Vector3( regInfo.RegionSizeX, regInfo.RegionSizeY, regInfo.RegionSizeZ);
|
||||
testScene.PhysicsScene
|
||||
= physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", new IniConfigSource(), "test", regionExtent);
|
||||
|
||||
testScene.RegionInfo.EstateSettings = new EstateSettings();
|
||||
testScene.LoginsEnabled = true;
|
||||
testScene.RegisterRegionWithGrid();
|
||||
|
|
|
@ -33,6 +33,7 @@ using OpenSim.Framework.Servers;
|
|||
using OpenSim.Region.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Physics.Manager;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
namespace OpenSim.Tests.Common.Mock
|
||||
|
@ -40,10 +41,10 @@ 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)
|
||||
{
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue