BulletSim: remove some errors on shutdown by moving terrain destruction until after physical object destruction. TerrainManager also made disposable and that feature used.
parent
ace1f1e931
commit
f3b1efd889
|
@ -349,8 +349,6 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
|
||||||
// make sure no stepping happens while we're deleting stuff
|
// make sure no stepping happens while we're deleting stuff
|
||||||
m_initialized = false;
|
m_initialized = false;
|
||||||
|
|
||||||
TerrainManager.ReleaseGroundPlaneAndTerrain();
|
|
||||||
|
|
||||||
foreach (KeyValuePair<uint, BSPhysObject> kvp in PhysObjects)
|
foreach (KeyValuePair<uint, BSPhysObject> kvp in PhysObjects)
|
||||||
{
|
{
|
||||||
kvp.Value.Destroy();
|
kvp.Value.Destroy();
|
||||||
|
@ -370,6 +368,13 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
|
||||||
Shapes = null;
|
Shapes = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (TerrainManager != null)
|
||||||
|
{
|
||||||
|
TerrainManager.ReleaseGroundPlaneAndTerrain();
|
||||||
|
TerrainManager.Dispose();
|
||||||
|
TerrainManager = null;
|
||||||
|
}
|
||||||
|
|
||||||
// Anything left in the unmanaged code should be cleaned out
|
// Anything left in the unmanaged code should be cleaned out
|
||||||
BulletSimAPI.Shutdown2(World.ptr);
|
BulletSimAPI.Shutdown2(World.ptr);
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ public abstract class BSTerrainPhys : IDisposable
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==========================================================================================
|
// ==========================================================================================
|
||||||
public sealed class BSTerrainManager
|
public sealed class BSTerrainManager : IDisposable
|
||||||
{
|
{
|
||||||
static string LogHeader = "[BULLETSIM TERRAIN MANAGER]";
|
static string LogHeader = "[BULLETSIM TERRAIN MANAGER]";
|
||||||
|
|
||||||
|
@ -122,6 +122,11 @@ public sealed class BSTerrainManager
|
||||||
MegaRegionParentPhysicsScene = null;
|
MegaRegionParentPhysicsScene = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
ReleaseGroundPlaneAndTerrain();
|
||||||
|
}
|
||||||
|
|
||||||
// Create the initial instance of terrain and the underlying ground plane.
|
// Create the initial instance of terrain and the underlying ground plane.
|
||||||
// This is called from the initialization routine so we presume it is
|
// This is called from the initialization routine so we presume it is
|
||||||
// safe to call Bullet in real time. We hope no one is moving prims around yet.
|
// safe to call Bullet in real time. We hope no one is moving prims around yet.
|
||||||
|
@ -366,6 +371,9 @@ public sealed class BSTerrainManager
|
||||||
{
|
{
|
||||||
PhysicsScene.Logger.ErrorFormat("{0} GetTerrainHeightAtXY: terrain not found: region={1}, x={2}, y={3}",
|
PhysicsScene.Logger.ErrorFormat("{0} GetTerrainHeightAtXY: terrain not found: region={1}, x={2}, y={3}",
|
||||||
LogHeader, PhysicsScene.RegionName, tX, tY);
|
LogHeader, PhysicsScene.RegionName, tX, tY);
|
||||||
|
DetailLog("{0},BSTerrainManager.GetTerrainHeightAtXYZ,terrainNotFound,loc={1},base={2}",
|
||||||
|
BSScene.DetailLogZero, loc, terrainBaseXYZ);
|
||||||
|
Util.PrintCallStack(); // DEBUG DEBUG DEBUG
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lastHeight = ret;
|
lastHeight = ret;
|
||||||
|
|
Loading…
Reference in New Issue