From 0842e2e15b6af6f940648b0b74488f2da88ce920 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Wed, 29 Jan 2014 06:44:14 -0800 Subject: BulletSim: default physical terrain implementation to heightmap. It originally looked like mesh terrain would perform better for vehicles but, after much use, heightmap is the clear winner. Force terrain implementation to heightmap if the physics region is larger than legacy region size. This solves running out of memory for very large regions. --- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 2 +- OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 8 ++++++++ bin/OpenSimDefaults.ini | 4 ++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 834228e..d993e6a 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -538,7 +538,7 @@ public static class BSParam (s,o) => { s.PE.SetContactProcessingThreshold(o.PhysBody, ContactProcessingThreshold); } ), new ParameterDefn("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)", - (float)BSTerrainPhys.TerrainImplementation.Mesh ), + (float)BSTerrainPhys.TerrainImplementation.Heightmap ), new ParameterDefn("TerrainMeshMagnification", "Number of times the 256x256 heightmap is multiplied to create the terrain mesh" , 2 ), new ParameterDefn("TerrainFriction", "Factor to reduce movement against terrain surface" , diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index fe014fc..2d2e55f 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -235,6 +235,14 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters // Set default values for physics parameters plus any overrides from the ini file GetInitialParameterValues(config); + // Force some parameters to values depending on other configurations + // Only use heightmap terrain implementation if terrain larger than legacy size + if ((uint)regionExtent.X > Constants.RegionSize || (uint)regionExtent.Y > Constants.RegionSize) + { + m_log.WarnFormat("{0} Forcing terrain implementation to heightmap for large region", LogHeader); + BSParam.TerrainImplementation = (float)BSTerrainPhys.TerrainImplementation.Heightmap; + } + // Get the connection to the physics engine (could be native or one of many DLLs) PE = SelectUnderlyingBulletEngine(BulletEngineName); diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index df94239..026f285 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -1001,10 +1001,10 @@ ; Terrain implementation can use either Bullet's heightField or BulletSim can build ; a mesh. 0=heightField, 1=mesh - TerrainImplementation = 1 + TerrainImplementation = 0 ; For mesh terrain, the detail of the created mesh. '1' gives 256x256 (heightfield ; resolution). '2' gives 512x512. Etc. Cannot be larger than '4'. Higher - ; magnification uses lots of memory. + ; magnifications use lots of memory. TerrainMeshMagnification = 2 ; Avatar physics height adjustments. -- cgit v1.1