aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorRobert Adams2012-11-21 10:37:40 -0800
committerRobert Adams2012-11-21 16:43:37 -0800
commita59368c4a1889ccd79da9e564ee84b213a7f6fbd (patch)
tree3a569d554afcc0ca9b5b3f7a53fdad06e9bb4f84 /OpenSim
parentBulletSim: fix line endings to be all Linux style (windows style keeps creepi... (diff)
downloadopensim-SC_OLD-a59368c4a1889ccd79da9e564ee84b213a7f6fbd.zip
opensim-SC_OLD-a59368c4a1889ccd79da9e564ee84b213a7f6fbd.tar.gz
opensim-SC_OLD-a59368c4a1889ccd79da9e564ee84b213a7f6fbd.tar.bz2
opensim-SC_OLD-a59368c4a1889ccd79da9e564ee84b213a7f6fbd.tar.xz
BulletSim: add terrainImplementation parameter with default to Mesh.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs5
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs45
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs1
3 files changed, 46 insertions, 5 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index 58dccea..0e73d04 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -1145,6 +1145,11 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
1145 (s,p,l,v) => { s.UpdateParameterObject(ref s.m_params[0].contactProcessingThreshold, p, l, v); }, 1145 (s,p,l,v) => { s.UpdateParameterObject(ref s.m_params[0].contactProcessingThreshold, p, l, v); },
1146 (s,o,v) => { BulletSimAPI.SetContactProcessingThreshold2(o.PhysBody.ptr, v); } ), 1146 (s,o,v) => { BulletSimAPI.SetContactProcessingThreshold2(o.PhysBody.ptr, v); } ),
1147 1147
1148 new ParameterDefn("TerrainImplementation", "Type of shape to use for terrain (0=heightmap, 1=mesh)",
1149 (float)BSTerrainPhys.TerrainImplementation.Mesh,
1150 (s,cf,p,v) => { s.m_params[0].terrainImplementation = cf.GetFloat(p,v); },
1151 (s) => { return s.m_params[0].terrainImplementation; },
1152 (s,p,l,v) => { s.m_params[0].terrainImplementation = v; } ),
1148 new ParameterDefn("TerrainFriction", "Factor to reduce movement against terrain surface" , 1153 new ParameterDefn("TerrainFriction", "Factor to reduce movement against terrain surface" ,
1149 0.5f, 1154 0.5f,
1150 (s,cf,p,v) => { s.m_params[0].terrainFriction = cf.GetFloat(p, v); }, 1155 (s,cf,p,v) => { s.m_params[0].terrainFriction = cf.GetFloat(p, v); },
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
index ed0dfa8..b88f561 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs
@@ -44,6 +44,12 @@ namespace OpenSim.Region.Physics.BulletSPlugin
44// The physical implementation of the terrain is wrapped in this class. 44// The physical implementation of the terrain is wrapped in this class.
45public abstract class BSTerrainPhys : IDisposable 45public abstract class BSTerrainPhys : IDisposable
46{ 46{
47 public enum TerrainImplementation
48 {
49 Heightmap = 0,
50 Mesh = 1
51 }
52
47 public BSScene PhysicsScene { get; private set; } 53 public BSScene PhysicsScene { get; private set; }
48 // Base of the region in world coordinates. Coordinates inside the region are relative to this. 54 // Base of the region in world coordinates. Coordinates inside the region are relative to this.
49 public Vector3 TerrainBase { get; private set; } 55 public Vector3 TerrainBase { get; private set; }
@@ -246,12 +252,27 @@ public sealed class BSTerrainManager
246 // Release any physical memory it may be using. 252 // Release any physical memory it may be using.
247 terrainPhys.Dispose(); 253 terrainPhys.Dispose();
248 254
255 BSTerrainPhys newTerrainPhys = null; ;
249 if (MegaRegionParentPhysicsScene == null) 256 if (MegaRegionParentPhysicsScene == null)
250 { 257 {
251 // BSTerrainPhys newTerrainPhys = new BSTerrainHeightmap(PhysicsScene, terrainRegionBase, id, 258 // TODO: redo terrain implementation selection to be centralized (there is another
252 // heightMap, minCoords, maxCoords); 259 // use below) and to accept an asset specification (for a mesh).
253 BSTerrainPhys newTerrainPhys = new BSTerrainMesh(PhysicsScene, terrainRegionBase, id, 260 switch ((int)PhysicsScene.Params.terrainImplementation)
261 {
262 case (int)BSTerrainPhys.TerrainImplementation.Heightmap:
263 newTerrainPhys = new BSTerrainHeightmap(PhysicsScene, terrainRegionBase, id,
264 heightMap, minCoords, maxCoords);
265 break;
266 case (int)BSTerrainPhys.TerrainImplementation.Mesh:
267 newTerrainPhys = new BSTerrainMesh(PhysicsScene, terrainRegionBase, id,
254 heightMap, minCoords, maxCoords); 268 heightMap, minCoords, maxCoords);
269 break;
270 default:
271 PhysicsScene.Logger.ErrorFormat("{0} Bad terrain implementation specified. type={1}/{2}",
272 LogHeader, (int)PhysicsScene.Params.terrainImplementation, PhysicsScene.Params.terrainImplementation);
273 break;
274 }
275
255 m_terrains.Add(terrainRegionBase, newTerrainPhys); 276 m_terrains.Add(terrainRegionBase, newTerrainPhys);
256 277
257 m_terrainModified = true; 278 m_terrainModified = true;
@@ -292,8 +313,22 @@ public sealed class BSTerrainManager
292 { 313 {
293 DetailLog("{0},UpdateTerrain:NewTerrain,taint,baseX={1},baseY={2}", 314 DetailLog("{0},UpdateTerrain:NewTerrain,taint,baseX={1},baseY={2}",
294 BSScene.DetailLogZero, minCoordsX.X, minCoordsX.Y); 315 BSScene.DetailLogZero, minCoordsX.X, minCoordsX.Y);
295 BSTerrainPhys newTerrainPhys = new BSTerrainHeightmap(PhysicsScene, terrainRegionBase, 316 BSTerrainPhys newTerrainPhys = null;
296 newTerrainID, heightMapX, minCoordsX, maxCoordsX); 317 switch ((int)PhysicsScene.Params.terrainImplementation)
318 {
319 case (int)BSTerrainPhys.TerrainImplementation.Heightmap:
320 newTerrainPhys = new BSTerrainHeightmap(PhysicsScene, terrainRegionBase, id,
321 heightMap, minCoords, maxCoords);
322 break;
323 case (int)BSTerrainPhys.TerrainImplementation.Mesh:
324 newTerrainPhys = new BSTerrainMesh(PhysicsScene, terrainRegionBase, id,
325 heightMap, minCoords, maxCoords);
326 break;
327 default:
328 PhysicsScene.Logger.ErrorFormat("{0} Bad terrain implementation specified. type={1}/{2}",
329 LogHeader, (int)PhysicsScene.Params.terrainImplementation, PhysicsScene.Params.terrainImplementation);
330 break;
331 }
297 m_terrains.Add(terrainRegionBase, newTerrainPhys); 332 m_terrains.Add(terrainRegionBase, newTerrainPhys);
298 333
299 m_terrainModified = true; 334 m_terrainModified = true;
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
index a2271a9..e218053 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs
@@ -283,6 +283,7 @@ public struct ConfigurationParameters
283 public float ccdSweptSphereRadius; 283 public float ccdSweptSphereRadius;
284 public float contactProcessingThreshold; 284 public float contactProcessingThreshold;
285 285
286 public float terrainImplementation;
286 public float terrainFriction; 287 public float terrainFriction;
287 public float terrainHitFraction; 288 public float terrainHitFraction;
288 public float terrainRestitution; 289 public float terrainRestitution;