diff options
author | Jak Daniels | 2014-03-17 20:39:36 +0000 |
---|---|---|
committer | Robert Adams | 2014-03-18 22:18:50 -0700 |
commit | 61353dde80a3912e26959c612a1d8d46ec1bc826 (patch) | |
tree | 3a78615a34b53a5e0201b4e570006f09a6745cc1 /OpenSim | |
parent | Revert "Simplify DoubleQueue to eliminate redundant sempahore work." (diff) | |
download | opensim-SC-61353dde80a3912e26959c612a1d8d46ec1bc826.zip opensim-SC-61353dde80a3912e26959c612a1d8d46ec1bc826.tar.gz opensim-SC-61353dde80a3912e26959c612a1d8d46ec1bc826.tar.bz2 opensim-SC-61353dde80a3912e26959c612a1d8d46ec1bc826.tar.xz |
Allow Region specific static maptiles to be loaded from file.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/RegionInfo.cs | 21 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs | 53 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 3 |
3 files changed, 58 insertions, 19 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; |