diff options
Diffstat (limited to '')
4 files changed, 19 insertions, 8 deletions
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. |
166 | public class BulletHMapInfo | 166 | public 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; |