aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
authorTeravus Ovares (Dan Olivares)2009-08-21 13:22:49 -0400
committerTeravus Ovares (Dan Olivares)2009-08-21 13:22:49 -0400
commite1b38ff00196c61af4c78cc96bed12afee1dcaf3 (patch)
tree18d2677d387405c2cbebd6361677612cc0d55788 /OpenSim/Region/Physics
parent* Fixes Terrain issues with combined regions. (diff)
downloadopensim-SC-e1b38ff00196c61af4c78cc96bed12afee1dcaf3.zip
opensim-SC-e1b38ff00196c61af4c78cc96bed12afee1dcaf3.tar.gz
opensim-SC-e1b38ff00196c61af4c78cc96bed12afee1dcaf3.tar.bz2
opensim-SC-e1b38ff00196c61af4c78cc96bed12afee1dcaf3.tar.xz
* It turns out that Physics heightmap values were being stored in managed memory in _heightmap and using multiple heightmaps caused them all to overwrite each other and the last one was the heightmap for all of the regions. This fixes that. It also reduces the terrain resolution to half.
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs49
1 files changed, 27 insertions, 22 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index de9b196..817cc22 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -227,7 +227,7 @@ namespace OpenSim.Region.Physics.OdePlugin
227 227
228 public int bodyFramesAutoDisable = 20; 228 public int bodyFramesAutoDisable = 20;
229 229
230 private float[] _heightmap; 230
231 231
232 private float[] _watermap; 232 private float[] _watermap;
233 private bool m_filterCollisions = true; 233 private bool m_filterCollisions = true;
@@ -351,11 +351,7 @@ namespace OpenSim.Region.Physics.OdePlugin
351 #endif 351 #endif
352 } 352 }
353 353
354 // zero out a heightmap array float array (single dimension [flattened])) 354
355 if ((int)Constants.RegionSize == 256)
356 _heightmap = new float[514*514];
357 else
358 _heightmap = new float[(((int)WorldExtents.Y + 2) * ((int)WorldExtents.X + 2))];
359 _watermap = new float[258 * 258]; 355 _watermap = new float[258 * 258];
360 356
361 // Zero out the prim spaces array (we split our space into smaller spaces so 357 // Zero out the prim spaces array (we split our space into smaller spaces so
@@ -3334,6 +3330,15 @@ namespace OpenSim.Region.Physics.OdePlugin
3334 // this._heightmap[i] = (double)heightMap[i]; 3330 // this._heightmap[i] = (double)heightMap[i];
3335 // dbm (danx0r) -- creating a buffer zone of one extra sample all around 3331 // dbm (danx0r) -- creating a buffer zone of one extra sample all around
3336 //_origheightmap = heightMap; 3332 //_origheightmap = heightMap;
3333
3334 float[] _heightmap;
3335
3336 // zero out a heightmap array float array (single dimension [flattened]))
3337 //if ((int)Constants.RegionSize == 256)
3338 // _heightmap = new float[514 * 514];
3339 //else
3340
3341 _heightmap = new float[(((int)Constants.RegionSize + 2) * ((int)Constants.RegionSize + 2))];
3337 3342
3338 uint heightmapWidth = Constants.RegionSize + 1; 3343 uint heightmapWidth = Constants.RegionSize + 1;
3339 uint heightmapHeight = Constants.RegionSize + 1; 3344 uint heightmapHeight = Constants.RegionSize + 1;
@@ -3342,19 +3347,19 @@ namespace OpenSim.Region.Physics.OdePlugin
3342 3347
3343 uint heightmapHeightSamples; 3348 uint heightmapHeightSamples;
3344 3349
3345 if (((int)Constants.RegionSize) == 256) 3350 //if (((int)Constants.RegionSize) == 256)
3346 { 3351 //{
3347 heightmapWidthSamples = 2 * (uint)Constants.RegionSize + 2; 3352 // heightmapWidthSamples = 2 * (uint)Constants.RegionSize + 2;
3348 heightmapHeightSamples = 2 * (uint)Constants.RegionSize + 2; 3353 // heightmapHeightSamples = 2 * (uint)Constants.RegionSize + 2;
3349 heightmapWidth++; 3354 // heightmapWidth++;
3350 heightmapHeight++; 3355 // heightmapHeight++;
3351 } 3356 //}
3352 else 3357 //else
3353 { 3358 //{
3354 3359
3355 heightmapWidthSamples = (uint)Constants.RegionSize + 1; 3360 heightmapWidthSamples = (uint)Constants.RegionSize + 1;
3356 heightmapHeightSamples = (uint)Constants.RegionSize + 1; 3361 heightmapHeightSamples = (uint)Constants.RegionSize + 1;
3357 } 3362 //}
3358 3363
3359 const float scale = 1.0f; 3364 const float scale = 1.0f;
3360 const float offset = 0.0f; 3365 const float offset = 0.0f;
@@ -3363,12 +3368,12 @@ namespace OpenSim.Region.Physics.OdePlugin
3363 3368
3364 int regionsize = (int) Constants.RegionSize; 3369 int regionsize = (int) Constants.RegionSize;
3365 //Double resolution 3370 //Double resolution
3366 if (((int)Constants.RegionSize) == 256) 3371 //if (((int)Constants.RegionSize) == 256)
3367 heightMap = ResizeTerrain512Interpolation(heightMap); 3372 // heightMap = ResizeTerrain512Interpolation(heightMap);
3368 3373
3369 3374
3370 if (((int)Constants.RegionSize) == 256 && (int)Constants.RegionSize == 256) 3375 // if (((int)Constants.RegionSize) == 256 && (int)Constants.RegionSize == 256)
3371 regionsize = 512; 3376 // regionsize = 512;
3372 3377
3373 float hfmin = 2000; 3378 float hfmin = 2000;
3374 float hfmax = -2000; 3379 float hfmax = -2000;
@@ -3431,14 +3436,14 @@ namespace OpenSim.Region.Physics.OdePlugin
3431 3436
3432 d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle); 3437 d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle);
3433 d.GeomSetRotation(GroundGeom, ref R); 3438 d.GeomSetRotation(GroundGeom, ref R);
3434 d.GeomSetPosition(GroundGeom, pOffset.X + ((int)Constants.RegionSize * 0.5f), (pOffset.Y + (int)Constants.RegionSize * 0.5f), 0); 3439 d.GeomSetPosition(GroundGeom, pOffset.X + ((int)Constants.RegionSize * 0.5f), pOffset.Y + ((int)Constants.RegionSize * 0.5f), 0);
3435 IntPtr testGround = IntPtr.Zero; 3440 IntPtr testGround = IntPtr.Zero;
3436 if (RegionTerrain.TryGetValue(pOffset, out testGround)) 3441 if (RegionTerrain.TryGetValue(pOffset, out testGround))
3437 { 3442 {
3438 RegionTerrain.Remove(pOffset); 3443 RegionTerrain.Remove(pOffset);
3439 } 3444 }
3440 RegionTerrain.Add(pOffset, GroundGeom, GroundGeom); 3445 RegionTerrain.Add(pOffset, GroundGeom, GroundGeom);
3441 TerrainHeightFieldHeights.Add(GroundGeom,heightMap); 3446 TerrainHeightFieldHeights.Add(GroundGeom,_heightmap);
3442 3447
3443 } 3448 }
3444 } 3449 }