diff options
author | onefang | 2019-05-19 21:24:15 +1000 |
---|---|---|
committer | onefang | 2019-05-19 21:24:15 +1000 |
commit | 5e4d6cab00cb29cd088ab7b62ab13aff103b64cb (patch) | |
tree | a9fbc62df9eb2d1d9ba2698d8552eae71eca20d8 /OpenSim/Region/CoreModules/World/LegacyMap | |
parent | Add a build script. (diff) | |
download | opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.zip opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.gz opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.bz2 opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.xz |
Dump OpenSim 0.9.0.1 into it's own branch.
Diffstat (limited to 'OpenSim/Region/CoreModules/World/LegacyMap')
3 files changed, 48 insertions, 40 deletions
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs index 796a15f..b927cfa 100644 --- a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs | |||
@@ -82,11 +82,11 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
82 | 82 | ||
83 | string[] configSections = new string[] { "Map", "Startup" }; | 83 | string[] configSections = new string[] { "Map", "Startup" }; |
84 | 84 | ||
85 | drawPrimVolume | 85 | drawPrimVolume |
86 | = Util.GetConfigVarFromSections<bool>(m_config, "DrawPrimOnMapTile", configSections, drawPrimVolume); | 86 | = Util.GetConfigVarFromSections<bool>(m_config, "DrawPrimOnMapTile", configSections, drawPrimVolume); |
87 | textureTerrain | 87 | textureTerrain |
88 | = Util.GetConfigVarFromSections<bool>(m_config, "TextureOnMapTile", configSections, textureTerrain); | 88 | = Util.GetConfigVarFromSections<bool>(m_config, "TextureOnMapTile", configSections, textureTerrain); |
89 | generateMaptiles | 89 | generateMaptiles |
90 | = Util.GetConfigVarFromSections<bool>(m_config, "GenerateMaptiles", configSections, generateMaptiles); | 90 | = Util.GetConfigVarFromSections<bool>(m_config, "GenerateMaptiles", configSections, generateMaptiles); |
91 | 91 | ||
92 | if (generateMaptiles) | 92 | if (generateMaptiles) |
@@ -112,7 +112,6 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
112 | //} | 112 | //} |
113 | //t = System.Environment.TickCount - t; | 113 | //t = System.Environment.TickCount - t; |
114 | //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t); | 114 | //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t); |
115 | |||
116 | if (drawPrimVolume) | 115 | if (drawPrimVolume) |
117 | { | 116 | { |
118 | DrawObjectVolume(m_scene, mapbmp); | 117 | DrawObjectVolume(m_scene, mapbmp); |
@@ -127,15 +126,15 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
127 | catch (Exception) | 126 | catch (Exception) |
128 | { | 127 | { |
129 | m_log.ErrorFormat( | 128 | m_log.ErrorFormat( |
130 | "[MAPTILE]: Failed to load Static map image texture file: {0} for {1}", | 129 | "[MAPTILE]: Failed to load Static map image texture file: {0} for {1}", |
131 | m_scene.RegionInfo.MaptileStaticFile, m_scene.Name); | 130 | m_scene.RegionInfo.MaptileStaticFile, m_scene.Name); |
132 | //mapbmp = new Bitmap((int)m_scene.Heightmap.Width, (int)m_scene.Heightmap.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb); | 131 | //mapbmp = new Bitmap((int)m_scene.Heightmap.Width, (int)m_scene.Heightmap.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb); |
133 | mapbmp = null; | 132 | mapbmp = null; |
134 | } | 133 | } |
135 | 134 | ||
136 | if (mapbmp != null) | 135 | if (mapbmp != null) |
137 | m_log.DebugFormat( | 136 | m_log.DebugFormat( |
138 | "[MAPTILE]: Static map image texture file {0} found for {1}", | 137 | "[MAPTILE]: Static map image texture file {0} found for {1}", |
139 | m_scene.RegionInfo.MaptileStaticFile, m_scene.Name); | 138 | m_scene.RegionInfo.MaptileStaticFile, m_scene.Name); |
140 | } | 139 | } |
141 | } | 140 | } |
@@ -309,7 +308,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
309 | List<uint> z_localIDs = new List<uint>(); | 308 | List<uint> z_localIDs = new List<uint>(); |
310 | Dictionary<uint, DrawStruct> z_sort = new Dictionary<uint, DrawStruct>(); | 309 | Dictionary<uint, DrawStruct> z_sort = new Dictionary<uint, DrawStruct>(); |
311 | 310 | ||
312 | try | 311 | try |
313 | { | 312 | { |
314 | lock (objs) | 313 | lock (objs) |
315 | { | 314 | { |
@@ -383,7 +382,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
383 | 382 | ||
384 | Vector3 pos = part.GetWorldPosition(); | 383 | Vector3 pos = part.GetWorldPosition(); |
385 | 384 | ||
386 | // skip prim outside of retion | 385 | // skip prim outside of region |
387 | if (!m_scene.PositionIsInCurrentRegion(pos)) | 386 | if (!m_scene.PositionIsInCurrentRegion(pos)) |
388 | continue; | 387 | continue; |
389 | 388 | ||
@@ -407,12 +406,13 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
407 | { | 406 | { |
408 | // Translate scale by rotation so scale is represented properly when object is rotated | 407 | // Translate scale by rotation so scale is represented properly when object is rotated |
409 | Vector3 lscale = new Vector3(part.Shape.Scale.X, part.Shape.Scale.Y, part.Shape.Scale.Z); | 408 | Vector3 lscale = new Vector3(part.Shape.Scale.X, part.Shape.Scale.Y, part.Shape.Scale.Z); |
409 | lscale *= 0.5f; | ||
410 | |||
410 | Vector3 scale = new Vector3(); | 411 | Vector3 scale = new Vector3(); |
411 | Vector3 tScale = new Vector3(); | 412 | Vector3 tScale = new Vector3(); |
412 | Vector3 axPos = new Vector3(pos.X, pos.Y, pos.Z); | 413 | Vector3 axPos = new Vector3(pos.X, pos.Y, pos.Z); |
413 | 414 | ||
414 | Quaternion llrot = part.GetWorldRotation(); | 415 | Quaternion rot = part.GetWorldRotation(); |
415 | Quaternion rot = new Quaternion(llrot.W, llrot.X, llrot.Y, llrot.Z); | ||
416 | scale = lscale * rot; | 416 | scale = lscale * rot; |
417 | 417 | ||
418 | // negative scales don't work in this situation | 418 | // negative scales don't work in this situation |
@@ -471,7 +471,6 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
471 | 471 | ||
472 | tScale = new Vector3(lscale.X, -lscale.Y, -lscale.Z); | 472 | tScale = new Vector3(lscale.X, -lscale.Y, -lscale.Z); |
473 | scale = ((tScale * rot)); | 473 | scale = ((tScale * rot)); |
474 | |||
475 | vertexes[2] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z))); | 474 | vertexes[2] = (new Vector3((pos.X + scale.X), (pos.Y + scale.Y), (pos.Z + scale.Z))); |
476 | 475 | ||
477 | //vertexes[2].x = pos.X + vertexes[2].x; | 476 | //vertexes[2].x = pos.X + vertexes[2].x; |
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 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 | } |