aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJak Daniels2014-03-17 20:39:36 +0000
committerRobert Adams2014-03-18 22:18:50 -0700
commit61353dde80a3912e26959c612a1d8d46ec1bc826 (patch)
tree3a78615a34b53a5e0201b4e570006f09a6745cc1
parentRevert "Simplify DoubleQueue to eliminate redundant sempahore work." (diff)
downloadopensim-SC_OLD-61353dde80a3912e26959c612a1d8d46ec1bc826.zip
opensim-SC_OLD-61353dde80a3912e26959c612a1d8d46ec1bc826.tar.gz
opensim-SC_OLD-61353dde80a3912e26959c612a1d8d46ec1bc826.tar.bz2
opensim-SC_OLD-61353dde80a3912e26959c612a1d8d46ec1bc826.tar.xz
Allow Region specific static maptiles to be loaded from file.
-rw-r--r--OpenSim/Framework/RegionInfo.cs21
-rw-r--r--OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs53
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs3
-rw-r--r--bin/OpenSim.ini.example1
-rw-r--r--bin/Regions/Regions.ini.example37
5 files changed, 94 insertions, 21 deletions
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index 1de30af..f71ee86 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -143,6 +143,7 @@ namespace OpenSim.Framework
143 public string RemotingAddress; 143 public string RemotingAddress;
144 public UUID ScopeID = UUID.Zero; 144 public UUID ScopeID = UUID.Zero;
145 private UUID m_maptileStaticUUID = UUID.Zero; 145 private UUID m_maptileStaticUUID = UUID.Zero;
146 public string m_maptileStaticFile;
146 147
147 public uint WorldLocX = 0; 148 public uint WorldLocX = 0;
148 public uint WorldLocY = 0; 149 public uint WorldLocY = 0;
@@ -349,6 +350,11 @@ namespace OpenSim.Framework
349 { 350 {
350 get { return m_maptileStaticUUID; } 351 get { return m_maptileStaticUUID; }
351 } 352 }
353
354 public string MaptileStaticFile
355 {
356 get { return m_maptileStaticFile; }
357 }
352 358
353 /// <summary> 359 /// <summary>
354 /// The port by which http communication occurs with the region (most noticeably, CAPS communication) 360 /// The port by which http communication occurs with the region (most noticeably, CAPS communication)
@@ -716,6 +722,9 @@ namespace OpenSim.Framework
716 { 722 {
717 config.Set("MaptileStaticUUID", m_maptileStaticUUID.ToString()); 723 config.Set("MaptileStaticUUID", m_maptileStaticUUID.ToString());
718 } 724 }
725
726 m_maptileStaticFile = config.GetString("MaptileStaticFile", String.Empty);
727 allKeys.Remove("MaptileStaticFile");
719 728
720 #endregion 729 #endregion
721 730
@@ -843,6 +852,9 @@ namespace OpenSim.Framework
843 852
844 if (m_maptileStaticUUID != UUID.Zero) 853 if (m_maptileStaticUUID != UUID.Zero)
845 config.Set("MaptileStaticUUID", m_maptileStaticUUID.ToString()); 854 config.Set("MaptileStaticUUID", m_maptileStaticUUID.ToString());
855
856 if (m_maptileStaticFile != String.Empty)
857 config.Set("MaptileStaticFile", m_maptileStaticFile);
846 } 858 }
847 859
848 public bool ignoreIncomingConfiguration(string configuration_key, object configuration_result) 860 public bool ignoreIncomingConfiguration(string configuration_key, object configuration_result)
@@ -952,6 +964,9 @@ namespace OpenSim.Framework
952 964
953 configMember.addConfigurationOption("region_static_maptile", ConfigurationOption.ConfigurationTypes.TYPE_UUID, 965 configMember.addConfigurationOption("region_static_maptile", ConfigurationOption.ConfigurationTypes.TYPE_UUID,
954 "UUID of a texture to use as the map for this region", m_maptileStaticUUID.ToString(), true); 966 "UUID of a texture to use as the map for this region", m_maptileStaticUUID.ToString(), true);
967
968 configMember.addConfigurationOption("region_static_mapfile", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
969 "Filename of a texture to use as the map for this region", m_maptileStaticFile, true);
955 } 970 }
956 971
957 public void loadConfigurationOptions() 972 public void loadConfigurationOptions()
@@ -1016,6 +1031,9 @@ namespace OpenSim.Framework
1016 1031
1017 configMember.addConfigurationOption("region_static_maptile", ConfigurationOption.ConfigurationTypes.TYPE_UUID, 1032 configMember.addConfigurationOption("region_static_maptile", ConfigurationOption.ConfigurationTypes.TYPE_UUID,
1018 "UUID of a texture to use as the map for this region", String.Empty, true); 1033 "UUID of a texture to use as the map for this region", String.Empty, true);
1034
1035 configMember.addConfigurationOption("region_static_mapfile", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
1036 "Filename of a texture to use as the map for this region", String.Empty, true);
1019 } 1037 }
1020 1038
1021 public bool handleIncomingConfiguration(string configuration_key, object configuration_result) 1039 public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
@@ -1097,6 +1115,9 @@ namespace OpenSim.Framework
1097 case "region_static_maptile": 1115 case "region_static_maptile":
1098 m_maptileStaticUUID = (UUID)configuration_result; 1116 m_maptileStaticUUID = (UUID)configuration_result;
1099 break; 1117 break;
1118 case "region_static_mapfile":
1119 m_maptileStaticFile = (string)configuration_result;
1120 break;
1100 } 1121 }
1101 1122
1102 return true; 1123 return true;
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
91 91
92 if (generateMaptiles) 92 if (generateMaptiles)
93 { 93 {
94 if (textureTerrain) 94 if (String.IsNullOrEmpty(m_scene.RegionInfo.m_maptileStaticFile))
95 { 95 {
96 terrainRenderer = new TexturedMapTileRenderer(); 96 if (textureTerrain)
97 } 97 {
98 else 98 terrainRenderer = new TexturedMapTileRenderer();
99 { 99 }
100 terrainRenderer = new ShadedMapTileRenderer(); 100 else
101 } 101 {
102 terrainRenderer = new ShadedMapTileRenderer();
103 }
102 104
103 terrainRenderer.Initialise(m_scene, m_config); 105 terrainRenderer.Initialise(m_scene, m_config);
104 106
105 mapbmp = new Bitmap((int)m_scene.Heightmap.Width, (int)m_scene.Heightmap.Height, 107 mapbmp = new Bitmap((int)m_scene.Heightmap.Width, (int)m_scene.Heightmap.Height,
106 System.Drawing.Imaging.PixelFormat.Format24bppRgb); 108 System.Drawing.Imaging.PixelFormat.Format24bppRgb);
107 //long t = System.Environment.TickCount; 109 //long t = System.Environment.TickCount;
108 //for (int i = 0; i < 10; ++i) { 110 //for (int i = 0; i < 10; ++i) {
109 terrainRenderer.TerrainToBitmap(mapbmp); 111 terrainRenderer.TerrainToBitmap(mapbmp);
110 //} 112 //}
111 //t = System.Environment.TickCount - t; 113 //t = System.Environment.TickCount - t;
112 //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);
113 115
114 if (drawPrimVolume) 116 if (drawPrimVolume)
117 {
118 DrawObjectVolume(m_scene, mapbmp);
119 }
120 }
121 else
115 { 122 {
116 DrawObjectVolume(m_scene, mapbmp); 123 try
124 {
125 mapbmp = new Bitmap("maptiles/" + m_scene.RegionInfo.m_maptileStaticFile);
126 }
127 catch (Exception e)
128 {
129 m_log.ErrorFormat("[MAPTILE]: Failed to load Static map image texture file: {0} for {1}", "maptiles/" + m_scene.RegionInfo.m_maptileStaticFile, m_scene.Name);
130 //mapbmp = new Bitmap((int)m_scene.Heightmap.Width, (int)m_scene.Heightmap.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
131 mapbmp = null;
132 }
133 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);
117 } 134 }
118 } 135 }
119 else 136 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
903 903
904 if (m_generateMaptiles) 904 if (m_generateMaptiles)
905 { 905 {
906 int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); 906 int maptileRefresh = Util.GetConfigVarFromSections<int>(config, "MaptileRefresh", possibleMapConfigSections, 0);
907 m_log.InfoFormat("[SCENE]: Region {0}, WORLD MAP refresh time set to {1} seconds", RegionInfo.RegionName, maptileRefresh);
907 if (maptileRefresh != 0) 908 if (maptileRefresh != 0)
908 { 909 {
909 m_mapGenerationTimer.Interval = maptileRefresh * 1000; 910 m_mapGenerationTimer.Interval = maptileRefresh * 1000;
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example
index c4697a1..bf5e18c 100644
--- a/bin/OpenSim.ini.example
+++ b/bin/OpenSim.ini.example
@@ -297,6 +297,7 @@
297 297
298 ;# {MaptileStaticUUID} {} {Asset ID for static map texture} {} 00000000-0000-0000-0000-000000000000 298 ;# {MaptileStaticUUID} {} {Asset ID for static map texture} {} 00000000-0000-0000-0000-000000000000
299 ;; If not generating maptiles, use this static texture asset ID 299 ;; If not generating maptiles, use this static texture asset ID
300 ;; This may be overridden on a per region basis in Regions.ini
300 ; MaptileStaticUUID = "00000000-0000-0000-0000-000000000000" 301 ; MaptileStaticUUID = "00000000-0000-0000-0000-000000000000"
301 302
302 ;# {TextureOnMapTile} {} {Use terrain textures for map tiles?} {true false} true 303 ;# {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 aabc4f8..57d503e 100644
--- a/bin/Regions/Regions.ini.example
+++ b/bin/Regions/Regions.ini.example
@@ -46,7 +46,40 @@ ExternalHostName = "SYSTEMIP"
46 46
47; RegionType = "Mainland" 47; RegionType = "Mainland"
48 48
49; * Region Specific Static Maptiles:
50; * Important: To use any kind of texture *assets* as a static maptile, the following
51; * things must be set in the [Map] section of OpenSim.ini :
49; * 52; *
50; * UUID of texture to use as a maptile for this region. 53; * MapImageModule = "MapImageModule"
51; * Only set if you have disabled dynamic generation of the map tile from the region contents. 54; * GenerateMaptiles = false
55; *
56; * Now, there is a setting in [Map] in OpenSim.ini called
57; *
58; * MaptileStaticUUID = "00000000-0000-0000-0000-000000000000"
59; *
60; * where, given the criteria above, lets you specify the UUID of a texture asset to use
61; * as a maptile *Simulator Wide*. Here, you can override that on a per region basis for
62; * Simulators that run multiple regions:
63
52; MaptileStaticUUID = "00000000-0000-0000-0000-000000000000" 64; MaptileStaticUUID = "00000000-0000-0000-0000-000000000000"
65
66
67; * Region Specific Static Maptiles from file:
68; * It is also possible to create maptiles using external image files of the right size
69; * and supported formats (bmp,tga,png,jpg in RGB 24bpp format)
70; *
71; * Important: To use any kind of texture *files* as a static maptile, the following
72; * things must be set in the [Map] section of OpenSim.ini :
73; *
74; * MapImageModule = "MapImageModule"
75; * GenerateMaptiles = true
76; *
77; * The image must be the same size in pixels as the region or varregion is in meters.
78; * i.e. 256x256 pixels for single region of 256x256m, or 1280x1280 pixels for a varregion
79; * of size 1280x1280m. The image is loaded from OpenSim's bin/maptiles/ directory.
80; *
81; * If this setting is used, then the base map is generated from this file instead of being
82; * built using MapImageModule's terrain and prim renderer. Parcel 'for sale' overlays are
83; * still drawn on top of the static map by the World Map module.
84
85; MaptileStaticFile = "SomeFile.png" \ No newline at end of file