diff options
author | Jak Daniels | 2013-01-30 21:43:35 +0000 |
---|---|---|
committer | BlueWall | 2013-01-30 23:37:02 -0500 |
commit | fac72d540b029ba72195dca69c56034167835d60 (patch) | |
tree | 392b165533aa772690ff222de34fd1866d681139 /OpenSim/Region/CoreModules/World/LegacyMap | |
parent | * This adds a bit more to the previous flying roll effect by adding additiona... (diff) | |
download | opensim-SC_OLD-fac72d540b029ba72195dca69c56034167835d60.zip opensim-SC_OLD-fac72d540b029ba72195dca69c56034167835d60.tar.gz opensim-SC_OLD-fac72d540b029ba72195dca69c56034167835d60.tar.bz2 opensim-SC_OLD-fac72d540b029ba72195dca69c56034167835d60.tar.xz |
Allow use of MaptileStaticUUID in Regions.ini to override the global setting in OpenSim.ini for each region.
Signed-off-by: BlueWall <jamesh@bluewallgroup.com>
Diffstat (limited to 'OpenSim/Region/CoreModules/World/LegacyMap')
-rw-r--r-- | OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs | 81 |
1 files changed, 63 insertions, 18 deletions
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; |