aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs7
-rw-r--r--OpenSim/Region/ClientStack/RegionApplicationBase.cs6
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs12
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs4
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs6
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs5
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs6
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsScene.cs9
-rw-r--r--OpenSim/Tests/Common/Helpers/SceneHelpers.cs3
9 files changed, 41 insertions, 17 deletions
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 1e34a1e..70d7ee9 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -690,7 +690,8 @@ namespace OpenSim
690 clientServer = clientNetworkServers; 690 clientServer = clientNetworkServers;
691 scene.LoadWorldMap(); 691 scene.LoadWorldMap();
692 692
693 scene.PhysicsScene = GetPhysicsScene(scene.RegionInfo.RegionName); 693 Vector3 regionExtent = new Vector3(regionInfo.RegionSizeX, regionInfo.RegionSizeY, regionInfo.RegionSizeZ);
694 scene.PhysicsScene = GetPhysicsScene(scene.RegionInfo.RegionName, regionExtent);
694 scene.PhysicsScene.RequestAssetMethod = scene.PhysicsRequestAsset; 695 scene.PhysicsScene.RequestAssetMethod = scene.PhysicsRequestAsset;
695 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); 696 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
696 scene.PhysicsScene.SetWaterLevel((float) regionInfo.RegionSettings.WaterHeight); 697 scene.PhysicsScene.SetWaterLevel((float) regionInfo.RegionSettings.WaterHeight);
@@ -752,10 +753,10 @@ namespace OpenSim
752 753
753 # region Setup methods 754 # region Setup methods
754 755
755 protected override PhysicsScene GetPhysicsScene(string osSceneIdentifier) 756 protected override PhysicsScene GetPhysicsScene(string osSceneIdentifier, Vector3 regionExtent)
756 { 757 {
757 return GetPhysicsScene( 758 return GetPhysicsScene(
758 m_configSettings.PhysicsEngine, m_configSettings.MeshEngineName, Config, osSceneIdentifier); 759 m_configSettings.PhysicsEngine, m_configSettings.MeshEngineName, Config, osSceneIdentifier, regionExtent);
759 } 760 }
760 761
761 /// <summary> 762 /// <summary>
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
index 853b72d..1ce166e 100644
--- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs
+++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
@@ -69,7 +69,7 @@ namespace OpenSim.Region.ClientStack
69 /// The name of the OpenSim scene this physics scene is serving. This will be used in log messages. 69 /// The name of the OpenSim scene this physics scene is serving. This will be used in log messages.
70 /// </param> 70 /// </param>
71 /// <returns></returns> 71 /// <returns></returns>
72 protected abstract PhysicsScene GetPhysicsScene(string osSceneIdentifier); 72 protected abstract PhysicsScene GetPhysicsScene(string osSceneIdentifier, Vector3 regionExtent);
73 73
74 protected abstract ClientStackManager CreateClientStackManager(); 74 protected abstract ClientStackManager CreateClientStackManager();
75 protected abstract Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, IEstateDataService estateDataService, AgentCircuitManager circuitManager); 75 protected abstract Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, IEstateDataService estateDataService, AgentCircuitManager circuitManager);
@@ -123,13 +123,13 @@ namespace OpenSim.Region.ClientStack
123 /// </param> 123 /// </param>
124 /// <returns></returns> 124 /// <returns></returns>
125 protected PhysicsScene GetPhysicsScene( 125 protected PhysicsScene GetPhysicsScene(
126 string engine, string meshEngine, IConfigSource config, string osSceneIdentifier) 126 string engine, string meshEngine, IConfigSource config, string osSceneIdentifier, Vector3 regionExtent)
127 { 127 {
128 PhysicsPluginManager physicsPluginManager; 128 PhysicsPluginManager physicsPluginManager;
129 physicsPluginManager = new PhysicsPluginManager(); 129 physicsPluginManager = new PhysicsPluginManager();
130 physicsPluginManager.LoadPluginsFromAssemblies("Physics"); 130 physicsPluginManager.LoadPluginsFromAssemblies("Physics");
131 131
132 return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config, osSceneIdentifier); 132 return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config, osSceneIdentifier, regionExtent);
133 } 133 }
134 } 134 }
135} \ No newline at end of file 135} \ No newline at end of file
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index b3dfa41..83ef1f6 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -210,6 +210,14 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
210 210
211 public override void Initialise(IMesher meshmerizer, IConfigSource config) 211 public override void Initialise(IMesher meshmerizer, IConfigSource config)
212 { 212 {
213 m_log.ErrorFormat("{0} WARNING WARNING WARNING! BulletSim initialized without region extent specification. Terrain will be messed up.");
214 Vector3 regionExtent = new Vector3( Constants.RegionSize, Constants.RegionSize, Constants.RegionSize);
215 Initialise(meshmerizer, config, regionExtent);
216
217 }
218
219 public override void Initialise(IMesher meshmerizer, IConfigSource config, Vector3 regionExtent)
220 {
213 mesher = meshmerizer; 221 mesher = meshmerizer;
214 _taintOperations = new List<TaintCallbackEntry>(); 222 _taintOperations = new List<TaintCallbackEntry>();
215 _postTaintOperations = new Dictionary<string, TaintCallbackEntry>(); 223 _postTaintOperations = new Dictionary<string, TaintCallbackEntry>();
@@ -250,13 +258,13 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
250 // a child in a mega-region. 258 // a child in a mega-region.
251 // Bullet actually doesn't care about the extents of the simulated 259 // Bullet actually doesn't care about the extents of the simulated
252 // area. It tracks active objects no matter where they are. 260 // area. It tracks active objects no matter where they are.
253 Vector3 worldExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight); 261 Vector3 worldExtent = regionExtent;
254 262
255 World = PE.Initialize(worldExtent, Params, m_maxCollisionsPerFrame, ref m_collisionArray, m_maxUpdatesPerFrame, ref m_updateArray); 263 World = PE.Initialize(worldExtent, Params, m_maxCollisionsPerFrame, ref m_collisionArray, m_maxUpdatesPerFrame, ref m_updateArray);
256 264
257 Constraints = new BSConstraintCollection(World); 265 Constraints = new BSConstraintCollection(World);
258 266
259 TerrainManager = new BSTerrainManager(this); 267 TerrainManager = new BSTerrainManager(this, worldExtent);
260 TerrainManager.CreateInitialGroundPlaneAndTerrain(); 268 TerrainManager.CreateInitialGroundPlaneAndTerrain();
261 269
262 // Put some informational messages into the log file. 270 // Put some informational messages into the log file.
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs
index 8888d6d..d70b2fb 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs
@@ -58,7 +58,7 @@ public sealed class BSTerrainHeightmap : BSTerrainPhys
58 { 58 {
59 initialMap[ii] = BSTerrainManager.HEIGHT_INITIALIZATION; 59 initialMap[ii] = BSTerrainManager.HEIGHT_INITIALIZATION;
60 } 60 }
61 m_mapInfo = new BulletHMapInfo(id, initialMap); 61 m_mapInfo = new BulletHMapInfo(id, initialMap, regionSize.X, regionSize.Y);
62 m_mapInfo.minCoords = minTerrainCoords; 62 m_mapInfo.minCoords = minTerrainCoords;
63 m_mapInfo.maxCoords = maxTerrainCoords; 63 m_mapInfo.maxCoords = maxTerrainCoords;
64 m_mapInfo.terrainRegionBase = TerrainBase; 64 m_mapInfo.terrainRegionBase = TerrainBase;
@@ -72,7 +72,7 @@ public sealed class BSTerrainHeightmap : BSTerrainPhys
72 Vector3 minCoords, Vector3 maxCoords) 72 Vector3 minCoords, Vector3 maxCoords)
73 : base(physicsScene, regionBase, id) 73 : base(physicsScene, regionBase, id)
74 { 74 {
75 m_mapInfo = new BulletHMapInfo(id, initialMap); 75 m_mapInfo = new BulletHMapInfo(id, initialMap, maxCoords.X - minCoords.X, maxCoords.Y - minCoords.Y);
76 m_mapInfo.minCoords = minCoords; 76 m_mapInfo.minCoords = minCoords;
77 m_mapInfo.maxCoords = maxCoords; 77 m_mapInfo.maxCoords = maxCoords;
78 m_mapInfo.minZ = minCoords.Z; 78 m_mapInfo.minZ = minCoords.Z;
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
index 441d2d3..3013077 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
@@ -111,9 +111,11 @@ public sealed class BSTerrainManager : IDisposable
111 private Vector3 m_worldMax; 111 private Vector3 m_worldMax;
112 private PhysicsScene MegaRegionParentPhysicsScene { get; set; } 112 private PhysicsScene MegaRegionParentPhysicsScene { get; set; }
113 113
114 public BSTerrainManager(BSScene physicsScene) 114 public BSTerrainManager(BSScene physicsScene, Vector3 regionSize)
115 { 115 {
116 m_physicsScene = physicsScene; 116 m_physicsScene = physicsScene;
117 DefaultRegionSize = regionSize;
118
117 m_terrains = new Dictionary<Vector3,BSTerrainPhys>(); 119 m_terrains = new Dictionary<Vector3,BSTerrainPhys>();
118 120
119 // Assume one region of default size 121 // Assume one region of default size
@@ -268,7 +270,7 @@ public sealed class BSTerrainManager : IDisposable
268 { 270 {
269 // There is already a terrain in this spot. Free the old and build the new. 271 // There is already a terrain in this spot. Free the old and build the new.
270 DetailLog("{0},BSTErrainManager.UpdateTerrain:UpdateExisting,call,id={1},base={2},minC={3},maxC={4}", 272 DetailLog("{0},BSTErrainManager.UpdateTerrain:UpdateExisting,call,id={1},base={2},minC={3},maxC={4}",
271 BSScene.DetailLogZero, id, terrainRegionBase, minCoords, minCoords); 273 BSScene.DetailLogZero, id, terrainRegionBase, minCoords, maxCoords);
272 274
273 // Remove old terrain from the collection 275 // Remove old terrain from the collection
274 m_terrains.Remove(terrainRegionBase); 276 m_terrains.Remove(terrainRegionBase);
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs
index 971ff9f..3425d9e 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs
@@ -165,14 +165,15 @@ public class BulletConstraint
165// than making copies. 165// than making copies.
166public class BulletHMapInfo 166public class BulletHMapInfo
167{ 167{
168 public BulletHMapInfo(uint id, float[] hm) { 168 public BulletHMapInfo(uint id, float[] hm, float pSizeX, float pSizeY) {
169 ID = id; 169 ID = id;
170 heightMap = hm; 170 heightMap = hm;
171 terrainRegionBase = OMV.Vector3.Zero; 171 terrainRegionBase = OMV.Vector3.Zero;
172 minCoords = new OMV.Vector3(100f, 100f, 25f); 172 minCoords = new OMV.Vector3(100f, 100f, 25f);
173 maxCoords = new OMV.Vector3(101f, 101f, 26f); 173 maxCoords = new OMV.Vector3(101f, 101f, 26f);
174 minZ = maxZ = 0f; 174 minZ = maxZ = 0f;
175 sizeX = sizeY = 256f; 175 sizeX = pSizeX;
176 sizeY = pSizeY;
176 } 177 }
177 public uint ID; 178 public uint ID;
178 public float[] heightMap; 179 public float[] heightMap;
diff --git a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
index 8ccfda5..9b06353 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{
@@ -66,7 +67,8 @@ namespace OpenSim.Region.Physics.Manager
66 /// <param name="meshEngineName"></param> 67 /// <param name="meshEngineName"></param>
67 /// <param name="config"></param> 68 /// <param name="config"></param>
68 /// <returns></returns> 69 /// <returns></returns>
69 public PhysicsScene GetPhysicsScene(string physEngineName, string meshEngineName, IConfigSource config, string regionName) 70 public PhysicsScene GetPhysicsScene(string physEngineName, string meshEngineName,
71 IConfigSource config, string regionName, Vector3 regionExtent)
70 { 72 {
71 if (String.IsNullOrEmpty(physEngineName)) 73 if (String.IsNullOrEmpty(physEngineName))
72 { 74 {
@@ -94,7 +96,7 @@ namespace OpenSim.Region.Physics.Manager
94 { 96 {
95 m_log.Info("[PHYSICS]: creating " + physEngineName); 97 m_log.Info("[PHYSICS]: creating " + physEngineName);
96 PhysicsScene result = _PhysPlugins[physEngineName].GetScene(regionName); 98 PhysicsScene result = _PhysPlugins[physEngineName].GetScene(regionName);
97 result.Initialise(meshEngine, config); 99 result.Initialise(meshEngine, config, regionExtent);
98 return result; 100 return result;
99 } 101 }
100 else 102 else
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
index c93206d..71ad795 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
@@ -126,8 +126,17 @@ namespace OpenSim.Region.Physics.Manager
126 } 126 }
127 } 127 }
128 128
129 // Deprecated. Do not use this for new physics engines.
129 public abstract void Initialise(IMesher meshmerizer, IConfigSource config); 130 public abstract void Initialise(IMesher meshmerizer, IConfigSource config);
130 131
132 // For older physics engines that do not implement non-legacy region sizes.
133 // If the physics engine handles the region extent feature, it overrides this function.
134 public virtual void Initialise(IMesher meshmerizer, IConfigSource config, Vector3 regionExtent)
135 {
136 // If not overridden, call the old initialization entry.
137 Initialise(meshmerizer, config);
138 }
139
131 /// <summary> 140 /// <summary>
132 /// Add an avatar 141 /// Add an avatar
133 /// </summary> 142 /// </summary>
diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
index 4cdfe98..008f2d0 100644
--- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
@@ -186,8 +186,9 @@ namespace OpenSim.Tests.Common
186 186
187 PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); 187 PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager();
188 physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll"); 188 physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll");
189 Vector3 regionExtent = new Vector3( regInfo.RegionSizeX, regInfo.RegionSizeY, regInfo.RegionSizeZ);
189 testScene.PhysicsScene 190 testScene.PhysicsScene
190 = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", new IniConfigSource(), "test"); 191 = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", new IniConfigSource(), "test", regionExtent);
191 192
192 testScene.RegionInfo.EstateSettings = new EstateSettings(); 193 testScene.RegionInfo.EstateSettings = new EstateSettings();
193 testScene.LoginsEnabled = true; 194 testScene.LoginsEnabled = true;