diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs index 91252f7..df5ac92 100644 --- a/OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs +++ b/OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs | |||
@@ -111,6 +111,9 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
111 | asset = assetService.GetCached(cacheID.ToString()); | 111 | asset = assetService.GetCached(cacheID.ToString()); |
112 | if (asset != null) | 112 | if (asset != null) |
113 | { | 113 | { |
114 | // m_log.DebugFormat( | ||
115 | // "[TERRAIN SPLAT]: Got asset service cached terrain texture {0} {1}", i, asset.ID); | ||
116 | |||
114 | try | 117 | try |
115 | { | 118 | { |
116 | using (System.IO.MemoryStream stream = new System.IO.MemoryStream(asset.Data)) | 119 | using (System.IO.MemoryStream stream = new System.IO.MemoryStream(asset.Data)) |
@@ -129,6 +132,9 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
129 | asset = assetService.Get(textureIDs[i].ToString()); | 132 | asset = assetService.Get(textureIDs[i].ToString()); |
130 | if (asset != null) | 133 | if (asset != null) |
131 | { | 134 | { |
135 | // m_log.DebugFormat( | ||
136 | // "[TERRAIN SPLAT]: Got cached original JPEG2000 terrain texture {0} {1}", i, asset.ID); | ||
137 | |||
132 | try { detailTexture[i] = (Bitmap)CSJ2K.J2kImage.FromBytes(asset.Data); } | 138 | try { detailTexture[i] = (Bitmap)CSJ2K.J2kImage.FromBytes(asset.Data); } |
133 | catch (Exception ex) | 139 | catch (Exception ex) |
134 | { | 140 | { |
@@ -137,15 +143,13 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
137 | } | 143 | } |
138 | 144 | ||
139 | if (detailTexture[i] != null) | 145 | if (detailTexture[i] != null) |
140 | { | 146 | { |
141 | Bitmap bitmap = detailTexture[i]; | ||
142 | |||
143 | // Make sure this texture is the correct size, otherwise resize | 147 | // Make sure this texture is the correct size, otherwise resize |
144 | if (bitmap.Width != 256 || bitmap.Height != 256) | 148 | if (detailTexture[i].Width != 256 || detailTexture[i].Height != 256) |
145 | { | 149 | { |
146 | using (Bitmap origBitmap = bitmap) | 150 | using (Bitmap origBitmap = detailTexture[i]) |
147 | { | 151 | { |
148 | bitmap = ImageUtils.ResizeImage(origBitmap, 256, 256); | 152 | detailTexture[i] = ImageUtils.ResizeImage(origBitmap, 256, 256); |
149 | } | 153 | } |
150 | } | 154 | } |
151 | 155 | ||
@@ -153,7 +157,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
153 | byte[] data; | 157 | byte[] data; |
154 | using (System.IO.MemoryStream stream = new System.IO.MemoryStream()) | 158 | using (System.IO.MemoryStream stream = new System.IO.MemoryStream()) |
155 | { | 159 | { |
156 | bitmap.Save(stream, ImageFormat.Png); | 160 | detailTexture[i].Save(stream, ImageFormat.Png); |
157 | data = stream.ToArray(); | 161 | data = stream.ToArray(); |
158 | } | 162 | } |
159 | 163 | ||
@@ -185,6 +189,9 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
185 | { | 189 | { |
186 | if (detailTexture[i] == null) | 190 | if (detailTexture[i] == null) |
187 | { | 191 | { |
192 | // m_log.DebugFormat( | ||
193 | // "[TERRAIN SPLAT]: Generating solid colour for missing texture {0}", i); | ||
194 | |||
188 | // Create a solid color texture for this layer | 195 | // Create a solid color texture for this layer |
189 | detailTexture[i] = new Bitmap(256, 256, PixelFormat.Format24bppRgb); | 196 | detailTexture[i] = new Bitmap(256, 256, PixelFormat.Format24bppRgb); |
190 | using (Graphics gfx = Graphics.FromImage(detailTexture[i])) | 197 | using (Graphics gfx = Graphics.FromImage(detailTexture[i])) |