diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index b17ab8b9ea..d89f4611cd 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -101,6 +101,7 @@ what it is today. * Iain Oliver * Imaze Rhiano * Intimidated +* Jak Daniels * Jeremy Bongio (IBM) * jhurliman * John R Sohn (XenReborn) diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 1de30afad3..f71ee86002 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -143,6 +143,7 @@ namespace OpenSim.Framework public string RemotingAddress; public UUID ScopeID = UUID.Zero; private UUID m_maptileStaticUUID = UUID.Zero; + public string m_maptileStaticFile; public uint WorldLocX = 0; public uint WorldLocY = 0; @@ -349,6 +350,11 @@ namespace OpenSim.Framework { get { return m_maptileStaticUUID; } } + + public string MaptileStaticFile + { + get { return m_maptileStaticFile; } + } /// /// The port by which http communication occurs with the region (most noticeably, CAPS communication) @@ -716,6 +722,9 @@ namespace OpenSim.Framework { config.Set("MaptileStaticUUID", m_maptileStaticUUID.ToString()); } + + m_maptileStaticFile = config.GetString("MaptileStaticFile", String.Empty); + allKeys.Remove("MaptileStaticFile"); #endregion @@ -843,6 +852,9 @@ namespace OpenSim.Framework if (m_maptileStaticUUID != UUID.Zero) config.Set("MaptileStaticUUID", m_maptileStaticUUID.ToString()); + + if (m_maptileStaticFile != String.Empty) + config.Set("MaptileStaticFile", m_maptileStaticFile); } public bool ignoreIncomingConfiguration(string configuration_key, object configuration_result) @@ -952,6 +964,9 @@ namespace OpenSim.Framework configMember.addConfigurationOption("region_static_maptile", ConfigurationOption.ConfigurationTypes.TYPE_UUID, "UUID of a texture to use as the map for this region", m_maptileStaticUUID.ToString(), true); + + configMember.addConfigurationOption("region_static_mapfile", ConfigurationOption.ConfigurationTypes.TYPE_STRING, + "Filename of a texture to use as the map for this region", m_maptileStaticFile, true); } public void loadConfigurationOptions() @@ -1016,6 +1031,9 @@ namespace OpenSim.Framework configMember.addConfigurationOption("region_static_maptile", ConfigurationOption.ConfigurationTypes.TYPE_UUID, "UUID of a texture to use as the map for this region", String.Empty, true); + + configMember.addConfigurationOption("region_static_mapfile", ConfigurationOption.ConfigurationTypes.TYPE_STRING, + "Filename of a texture to use as the map for this region", String.Empty, true); } public bool handleIncomingConfiguration(string configuration_key, object configuration_result) @@ -1097,6 +1115,9 @@ namespace OpenSim.Framework case "region_static_maptile": m_maptileStaticUUID = (UUID)configuration_result; break; + case "region_static_mapfile": + m_maptileStaticFile = (string)configuration_result; + break; } return true; diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs index 1dad8ba20a..556b11f36f 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(); + if (textureTerrain) + { + terrainRenderer = new TexturedMapTileRenderer(); + } + else + { + terrainRenderer = new ShadedMapTileRenderer(); + } + + 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); + + if (drawPrimVolume) + { + DrawObjectVolume(m_scene, mapbmp); + } } else { - terrainRenderer = new ShadedMapTileRenderer(); - } - - 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); - - if (drawPrimVolume) - { - DrawObjectVolume(m_scene, mapbmp); + try + { + mapbmp = new Bitmap(m_scene.RegionInfo.m_maptileStaticFile); + } + catch (Exception e) + { + m_log.ErrorFormat("[MAPTILE]: Failed to load Static map image texture file: {0} for {1}", 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}", 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 fa90ef4afa..d16b73bbc0 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; diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index c4697a178c..bf5e18c608 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -297,6 +297,7 @@ ;# {MaptileStaticUUID} {} {Asset ID for static map texture} {} 00000000-0000-0000-0000-000000000000 ;; If not generating maptiles, use this static texture asset ID + ;; This may be overridden on a per region basis in Regions.ini ; MaptileStaticUUID = "00000000-0000-0000-0000-000000000000" ;# {TextureOnMapTile} {} {Use terrain textures for map tiles?} {true false} true diff --git a/bin/Regions/Regions.ini.example b/bin/Regions/Regions.ini.example index aabc4f8b2b..36ccd8c4db 100644 --- a/bin/Regions/Regions.ini.example +++ b/bin/Regions/Regions.ini.example @@ -46,7 +46,41 @@ ExternalHostName = "SYSTEMIP" ; RegionType = "Mainland" +; * Region Specific Static Maptiles: +; * Important: To use any kind of texture *assets* as a static maptile, the following +; * things must be set in the [Map] section of OpenSim.ini : ; * -; * UUID of texture to use as a maptile for this region. -; * Only set if you have disabled dynamic generation of the map tile from the region contents. +; * MapImageModule = "MapImageModule" +; * GenerateMaptiles = false +; * +; * Now, there is a setting in [Map] in OpenSim.ini called +; * +; * MaptileStaticUUID = "00000000-0000-0000-0000-000000000000" +; * +; * where, given the criteria above, lets you specify the UUID of a texture asset to use +; * as a maptile *Simulator Wide*. Here, you can override that on a per region basis for +; * Simulators that run multiple regions: + ; MaptileStaticUUID = "00000000-0000-0000-0000-000000000000" + + +; * Region Specific Static Maptiles from file: +; * It is also possible to create maptiles using external image files of the right size +; * and supported formats (bmp,png,jpg in RGB 24bpp format) +; * +; * Important: To use any kind of texture *files* as a static maptile, the following +; * things must be set in the [Map] section of OpenSim.ini : +; * +; * MapImageModule = "MapImageModule" +; * GenerateMaptiles = true +; * +; * The image must be the same size in pixels as the region or varregion is in meters. +; * i.e. 256x256 pixels for single region of 256x256m, or 1280x1280 pixels for a varregion +; * of size 1280x1280m. The image can be loaded from anywhere by setting the path +; * ie: MaptileStaticFile = "maptiles/SomeFile.png" +; * +; * If this setting is used, then the base map is generated from this file instead of being +; * built using MapImageModule's terrain and prim renderer. Parcel 'for sale' overlays are +; * still drawn on top of the static map by the World Map module. + +; MaptileStaticFile = "SomeFile.png" \ No newline at end of file