From 61353dde80a3912e26959c612a1d8d46ec1bc826 Mon Sep 17 00:00:00 2001 From: Jak Daniels Date: Mon, 17 Mar 2014 20:39:36 +0000 Subject: Allow Region specific static maptiles to be loaded from file. --- .../CoreModules/World/LegacyMap/MapImageModule.cs | 53 ++++++++++++++-------- OpenSim/Region/Framework/Scenes/Scene.cs | 3 +- 2 files changed, 37 insertions(+), 19 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs index 1dad8ba..0bd6ae4 100644 --- a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs @@ -91,29 +91,46 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap if (generateMaptiles) { - if (textureTerrain) + if (String.IsNullOrEmpty(m_scene.RegionInfo.m_maptileStaticFile)) { - terrainRenderer = new TexturedMapTileRenderer(); - } - else - { - terrainRenderer = new ShadedMapTileRenderer(); - } + if (textureTerrain) + { + terrainRenderer = new TexturedMapTileRenderer(); + } + else + { + terrainRenderer = new ShadedMapTileRenderer(); + } - terrainRenderer.Initialise(m_scene, m_config); + terrainRenderer.Initialise(m_scene, m_config); - mapbmp = new Bitmap((int)m_scene.Heightmap.Width, (int)m_scene.Heightmap.Height, - System.Drawing.Imaging.PixelFormat.Format24bppRgb); - //long t = System.Environment.TickCount; - //for (int i = 0; i < 10; ++i) { - terrainRenderer.TerrainToBitmap(mapbmp); - //} - //t = System.Environment.TickCount - t; - //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t); + mapbmp = new Bitmap((int)m_scene.Heightmap.Width, (int)m_scene.Heightmap.Height, + System.Drawing.Imaging.PixelFormat.Format24bppRgb); + //long t = System.Environment.TickCount; + //for (int i = 0; i < 10; ++i) { + terrainRenderer.TerrainToBitmap(mapbmp); + //} + //t = System.Environment.TickCount - t; + //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t); - if (drawPrimVolume) + if (drawPrimVolume) + { + DrawObjectVolume(m_scene, mapbmp); + } + } + else { - DrawObjectVolume(m_scene, mapbmp); + try + { + mapbmp = new Bitmap("maptiles/" + m_scene.RegionInfo.m_maptileStaticFile); + } + catch (Exception e) + { + m_log.ErrorFormat("[MAPTILE]: Failed to load Static map image texture file: {0} for {1}", "maptiles/" + m_scene.RegionInfo.m_maptileStaticFile, m_scene.Name); + //mapbmp = new Bitmap((int)m_scene.Heightmap.Width, (int)m_scene.Heightmap.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb); + mapbmp = null; + } + if (mapbmp != null) m_log.DebugFormat("[MAPTILE]: Static map image texture file {0} found for {1}", "maptiles/" + m_scene.RegionInfo.m_maptileStaticFile, m_scene.Name); } } else diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index fa90ef4..d16b73b 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -903,7 +903,8 @@ namespace OpenSim.Region.Framework.Scenes if (m_generateMaptiles) { - int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); + int maptileRefresh = Util.GetConfigVarFromSections(config, "MaptileRefresh", possibleMapConfigSections, 0); + m_log.InfoFormat("[SCENE]: Region {0}, WORLD MAP refresh time set to {1} seconds", RegionInfo.RegionName, maptileRefresh); if (maptileRefresh != 0) { m_mapGenerationTimer.Interval = maptileRefresh * 1000; -- cgit v1.1