diff options
author | Robert Adams | 2012-11-21 10:37:40 -0800 |
---|---|---|
committer | Robert Adams | 2012-11-21 16:43:37 -0800 |
commit | a59368c4a1889ccd79da9e564ee84b213a7f6fbd (patch) | |
tree | 3a569d554afcc0ca9b5b3f7a53fdad06e9bb4f84 /OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs | |
parent | BulletSim: fix line endings to be all Linux style (windows style keeps creepi... (diff) | |
download | opensim-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/Region/Physics/BulletSPlugin/BSTerrainManager.cs')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs | 45 |
1 files changed, 40 insertions, 5 deletions
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. |
45 | public abstract class BSTerrainPhys : IDisposable | 45 | public 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; |