From 458f295fdbc16a9861e1f6ee19fbfb54230a138b Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 2 Mar 2012 22:19:28 +0100 Subject: [PATCH 1/2] This still causes terrain artefacts Revert " fix the last fix. Regions are square but... Also remove the 0.5 offset in map position. It was apparently needed to fix we having nsamples = size and not size + 1." This reverts commit 15bc539bd49e7a09c1ec6e539871cde5eee6032e. --- OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs index a57ebe9af9..ccdd32eb2a 100644 --- a/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs @@ -3495,7 +3495,7 @@ namespace OpenSim.Region.Physics.OdePlugin // Output x = 0 1 2 3 ..... 255 256 257 258 total out float val= heightMap[(yy * regionsize) + xx]; // input from heightMap, <0-255 * 256> <0-255> if (val < minele) val = minele; - _heightmap[x * (heightmapHeightSamples) + y] = val; // samples output to _heightmap, <0-257 * 258> <0-257> + _heightmap[x * (heightmapWidthSamples) + y] = val; // samples output to _heightmap, <0-257 * 258> <0-257> hfmin = (val < hfmin) ? val : hfmin; hfmax = (val > hfmax) ? val : hfmax; } @@ -3545,8 +3545,6 @@ namespace OpenSim.Region.Physics.OdePlugin d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle); d.GeomSetRotation(GroundGeom, ref R); d.GeomSetPosition(GroundGeom, (pOffset.X + (regionsize * 0.5f)) - 0.5f, (pOffset.Y + (regionsize * 0.5f)) - 0.5f, 0); - // having nsamples = size + 1 center is actually at size/2 - d.GeomSetPosition(GroundGeom, (pOffset.X + (regionsize * 0.5f)), (pOffset.Y + (regionsize * 0.5f)), 0); IntPtr testGround = IntPtr.Zero; if (RegionTerrain.TryGetValue(pOffset, out testGround)) { From bfcba0a417f876a09eae7612f08919304f7513e3 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 2 Mar 2012 22:20:02 +0100 Subject: [PATCH 2/2] This still causes terrain artefacts Revert " fix my bug on ChODE terrain heightmap build" This reverts commit aa77d1d486f11da7dc841190f1ca85e085d0d648. --- OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs index ccdd32eb2a..7a1e671e99 100644 --- a/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs @@ -3457,8 +3457,8 @@ namespace OpenSim.Region.Physics.OdePlugin int heightmapWidth = regionsize + 2; // ODE map size 257 x 257 (Meters) (1 extra int heightmapHeight = regionsize + 2; - int heightmapWidthSamples = (int)regionsize + 3; // Sample file size, 258 x 258 samples - int heightmapHeightSamples = (int)regionsize + 3; + int heightmapWidthSamples = (int)regionsize + 2; // Sample file size, 258 x 258 samples + int heightmapHeightSamples = (int)regionsize + 2; // Array of height samples for ODE float[] _heightmap; @@ -3495,7 +3495,7 @@ namespace OpenSim.Region.Physics.OdePlugin // Output x = 0 1 2 3 ..... 255 256 257 258 total out float val= heightMap[(yy * regionsize) + xx]; // input from heightMap, <0-255 * 256> <0-255> if (val < minele) val = minele; - _heightmap[x * (heightmapWidthSamples) + y] = val; // samples output to _heightmap, <0-257 * 258> <0-257> + _heightmap[x * (regionsize + 2) + y] = val; // samples output to _heightmap, <0-257 * 258> <0-257> hfmin = (val < hfmin) ? val : hfmin; hfmax = (val > hfmax) ? val : hfmax; }