aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs23
1 files changed, 5 insertions, 18 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
index 880859a..7c34af2 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
@@ -40,7 +40,7 @@ using OpenMetaverse;
40 40
41namespace OpenSim.Region.Physics.BulletSPlugin 41namespace OpenSim.Region.Physics.BulletSPlugin
42{ 42{
43public class BSTerrainManager 43public sealed class BSTerrainManager
44{ 44{
45 static string LogHeader = "[BULLETSIM TERRAIN MANAGER]"; 45 static string LogHeader = "[BULLETSIM TERRAIN MANAGER]";
46 46
@@ -238,7 +238,7 @@ public class BSTerrainManager
238 DetailLog("{0},UpdateOrCreateTerrain:UpdateExisting,call,terrainBase={1},minC={2}, maxC={3}, szX={4}, szY={5}", 238 DetailLog("{0},UpdateOrCreateTerrain:UpdateExisting,call,terrainBase={1},minC={2}, maxC={3}, szX={4}, szY={5}",
239 BSScene.DetailLogZero, terrainRegionBase, mapInfo.minCoords, mapInfo.maxCoords, mapInfo.sizeX, mapInfo.sizeY); 239 BSScene.DetailLogZero, terrainRegionBase, mapInfo.minCoords, mapInfo.maxCoords, mapInfo.sizeX, mapInfo.sizeY);
240 240
241 BSScene.TaintCallback rebuildOperation = delegate() 241 PhysicsScene.TaintedObject(inTaintTime, "BSScene.UpdateOrCreateTerrain:UpdateExisting", delegate()
242 { 242 {
243 if (MegaRegionParentPhysicsScene != null) 243 if (MegaRegionParentPhysicsScene != null)
244 { 244 {
@@ -337,14 +337,7 @@ public class BSTerrainManager
337 BulletSimAPI.ForceActivationState2(mapInfo.terrainBody.ptr, ActivationState.DISABLE_SIMULATION); 337 BulletSimAPI.ForceActivationState2(mapInfo.terrainBody.ptr, ActivationState.DISABLE_SIMULATION);
338 338
339 m_terrainModified = true; 339 m_terrainModified = true;
340 }; 340 });
341
342 // There is the option to do the changes now (we're already in 'taint time'), or
343 // to do the Bullet operations later.
344 if (inTaintTime)
345 rebuildOperation();
346 else
347 PhysicsScene.TaintedObject("BSScene.UpdateOrCreateTerrain:UpdateExisting", rebuildOperation);
348 } 341 }
349 else 342 else
350 { 343 {
@@ -364,7 +357,7 @@ public class BSTerrainManager
364 BSScene.DetailLogZero, newTerrainID, minCoords, minCoords); 357 BSScene.DetailLogZero, newTerrainID, minCoords, minCoords);
365 358
366 // Code that must happen at taint-time 359 // Code that must happen at taint-time
367 BSScene.TaintCallback createOperation = delegate() 360 PhysicsScene.TaintedObject(inTaintTime, "BSScene.UpdateOrCreateTerrain:NewTerrain", delegate()
368 { 361 {
369 DetailLog("{0},UpdateOrCreateTerrain:NewTerrain,taint,baseX={1},baseY={2}", BSScene.DetailLogZero, minCoords.X, minCoords.Y); 362 DetailLog("{0},UpdateOrCreateTerrain:NewTerrain,taint,baseX={1},baseY={2}", BSScene.DetailLogZero, minCoords.X, minCoords.Y);
370 // Create a new mapInfo that will be filled with the new info 363 // Create a new mapInfo that will be filled with the new info
@@ -377,13 +370,7 @@ public class BSTerrainManager
377 UpdateOrCreateTerrain(newTerrainID, heightMap, minCoords, maxCoords, true); 370 UpdateOrCreateTerrain(newTerrainID, heightMap, minCoords, maxCoords, true);
378 371
379 m_terrainModified = true; 372 m_terrainModified = true;
380 }; 373 });
381
382 // If already in taint-time, just call Bullet. Otherwise queue the operations for the safe time.
383 if (inTaintTime)
384 createOperation();
385 else
386 PhysicsScene.TaintedObject("BSScene.UpdateOrCreateTerrain:NewTerrain", createOperation);
387 } 374 }
388 } 375 }
389 376