aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs
diff options
context:
space:
mode:
authorRobert Adams2015-09-08 04:54:16 -0700
committerRobert Adams2015-09-08 04:54:16 -0700
commite5367d822be9b05e74c859afe2d2956a3e95aa33 (patch)
treee904050a30715df587aa527d7f313755177726a7 /OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs
parentadd lost admin_reset_land method (diff)
parentDeleted access control spec from [LoginService] section of standalone config.... (diff)
downloadopensim-SC-e5367d822be9b05e74c859afe2d2956a3e95aa33.zip
opensim-SC-e5367d822be9b05e74c859afe2d2956a3e95aa33.tar.gz
opensim-SC-e5367d822be9b05e74c859afe2d2956a3e95aa33.tar.bz2
opensim-SC-e5367d822be9b05e74c859afe2d2956a3e95aa33.tar.xz
Merge of ubitworkvarnew with opensim/master as of 20150905.
This integrates the OpenSim refactoring to make physics, etc into modules. AVN physics hasn't been moved to new location. Does not compile yet. Merge branch 'osmaster' into mbworknew1
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs (renamed from OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs)72
1 files changed, 59 insertions, 13 deletions
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs
index 0d28c8e..ac2c1f3 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs
+++ b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs
@@ -28,11 +28,14 @@
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.Physics.Manager; 34using OpenSim.Region.PhysicsModules.SharedBase;
35using OpenSim.Region.Framework.Scenes;
36using OpenSim.Region.Framework.Interfaces;
34 37
35namespace OpenSim.Region.Physics.BasicPhysicsPlugin 38namespace OpenSim.Region.PhysicsModule.BasicPhysics
36{ 39{
37 /// <summary> 40 /// <summary>
38 /// This is an incomplete extremely basic physics implementation 41 /// This is an incomplete extremely basic physics implementation
@@ -41,32 +44,74 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
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 base.Initialise(scene.PhysicsRequestAsset,
97 (scene.Heightmap != null ? scene.Heightmap.GetFloatsSerialised() : new float[scene.RegionInfo.RegionSizeX * scene.RegionInfo.RegionSizeY]),
98 (float)scene.RegionInfo.RegionSettings.WaterHeight);
99
100 }
101
102 public void RemoveRegion(Scene scene)
103 {
104 if (!m_Enabled)
105 return;
106 }
107
108 public void RegionLoaded(Scene scene)
109 {
110 if (!m_Enabled)
111 return;
112 }
113 #endregion
114
70 public override void Dispose() {} 115 public override void Dispose() {}
71 116
72 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, 117 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
@@ -119,8 +164,8 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
119 Vector3 actorPosition = actor.Position; 164 Vector3 actorPosition = actor.Position;
120 Vector3 actorVelocity = actor.Velocity; 165 Vector3 actorVelocity = actor.Velocity;
121 166
122// Console.WriteLine( 167 //Console.WriteLine(
123// "Processing actor {0}, starting pos {1}, starting vel {2}", i, actorPosition, actorVelocity); 168 // "Processing actor {0}, starting pos {1}, starting vel {2}", i, actorPosition, actorVelocity);
124 169
125 actorPosition.X += actor.Velocity.X * timeStep; 170 actorPosition.X += actor.Velocity.X * timeStep;
126 actorPosition.Y += actor.Velocity.Y * timeStep; 171 actorPosition.Y += actor.Velocity.Y * timeStep;
@@ -206,5 +251,6 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
206 Dictionary<uint, float> returncolliders = new Dictionary<uint, float>(); 251 Dictionary<uint, float> returncolliders = new Dictionary<uint, float>();
207 return returncolliders; 252 return returncolliders;
208 } 253 }
254
209 } 255 }
210} 256}