diff options
author | Robert Adams | 2014-01-26 07:56:47 -0800 |
---|---|---|
committer | Robert Adams | 2014-01-26 07:56:47 -0800 |
commit | 13a9d5409cdb14a66e88883fe2287b51554f3b88 (patch) | |
tree | a1f40f332400dd900f432f26ee34fabb317bde5c /OpenSim/Region/CoreModules/World/LegacyMap | |
parent | varregion: modify MapImageModule structure so it will better merge (diff) | |
parent | Merge branch 'justincc-master' (diff) | |
download | opensim-SC_OLD-13a9d5409cdb14a66e88883fe2287b51554f3b88.zip opensim-SC_OLD-13a9d5409cdb14a66e88883fe2287b51554f3b88.tar.gz opensim-SC_OLD-13a9d5409cdb14a66e88883fe2287b51554f3b88.tar.bz2 opensim-SC_OLD-13a9d5409cdb14a66e88883fe2287b51554f3b88.tar.xz |
Merge branch 'master' into varregion
Conflicts:
OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
OpenSim/Region/CoreModules/World/LegacyMap/ShadedMapTileRenderer.cs
OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs
Diffstat (limited to 'OpenSim/Region/CoreModules/World/LegacyMap')
3 files changed, 53 insertions, 46 deletions
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs index 165ea6e..81d1a4a 100644 --- a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs | |||
@@ -55,7 +55,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
55 | public struct DrawStruct | 55 | public struct DrawStruct |
56 | { | 56 | { |
57 | public DrawRoutine dr; | 57 | public DrawRoutine dr; |
58 | public Rectangle rect; | 58 | // public Rectangle rect; |
59 | public SolidBrush brush; | 59 | public SolidBrush brush; |
60 | public face[] trns; | 60 | public face[] trns; |
61 | } | 61 | } |
@@ -120,6 +120,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
120 | { | 120 | { |
121 | mapbmp = FetchTexture(m_scene.RegionInfo.RegionSettings.TerrainImageID); | 121 | mapbmp = FetchTexture(m_scene.RegionInfo.RegionSettings.TerrainImageID); |
122 | } | 122 | } |
123 | |||
123 | return mapbmp; | 124 | return mapbmp; |
124 | } | 125 | } |
125 | 126 | ||
@@ -128,7 +129,10 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
128 | try | 129 | try |
129 | { | 130 | { |
130 | using (Bitmap mapbmp = CreateMapTile()) | 131 | using (Bitmap mapbmp = CreateMapTile()) |
131 | return OpenJPEG.EncodeFromImage(mapbmp, true); | 132 | { |
133 | if (mapbmp != null) | ||
134 | return OpenJPEG.EncodeFromImage(mapbmp, true); | ||
135 | } | ||
132 | } | 136 | } |
133 | catch (Exception e) // LEGIT: Catching problems caused by OpenJPEG p/invoke | 137 | catch (Exception e) // LEGIT: Catching problems caused by OpenJPEG p/invoke |
134 | { | 138 | { |
@@ -278,12 +282,11 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
278 | tc = Environment.TickCount; | 282 | tc = Environment.TickCount; |
279 | m_log.Debug("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile"); | 283 | m_log.Debug("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile"); |
280 | EntityBase[] objs = whichScene.GetEntities(); | 284 | EntityBase[] objs = whichScene.GetEntities(); |
281 | Dictionary<uint, DrawStruct> z_sort = new Dictionary<uint, DrawStruct>(); | ||
282 | //SortedList<float, RectangleDrawStruct> z_sort = new SortedList<float, RectangleDrawStruct>(); | ||
283 | List<float> z_sortheights = new List<float>(); | 285 | List<float> z_sortheights = new List<float>(); |
284 | List<uint> z_localIDs = new List<uint>(); | 286 | List<uint> z_localIDs = new List<uint>(); |
287 | Dictionary<uint, DrawStruct> z_sort = new Dictionary<uint, DrawStruct>(); | ||
285 | 288 | ||
286 | try | 289 | try |
287 | { | 290 | { |
288 | lock (objs) | 291 | lock (objs) |
289 | { | 292 | { |
@@ -294,7 +297,6 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
294 | { | 297 | { |
295 | SceneObjectGroup mapdot = (SceneObjectGroup)obj; | 298 | SceneObjectGroup mapdot = (SceneObjectGroup)obj; |
296 | Color mapdotspot = Color.Gray; // Default color when prim color is white | 299 | Color mapdotspot = Color.Gray; // Default color when prim color is white |
297 | |||
298 | // Loop over prim in group | 300 | // Loop over prim in group |
299 | foreach (SceneObjectPart part in mapdot.Parts) | 301 | foreach (SceneObjectPart part in mapdot.Parts) |
300 | { | 302 | { |
@@ -547,27 +549,25 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
547 | z_localIDs.Add(part.LocalId); | 549 | z_localIDs.Add(part.LocalId); |
548 | z_sortheights.Add(pos.Z); | 550 | z_sortheights.Add(pos.Z); |
549 | 551 | ||
550 | //for (int wx = mapdrawstartX; wx < mapdrawendX; wx++) | 552 | for (int wx = mapdrawstartX; wx < mapdrawendX; wx++) |
551 | //{ | 553 | // { |
552 | //for (wy = mapdrawstartY; wy < mapdrawendY; wy++) | 554 | // for (wy = mapdrawstartY; wy < mapdrawendY; wy++) |
553 | //{ | 555 | // { |
554 | //m_log.InfoFormat("[MAPDEBUG]: {0},{1}({2})", wx, (255 - wy),wy); | 556 | // m_log.InfoFormat("[MAPDEBUG]: {0},{1}({2})", wx, (255 - wy),wy); |
555 | //try | 557 | // try |
556 | //{ | 558 | // { |
557 | // Remember, flip the y! | 559 | // // Remember, flip the y! |
558 | // mapbmp.SetPixel(wx, (255 - wy), mapdotspot); | 560 | // mapbmp.SetPixel(wx, (255 - wy), mapdotspot); |
559 | //} | 561 | // } |
560 | //catch (ArgumentException) | 562 | // catch (ArgumentException) |
561 | //{ | 563 | // { |
562 | // breakYN = true; | 564 | // breakYN = true; |
563 | //} | 565 | // } |
564 | 566 | // } | |
565 | //if (breakYN) | 567 | // if (breakYN) |
566 | // break; | 568 | // break; |
567 | //} | 569 | // } |
568 | 570 | // } | |
569 | //if (breakYN) | ||
570 | // break; | ||
571 | //} | 571 | //} |
572 | } // Object is within 256m Z of terrain | 572 | } // Object is within 256m Z of terrain |
573 | } // object is at least a meter wide | 573 | } // object is at least a meter wide |
@@ -581,21 +581,23 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
581 | // Sort prim by Z position | 581 | // Sort prim by Z position |
582 | Array.Sort(sortedZHeights, sortedlocalIds); | 582 | Array.Sort(sortedZHeights, sortedlocalIds); |
583 | 583 | ||
584 | Graphics g = Graphics.FromImage(mapbmp); | 584 | using (Graphics g = Graphics.FromImage(mapbmp)) |
585 | |||
586 | for (int s = 0; s < sortedZHeights.Length; s++) | ||
587 | { | 585 | { |
588 | if (z_sort.ContainsKey(sortedlocalIds[s])) | 586 | for (int s = 0; s < sortedZHeights.Length; s++) |
589 | { | 587 | { |
590 | DrawStruct rectDrawStruct = z_sort[sortedlocalIds[s]]; | 588 | if (z_sort.ContainsKey(sortedlocalIds[s])) |
591 | for (int r = 0; r < rectDrawStruct.trns.Length; r++) | ||
592 | { | 589 | { |
593 | g.FillPolygon(rectDrawStruct.brush,rectDrawStruct.trns[r].pts); | 590 | DrawStruct rectDrawStruct = z_sort[sortedlocalIds[s]]; |
591 | for (int r = 0; r < rectDrawStruct.trns.Length; r++) | ||
592 | { | ||
593 | g.FillPolygon(rectDrawStruct.brush,rectDrawStruct.trns[r].pts); | ||
594 | } | ||
595 | //g.FillRectangle(rectDrawStruct.brush , rectDrawStruct.rect); | ||
594 | } | 596 | } |
595 | //g.FillRectangle(rectDrawStruct.brush , rectDrawStruct.rect); | ||
596 | } | 597 | } |
597 | } | 598 | } |
598 | } // lock(objs) | 599 | } // lock entities objs |
600 | |||
599 | } | 601 | } |
600 | finally | 602 | finally |
601 | { | 603 | { |
@@ -603,9 +605,8 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
603 | ds.brush.Dispose(); | 605 | ds.brush.Dispose(); |
604 | } | 606 | } |
605 | 607 | ||
606 | g.Dispose(); | ||
607 | |||
608 | m_log.Debug("[MAPTILE]: Generating Maptile Step 2: Done in " + (Environment.TickCount - tc) + " ms"); | 608 | m_log.Debug("[MAPTILE]: Generating Maptile Step 2: Done in " + (Environment.TickCount - tc) + " ms"); |
609 | |||
609 | return mapbmp; | 610 | return mapbmp; |
610 | } | 611 | } |
611 | 612 | ||
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/ShadedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/LegacyMap/ShadedMapTileRenderer.cs index 9b939c9..708286c 100644 --- a/OpenSim/Region/CoreModules/World/LegacyMap/ShadedMapTileRenderer.cs +++ b/OpenSim/Region/CoreModules/World/LegacyMap/ShadedMapTileRenderer.cs | |||
@@ -207,7 +207,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
207 | { | 207 | { |
208 | if (!terraincorruptedwarningsaid) | 208 | if (!terraincorruptedwarningsaid) |
209 | { | 209 | { |
210 | m_log.WarnFormat("[MAPIMAGE]: Your terrain is corrupted in region {0}, it might take a few minutes to generate the map image depending on the corruption level", m_scene.RegionInfo.RegionName); | 210 | m_log.WarnFormat("[SHADED MAP TILE RENDERER]: Your terrain is corrupted in region {0}, it might take a few minutes to generate the map image depending on the corruption level", m_scene.RegionInfo.RegionName); |
211 | terraincorruptedwarningsaid = true; | 211 | terraincorruptedwarningsaid = true; |
212 | } | 212 | } |
213 | color = Color.Black; | 213 | color = Color.Black; |
@@ -237,7 +237,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
237 | { | 237 | { |
238 | if (!terraincorruptedwarningsaid) | 238 | if (!terraincorruptedwarningsaid) |
239 | { | 239 | { |
240 | m_log.WarnFormat("[MAPIMAGE]: Your terrain is corrupted in region {0}, it might take a few minutes to generate the map image depending on the corruption level", m_scene.RegionInfo.RegionName); | 240 | m_log.WarnFormat("[SHADED MAP TILE RENDERER]: Your terrain is corrupted in region {0}, it might take a few minutes to generate the map image depending on the corruption level", m_scene.RegionInfo.RegionName); |
241 | terraincorruptedwarningsaid = true; | 241 | terraincorruptedwarningsaid = true; |
242 | } | 242 | } |
243 | Color black = Color.Black; | 243 | Color black = Color.Black; |
@@ -246,7 +246,8 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
246 | } | 246 | } |
247 | } | 247 | } |
248 | } | 248 | } |
249 | m_log.Debug("[MAPTILE]: Generating Maptile Step 1: Done in " + (Environment.TickCount - tc) + " ms"); | 249 | |
250 | m_log.Debug("[SHADED MAP TILE RENDERER]: Generating Maptile Step 1: Done in " + (Environment.TickCount - tc) + " ms"); | ||
250 | } | 251 | } |
251 | } | 252 | } |
252 | } | 253 | } |
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs index 413ac64..9f23141 100644 --- a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs +++ b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs | |||
@@ -232,10 +232,14 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
232 | if (textureID == UUID.Zero) return defaultColor; // not set | 232 | if (textureID == UUID.Zero) return defaultColor; // not set |
233 | if (m_mapping.ContainsKey(textureID)) return m_mapping[textureID]; // one of the predefined textures | 233 | if (m_mapping.ContainsKey(textureID)) return m_mapping[textureID]; // one of the predefined textures |
234 | 234 | ||
235 | Bitmap bmp = fetchTexture(textureID); | 235 | Color color; |
236 | Color color = bmp == null ? defaultColor : computeAverageColor(bmp); | 236 | |
237 | // store it for future reference | 237 | using (Bitmap bmp = fetchTexture(textureID)) |
238 | m_mapping[textureID] = color; | 238 | { |
239 | color = bmp == null ? defaultColor : computeAverageColor(bmp); | ||
240 | // store it for future reference | ||
241 | m_mapping[textureID] = color; | ||
242 | } | ||
239 | 243 | ||
240 | return color; | 244 | return color; |
241 | } | 245 | } |
@@ -417,7 +421,8 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
417 | } | 421 | } |
418 | } | 422 | } |
419 | } | 423 | } |
420 | m_log.Debug("[MAPTILE]: Generating Maptile Step 1: Done in " + (Environment.TickCount - tc) + " ms"); | 424 | |
425 | m_log.Debug("[TEXTURED MAP TILE RENDERER]: Generating Maptile Step 1: Done in " + (Environment.TickCount - tc) + " ms"); | ||
421 | } | 426 | } |
422 | } | 427 | } |
423 | } | 428 | } |