diff options
Diffstat (limited to '')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs index 269c3d5..70aa429 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs | |||
@@ -64,7 +64,7 @@ public class BSTerrainManager | |||
64 | 64 | ||
65 | // The ground plane created to keep thing from falling to infinity. | 65 | // The ground plane created to keep thing from falling to infinity. |
66 | private BulletBody m_groundPlane; | 66 | private BulletBody m_groundPlane; |
67 | 67 | ||
68 | // If doing mega-regions, if we're region zero we will be managing multiple | 68 | // If doing mega-regions, if we're region zero we will be managing multiple |
69 | // region terrains since region zero does the physics for the whole mega-region. | 69 | // region terrains since region zero does the physics for the whole mega-region. |
70 | private Dictionary<Vector2, BulletHeightMapInfo> m_heightMaps; | 70 | private Dictionary<Vector2, BulletHeightMapInfo> m_heightMaps; |
@@ -110,8 +110,8 @@ public class BSTerrainManager | |||
110 | BulletShape groundPlaneShape = new BulletShape( | 110 | BulletShape groundPlaneShape = new BulletShape( |
111 | BulletSimAPI.CreateGroundPlaneShape2(BSScene.GROUNDPLANE_ID, 1f, TERRAIN_COLLISION_MARGIN), | 111 | BulletSimAPI.CreateGroundPlaneShape2(BSScene.GROUNDPLANE_ID, 1f, TERRAIN_COLLISION_MARGIN), |
112 | ShapeData.PhysicsShapeType.SHAPE_GROUNDPLANE); | 112 | ShapeData.PhysicsShapeType.SHAPE_GROUNDPLANE); |
113 | m_groundPlane = new BulletBody(BSScene.GROUNDPLANE_ID, | 113 | m_groundPlane = new BulletBody(BSScene.GROUNDPLANE_ID, |
114 | BulletSimAPI.CreateBodyWithDefaultMotionState2(groundPlaneShape.ptr, BSScene.GROUNDPLANE_ID, | 114 | BulletSimAPI.CreateBodyWithDefaultMotionState2(groundPlaneShape.ptr, BSScene.GROUNDPLANE_ID, |
115 | Vector3.Zero, Quaternion.Identity)); | 115 | Vector3.Zero, Quaternion.Identity)); |
116 | BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, m_groundPlane.ptr); | 116 | BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, m_groundPlane.ptr); |
117 | // Everything collides with the ground plane. | 117 | // Everything collides with the ground plane. |
@@ -182,7 +182,7 @@ public class BSTerrainManager | |||
182 | // If not doing the mega-prim thing, just change the terrain | 182 | // If not doing the mega-prim thing, just change the terrain |
183 | DetailLog("{0},SetTerrain.Existing", BSScene.DetailLogZero); | 183 | DetailLog("{0},SetTerrain.Existing", BSScene.DetailLogZero); |
184 | 184 | ||
185 | UpdateOrCreateTerrain(BSScene.TERRAIN_ID, localHeightMap, | 185 | UpdateOrCreateTerrain(BSScene.TERRAIN_ID, localHeightMap, |
186 | m_worldOffset, m_worldOffset + DefaultRegionSize, true); | 186 | m_worldOffset, m_worldOffset + DefaultRegionSize, true); |
187 | } | 187 | } |
188 | }); | 188 | }); |
@@ -234,7 +234,7 @@ public class BSTerrainManager | |||
234 | mapInfo.maxZ = maxZ; | 234 | mapInfo.maxZ = maxZ; |
235 | mapInfo.sizeX = maxCoords.X - minCoords.X; | 235 | mapInfo.sizeX = maxCoords.X - minCoords.X; |
236 | mapInfo.sizeY = maxCoords.Y - minCoords.Y; | 236 | mapInfo.sizeY = maxCoords.Y - minCoords.Y; |
237 | DetailLog("{0},UpdateOrCreateTerrain:UpdateExisting,call,terrainBase={1},minC={2}, maxC={3}, szX={4}, szY={5}", | 237 | DetailLog("{0},UpdateOrCreateTerrain:UpdateExisting,call,terrainBase={1},minC={2}, maxC={3}, szX={4}, szY={5}", |
238 | BSScene.DetailLogZero, terrainRegionBase, mapInfo.minCoords, mapInfo.maxCoords, mapInfo.sizeX, mapInfo.sizeY); | 238 | BSScene.DetailLogZero, terrainRegionBase, mapInfo.minCoords, mapInfo.maxCoords, mapInfo.sizeX, mapInfo.sizeY); |
239 | 239 | ||
240 | BSScene.TaintCallback rebuildOperation = delegate() | 240 | BSScene.TaintCallback rebuildOperation = delegate() |
@@ -255,7 +255,7 @@ public class BSTerrainManager | |||
255 | if (mapInfo.terrainBody.ptr != IntPtr.Zero) | 255 | if (mapInfo.terrainBody.ptr != IntPtr.Zero) |
256 | { | 256 | { |
257 | // Updating an existing terrain. | 257 | // Updating an existing terrain. |
258 | DetailLog("{0},UpdateOrCreateTerrain:UpdateExisting,taint,terrainBase={1},minC={2}, maxC={3}, szX={4}, szY={5}", | 258 | DetailLog("{0},UpdateOrCreateTerrain:UpdateExisting,taint,terrainBase={1},minC={2}, maxC={3}, szX={4}, szY={5}", |
259 | BSScene.DetailLogZero, terrainRegionBase, mapInfo.minCoords, mapInfo.maxCoords, mapInfo.sizeX, mapInfo.sizeY); | 259 | BSScene.DetailLogZero, terrainRegionBase, mapInfo.minCoords, mapInfo.maxCoords, mapInfo.sizeX, mapInfo.sizeY); |
260 | 260 | ||
261 | // Remove from the dynamics world because we're going to mangle this object | 261 | // Remove from the dynamics world because we're going to mangle this object |
@@ -289,7 +289,7 @@ public class BSTerrainManager | |||
289 | // else | 289 | // else |
290 | { | 290 | { |
291 | // Creating a new terrain. | 291 | // Creating a new terrain. |
292 | DetailLog("{0},UpdateOrCreateTerrain:CreateNewTerrain,taint,baseX={1},baseY={2},minZ={3},maxZ={4}", | 292 | DetailLog("{0},UpdateOrCreateTerrain:CreateNewTerrain,taint,baseX={1},baseY={2},minZ={3},maxZ={4}", |
293 | BSScene.DetailLogZero, mapInfo.minCoords.X, mapInfo.minCoords.Y, minZ, maxZ); | 293 | BSScene.DetailLogZero, mapInfo.minCoords.X, mapInfo.minCoords.Y, minZ, maxZ); |
294 | 294 | ||
295 | mapInfo.ID = id; | 295 | mapInfo.ID = id; |
@@ -306,9 +306,9 @@ public class BSTerrainManager | |||
306 | mapInfo.terrainShape = new BulletShape(BulletSimAPI.CreateTerrainShape2(mapInfo.Ptr), | 306 | mapInfo.terrainShape = new BulletShape(BulletSimAPI.CreateTerrainShape2(mapInfo.Ptr), |
307 | ShapeData.PhysicsShapeType.SHAPE_TERRAIN); | 307 | ShapeData.PhysicsShapeType.SHAPE_TERRAIN); |
308 | 308 | ||
309 | mapInfo.terrainBody = new BulletBody(mapInfo.ID, | 309 | mapInfo.terrainBody = new BulletBody(mapInfo.ID, |
310 | BulletSimAPI.CreateBodyWithDefaultMotionState2(mapInfo.terrainShape.ptr, | 310 | BulletSimAPI.CreateBodyWithDefaultMotionState2(mapInfo.terrainShape.ptr, |
311 | id, centerPos, Quaternion.Identity)); | 311 | id, centerPos, Quaternion.Identity)); |
312 | } | 312 | } |
313 | 313 | ||
314 | // Make sure the entry is in the heightmap table | 314 | // Make sure the entry is in the heightmap table |
@@ -329,7 +329,7 @@ public class BSTerrainManager | |||
329 | // redo its bounding box now that it is in the world | 329 | // redo its bounding box now that it is in the world |
330 | BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, mapInfo.terrainBody.ptr); | 330 | BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, mapInfo.terrainBody.ptr); |
331 | 331 | ||
332 | BulletSimAPI.SetCollisionFilterMask2(mapInfo.terrainBody.ptr, | 332 | BulletSimAPI.SetCollisionFilterMask2(mapInfo.terrainBody.ptr, |
333 | (uint)CollisionFilterGroups.TerrainFilter, | 333 | (uint)CollisionFilterGroups.TerrainFilter, |
334 | (uint)CollisionFilterGroups.TerrainMask); | 334 | (uint)CollisionFilterGroups.TerrainMask); |
335 | 335 | ||
@@ -361,7 +361,7 @@ public class BSTerrainManager | |||
361 | Vector3 minCoordsX = minCoords; | 361 | Vector3 minCoordsX = minCoords; |
362 | Vector3 maxCoordsX = maxCoords; | 362 | Vector3 maxCoordsX = maxCoords; |
363 | 363 | ||
364 | DetailLog("{0},UpdateOrCreateTerrain:NewTerrain,call,id={1}, minC={2}, maxC={3}", | 364 | DetailLog("{0},UpdateOrCreateTerrain:NewTerrain,call,id={1}, minC={2}, maxC={3}", |
365 | BSScene.DetailLogZero, newTerrainID, minCoords, minCoords); | 365 | BSScene.DetailLogZero, newTerrainID, minCoords, minCoords); |
366 | 366 | ||
367 | // Code that must happen at taint-time | 367 | // Code that must happen at taint-time |
@@ -370,7 +370,7 @@ public class BSTerrainManager | |||
370 | DetailLog("{0},UpdateOrCreateTerrain:NewTerrain,taint,baseX={1},baseY={2}", BSScene.DetailLogZero, minCoords.X, minCoords.Y); | 370 | DetailLog("{0},UpdateOrCreateTerrain:NewTerrain,taint,baseX={1},baseY={2}", BSScene.DetailLogZero, minCoords.X, minCoords.Y); |
371 | // Create a new mapInfo that will be filled with the new info | 371 | // Create a new mapInfo that will be filled with the new info |
372 | mapInfo = new BulletHeightMapInfo(id, heightMapX, | 372 | mapInfo = new BulletHeightMapInfo(id, heightMapX, |
373 | BulletSimAPI.CreateHeightMapInfo2(PhysicsScene.World.ptr, newTerrainID, | 373 | BulletSimAPI.CreateHeightMapInfo2(PhysicsScene.World.ptr, newTerrainID, |
374 | minCoordsX, maxCoordsX, heightMapX, TERRAIN_COLLISION_MARGIN)); | 374 | minCoordsX, maxCoordsX, heightMapX, TERRAIN_COLLISION_MARGIN)); |
375 | // Put the unfilled heightmap info into the collection of same | 375 | // Put the unfilled heightmap info into the collection of same |
376 | m_heightMaps.Add(terrainRegionBase, mapInfo); | 376 | m_heightMaps.Add(terrainRegionBase, mapInfo); |
@@ -454,7 +454,7 @@ public class BSTerrainManager | |||
454 | { | 454 | { |
455 | return true; | 455 | return true; |
456 | } | 456 | } |
457 | 457 | ||
458 | // This routine is called two ways: | 458 | // This routine is called two ways: |
459 | // One with 'offset' and 'pScene' zero and null but 'extents' giving the maximum | 459 | // One with 'offset' and 'pScene' zero and null but 'extents' giving the maximum |
460 | // extent of the combined regions. This is to inform the parent of the size | 460 | // extent of the combined regions. This is to inform the parent of the size |
@@ -469,11 +469,11 @@ public class BSTerrainManager | |||
469 | MegaRegionParentPhysicsScene = pScene; | 469 | MegaRegionParentPhysicsScene = pScene; |
470 | if (pScene != null) | 470 | if (pScene != null) |
471 | { | 471 | { |
472 | // We are a child. | 472 | // We are a child. |
473 | // We want m_worldMax to be the highest coordinate of our piece of terrain. | 473 | // We want m_worldMax to be the highest coordinate of our piece of terrain. |
474 | m_worldMax = offset + DefaultRegionSize; | 474 | m_worldMax = offset + DefaultRegionSize; |
475 | } | 475 | } |
476 | DetailLog("{0},BSTerrainManager.Combine,offset={1},extents={2},wOffset={3},wMax={4}", | 476 | DetailLog("{0},BSTerrainManager.Combine,offset={1},extents={2},wOffset={3},wMax={4}", |
477 | BSScene.DetailLogZero, offset, extents, m_worldOffset, m_worldMax); | 477 | BSScene.DetailLogZero, offset, extents, m_worldOffset, m_worldMax); |
478 | } | 478 | } |
479 | 479 | ||