aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
authorRobert Adams2015-03-29 14:25:12 -0700
committerRobert Adams2015-03-29 14:25:12 -0700
commit07dead7dcb8b0f2a27a50748e4a460d9669903fc (patch)
treeb61c3d892e83d36fece40e7735c5d97e64b9020f /OpenSim/Region/Physics
parentvarregion: add varregion and TerrainData use in LLClientView. (diff)
downloadopensim-SC-07dead7dcb8b0f2a27a50748e4a460d9669903fc.zip
opensim-SC-07dead7dcb8b0f2a27a50748e4a460d9669903fc.tar.gz
opensim-SC-07dead7dcb8b0f2a27a50748e4a460d9669903fc.tar.bz2
opensim-SC-07dead7dcb8b0f2a27a50748e4a460d9669903fc.tar.xz
varregion: any conversions of use of Constants.RegionSize converted into
Util.cs routines to convert region coords to and from world coords or handles.
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs17
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs14
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsScene.cs9
3 files changed, 33 insertions, 7 deletions
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs
index 0816b7b..8e40561 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs
@@ -46,6 +46,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
46 private List<BasicActor> _actors = new List<BasicActor>(); 46 private List<BasicActor> _actors = new List<BasicActor>();
47 private List<BasicPhysicsPrim> _prims = new List<BasicPhysicsPrim>(); 47 private List<BasicPhysicsPrim> _prims = new List<BasicPhysicsPrim>();
48 private float[] _heightMap; 48 private float[] _heightMap;
49 private Vector3 m_regionExtent;
49 50
50 //protected internal string sceneIdentifier; 51 //protected internal string sceneIdentifier;
51 52
@@ -58,6 +59,12 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
58 59
59 public override void Initialise(IMesher meshmerizer, IConfigSource config) 60 public override void Initialise(IMesher meshmerizer, IConfigSource config)
60 { 61 {
62 throw new Exception("Should not be called.");
63 }
64
65 public override void Initialise(IMesher meshmerizer, IConfigSource config, Vector3 regionExtent)
66 {
67 m_regionExtent = regionExtent;
61 } 68 }
62 69
63 public override void Dispose() {} 70 public override void Dispose() {}
@@ -121,23 +128,23 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
121 { 128 {
122 actorPosition.Y = 0.1F; 129 actorPosition.Y = 0.1F;
123 } 130 }
124 else if (actor.Position.Y >= Constants.RegionSize) 131 else if (actor.Position.Y >= m_regionExtent.Y)
125 { 132 {
126 actorPosition.Y = ((int)Constants.RegionSize - 0.1f); 133 actorPosition.Y = (m_regionExtent.Y - 0.1f);
127 } 134 }
128 135
129 if (actor.Position.X < 0) 136 if (actor.Position.X < 0)
130 { 137 {
131 actorPosition.X = 0.1F; 138 actorPosition.X = 0.1F;
132 } 139 }
133 else if (actor.Position.X >= Constants.RegionSize) 140 else if (actor.Position.X >= m_regionExtent.X)
134 { 141 {
135 actorPosition.X = ((int)Constants.RegionSize - 0.1f); 142 actorPosition.X = (m_regionExtent.X - 0.1f);
136 } 143 }
137 144
138 float terrainHeight = 0; 145 float terrainHeight = 0;
139 if (_heightMap != null) 146 if (_heightMap != null)
140 terrainHeight = _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X]; 147 terrainHeight = _heightMap[(int)actor.Position.Y * (int)m_regionExtent.Y + (int)actor.Position.X];
141 148
142 float height = terrainHeight + actor.Size.Z; 149 float height = terrainHeight + actor.Size.Z;
143 150
diff --git a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
index 8ccfda5..d14edfd 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
@@ -32,6 +32,7 @@ using System.Reflection;
32using Nini.Config; 32using Nini.Config;
33using log4net; 33using log4net;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenMetaverse;
35 36
36namespace OpenSim.Region.Physics.Manager 37namespace OpenSim.Region.Physics.Manager
37{ 38{
@@ -59,6 +60,14 @@ namespace OpenSim.Region.Physics.Manager
59 m_log.Info("[PHYSICS]: Added meshing engine: " + plugHard.GetName()); 60 m_log.Info("[PHYSICS]: Added meshing engine: " + plugHard.GetName());
60 } 61 }
61 62
63 // Legacy method for simulators before extent was passed
64 public PhysicsScene GetPhysicsScene(string physEngineName, string meshEngineName,
65 IConfigSource config, string regionName)
66 {
67 Vector3 extent = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight);
68 return GetPhysicsScene(physEngineName, meshEngineName, config, regionName, extent);
69 }
70
62 /// <summary> 71 /// <summary>
63 /// Get a physics scene for the given physics engine and mesher. 72 /// Get a physics scene for the given physics engine and mesher.
64 /// </summary> 73 /// </summary>
@@ -66,7 +75,8 @@ namespace OpenSim.Region.Physics.Manager
66 /// <param name="meshEngineName"></param> 75 /// <param name="meshEngineName"></param>
67 /// <param name="config"></param> 76 /// <param name="config"></param>
68 /// <returns></returns> 77 /// <returns></returns>
69 public PhysicsScene GetPhysicsScene(string physEngineName, string meshEngineName, IConfigSource config, string regionName) 78 public PhysicsScene GetPhysicsScene(string physEngineName, string meshEngineName,
79 IConfigSource config, string regionName, Vector3 regionExtent)
70 { 80 {
71 if (String.IsNullOrEmpty(physEngineName)) 81 if (String.IsNullOrEmpty(physEngineName))
72 { 82 {
@@ -94,7 +104,7 @@ namespace OpenSim.Region.Physics.Manager
94 { 104 {
95 m_log.Info("[PHYSICS]: creating " + physEngineName); 105 m_log.Info("[PHYSICS]: creating " + physEngineName);
96 PhysicsScene result = _PhysPlugins[physEngineName].GetScene(regionName); 106 PhysicsScene result = _PhysPlugins[physEngineName].GetScene(regionName);
97 result.Initialise(meshEngine, config); 107 result.Initialise(meshEngine, config, regionExtent);
98 return result; 108 return result;
99 } 109 }
100 else 110 else
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
index dd9bbc1..4f4ff07 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
@@ -132,8 +132,17 @@ namespace OpenSim.Region.Physics.Manager
132 } 132 }
133 } 133 }
134 134
135 // Deprecated. Do not use this for new physics engines.
135 public abstract void Initialise(IMesher meshmerizer, IConfigSource config); 136 public abstract void Initialise(IMesher meshmerizer, IConfigSource config);
136 137
138 // For older physics engines that do not implement non-legacy region sizes.
139 // If the physics engine handles the region extent feature, it overrides this function.
140 public virtual void Initialise(IMesher meshmerizer, IConfigSource config, Vector3 regionExtent)
141 {
142 // If not overridden, call the old initialization entry.
143 Initialise(meshmerizer, config);
144 }
145
137 /// <summary> 146 /// <summary>
138 /// Add an avatar 147 /// Add an avatar
139 /// </summary> 148 /// </summary>