diff options
author | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
---|---|---|
committer | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
commit | 134f86e8d5c414409631b25b8c6f0ee45fbd8631 (patch) | |
tree | 216b89d3fb89acfb81be1e440c25c41ab09fa96d /OpenSim/Region/PhysicsModules/BasicPhysics | |
parent | More changing to production grid. Double oops. (diff) | |
download | opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.zip opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.gz opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.bz2 opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.xz |
Initial update to OpenSim 0.8.2.1 source code.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/PhysicsModules/BasicPhysics/AssemblyInfo.cs (renamed from OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs) | 10 | ||||
-rw-r--r-- | OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsActor.cs (renamed from OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs) | 16 | ||||
-rw-r--r-- | OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsPrim.cs (renamed from OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs) | 5 | ||||
-rw-r--r-- | OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs (renamed from OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs) | 90 |
4 files changed, 90 insertions, 31 deletions
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs b/OpenSim/Region/PhysicsModules/BasicPhysics/AssemblyInfo.cs index fb9cb66..1765ae0 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs +++ b/OpenSim/Region/PhysicsModules/BasicPhysics/AssemblyInfo.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System.Reflection; | 28 | using System.Reflection; |
29 | using System.Runtime.InteropServices; | 29 | using System.Runtime.InteropServices; |
30 | using Mono.Addins; | ||
30 | 31 | ||
31 | // Information about this assembly is defined by the following | 32 | // Information about this assembly is defined by the following |
32 | // attributes. | 33 | // attributes. |
@@ -34,11 +35,11 @@ using System.Runtime.InteropServices; | |||
34 | // change them to the information which is associated with the assembly | 35 | // change them to the information which is associated with the assembly |
35 | // you compile. | 36 | // you compile. |
36 | 37 | ||
37 | [assembly : AssemblyTitle("BasicPhysicsPlugin")] | 38 | [assembly : AssemblyTitle("BasicPhysicsModule")] |
38 | [assembly : AssemblyDescription("")] | 39 | [assembly : AssemblyDescription("")] |
39 | [assembly : AssemblyConfiguration("")] | 40 | [assembly : AssemblyConfiguration("")] |
40 | [assembly : AssemblyCompany("http://opensimulator.org")] | 41 | [assembly : AssemblyCompany("http://opensimulator.org")] |
41 | [assembly : AssemblyProduct("BasicPhysicsPlugin")] | 42 | [assembly : AssemblyProduct("BasicPhysicsModule")] |
42 | [assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers")] | 43 | [assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers")] |
43 | [assembly : AssemblyTrademark("")] | 44 | [assembly : AssemblyTrademark("")] |
44 | [assembly : AssemblyCulture("")] | 45 | [assembly : AssemblyCulture("")] |
@@ -55,4 +56,7 @@ using System.Runtime.InteropServices; | |||
55 | // You can specify all values by your own or you can build default build and revision | 56 | // You can specify all values by your own or you can build default build and revision |
56 | // numbers with the '*' character (the default): | 57 | // numbers with the '*' character (the default): |
57 | 58 | ||
58 | [assembly : AssemblyVersion("0.7.5.*")] | 59 | [assembly : AssemblyVersion("0.8.2.*")] |
60 | |||
61 | [assembly: Addin("OpenSim.Region.PhysicsModule.BasicPhysics", OpenSim.VersionInfo.VersionNumber)] | ||
62 | [assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)] | ||
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsActor.cs index e43136a..e7b30ba 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs +++ b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsActor.cs | |||
@@ -30,14 +30,12 @@ using System.Collections.Generic; | |||
30 | using Nini.Config; | 30 | using Nini.Config; |
31 | using OpenMetaverse; | 31 | using OpenMetaverse; |
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenSim.Region.Physics.Manager; | 33 | using OpenSim.Region.PhysicsModules.SharedBase; |
34 | 34 | ||
35 | namespace OpenSim.Region.Physics.BasicPhysicsPlugin | 35 | namespace OpenSim.Region.PhysicsModule.BasicPhysics |
36 | { | 36 | { |
37 | public class BasicActor : PhysicsActor | 37 | public class BasicActor : PhysicsActor |
38 | { | 38 | { |
39 | private Vector3 _size; | ||
40 | |||
41 | public BasicActor(Vector3 size) | 39 | public BasicActor(Vector3 size) |
42 | { | 40 | { |
43 | Size = size; | 41 | Size = size; |
@@ -118,14 +116,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
118 | 116 | ||
119 | public override Vector3 Position { get; set; } | 117 | public override Vector3 Position { get; set; } |
120 | 118 | ||
121 | public override Vector3 Size | 119 | public override Vector3 Size { get; set; } |
122 | { | ||
123 | get { return _size; } | ||
124 | set { | ||
125 | _size = value; | ||
126 | _size.Z = _size.Z / 2.0f; | ||
127 | } | ||
128 | } | ||
129 | 120 | ||
130 | public override PrimitiveBaseShape Shape | 121 | public override PrimitiveBaseShape Shape |
131 | { | 122 | { |
@@ -247,6 +238,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
247 | 238 | ||
248 | public override bool PIDActive | 239 | public override bool PIDActive |
249 | { | 240 | { |
241 | get { return false; } | ||
250 | set { return; } | 242 | set { return; } |
251 | } | 243 | } |
252 | 244 | ||
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsPrim.cs index 47d7df3..5383f1b 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs +++ b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsPrim.cs | |||
@@ -30,9 +30,9 @@ using System.Collections.Generic; | |||
30 | using Nini.Config; | 30 | using Nini.Config; |
31 | using OpenMetaverse; | 31 | using OpenMetaverse; |
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenSim.Region.Physics.Manager; | 33 | using OpenSim.Region.PhysicsModules.SharedBase; |
34 | 34 | ||
35 | namespace OpenSim.Region.Physics.BasicPhysicsPlugin | 35 | namespace OpenSim.Region.PhysicsModule.BasicPhysics |
36 | { | 36 | { |
37 | public class BasicPhysicsPrim : PhysicsActor | 37 | public class BasicPhysicsPrim : PhysicsActor |
38 | { | 38 | { |
@@ -251,6 +251,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
251 | 251 | ||
252 | public override bool PIDActive | 252 | public override bool PIDActive |
253 | { | 253 | { |
254 | get { return false; } | ||
254 | set { return; } | 255 | set { return; } |
255 | } | 256 | } |
256 | 257 | ||
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs index f5826ed..20b337a 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs +++ b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs | |||
@@ -28,11 +28,14 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using Nini.Config; | 30 | using Nini.Config; |
31 | using Mono.Addins; | ||
31 | using OpenMetaverse; | 32 | using OpenMetaverse; |
32 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
33 | using OpenSim.Region.Physics.Manager; | 34 | using OpenSim.Region.PhysicsModules.SharedBase; |
35 | using OpenSim.Region.Framework.Scenes; | ||
36 | using OpenSim.Region.Framework.Interfaces; | ||
34 | 37 | ||
35 | namespace OpenSim.Region.Physics.BasicPhysicsPlugin | 38 | namespace 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,23 +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; |
53 | private Vector3 m_regionExtent; | ||
54 | |||
55 | private bool m_Enabled = false; | ||
49 | 56 | ||
50 | //protected internal string sceneIdentifier; | 57 | //protected internal string sceneIdentifier; |
58 | #region INonSharedRegionModule | ||
59 | public string Name | ||
60 | { | ||
61 | get { return "basicphysics"; } | ||
62 | } | ||
63 | |||
64 | public Type ReplaceableInterface | ||
65 | { | ||
66 | get { return null; } | ||
67 | } | ||
68 | |||
69 | public void Initialise(IConfigSource source) | ||
70 | { | ||
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 | |||
80 | } | ||
51 | 81 | ||
52 | public BasicScene(string _sceneIdentifier) | 82 | public void Close() |
53 | { | 83 | { |
54 | //sceneIdentifier = _sceneIdentifier; | ||
55 | } | 84 | } |
56 | 85 | ||
57 | public override void Initialise(IMesher meshmerizer, IConfigSource config) | 86 | public void AddRegion(Scene scene) |
58 | { | 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; | ||
59 | } | 106 | } |
60 | 107 | ||
108 | public void RegionLoaded(Scene scene) | ||
109 | { | ||
110 | if (!m_Enabled) | ||
111 | return; | ||
112 | } | ||
113 | #endregion | ||
114 | |||
61 | public override void Dispose() {} | 115 | public override void Dispose() {} |
62 | 116 | ||
63 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, | 117 | public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, |
@@ -71,10 +125,11 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
71 | return prim; | 125 | return prim; |
72 | } | 126 | } |
73 | 127 | ||
74 | public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) | 128 | public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying) |
75 | { | 129 | { |
76 | BasicActor act = new BasicActor(size); | 130 | BasicActor act = new BasicActor(size); |
77 | act.Position = position; | 131 | act.Position = position; |
132 | act.Velocity = velocity; | ||
78 | act.Flying = isFlying; | 133 | act.Flying = isFlying; |
79 | _actors.Add(act); | 134 | _actors.Add(act); |
80 | return act; | 135 | return act; |
@@ -100,6 +155,8 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
100 | 155 | ||
101 | public override float Simulate(float timeStep) | 156 | public override float Simulate(float timeStep) |
102 | { | 157 | { |
158 | // Console.WriteLine("Simulating"); | ||
159 | |||
103 | float fps = 0; | 160 | float fps = 0; |
104 | for (int i = 0; i < _actors.Count; ++i) | 161 | for (int i = 0; i < _actors.Count; ++i) |
105 | { | 162 | { |
@@ -107,32 +164,36 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
107 | Vector3 actorPosition = actor.Position; | 164 | Vector3 actorPosition = actor.Position; |
108 | Vector3 actorVelocity = actor.Velocity; | 165 | Vector3 actorVelocity = actor.Velocity; |
109 | 166 | ||
110 | actorPosition.X += actor.Velocity.X*timeStep; | 167 | //Console.WriteLine( |
111 | actorPosition.Y += actor.Velocity.Y*timeStep; | 168 | // "Processing actor {0}, starting pos {1}, starting vel {2}", i, actorPosition, actorVelocity); |
169 | |||
170 | actorPosition.X += actor.Velocity.X * timeStep; | ||
171 | actorPosition.Y += actor.Velocity.Y * timeStep; | ||
112 | 172 | ||
113 | if (actor.Position.Y < 0) | 173 | if (actor.Position.Y < 0) |
114 | { | 174 | { |
115 | actorPosition.Y = 0.1F; | 175 | actorPosition.Y = 0.1F; |
116 | } | 176 | } |
117 | else if (actor.Position.Y >= Constants.RegionSize) | 177 | else if (actor.Position.Y >= m_regionExtent.Y) |
118 | { | 178 | { |
119 | actorPosition.Y = ((int)Constants.RegionSize - 0.1f); | 179 | actorPosition.Y = (m_regionExtent.Y - 0.1f); |
120 | } | 180 | } |
121 | 181 | ||
122 | if (actor.Position.X < 0) | 182 | if (actor.Position.X < 0) |
123 | { | 183 | { |
124 | actorPosition.X = 0.1F; | 184 | actorPosition.X = 0.1F; |
125 | } | 185 | } |
126 | else if (actor.Position.X >= Constants.RegionSize) | 186 | else if (actor.Position.X >= m_regionExtent.X) |
127 | { | 187 | { |
128 | actorPosition.X = ((int)Constants.RegionSize - 0.1f); | 188 | actorPosition.X = (m_regionExtent.X - 0.1f); |
129 | } | 189 | } |
130 | 190 | ||
131 | float terrainHeight = 0; | 191 | float terrainHeight = 0; |
132 | if (_heightMap != null) | 192 | if (_heightMap != null) |
133 | terrainHeight = _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X]; | 193 | terrainHeight = _heightMap[(int)actor.Position.Y * (int)m_regionExtent.Y + (int)actor.Position.X]; |
134 | 194 | ||
135 | float height = terrainHeight + actor.Size.Z; | 195 | float height = terrainHeight + actor.Size.Z; |
196 | // Console.WriteLine("height {0}, actorPosition {1}", height, actorPosition); | ||
136 | 197 | ||
137 | if (actor.Flying) | 198 | if (actor.Flying) |
138 | { | 199 | { |
@@ -190,5 +251,6 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
190 | Dictionary<uint, float> returncolliders = new Dictionary<uint, float>(); | 251 | Dictionary<uint, float> returncolliders = new Dictionary<uint, float>(); |
191 | return returncolliders; | 252 | return returncolliders; |
192 | } | 253 | } |
254 | |||
193 | } | 255 | } |
194 | } | 256 | } |