aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/OdePlugin.cs')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs47
1 files changed, 38 insertions, 9 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 9805ff5..50dc91d 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -304,6 +304,13 @@ namespace OpenSim.Region.Physics.OdePlugin
304 public d.Vector3 xyz = new d.Vector3(128.1640f, 128.3079f, 25.7600f); 304 public d.Vector3 xyz = new d.Vector3(128.1640f, 128.3079f, 25.7600f);
305 public d.Vector3 hpr = new d.Vector3(125.5000f, -17.0000f, 0.0000f); 305 public d.Vector3 hpr = new d.Vector3(125.5000f, -17.0000f, 0.0000f);
306 306
307 private uint heightmapWidth = m_regionWidth + 1;
308 private uint heightmapHeight = m_regionHeight + 1;
309
310 private uint heightmapWidthSamples;
311
312 private uint heightmapHeightSamples;
313
307 private volatile int m_global_contactcount = 0; 314 private volatile int m_global_contactcount = 0;
308 315
309 private ODERayCastRequestManager m_rayCastManager; 316 private ODERayCastRequestManager m_rayCastManager;
@@ -3271,27 +3278,49 @@ namespace OpenSim.Region.Physics.OdePlugin
3271 // this._heightmap[i] = (double)heightMap[i]; 3278 // this._heightmap[i] = (double)heightMap[i];
3272 // dbm (danx0r) -- creating a buffer zone of one extra sample all around 3279 // dbm (danx0r) -- creating a buffer zone of one extra sample all around
3273 _origheightmap = heightMap; // Used for Fly height. Kitto Flora 3280 _origheightmap = heightMap; // Used for Fly height. Kitto Flora
3274 const uint heightmapWidth = m_regionWidth + 2; 3281 uint heightmapWidth = m_regionWidth + 1;
3275 const uint heightmapHeight = m_regionHeight + 2; 3282 uint heightmapHeight = m_regionHeight + 1;
3276 const uint heightmapWidthSamples = 2*m_regionWidth + 2; 3283
3277 const uint heightmapHeightSamples = 2*m_regionHeight + 2; 3284 uint heightmapWidthSamples;
3285
3286 uint heightmapHeightSamples;
3287 if (((int)Constants.RegionSize) == 256)
3288 {
3289 heightmapWidthSamples = 2*m_regionWidth + 2;
3290 heightmapHeightSamples = 2*m_regionHeight + 2;
3291 heightmapWidth++;
3292 heightmapHeight++;
3293 }
3294 else
3295 {
3296 heightmapWidthSamples = m_regionWidth + 1;
3297 heightmapHeightSamples = m_regionHeight + 1;
3298 }
3299
3278 const float scale = 1.0f; 3300 const float scale = 1.0f;
3279 const float offset = 0.0f; 3301 const float offset = 0.0f;
3280 const float thickness = 0.2f; 3302 const float thickness = 0.2f;
3281 const int wrap = 0; 3303 const int wrap = 0;
3304
3282 3305
3283 //Double resolution 3306 //Double resolution
3284 heightMap = ResizeTerrain512Interpolation(heightMap); 3307 if (((int)Constants.RegionSize) == 256)
3308 heightMap = ResizeTerrain512Interpolation(heightMap);
3309
3310 int regionsize = (int)Constants.RegionSize;
3311 if (regionsize == 256)
3312 regionsize = 512;
3313
3285 float hfmin = 2000; 3314 float hfmin = 2000;
3286 float hfmax = -2000; 3315 float hfmax = -2000;
3287 for (int x = 0; x < heightmapWidthSamples; x++) 3316 for (int x = 0; x < heightmapWidthSamples; x++)
3288 { 3317 {
3289 for (int y = 0; y < heightmapHeightSamples; y++) 3318 for (int y = 0; y < heightmapHeightSamples; y++)
3290 { 3319 {
3291 int xx = Util.Clip(x - 1, 0, 511); 3320 int xx = Util.Clip(x - 1, 0, regionsize - 1);
3292 int yy = Util.Clip(y - 1, 0, 511); 3321 int yy = Util.Clip(y - 1, 0, regionsize - 1);
3293 3322
3294 float val = heightMap[yy*512 + xx]; 3323 float val = heightMap[yy*regionsize + xx];
3295 _heightmap[x*heightmapHeightSamples + y] = val; 3324 _heightmap[x*heightmapHeightSamples + y] = val;
3296 hfmin = (val < hfmin) ? val : hfmin; 3325 hfmin = (val < hfmin) ? val : hfmin;
3297 hfmax = (val > hfmax) ? val : hfmax; 3326 hfmax = (val > hfmax) ? val : hfmax;
@@ -3332,7 +3361,7 @@ namespace OpenSim.Region.Physics.OdePlugin
3332 3361
3333 d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle); 3362 d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle);
3334 d.GeomSetRotation(LandGeom, ref R); 3363 d.GeomSetRotation(LandGeom, ref R);
3335 d.GeomSetPosition(LandGeom, 128, 128, 0); 3364 d.GeomSetPosition(LandGeom, (int)Constants.RegionSize * 0.5f, (int)Constants.RegionSize * 0.5f, 0);
3336 } 3365 }
3337 } 3366 }
3338 3367