diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/WorldMap/MapImageModule.cs | 154 |
1 files changed, 78 insertions, 76 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/Environment/Modules/World/WorldMap/MapImageModule.cs index 9b8dc75..ea8aa55 100644 --- a/OpenSim/Region/Environment/Modules/World/WorldMap/MapImageModule.cs +++ b/OpenSim/Region/Environment/Modules/World/WorldMap/MapImageModule.cs | |||
@@ -118,45 +118,46 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
118 | 118 | ||
119 | #endregion | 119 | #endregion |
120 | 120 | ||
121 | private void ShadeBuildings(Bitmap map) | 121 | // TODO: unused: |
122 | { | 122 | // private void ShadeBuildings(Bitmap map) |
123 | lock (map) | 123 | // { |
124 | { | 124 | // lock (map) |
125 | lock (m_scene.Entities) | 125 | // { |
126 | { | 126 | // lock (m_scene.Entities) |
127 | foreach (EntityBase entity in m_scene.Entities.Values) | 127 | // { |
128 | { | 128 | // foreach (EntityBase entity in m_scene.Entities.Values) |
129 | if (entity is SceneObjectGroup) | 129 | // { |
130 | { | 130 | // if (entity is SceneObjectGroup) |
131 | SceneObjectGroup sog = (SceneObjectGroup) entity; | 131 | // { |
132 | 132 | // SceneObjectGroup sog = (SceneObjectGroup) entity; | |
133 | foreach (SceneObjectPart primitive in sog.Children.Values) | 133 | // |
134 | { | 134 | // foreach (SceneObjectPart primitive in sog.Children.Values) |
135 | int x = (int) (primitive.AbsolutePosition.X - (primitive.Scale.X / 2)); | 135 | // { |
136 | int y = (int) (primitive.AbsolutePosition.Y - (primitive.Scale.Y / 2)); | 136 | // int x = (int) (primitive.AbsolutePosition.X - (primitive.Scale.X / 2)); |
137 | int w = (int) primitive.Scale.X; | 137 | // int y = (int) (primitive.AbsolutePosition.Y - (primitive.Scale.Y / 2)); |
138 | int h = (int) primitive.Scale.Y; | 138 | // int w = (int) primitive.Scale.X; |
139 | 139 | // int h = (int) primitive.Scale.Y; | |
140 | int dx; | 140 | // |
141 | for (dx = x; dx < x + w; dx++) | 141 | // int dx; |
142 | { | 142 | // for (dx = x; dx < x + w; dx++) |
143 | int dy; | 143 | // { |
144 | for (dy = y; dy < y + h; dy++) | 144 | // int dy; |
145 | { | 145 | // for (dy = y; dy < y + h; dy++) |
146 | if (x < 0 || y < 0) | 146 | // { |
147 | continue; | 147 | // if (x < 0 || y < 0) |
148 | if (x >= map.Width || y >= map.Height) | 148 | // continue; |
149 | continue; | 149 | // if (x >= map.Width || y >= map.Height) |
150 | 150 | // continue; | |
151 | map.SetPixel(dx, dy, Color.DarkGray); | 151 | // |
152 | } | 152 | // map.SetPixel(dx, dy, Color.DarkGray); |
153 | } | 153 | // } |
154 | } | 154 | // } |
155 | } | 155 | // } |
156 | } | 156 | // } |
157 | } | 157 | // } |
158 | } | 158 | // } |
159 | } | 159 | // } |
160 | // } | ||
160 | 161 | ||
161 | private Bitmap TerrainToBitmap2(Scene whichScene, Bitmap mapbmp) | 162 | private Bitmap TerrainToBitmap2(Scene whichScene, Bitmap mapbmp) |
162 | { | 163 | { |
@@ -532,42 +533,43 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
532 | return mapbmp; | 533 | return mapbmp; |
533 | } | 534 | } |
534 | 535 | ||
535 | # region Depreciated Maptile Generation. Adam may update this | 536 | // TODO: unused: |
536 | private Bitmap TerrainToBitmap(string gradientmap) | 537 | // #region Deprecated Maptile Generation. Adam may update this |
537 | { | 538 | // private Bitmap TerrainToBitmap(string gradientmap) |
538 | Bitmap gradientmapLd = new Bitmap(gradientmap); | 539 | // { |
539 | 540 | // Bitmap gradientmapLd = new Bitmap(gradientmap); | |
540 | int pallete = gradientmapLd.Height; | 541 | // |
541 | 542 | // int pallete = gradientmapLd.Height; | |
542 | Bitmap bmp = new Bitmap(m_scene.Heightmap.Width, m_scene.Heightmap.Height); | 543 | // |
543 | Color[] colours = new Color[pallete]; | 544 | // Bitmap bmp = new Bitmap(m_scene.Heightmap.Width, m_scene.Heightmap.Height); |
544 | 545 | // Color[] colours = new Color[pallete]; | |
545 | for (int i = 0; i < pallete; i++) | 546 | // |
546 | { | 547 | // for (int i = 0; i < pallete; i++) |
547 | colours[i] = gradientmapLd.GetPixel(0, i); | 548 | // { |
548 | } | 549 | // colours[i] = gradientmapLd.GetPixel(0, i); |
549 | 550 | // } | |
550 | lock (m_scene.Heightmap) | 551 | // |
551 | { | 552 | // lock (m_scene.Heightmap) |
552 | ITerrainChannel copy = m_scene.Heightmap; | 553 | // { |
553 | for (int y = 0; y < copy.Height; y++) | 554 | // ITerrainChannel copy = m_scene.Heightmap; |
554 | { | 555 | // for (int y = 0; y < copy.Height; y++) |
555 | for (int x = 0; x < copy.Width; x++) | 556 | // { |
556 | { | 557 | // for (int x = 0; x < copy.Width; x++) |
557 | // 512 is the largest possible height before colours clamp | 558 | // { |
558 | int colorindex = (int) (Math.Max(Math.Min(1.0, copy[x, y] / 512.0), 0.0) * (pallete - 1)); | 559 | // // 512 is the largest possible height before colours clamp |
559 | 560 | // int colorindex = (int) (Math.Max(Math.Min(1.0, copy[x, y] / 512.0), 0.0) * (pallete - 1)); | |
560 | // Handle error conditions | 561 | // |
561 | if (colorindex > pallete - 1 || colorindex < 0) | 562 | // // Handle error conditions |
562 | bmp.SetPixel(x, copy.Height - y - 1, Color.Red); | 563 | // if (colorindex > pallete - 1 || colorindex < 0) |
563 | else | 564 | // bmp.SetPixel(x, copy.Height - y - 1, Color.Red); |
564 | bmp.SetPixel(x, copy.Height - y - 1, colours[colorindex]); | 565 | // else |
565 | } | 566 | // bmp.SetPixel(x, copy.Height - y - 1, colours[colorindex]); |
566 | } | 567 | // } |
567 | ShadeBuildings(bmp); | 568 | // } |
568 | return bmp; | 569 | // ShadeBuildings(bmp); |
569 | } | 570 | // return bmp; |
570 | } | 571 | // } |
571 | #endregion | 572 | // } |
573 | // #endregion | ||
572 | } | 574 | } |
573 | } | 575 | } |