aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World
diff options
context:
space:
mode:
authorTomTheDragon2017-11-05 17:33:13 -0500
committerUbitUmarov2017-11-13 20:43:16 +0000
commit98f90f4eed231724f1105f19d9bc29cb23b3e5bf (patch)
tree3842b486087b5640256bbd15ac23a49ff9aabea2 /OpenSim/Region/CoreModules/World
parentmantis 8253: don't let attachments delete remove controls from viewers on cro... (diff)
downloadopensim-SC-98f90f4eed231724f1105f19d9bc29cb23b3e5bf.zip
opensim-SC-98f90f4eed231724f1105f19d9bc29cb23b3e5bf.tar.gz
opensim-SC-98f90f4eed231724f1105f19d9bc29cb23b3e5bf.tar.bz2
opensim-SC-98f90f4eed231724f1105f19d9bc29cb23b3e5bf.tar.xz
Changing map tile colors This change also allows setting the water color, as well as the 4 colors for textured map tiles.
Signed-off-by: UbitUmarov <ajlduarte@sapo.pt>
Diffstat (limited to 'OpenSim/Region/CoreModules/World')
-rw-r--r--OpenSim/Region/CoreModules/World/LegacyMap/ShadedMapTileRenderer.cs12
-rw-r--r--OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs43
2 files changed, 32 insertions, 23 deletions
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/ShadedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/LegacyMap/ShadedMapTileRenderer.cs
index 708286c..0b37179 100644
--- a/OpenSim/Region/CoreModules/World/LegacyMap/ShadedMapTileRenderer.cs
+++ b/OpenSim/Region/CoreModules/World/LegacyMap/ShadedMapTileRenderer.cs
@@ -38,18 +38,20 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
38{ 38{
39 public class ShadedMapTileRenderer : IMapTileTerrainRenderer 39 public class ShadedMapTileRenderer : IMapTileTerrainRenderer
40 { 40 {
41 private static readonly Color WATER_COLOR = Color.FromArgb(29, 71, 95);
42
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 private static readonly string LogHeader = "[SHADED MAPTILE RENDERER]"; 42 private static readonly string LogHeader = "[SHADED MAPTILE RENDERER]";
45 43
46 private Scene m_scene; 44 private Scene m_scene;
47 //private IConfigSource m_config; // not used currently 45 private IConfigSource m_config;
46 private Color m_color_water;
48 47
49 public void Initialise(Scene scene, IConfigSource config) 48 public void Initialise(Scene scene, IConfigSource config)
50 { 49 {
51 m_scene = scene; 50 m_scene = scene;
52 // m_config = config; // not used currently 51 m_config = config;
52
53 string[] configSections = new string[] { "Map", "Startup" };
54 m_color_water = System.Drawing.ColorTranslator.FromHtml(Util.GetConfigVarFromSections<string>(m_config, "MapColorWater", configSections, "#1D475F"));
53 } 55 }
54 56
55 public void TerrainToBitmap(Bitmap mapbmp) 57 public void TerrainToBitmap(Bitmap mapbmp)
@@ -231,7 +233,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
231 233
232 try 234 try
233 { 235 {
234 mapbmp.SetPixel(x, yr, WATER_COLOR); 236 mapbmp.SetPixel(x, yr, m_color_water);
235 } 237 }
236 catch (ArgumentException) 238 catch (ArgumentException)
237 { 239 {
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs
index 4b3ee18..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
@@ -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;
@@ -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 }