From 212326eeb0a7aa2180661e4c0ad253e2e7ae4515 Mon Sep 17 00:00:00 2001 From: dahlia Date: Tue, 19 Apr 2011 22:16:10 -0700 Subject: fix meshing failure on sculpt maps smaller than 64x64 --- OpenSim/Region/Physics/Meshing/SculptMap.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Physics/Meshing/SculptMap.cs') diff --git a/OpenSim/Region/Physics/Meshing/SculptMap.cs b/OpenSim/Region/Physics/Meshing/SculptMap.cs index d2d71de..740424e 100644 --- a/OpenSim/Region/Physics/Meshing/SculptMap.cs +++ b/OpenSim/Region/Physics/Meshing/SculptMap.cs @@ -62,6 +62,8 @@ namespace PrimMesher bool needsScaling = false; + bool smallMap = bmW * bmH <= lod * lod; + width = bmW; height = bmH; while (width * height > numLodPixels) @@ -104,9 +106,14 @@ namespace PrimMesher { for (int x = 0; x <= width; x++) { - int bmY = y < height ? y * 2 : y * 2 - 1; - int bmX = x < width ? x * 2 : x * 2 - 1; - Color c = bm.GetPixel(bmX, bmY); + Color c; + + if (smallMap) + c = bm.GetPixel(x < width ? x : x - 1, + y < height ? y : y - 1); + else + c = bm.GetPixel(x < width ? x * 2 : x * 2 - 1, + y < height ? y * 2 : y * 2 - 1); redBytes[byteNdx] = c.R; greenBytes[byteNdx] = c.G; -- cgit v1.1