aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorTeravus Ovares (Dan Olivares)2009-09-04 00:03:54 -0400
committerTeravus Ovares (Dan Olivares)2009-09-04 00:03:54 -0400
commitbb5857c4bbd40d17748f65322247f6929f30eb4d (patch)
tree7e216f7089e39a7bdb2b4111ff08c7d33d3eb8af
parentFlech out the Authentication service. Add the database loader. Introduce (diff)
downloadopensim-SC-bb5857c4bbd40d17748f65322247f6929f30eb4d.zip
opensim-SC-bb5857c4bbd40d17748f65322247f6929f30eb4d.tar.gz
opensim-SC-bb5857c4bbd40d17748f65322247f6929f30eb4d.tar.bz2
opensim-SC-bb5857c4bbd40d17748f65322247f6929f30eb4d.tar.xz
* Fixes the function 'GetTerrainHeightAtXY'
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs42
1 files changed, 26 insertions, 16 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index dc7010e..572412a 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -1590,10 +1590,14 @@ namespace OpenSim.Region.Physics.OdePlugin
1590 x = x - offsetX; 1590 x = x - offsetX;
1591 y = y - offsetY; 1591 y = y - offsetY;
1592 1592
1593 index = (int)((int)y * (int)Constants.RegionSize + (int)x); 1593 index = (int)((int)x * ((int)Constants.RegionSize + 2) + (int)y);
1594 1594
1595 if (index < TerrainHeightFieldHeights[heightFieldGeom].Length) 1595 if (index < TerrainHeightFieldHeights[heightFieldGeom].Length)
1596 return (float)TerrainHeightFieldHeights[heightFieldGeom][(int)y * (int)Constants.RegionSize + (int)x]; 1596 {
1597 //m_log.DebugFormat("x{0} y{1} = {2}", x, y, (float)TerrainHeightFieldHeights[heightFieldGeom][index]);
1598 return (float)TerrainHeightFieldHeights[heightFieldGeom][index];
1599 }
1600
1597 else 1601 else
1598 return 0f; 1602 return 0f;
1599 } 1603 }
@@ -3366,7 +3370,7 @@ namespace OpenSim.Region.Physics.OdePlugin
3366 const float thickness = 0.2f; 3370 const float thickness = 0.2f;
3367 const int wrap = 0; 3371 const int wrap = 0;
3368 3372
3369 int regionsize = (int) Constants.RegionSize; 3373 int regionsize = (int) Constants.RegionSize + 2;
3370 //Double resolution 3374 //Double resolution
3371 //if (((int)Constants.RegionSize) == 256) 3375 //if (((int)Constants.RegionSize) == 256)
3372 // heightMap = ResizeTerrain512Interpolation(heightMap); 3376 // heightMap = ResizeTerrain512Interpolation(heightMap);
@@ -3377,19 +3381,25 @@ namespace OpenSim.Region.Physics.OdePlugin
3377 3381
3378 float hfmin = 2000; 3382 float hfmin = 2000;
3379 float hfmax = -2000; 3383 float hfmax = -2000;
3380 for (int x = 0; x < heightmapWidthSamples; x++) 3384
3381 { 3385 for (int x = 0; x < heightmapWidthSamples; x++)
3382 for (int y = 0; y < heightmapHeightSamples; y++)
3383 { 3386 {
3384 int xx = Util.Clip(x - 1, 0, regionsize - 1); 3387 for (int y = 0; y < heightmapHeightSamples; y++)
3385 int yy = Util.Clip(y - 1, 0, regionsize - 1); 3388 {
3386 3389 int xx = Util.Clip(x - 1, 0, regionsize - 1);
3387 float val = heightMap[yy * regionsize + xx]; 3390 int yy = Util.Clip(y - 1, 0, regionsize - 1);
3388 _heightmap[x * heightmapHeightSamples + y] = val; 3391
3389 hfmin = (val < hfmin) ? val : hfmin; 3392
3390 hfmax = (val > hfmax) ? val : hfmax; 3393 float val= heightMap[yy * (int)Constants.RegionSize + xx];
3394 _heightmap[x * ((int)Constants.RegionSize + 2) + y] = val;
3395
3396 hfmin = (val < hfmin) ? val : hfmin;
3397 hfmax = (val > hfmax) ? val : hfmax;
3398 }
3391 } 3399 }
3392 } 3400
3401
3402
3393 3403
3394 lock (OdeLock) 3404 lock (OdeLock)
3395 { 3405 {
@@ -3409,8 +3419,8 @@ namespace OpenSim.Region.Physics.OdePlugin
3409 3419
3410 } 3420 }
3411 IntPtr HeightmapData = d.GeomHeightfieldDataCreate(); 3421 IntPtr HeightmapData = d.GeomHeightfieldDataCreate();
3412 d.GeomHeightfieldDataBuildSingle(HeightmapData, _heightmap, 0, heightmapWidth, heightmapHeight, 3422 d.GeomHeightfieldDataBuildSingle(HeightmapData, _heightmap, 0, heightmapWidth + 1, heightmapHeight + 1,
3413 (int)heightmapWidthSamples, (int)heightmapHeightSamples, scale, 3423 (int)heightmapWidthSamples + 1, (int)heightmapHeightSamples + 1, scale,
3414 offset, thickness, wrap); 3424 offset, thickness, wrap);
3415 d.GeomHeightfieldDataSetBounds(HeightmapData, hfmin - 1, hfmax + 1); 3425 d.GeomHeightfieldDataSetBounds(HeightmapData, hfmin - 1, hfmax + 1);
3416 GroundGeom = d.CreateHeightfield(space, HeightmapData, 1); 3426 GroundGeom = d.CreateHeightfield(space, HeightmapData, 1);