aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/Meshing/SculptMap.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/Meshing/SculptMap.cs')
-rw-r--r--OpenSim/Region/Physics/Meshing/SculptMap.cs15
1 files changed, 11 insertions, 4 deletions
diff --git a/OpenSim/Region/Physics/Meshing/SculptMap.cs b/OpenSim/Region/Physics/Meshing/SculptMap.cs
index 4d3f82b..4906cf6 100644
--- a/OpenSim/Region/Physics/Meshing/SculptMap.cs
+++ b/OpenSim/Region/Physics/Meshing/SculptMap.cs
@@ -60,21 +60,23 @@ namespace PrimMesher
60 60
61 int numLodPixels = lod * 2 * lod * 2; // (32 * 2)^2 = 64^2 pixels for default sculpt map image 61 int numLodPixels = lod * 2 * lod * 2; // (32 * 2)^2 = 64^2 pixels for default sculpt map image
62 62
63 bool needsScaling = false;
64
63 width = bmW; 65 width = bmW;
64 height = bmH; 66 height = bmH;
65 while (width * height > numLodPixels) 67 while (width * height > numLodPixels)
66 { 68 {
67 width >>= 1; 69 width >>= 1;
68 height >>= 1; 70 height >>= 1;
71 needsScaling = true;
69 } 72 }
70 73
71 width >>= 1; 74
72 height >>= 1;
73 75
74 try 76 try
75 { 77 {
76 if (!(bmW == width * 2 && bmH == height * 2)) 78 if (needsScaling)
77 bm = ScaleImage(bm, width * 2, height * 2, 79 bm = ScaleImage(bm, width, height,
78 System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor); 80 System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor);
79 } 81 }
80 82
@@ -83,6 +85,11 @@ namespace PrimMesher
83 throw new Exception("Exception in ScaleImage(): e: " + e.ToString()); 85 throw new Exception("Exception in ScaleImage(): e: " + e.ToString());
84 } 86 }
85 87
88 if (width * height > lod * lod)
89 {
90 width >>= 1;
91 height >>= 1;
92 }
86 93
87 int numBytes = (width + 1) * (height + 1); 94 int numBytes = (width + 1) * (height + 1);
88 redBytes = new byte[numBytes]; 95 redBytes = new byte[numBytes];