diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs | 53 |
1 files changed, 30 insertions, 23 deletions
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs index 9f23141..c71f5c0 100644 --- a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs +++ b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs | |||
@@ -130,21 +130,19 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
130 | // some hardcoded terrain UUIDs that work with SL 1.20 (the four default textures and "Blank"). | 130 | // some hardcoded terrain UUIDs that work with SL 1.20 (the four default textures and "Blank"). |
131 | // The color-values were choosen because they "look right" (at least to me) ;-) | 131 | // The color-values were choosen because they "look right" (at least to me) ;-) |
132 | private static readonly UUID defaultTerrainTexture1 = new UUID("0bc58228-74a0-7e83-89bc-5c23464bcec5"); | 132 | private static readonly UUID defaultTerrainTexture1 = new UUID("0bc58228-74a0-7e83-89bc-5c23464bcec5"); |
133 | private static readonly Color defaultColor1 = Color.FromArgb(165, 137, 118); | ||
134 | private static readonly UUID defaultTerrainTexture2 = new UUID("63338ede-0037-c4fd-855b-015d77112fc8"); | 133 | private static readonly UUID defaultTerrainTexture2 = new UUID("63338ede-0037-c4fd-855b-015d77112fc8"); |
135 | private static readonly Color defaultColor2 = Color.FromArgb(69, 89, 49); | ||
136 | private static readonly UUID defaultTerrainTexture3 = new UUID("303cd381-8560-7579-23f1-f0a880799740"); | 134 | private static readonly UUID defaultTerrainTexture3 = new UUID("303cd381-8560-7579-23f1-f0a880799740"); |
137 | private static readonly Color defaultColor3 = Color.FromArgb(162, 154, 141); | ||
138 | private static readonly UUID defaultTerrainTexture4 = new UUID("53a2f406-4895-1d13-d541-d2e3b86bc19c"); | 135 | private static readonly UUID defaultTerrainTexture4 = new UUID("53a2f406-4895-1d13-d541-d2e3b86bc19c"); |
139 | private static readonly Color defaultColor4 = Color.FromArgb(200, 200, 200); | ||
140 | |||
141 | private static readonly Color WATER_COLOR = Color.FromArgb(29, 71, 95); | ||
142 | 136 | ||
143 | #endregion | 137 | #endregion |
144 | 138 | ||
145 | |||
146 | private Scene m_scene; | 139 | private Scene m_scene; |
147 | // private IConfigSource m_config; // not used currently | 140 | private IConfigSource m_config; |
141 | private Color m_color_water; | ||
142 | private Color m_color_1; | ||
143 | private Color m_color_2; | ||
144 | private Color m_color_3; | ||
145 | private Color m_color_4; | ||
148 | 146 | ||
149 | // mapping from texture UUIDs to averaged color. This will contain 5-9 values, in general; new values are only | 147 | // mapping from texture UUIDs to averaged color. This will contain 5-9 values, in general; new values are only |
150 | // added when the terrain textures are changed in the estate dialog and a new map is generated (and will stay in | 148 | // added when the terrain textures are changed in the estate dialog and a new map is generated (and will stay in |
@@ -156,12 +154,21 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
156 | public void Initialise(Scene scene, IConfigSource source) | 154 | public void Initialise(Scene scene, IConfigSource source) |
157 | { | 155 | { |
158 | m_scene = scene; | 156 | m_scene = scene; |
159 | // m_config = source; // not used currently | 157 | m_config = source; |
158 | |||
159 | string[] configSections = new string[] { "Map", "Startup" }; | ||
160 | |||
161 | m_color_water = System.Drawing.ColorTranslator.FromHtml(Util.GetConfigVarFromSections<string>(m_config, "MapColorWater", configSections, "#1D475F")); | ||
162 | m_color_1 = System.Drawing.ColorTranslator.FromHtml(Util.GetConfigVarFromSections<string>(m_config, "MapColor1", configSections, "#A58976")); | ||
163 | m_color_2 = System.Drawing.ColorTranslator.FromHtml(Util.GetConfigVarFromSections<string>(m_config, "MapColor2", configSections, "#455931")); | ||
164 | m_color_3 = System.Drawing.ColorTranslator.FromHtml(Util.GetConfigVarFromSections<string>(m_config, "MapColor3", configSections, "#A29A8D")); | ||
165 | m_color_4 = System.Drawing.ColorTranslator.FromHtml(Util.GetConfigVarFromSections<string>(m_config, "MapColor4", configSections, "#C8C8C8")); | ||
166 | |||
160 | m_mapping = new Dictionary<UUID,Color>(); | 167 | m_mapping = new Dictionary<UUID,Color>(); |
161 | m_mapping.Add(defaultTerrainTexture1, defaultColor1); | 168 | m_mapping.Add(defaultTerrainTexture1, m_color_1); |
162 | m_mapping.Add(defaultTerrainTexture2, defaultColor2); | 169 | m_mapping.Add(defaultTerrainTexture2, m_color_2); |
163 | m_mapping.Add(defaultTerrainTexture3, defaultColor3); | 170 | m_mapping.Add(defaultTerrainTexture3, m_color_3); |
164 | m_mapping.Add(defaultTerrainTexture4, defaultColor4); | 171 | m_mapping.Add(defaultTerrainTexture4, m_color_4); |
165 | m_mapping.Add(Util.BLANK_TEXTURE_UUID, Color.White); | 172 | m_mapping.Add(Util.BLANK_TEXTURE_UUID, Color.White); |
166 | } | 173 | } |
167 | 174 | ||
@@ -180,7 +187,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
180 | 187 | ||
181 | ManagedImage managedImage; | 188 | ManagedImage managedImage; |
182 | Image image; | 189 | Image image; |
183 | 190 | ||
184 | try | 191 | try |
185 | { | 192 | { |
186 | if (OpenJPEG.DecodeToImage(asset.Data, out managedImage, out image)) | 193 | if (OpenJPEG.DecodeToImage(asset.Data, out managedImage, out image)) |
@@ -201,7 +208,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
201 | m_log.ErrorFormat("{0} OpenJpeg was unable to encode this. Asset Data is empty for {1}", LogHeader, id); | 208 | m_log.ErrorFormat("{0} OpenJpeg was unable to encode this. Asset Data is empty for {1}", LogHeader, id); |
202 | } | 209 | } |
203 | return null; | 210 | return null; |
204 | 211 | ||
205 | } | 212 | } |
206 | 213 | ||
207 | // Compute the average color of a texture. | 214 | // Compute the average color of a texture. |
@@ -288,7 +295,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
288 | if (mapbmp.Width != hm.Width || mapbmp.Height != hm.Height) | 295 | if (mapbmp.Width != hm.Width || mapbmp.Height != hm.Height) |
289 | { | 296 | { |
290 | m_log.ErrorFormat("{0} TerrainToBitmap. Passed bitmap wrong dimensions. passed=<{1},{2}>, size=<{3},{4}>", | 297 | m_log.ErrorFormat("{0} TerrainToBitmap. Passed bitmap wrong dimensions. passed=<{1},{2}>, size=<{3},{4}>", |
291 | LogHeader, mapbmp.Width, mapbmp.Height, hm.Width, hm.Height); | 298 | "[TEXTURED MAP TILE RENDERER]", mapbmp.Width, mapbmp.Height, hm.Width, hm.Height); |
292 | } | 299 | } |
293 | 300 | ||
294 | // These textures should be in the AssetCache anyway, as every client conneting to this | 301 | // These textures should be in the AssetCache anyway, as every client conneting to this |
@@ -298,10 +305,10 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
298 | RegionSettings settings = m_scene.RegionInfo.RegionSettings; | 305 | RegionSettings settings = m_scene.RegionInfo.RegionSettings; |
299 | 306 | ||
300 | // the four terrain colors as HSVs for interpolation | 307 | // the four terrain colors as HSVs for interpolation |
301 | HSV hsv1 = new HSV(computeAverageColor(settings.TerrainTexture1, defaultColor1)); | 308 | HSV hsv1 = new HSV(computeAverageColor(settings.TerrainTexture1, m_color_1)); |
302 | HSV hsv2 = new HSV(computeAverageColor(settings.TerrainTexture2, defaultColor2)); | 309 | HSV hsv2 = new HSV(computeAverageColor(settings.TerrainTexture2, m_color_2)); |
303 | HSV hsv3 = new HSV(computeAverageColor(settings.TerrainTexture3, defaultColor3)); | 310 | HSV hsv3 = new HSV(computeAverageColor(settings.TerrainTexture3, m_color_3)); |
304 | HSV hsv4 = new HSV(computeAverageColor(settings.TerrainTexture4, defaultColor4)); | 311 | HSV hsv4 = new HSV(computeAverageColor(settings.TerrainTexture4, m_color_4)); |
305 | 312 | ||
306 | float levelNElow = (float)settings.Elevation1NE; | 313 | float levelNElow = (float)settings.Elevation1NE; |
307 | float levelNEhigh = (float)settings.Elevation2NE; | 314 | float levelNEhigh = (float)settings.Elevation2NE; |
@@ -371,8 +378,8 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
371 | // first, rescale h to 0.0 - 1.0 | 378 | // first, rescale h to 0.0 - 1.0 |
372 | hmod = (hmod - low) / (high - low); | 379 | hmod = (hmod - low) / (high - low); |
373 | // now we have to split: 0.00 => color1, 0.33 => color2, 0.67 => color3, 1.00 => color4 | 380 | // now we have to split: 0.00 => color1, 0.33 => color2, 0.67 => color3, 1.00 => color4 |
374 | if (hmod < 1f/3f) hsv = interpolateHSV(ref hsv1, ref hsv2, hmod * 3f); | 381 | if (hmod < 1f / 3f) hsv = interpolateHSV(ref hsv1, ref hsv2, hmod * 3f); |
375 | else if (hmod < 2f/3f) hsv = interpolateHSV(ref hsv2, ref hsv3, (hmod * 3f) - 1f); | 382 | else if (hmod < 2f / 3f) hsv = interpolateHSV(ref hsv2, ref hsv3, (hmod * 3f) - 1f); |
376 | else hsv = interpolateHSV(ref hsv3, ref hsv4, (hmod * 3f) - 2f); | 383 | else hsv = interpolateHSV(ref hsv3, ref hsv4, (hmod * 3f) - 2f); |
377 | } | 384 | } |
378 | 385 | ||
@@ -417,7 +424,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
417 | 424 | ||
418 | heightvalue = 100f - (heightvalue * 100f) / 19f; // 0 - 19 => 100 - 0 | 425 | heightvalue = 100f - (heightvalue * 100f) / 19f; // 0 - 19 => 100 - 0 |
419 | 426 | ||
420 | mapbmp.SetPixel(x, yr, WATER_COLOR); | 427 | mapbmp.SetPixel(x, yr, m_color_water); |
421 | } | 428 | } |
422 | } | 429 | } |
423 | } | 430 | } |