aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs19
1 files changed, 11 insertions, 8 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
index 441d2d3..50f917a 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -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
@@ -135,8 +137,9 @@ public sealed class BSTerrainManager : IDisposable
135 DetailLog("{0},BSTerrainManager.CreateInitialGroundPlaneAndTerrain,region={1}", BSScene.DetailLogZero, m_physicsScene.RegionName); 137 DetailLog("{0},BSTerrainManager.CreateInitialGroundPlaneAndTerrain,region={1}", BSScene.DetailLogZero, m_physicsScene.RegionName);
136 // The ground plane is here to catch things that are trying to drop to negative infinity 138 // The ground plane is here to catch things that are trying to drop to negative infinity
137 BulletShape groundPlaneShape = m_physicsScene.PE.CreateGroundPlaneShape(BSScene.GROUNDPLANE_ID, 1f, BSParam.TerrainCollisionMargin); 139 BulletShape groundPlaneShape = m_physicsScene.PE.CreateGroundPlaneShape(BSScene.GROUNDPLANE_ID, 1f, BSParam.TerrainCollisionMargin);
140 Vector3 groundPlaneAltitude = new Vector3(0f, 0f, BSParam.TerrainGroundPlane);
138 m_groundPlane = m_physicsScene.PE.CreateBodyWithDefaultMotionState(groundPlaneShape, 141 m_groundPlane = m_physicsScene.PE.CreateBodyWithDefaultMotionState(groundPlaneShape,
139 BSScene.GROUNDPLANE_ID, Vector3.Zero, Quaternion.Identity); 142 BSScene.GROUNDPLANE_ID, groundPlaneAltitude, Quaternion.Identity);
140 143
141 // Everything collides with the ground plane. 144 // Everything collides with the ground plane.
142 m_groundPlane.collisionType = CollisionType.Groundplane; 145 m_groundPlane.collisionType = CollisionType.Groundplane;
@@ -237,9 +240,6 @@ public sealed class BSTerrainManager : IDisposable
237 // Called during taint-time. 240 // Called during taint-time.
238 private void UpdateTerrain(uint id, float[] heightMap, Vector3 minCoords, Vector3 maxCoords) 241 private void UpdateTerrain(uint id, float[] heightMap, Vector3 minCoords, Vector3 maxCoords)
239 { 242 {
240 DetailLog("{0},BSTerrainManager.UpdateTerrain,call,id={1},minC={2},maxC={3}",
241 BSScene.DetailLogZero, id, minCoords, maxCoords);
242
243 // Find high and low points of passed heightmap. 243 // Find high and low points of passed heightmap.
244 // The min and max passed in is usually the area objects can be in (maximum 244 // The min and max passed in is usually the area objects can be in (maximum
245 // object height, for instance). The terrain wants the bounding box for the 245 // object height, for instance). The terrain wants the bounding box for the
@@ -259,6 +259,9 @@ public sealed class BSTerrainManager : IDisposable
259 minCoords.Z = minZ; 259 minCoords.Z = minZ;
260 maxCoords.Z = maxZ; 260 maxCoords.Z = maxZ;
261 261
262 DetailLog("{0},BSTerrainManager.UpdateTerrain,call,id={1},minC={2},maxC={3}",
263 BSScene.DetailLogZero, id, minCoords, maxCoords);
264
262 Vector3 terrainRegionBase = new Vector3(minCoords.X, minCoords.Y, 0f); 265 Vector3 terrainRegionBase = new Vector3(minCoords.X, minCoords.Y, 0f);
263 266
264 lock (m_terrains) 267 lock (m_terrains)
@@ -267,8 +270,8 @@ public sealed class BSTerrainManager : IDisposable
267 if (m_terrains.TryGetValue(terrainRegionBase, out terrainPhys)) 270 if (m_terrains.TryGetValue(terrainRegionBase, out terrainPhys))
268 { 271 {
269 // There is already a terrain in this spot. Free the old and build the new. 272 // 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}", 273 DetailLog("{0},BSTerrainManager.UpdateTerrain:UpdateExisting,call,id={1},base={2},minC={3},maxC={4}",
271 BSScene.DetailLogZero, id, terrainRegionBase, minCoords, minCoords); 274 BSScene.DetailLogZero, id, terrainRegionBase, minCoords, maxCoords);
272 275
273 // Remove old terrain from the collection 276 // Remove old terrain from the collection
274 m_terrains.Remove(terrainRegionBase); 277 m_terrains.Remove(terrainRegionBase);