aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs50
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/ShadedMapTileRenderer.cs5
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/TexturedMapTileRenderer.cs5
-rw-r--r--OpenSim/Region/Framework/Interfaces/ITerrain.cs1
4 files changed, 33 insertions, 28 deletions
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
index b71b5f6..b96d95a 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
@@ -70,10 +70,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
70 70
71 #region IMapImageGenerator Members 71 #region IMapImageGenerator Members
72 72
73 public byte[] WriteJpeg2000Image(string gradientmap) 73 public Bitmap CreateMapTile(string gradientmap)
74 { 74 {
75 byte[] imageData = null;
76
77 bool drawPrimVolume = true; 75 bool drawPrimVolume = true;
78 bool textureTerrain = false; 76 bool textureTerrain = false;
79 77
@@ -98,32 +96,36 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
98 } 96 }
99 terrainRenderer.Initialise(m_scene, m_config); 97 terrainRenderer.Initialise(m_scene, m_config);
100 98
101 using (Bitmap mapbmp = new Bitmap((int)Constants.RegionSize, (int)Constants.RegionSize)) 99 Bitmap mapbmp = new Bitmap((int)Constants.RegionSize, (int)Constants.RegionSize, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
102 { 100 //long t = System.Environment.TickCount;
103 //long t = System.Environment.TickCount; 101 //for (int i = 0; i < 10; ++i) {
104 //for (int i = 0; i < 10; ++i) { 102 terrainRenderer.TerrainToBitmap(mapbmp);
105 terrainRenderer.TerrainToBitmap(mapbmp); 103 //}
106 //} 104 //t = System.Environment.TickCount - t;
107 //t = System.Environment.TickCount - t; 105 //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t);
108 //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t);
109 106
110 107
111 if (drawPrimVolume) 108 if (drawPrimVolume)
112 { 109 {
113 DrawObjectVolume(m_scene, mapbmp); 110 DrawObjectVolume(m_scene, mapbmp);
114 } 111 }
115 112
116 try 113 return mapbmp;
117 { 114 }
118 imageData = OpenJPEG.EncodeFromImage(mapbmp, true); 115
119 } 116 public byte[] WriteJpeg2000Image(string gradientmap)
120 catch (Exception e) // LEGIT: Catching problems caused by OpenJPEG p/invoke 117 {
121 { 118 try
122 m_log.Error("Failed generating terrain map: " + e); 119 {
123 } 120 using (Bitmap mapbmp = CreateMapTile(gradientmap))
121 return OpenJPEG.EncodeFromImage(mapbmp, true);
122 }
123 catch (Exception e) // LEGIT: Catching problems caused by OpenJPEG p/invoke
124 {
125 m_log.Error("Failed generating terrain map: " + e);
124 } 126 }
125 127
126 return imageData; 128 return null;
127 } 129 }
128 130
129 #endregion 131 #endregion
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/ShadedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/WorldMap/ShadedMapTileRenderer.cs
index a297cf3..fef2ef3 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/ShadedMapTileRenderer.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/ShadedMapTileRenderer.cs
@@ -37,6 +37,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
37{ 37{
38 public class ShadedMapTileRenderer : IMapTileTerrainRenderer 38 public class ShadedMapTileRenderer : IMapTileTerrainRenderer
39 { 39 {
40 private static readonly Color WATER_COLOR = Color.FromArgb(29, 71, 95);
41
40 private static readonly ILog m_log = 42 private static readonly ILog m_log =
41 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42 44
@@ -221,8 +223,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
221 223
222 try 224 try
223 { 225 {
224 Color water = Color.FromArgb((int)heightvalue, (int)heightvalue, 255); 226 mapbmp.SetPixel(x, yr, WATER_COLOR);
225 mapbmp.SetPixel(x, yr, water);
226 } 227 }
227 catch (ArgumentException) 228 catch (ArgumentException)
228 { 229 {
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/TexturedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/WorldMap/TexturedMapTileRenderer.cs
index 4ecad74..8b34f6e 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/TexturedMapTileRenderer.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/TexturedMapTileRenderer.cs
@@ -136,6 +136,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
136 private static readonly UUID defaultTerrainTexture4 = new UUID("53a2f406-4895-1d13-d541-d2e3b86bc19c"); 136 private static readonly UUID defaultTerrainTexture4 = new UUID("53a2f406-4895-1d13-d541-d2e3b86bc19c");
137 private static readonly Color defaultColor4 = Color.FromArgb(200, 200, 200); 137 private static readonly Color defaultColor4 = Color.FromArgb(200, 200, 200);
138 138
139 private static readonly Color WATER_COLOR = Color.FromArgb(29, 71, 95);
140
139 #endregion 141 #endregion
140 142
141 143
@@ -406,8 +408,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
406 408
407 heightvalue = 100f - (heightvalue * 100f) / 19f; // 0 - 19 => 100 - 0 409 heightvalue = 100f - (heightvalue * 100f) / 19f; // 0 - 19 => 100 - 0
408 410
409 Color water = Color.FromArgb((int)heightvalue, (int)heightvalue, 255); 411 mapbmp.SetPixel(x, yr, WATER_COLOR);
410 mapbmp.SetPixel(x, yr, water);
411 } 412 }
412 } 413 }
413 } 414 }
diff --git a/OpenSim/Region/Framework/Interfaces/ITerrain.cs b/OpenSim/Region/Framework/Interfaces/ITerrain.cs
index f5662cb..b42e872 100644
--- a/OpenSim/Region/Framework/Interfaces/ITerrain.cs
+++ b/OpenSim/Region/Framework/Interfaces/ITerrain.cs
@@ -73,6 +73,7 @@ namespace OpenSim.Region.Framework.Interfaces
73 73
74 public interface IMapImageGenerator 74 public interface IMapImageGenerator
75 { 75 {
76 System.Drawing.Bitmap CreateMapTile(string gradientmap);
76 byte[] WriteJpeg2000Image(string gradientmap); 77 byte[] WriteJpeg2000Image(string gradientmap);
77 } 78 }
78} 79}