diff options
author | dahlia | 2010-05-06 23:02:24 -0700 |
---|---|---|
committer | dahlia | 2010-05-06 23:02:24 -0700 |
commit | eb6d63ab8ee1c37b10fb885e4f0c672af90ce1ec (patch) | |
tree | 8128d4d9ac61214b34cd0d807e52ff33c7dcd610 /OpenSim | |
parent | corrections for face numbering and uv mapping, mostly for spheres - sync with... (diff) | |
download | opensim-SC-eb6d63ab8ee1c37b10fb885e4f0c672af90ce1ec.zip opensim-SC-eb6d63ab8ee1c37b10fb885e4f0c672af90ce1ec.tar.gz opensim-SC-eb6d63ab8ee1c37b10fb885e4f0c672af90ce1ec.tar.bz2 opensim-SC-eb6d63ab8ee1c37b10fb885e4f0c672af90ce1ec.tar.xz |
improve handling of undersize sculpt textures
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Physics/Meshing/SculptMap.cs | 15 |
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]; |