aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs')
-rw-r--r--OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs61
1 files changed, 52 insertions, 9 deletions
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 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using Nini.Config; 30using Nini.Config;
31using Mono.Addins;
31using OpenMetaverse; 32using OpenMetaverse;
32using OpenSim.Framework; 33using OpenSim.Framework;
33using OpenSim.Region.PhysicsModules.SharedBase; 34using OpenSim.Region.PhysicsModules.SharedBase;
35using OpenSim.Region.Framework.Scenes;
36using OpenSim.Region.Framework.Interfaces;
34 37
35namespace OpenSim.Region.PhysicsModule.BasicPhysics 38namespace OpenSim.Region.PhysicsModule.BasicPhysics
36{ 39{
@@ -41,32 +44,71 @@ namespace OpenSim.Region.PhysicsModule.BasicPhysics
41 /// Not useful for anything at the moment apart from some regression testing in other components where some form 44 /// Not useful for anything at the moment apart from some regression testing in other components where some form
42 /// of physics plugin is needed. 45 /// of physics plugin is needed.
43 /// </remarks> 46 /// </remarks>
44 public class BasicScene : PhysicsScene 47 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BasicPhysicsScene")]
48 public class BasicScene : PhysicsScene, INonSharedRegionModule
45 { 49 {
46 private List<BasicActor> _actors = new List<BasicActor>(); 50 private List<BasicActor> _actors = new List<BasicActor>();
47 private List<BasicPhysicsPrim> _prims = new List<BasicPhysicsPrim>(); 51 private List<BasicPhysicsPrim> _prims = new List<BasicPhysicsPrim>();
48 private float[] _heightMap; 52 private float[] _heightMap;
49 private Vector3 m_regionExtent; 53 private Vector3 m_regionExtent;
50 54
55 private bool m_Enabled = false;
56
51 //protected internal string sceneIdentifier; 57 //protected internal string sceneIdentifier;
58 #region INonSharedRegionModule
59 public string Name
60 {
61 get { return "basicphysics"; }
62 }
52 63
53 public BasicScene(string engineType, string _sceneIdentifier) 64 public Type ReplaceableInterface
54 { 65 {
55 EngineType = engineType; 66 get { return null; }
56 Name = EngineType + "/" + _sceneIdentifier;
57 //sceneIdentifier = _sceneIdentifier;
58 } 67 }
59 68
60 public override void Initialise(IMesher meshmerizer, IConfigSource config) 69 public void Initialise(IConfigSource source)
61 { 70 {
62 throw new Exception("Should not be called."); 71 // TODO: Move this out of Startup
72 IConfig config = source.Configs["Startup"];
73 if (config != null)
74 {
75 string physics = config.GetString("physics", string.Empty);
76 if (physics == Name)
77 m_Enabled = true;
78 }
79
63 } 80 }
64 81
65 public override void Initialise(IMesher meshmerizer, IConfigSource config, Vector3 regionExtent) 82 public void Close()
66 { 83 {
67 m_regionExtent = regionExtent;
68 } 84 }
69 85
86 public void AddRegion(Scene scene)
87 {
88 if (!m_Enabled)
89 return;
90
91 EngineType = Name;
92 PhysicsSceneName = EngineType + "/" + scene.RegionInfo.RegionName;
93
94 scene.RegisterModuleInterface<PhysicsScene>(this);
95 m_regionExtent = new Vector3(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, scene.RegionInfo.RegionSizeZ);
96
97 }
98
99 public void RemoveRegion(Scene scene)
100 {
101 if (!m_Enabled)
102 return;
103 }
104
105 public void RegionLoaded(Scene scene)
106 {
107 if (!m_Enabled)
108 return;
109 }
110 #endregion
111
70 public override void Dispose() {} 112 public override void Dispose() {}
71 113
72 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, 114 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
@@ -206,5 +248,6 @@ namespace OpenSim.Region.PhysicsModule.BasicPhysics
206 Dictionary<uint, float> returncolliders = new Dictionary<uint, float>(); 248 Dictionary<uint, float> returncolliders = new Dictionary<uint, float>();
207 return returncolliders; 249 return returncolliders;
208 } 250 }
251
209 } 252 }
210} 253}