aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDan Lake2013-01-31 11:15:22 -0800
committerDan Lake2013-01-31 11:15:22 -0800
commitb659ccfc806b4f46446b0db1018c729edd1960a4 (patch)
treed828367e2209c6316f9a526bdcd45bcb16cd4db4
parentAdded option for UUID as command parameters. This lets the command handle the... (diff)
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-b659ccfc806b4f46446b0db1018c729edd1960a4.zip
opensim-SC_OLD-b659ccfc806b4f46446b0db1018c729edd1960a4.tar.gz
opensim-SC_OLD-b659ccfc806b4f46446b0db1018c729edd1960a4.tar.bz2
opensim-SC_OLD-b659ccfc806b4f46446b0db1018c729edd1960a4.tar.xz
Merge branch 'master' of git://opensimulator.org/git/opensim
-rw-r--r--OpenSim/Framework/RegionInfo.cs27
-rw-r--r--OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs81
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs7
-rw-r--r--bin/Regions/Regions.ini.example1
4 files changed, 96 insertions, 20 deletions
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index 016f2a6..24b9c89 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -143,6 +143,7 @@ namespace OpenSim.Framework
143 public UUID RegionID = UUID.Zero; 143 public UUID RegionID = UUID.Zero;
144 public string RemotingAddress; 144 public string RemotingAddress;
145 public UUID ScopeID = UUID.Zero; 145 public UUID ScopeID = UUID.Zero;
146 private UUID m_maptileStaticUUID = UUID.Zero;
146 147
147 private Dictionary<String, String> m_otherSettings = new Dictionary<string, string>(); 148 private Dictionary<String, String> m_otherSettings = new Dictionary<string, string>();
148 149
@@ -338,6 +339,11 @@ namespace OpenSim.Framework
338 get { return m_regionType; } 339 get { return m_regionType; }
339 } 340 }
340 341
342 public UUID MaptileStaticUUID
343 {
344 get { return m_maptileStaticUUID; }
345 }
346
341 /// <summary> 347 /// <summary>
342 /// The port by which http communication occurs with the region (most noticeably, CAPS communication) 348 /// The port by which http communication occurs with the region (most noticeably, CAPS communication)
343 /// </summary> 349 /// </summary>
@@ -641,7 +647,7 @@ namespace OpenSim.Framework
641 m_regionType = config.GetString("RegionType", String.Empty); 647 m_regionType = config.GetString("RegionType", String.Empty);
642 allKeys.Remove("RegionType"); 648 allKeys.Remove("RegionType");
643 649
644 #region Prim stuff 650 #region Prim and map stuff
645 651
646 m_nonphysPrimMin = config.GetFloat("NonPhysicalPrimMin", 0); 652 m_nonphysPrimMin = config.GetFloat("NonPhysicalPrimMin", 0);
647 allKeys.Remove("NonPhysicalPrimMin"); 653 allKeys.Remove("NonPhysicalPrimMin");
@@ -663,6 +669,13 @@ namespace OpenSim.Framework
663 669
664 m_linksetCapacity = config.GetInt("LinksetPrims", 0); 670 m_linksetCapacity = config.GetInt("LinksetPrims", 0);
665 allKeys.Remove("LinksetPrims"); 671 allKeys.Remove("LinksetPrims");
672
673 allKeys.Remove("MaptileStaticUUID");
674 string mapTileStaticUUID = config.GetString("MaptileStaticUUID", UUID.Zero.ToString());
675 if (UUID.TryParse(mapTileStaticUUID.Trim(), out m_maptileStaticUUID))
676 {
677 config.Set("MaptileStaticUUID", m_maptileStaticUUID.ToString());
678 }
666 679
667 #endregion 680 #endregion
668 681
@@ -729,6 +742,9 @@ namespace OpenSim.Framework
729 742
730 if (RegionType != String.Empty) 743 if (RegionType != String.Empty)
731 config.Set("RegionType", RegionType); 744 config.Set("RegionType", RegionType);
745
746 if (m_maptileStaticUUID != UUID.Zero)
747 config.Set("MaptileStaticUUID", m_maptileStaticUUID.ToString());
732 } 748 }
733 749
734 public bool ignoreIncomingConfiguration(string configuration_key, object configuration_result) 750 public bool ignoreIncomingConfiguration(string configuration_key, object configuration_result)
@@ -827,6 +843,9 @@ namespace OpenSim.Framework
827 843
828 configMember.addConfigurationOption("region_type", ConfigurationOption.ConfigurationTypes.TYPE_STRING, 844 configMember.addConfigurationOption("region_type", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
829 "Free form string describing the type of region", String.Empty, true); 845 "Free form string describing the type of region", String.Empty, true);
846
847 configMember.addConfigurationOption("region_static_maptile", ConfigurationOption.ConfigurationTypes.TYPE_UUID,
848 "UUID of a texture to use as the map for this region", m_maptileStaticUUID.ToString(), true);
830 } 849 }
831 850
832 public void loadConfigurationOptions() 851 public void loadConfigurationOptions()
@@ -880,6 +899,9 @@ namespace OpenSim.Framework
880 899
881 configMember.addConfigurationOption("region_type", ConfigurationOption.ConfigurationTypes.TYPE_STRING, 900 configMember.addConfigurationOption("region_type", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
882 "Region Type", String.Empty, true); 901 "Region Type", String.Empty, true);
902
903 configMember.addConfigurationOption("region_static_maptile", ConfigurationOption.ConfigurationTypes.TYPE_UUID,
904 "UUID of a texture to use as the map for this region", String.Empty, true);
883 } 905 }
884 906
885 public bool handleIncomingConfiguration(string configuration_key, object configuration_result) 907 public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
@@ -949,6 +971,9 @@ namespace OpenSim.Framework
949 case "region_type": 971 case "region_type":
950 m_regionType = (string)configuration_result; 972 m_regionType = (string)configuration_result;
951 break; 973 break;
974 case "region_static_maptile":
975 m_maptileStaticUUID = (UUID)configuration_result;
976 break;
952 } 977 }
953 978
954 return true; 979 return true;
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);
diff --git a/bin/Regions/Regions.ini.example b/bin/Regions/Regions.ini.example
index 54a841d..f5282a7 100644
--- a/bin/Regions/Regions.ini.example
+++ b/bin/Regions/Regions.ini.example
@@ -45,3 +45,4 @@ ExternalHostName = "SYSTEMIP"
45; * 45; *
46 46
47; RegionType = "Mainland" 47; RegionType = "Mainland"
48; MaptileStaticUUID = "00000000-0000-0000-0000-000000000000"