diff options
author | UbitUmarov | 2015-09-09 18:53:24 +0100 |
---|---|---|
committer | UbitUmarov | 2015-09-09 18:53:24 +0100 |
commit | 47aa8107fd49039feb8dd95ec93e8ac80088e158 (patch) | |
tree | f8b6c11b111b19dfe45b4ccec62e179d9f78c4e8 /OpenSim/Region/PhysicsModules/Ode/OdeScene.cs | |
parent | found core hack to fix modules interdependencies RegionLoaded is not that ob... (diff) | |
download | opensim-SC-47aa8107fd49039feb8dd95ec93e8ac80088e158.zip opensim-SC-47aa8107fd49039feb8dd95ec93e8ac80088e158.tar.gz opensim-SC-47aa8107fd49039feb8dd95ec93e8ac80088e158.tar.bz2 opensim-SC-47aa8107fd49039feb8dd95ec93e8ac80088e158.tar.xz |
let old ode also have a Module class
Diffstat (limited to 'OpenSim/Region/PhysicsModules/Ode/OdeScene.cs')
-rw-r--r-- | OpenSim/Region/PhysicsModules/Ode/OdeScene.cs | 92 |
1 files changed, 19 insertions, 73 deletions
diff --git a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs index 1d1b710..3ea522c 100644 --- a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs +++ b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs | |||
@@ -111,11 +111,9 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
111 | Rubber = 6 | 111 | Rubber = 6 |
112 | } | 112 | } |
113 | 113 | ||
114 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ODEPhysicsScene")] | 114 | public class OdeScene : PhysicsScene |
115 | public class OdeScene : PhysicsScene, INonSharedRegionModule | ||
116 | { | 115 | { |
117 | private readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString()); | 116 | private readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString()); |
118 | private bool m_Enabled = false; | ||
119 | 117 | ||
120 | // private Dictionary<string, sCollisionData> m_storedCollisions = new Dictionary<string, sCollisionData>(); | 118 | // private Dictionary<string, sCollisionData> m_storedCollisions = new Dictionary<string, sCollisionData>(); |
121 | 119 | ||
@@ -534,89 +532,37 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
534 | int spaceGridMaxY; | 532 | int spaceGridMaxY; |
535 | 533 | ||
536 | private ODERayCastRequestManager m_rayCastManager; | 534 | private ODERayCastRequestManager m_rayCastManager; |
535 | |||
536 | public Scene m_frameWorkScene = null; | ||
537 | 537 | ||
538 | public OdeScene(Scene pscene, IConfigSource psourceconfig, string pname) | ||
539 | { | ||
540 | m_config = psourceconfig; | ||
541 | m_frameWorkScene = pscene; | ||
542 | |||
543 | EngineType = pname; | ||
544 | PhysicsSceneName = EngineType + "/" + pscene.RegionInfo.RegionName; | ||
538 | 545 | ||
539 | #region INonSharedRegionModule | 546 | pscene.RegisterModuleInterface<PhysicsScene>(this); |
540 | public string Name | 547 | Vector3 extent = new Vector3(pscene.RegionInfo.RegionSizeX, pscene.RegionInfo.RegionSizeY, pscene.RegionInfo.RegionSizeZ); |
541 | { | ||
542 | get { return "OpenDynamicsEngine"; } | ||
543 | } | ||
544 | |||
545 | public Type ReplaceableInterface | ||
546 | { | ||
547 | get { return null; } | ||
548 | } | ||
549 | |||
550 | public void Initialise(IConfigSource source) | ||
551 | { | ||
552 | // TODO: Move this out of Startup | ||
553 | IConfig config = source.Configs["Startup"]; | ||
554 | if (config != null) | ||
555 | { | ||
556 | string physics = config.GetString("physics", string.Empty); | ||
557 | if (physics == Name) | ||
558 | { | ||
559 | m_Enabled = true; | ||
560 | m_config = source; | ||
561 | |||
562 | // We do this so that OpenSimulator on Windows loads the correct native ODE library depending on whether | ||
563 | // it's running as a 32-bit process or a 64-bit one. By invoking LoadLibary here, later DLLImports | ||
564 | // will find it already loaded later on. | ||
565 | // | ||
566 | // This isn't necessary for other platforms (e.g. Mac OSX and Linux) since the DLL used can be | ||
567 | // controlled in Ode.NET.dll.config | ||
568 | if (Util.IsWindows()) | ||
569 | Util.LoadArchSpecificWindowsDll("ode.dll"); | ||
570 | |||
571 | // Initializing ODE only when a scene is created allows alternative ODE plugins to co-habit (according to | ||
572 | // http://opensimulator.org/mantis/view.php?id=2750). | ||
573 | d.InitODE(); | ||
574 | |||
575 | } | ||
576 | } | ||
577 | |||
578 | } | ||
579 | |||
580 | public void Close() | ||
581 | { | ||
582 | } | ||
583 | |||
584 | public void AddRegion(Scene scene) | ||
585 | { | ||
586 | if (!m_Enabled) | ||
587 | return; | ||
588 | |||
589 | EngineType = Name; | ||
590 | PhysicsSceneName = EngineType + "/" + scene.RegionInfo.RegionName; | ||
591 | |||
592 | scene.RegisterModuleInterface<PhysicsScene>(this); | ||
593 | Vector3 extent = new Vector3(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, scene.RegionInfo.RegionSizeZ); | ||
594 | Initialise(extent); | 548 | Initialise(extent); |
595 | InitialiseFromConfig(m_config); | 549 | InitialiseFromConfig(m_config); |
596 | 550 | ||
597 | // This may not be that good since terrain may not be avaiable at this point | 551 | // This may not be that good since terrain may not be avaiable at this point |
598 | base.Initialise(scene.PhysicsRequestAsset, | 552 | base.Initialise(pscene.PhysicsRequestAsset, |
599 | (scene.Heightmap != null ? scene.Heightmap.GetFloatsSerialised() : new float[(int)(extent.X * extent.Y)]), | 553 | (pscene.Heightmap != null ? pscene.Heightmap.GetFloatsSerialised() : new float[(int)(extent.X * extent.Y)]), |
600 | (float)scene.RegionInfo.RegionSettings.WaterHeight); | 554 | (float)pscene.RegionInfo.RegionSettings.WaterHeight); |
601 | 555 | ||
602 | } | 556 | } |
603 | 557 | ||
604 | public void RemoveRegion(Scene scene) | 558 | public void RegionLoaded() |
605 | { | 559 | { |
606 | if (!m_Enabled) | 560 | mesher = m_frameWorkScene.RequestModuleInterface<IMesher>(); |
607 | return; | ||
608 | } | ||
609 | |||
610 | public void RegionLoaded(Scene scene) | ||
611 | { | ||
612 | if (!m_Enabled) | ||
613 | return; | ||
614 | |||
615 | mesher = scene.RequestModuleInterface<IMesher>(); | ||
616 | if (mesher == null) | 561 | if (mesher == null) |
617 | m_log.WarnFormat("[ODE SCENE]: No mesher in {0}. Things will not work well.", PhysicsSceneName); | 562 | m_log.WarnFormat("[ODE SCENE]: No mesher in {0}. Things will not work well.", PhysicsSceneName); |
563 | |||
564 | m_frameWorkScene.PhysicsEnabled = true; | ||
618 | } | 565 | } |
619 | #endregion | ||
620 | 566 | ||
621 | /// <summary> | 567 | /// <summary> |
622 | /// Initiailizes the scene | 568 | /// Initiailizes the scene |