aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs81
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs7
2 files changed, 69 insertions, 19 deletions
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
index 8a422b0..d412efc 100644
--- a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
@@ -77,42 +77,52 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
77 { 77 {
78 bool drawPrimVolume = true; 78 bool drawPrimVolume = true;
79 bool textureTerrain = false; 79 bool textureTerrain = false;
80 bool generateMaptiles = true;
81 Bitmap mapbmp;
80 82
81 try 83 try
82 { 84 {
83 IConfig startupConfig = m_config.Configs["Startup"]; 85 IConfig startupConfig = m_config.Configs["Startup"];
84 drawPrimVolume = startupConfig.GetBoolean("DrawPrimOnMapTile", drawPrimVolume); 86 drawPrimVolume = startupConfig.GetBoolean("DrawPrimOnMapTile", drawPrimVolume);
85 textureTerrain = startupConfig.GetBoolean("TextureOnMapTile", textureTerrain); 87 textureTerrain = startupConfig.GetBoolean("TextureOnMapTile", textureTerrain);
88 generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", generateMaptiles);
86 } 89 }
87 catch 90 catch
88 { 91 {
89 m_log.Warn("[MAPTILE]: Failed to load StartupConfig"); 92 m_log.Warn("[MAPTILE]: Failed to load StartupConfig");
90 } 93 }
91 94
92 if (textureTerrain) 95 if (generateMaptiles)
93 { 96 {
94 terrainRenderer = new TexturedMapTileRenderer(); 97 if (textureTerrain)
95 } 98 {
96 else 99 terrainRenderer = new TexturedMapTileRenderer();
97 { 100 }
98 terrainRenderer = new ShadedMapTileRenderer(); 101 else
99 } 102 {
100 terrainRenderer.Initialise(m_scene, m_config); 103 terrainRenderer = new ShadedMapTileRenderer();
104 }
105
106 terrainRenderer.Initialise(m_scene, m_config);
101 107
102 Bitmap mapbmp = new Bitmap((int)Constants.RegionSize, (int)Constants.RegionSize, System.Drawing.Imaging.PixelFormat.Format24bppRgb); 108 mapbmp = new Bitmap((int)Constants.RegionSize, (int)Constants.RegionSize, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
103 //long t = System.Environment.TickCount; 109 //long t = System.Environment.TickCount;
104 //for (int i = 0; i < 10; ++i) { 110 //for (int i = 0; i < 10; ++i) {
105 terrainRenderer.TerrainToBitmap(mapbmp); 111 terrainRenderer.TerrainToBitmap(mapbmp);
106 //} 112 //}
107 //t = System.Environment.TickCount - t; 113 //t = System.Environment.TickCount - t;
108 //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);
109 115
110 116
111 if (drawPrimVolume) 117 if (drawPrimVolume)
118 {
119 DrawObjectVolume(m_scene, mapbmp);
120 }
121 }
122 else
112 { 123 {
113 DrawObjectVolume(m_scene, mapbmp); 124 mapbmp = fetchTexture(m_scene.RegionInfo.RegionSettings.TerrainImageID);
114 } 125 }
115
116 return mapbmp; 126 return mapbmp;
117 } 127 }
118 128
@@ -222,6 +232,41 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
222// } 232// }
223// } 233// }
224 234
235 private Bitmap fetchTexture(UUID id)
236 {
237 AssetBase asset = m_scene.AssetService.Get(id.ToString());
238 m_log.DebugFormat("[MAPTILE]: Fetched static texture {0}, found: {1}", id, asset != null);
239 if (asset == null) return null;
240
241 ManagedImage managedImage;
242 Image image;
243
244 try
245 {
246 if (OpenJPEG.DecodeToImage(asset.Data, out managedImage, out image))
247 return new Bitmap(image);
248 else
249 return null;
250 }
251 catch (DllNotFoundException)
252 {
253 m_log.ErrorFormat("[MAPTILE]: OpenJpeg is not installed correctly on this system. Asset Data is empty for {0}", id);
254
255 }
256 catch (IndexOutOfRangeException)
257 {
258 m_log.ErrorFormat("[MAPTILE]: OpenJpeg was unable to decode this. Asset Data is empty for {0}", id);
259
260 }
261 catch (Exception)
262 {
263 m_log.ErrorFormat("[MAPTILE]: OpenJpeg was unable to decode this. Asset Data is empty for {0}", id);
264
265 }
266 return null;
267
268 }
269
225 private Bitmap DrawObjectVolume(Scene whichScene, Bitmap mapbmp) 270 private Bitmap DrawObjectVolume(Scene whichScene, Bitmap mapbmp)
226 { 271 {
227 int tc = 0; 272 int tc = 0;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index f2cb117..9e3d60f 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -917,10 +917,15 @@ namespace OpenSim.Region.Framework.Scenes
917 string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString()); 917 string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString());
918 UUID tileID; 918 UUID tileID;
919 919
920 if (UUID.TryParse(tile, out tileID)) 920 if ((tile!=UUID.Zero.ToString()) && UUID.TryParse(tile, out tileID))
921 { 921 {
922 RegionInfo.RegionSettings.TerrainImageID = tileID; 922 RegionInfo.RegionSettings.TerrainImageID = tileID;
923 } 923 }
924 else
925 {
926 RegionInfo.RegionSettings.TerrainImageID = RegionInfo.MaptileStaticUUID;
927 m_log.InfoFormat("[SCENE]: Region {0}, maptile set to {1}", RegionInfo.RegionName, RegionInfo.MaptileStaticUUID.ToString());
928 }
924 } 929 }
925 930
926 string grant = startupConfig.GetString("AllowedClients", String.Empty); 931 string grant = startupConfig.GetString("AllowedClients", String.Empty);