diff options
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World/WorldMap')
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/WorldMap/MapImageModule.cs | 12 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs | 35 |
2 files changed, 19 insertions, 28 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/Environment/Modules/World/WorldMap/MapImageModule.cs index a331d37..9b8dc75 100644 --- a/OpenSim/Region/Environment/Modules/World/WorldMap/MapImageModule.cs +++ b/OpenSim/Region/Environment/Modules/World/WorldMap/MapImageModule.cs | |||
@@ -162,7 +162,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
162 | { | 162 | { |
163 | int tc = System.Environment.TickCount; | 163 | int tc = System.Environment.TickCount; |
164 | m_log.Info("[MAPTILE]: Generating Maptile Step 1: Terrain"); | 164 | m_log.Info("[MAPTILE]: Generating Maptile Step 1: Terrain"); |
165 | 165 | ||
166 | double[,] hm = whichScene.Heightmap.GetDoubles(); | 166 | double[,] hm = whichScene.Heightmap.GetDoubles(); |
167 | bool ShadowDebugContinue = true; | 167 | bool ShadowDebugContinue = true; |
168 | //Color prim = Color.FromArgb(120, 120, 120); | 168 | //Color prim = Color.FromArgb(120, 120, 120); |
@@ -247,7 +247,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
247 | //X | 247 | //X |
248 | // . | 248 | // . |
249 | // | 249 | // |
250 | // Shade the terrain for shadows | 250 | // Shade the terrain for shadows |
251 | if ((x - 1 > 0) && (y - 1 > 0)) | 251 | if ((x - 1 > 0) && (y - 1 > 0)) |
252 | { | 252 | { |
253 | hfvalue = (float)hm[x, y]; | 253 | hfvalue = (float)hm[x, y]; |
@@ -268,7 +268,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
268 | else if (hfdiff < -0.3f) | 268 | else if (hfdiff < -0.3f) |
269 | { | 269 | { |
270 | // We have to desaturate and blacken the land at the same time | 270 | // We have to desaturate and blacken the land at the same time |
271 | // we use floats, colors use bytes, so shrink are space down to | 271 | // we use floats, colors use bytes, so shrink are space down to |
272 | // 0-255 | 272 | // 0-255 |
273 | 273 | ||
274 | 274 | ||
@@ -368,8 +368,8 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
368 | 368 | ||
369 | return mapbmp; | 369 | return mapbmp; |
370 | } | 370 | } |
371 | 371 | ||
372 | 372 | ||
373 | private Bitmap DrawObjectVolume(Scene whichScene, Bitmap mapbmp) | 373 | private Bitmap DrawObjectVolume(Scene whichScene, Bitmap mapbmp) |
374 | { | 374 | { |
375 | int tc = 0; | 375 | int tc = 0; |
@@ -570,4 +570,4 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
570 | } | 570 | } |
571 | #endregion | 571 | #endregion |
572 | } | 572 | } |
573 | } \ No newline at end of file | 573 | } |
diff --git a/OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs index 2a7af87..2430822 100644 --- a/OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs | |||
@@ -54,13 +54,13 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
54 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 54 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
55 | 55 | ||
56 | private static readonly string m_mapLayerPath = "0001/"; | 56 | private static readonly string m_mapLayerPath = "0001/"; |
57 | 57 | ||
58 | //private IConfig m_config; | 58 | //private IConfig m_config; |
59 | private Scene m_scene; | 59 | private Scene m_scene; |
60 | private List<MapBlockData> cachedMapBlocks = new List<MapBlockData>(); | 60 | private List<MapBlockData> cachedMapBlocks = new List<MapBlockData>(); |
61 | private int cachedTime = 0; | 61 | private int cachedTime = 0; |
62 | private byte[] myMapImageJPEG; | 62 | private byte[] myMapImageJPEG; |
63 | 63 | ||
64 | //private int CacheRegionsDistance = 256; | 64 | //private int CacheRegionsDistance = 256; |
65 | 65 | ||
66 | #region IRegionModule Members | 66 | #region IRegionModule Members |
@@ -85,7 +85,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
85 | } | 85 | } |
86 | public void PostInitialise() | 86 | public void PostInitialise() |
87 | { | 87 | { |
88 | 88 | ||
89 | } | 89 | } |
90 | 90 | ||
91 | public void Close() | 91 | public void Close() |
@@ -102,10 +102,6 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
102 | } | 102 | } |
103 | 103 | ||
104 | #endregion | 104 | #endregion |
105 | |||
106 | |||
107 | |||
108 | |||
109 | 105 | ||
110 | public void OnRegisterCaps(LLUUID agentID, Caps caps) | 106 | public void OnRegisterCaps(LLUUID agentID, Caps caps) |
111 | { | 107 | { |
@@ -117,9 +113,8 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
117 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | 113 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) |
118 | { | 114 | { |
119 | return MapLayerRequest(request, path, param, | 115 | return MapLayerRequest(request, path, param, |
120 | agentID, caps); | 116 | agentID, caps); |
121 | })); | 117 | })); |
122 | |||
123 | } | 118 | } |
124 | 119 | ||
125 | /// <summary> | 120 | /// <summary> |
@@ -138,12 +133,12 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
138 | //{ | 133 | //{ |
139 | //m_log.DebugFormat("[MAPLAYER]: request: {0}, path: {1}, param: {2}, agent:{3}", | 134 | //m_log.DebugFormat("[MAPLAYER]: request: {0}, path: {1}, param: {2}, agent:{3}", |
140 | //request, path, param,agentID.ToString()); | 135 | //request, path, param,agentID.ToString()); |
141 | 136 | ||
142 | // this is here because CAPS map requests work even beyond the 10,000 limit. | 137 | // this is here because CAPS map requests work even beyond the 10,000 limit. |
143 | ScenePresence avatarPresence = null; | 138 | ScenePresence avatarPresence = null; |
144 | 139 | ||
145 | m_scene.TryGetAvatar(agentID, out avatarPresence); | 140 | m_scene.TryGetAvatar(agentID, out avatarPresence); |
146 | 141 | ||
147 | if (avatarPresence != null) | 142 | if (avatarPresence != null) |
148 | { | 143 | { |
149 | bool lookup = false; | 144 | bool lookup = false; |
@@ -168,7 +163,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
168 | 163 | ||
169 | mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks((int)m_scene.RegionInfo.RegionLocX - 8, (int)m_scene.RegionInfo.RegionLocY - 8, (int)m_scene.RegionInfo.RegionLocX + 8, (int)m_scene.RegionInfo.RegionLocY + 8); | 164 | mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks((int)m_scene.RegionInfo.RegionLocX - 8, (int)m_scene.RegionInfo.RegionLocY - 8, (int)m_scene.RegionInfo.RegionLocX + 8, (int)m_scene.RegionInfo.RegionLocY + 8); |
170 | avatarPresence.ControllingClient.SendMapBlock(mapBlocks,0); | 165 | avatarPresence.ControllingClient.SendMapBlock(mapBlocks,0); |
171 | 166 | ||
172 | lock (cachedMapBlocks) | 167 | lock (cachedMapBlocks) |
173 | cachedMapBlocks = mapBlocks; | 168 | cachedMapBlocks = mapBlocks; |
174 | 169 | ||
@@ -262,18 +257,16 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
262 | MemoryStream imgstream = new MemoryStream(); | 257 | MemoryStream imgstream = new MemoryStream(); |
263 | Bitmap mapTexture = new Bitmap(1,1); | 258 | Bitmap mapTexture = new Bitmap(1,1); |
264 | System.Drawing.Image image = (System.Drawing.Image)mapTexture; | 259 | System.Drawing.Image image = (System.Drawing.Image)mapTexture; |
265 | 260 | ||
266 | |||
267 | try | 261 | try |
268 | { | 262 | { |
269 | // Taking our jpeg2000 data, decoding it, then saving it to a byte array with regular jpeg data | 263 | // Taking our jpeg2000 data, decoding it, then saving it to a byte array with regular jpeg data |
270 | 264 | ||
271 | |||
272 | imgstream = new MemoryStream(); | 265 | imgstream = new MemoryStream(); |
273 | 266 | ||
274 | // non-async because we know we have the asset immediately. | 267 | // non-async because we know we have the asset immediately. |
275 | AssetBase mapasset = m_scene.AssetCache.GetAsset(m_scene.RegionInfo.lastMapUUID, true); | 268 | AssetBase mapasset = m_scene.AssetCache.GetAsset(m_scene.RegionInfo.lastMapUUID, true); |
276 | 269 | ||
277 | // Decode image to System.Drawing.Image | 270 | // Decode image to System.Drawing.Image |
278 | image = OpenJPEG.DecodeToImage(mapasset.Data); | 271 | image = OpenJPEG.DecodeToImage(mapasset.Data); |
279 | 272 | ||
@@ -293,7 +286,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
293 | 286 | ||
294 | myEncoderParameter = new EncoderParameter(myEncoder, 95L); | 287 | myEncoderParameter = new EncoderParameter(myEncoder, 95L); |
295 | myEncoderParameters.Param[0] = myEncoderParameter; | 288 | myEncoderParameters.Param[0] = myEncoderParameter; |
296 | 289 | ||
297 | // Save bitmap to stream | 290 | // Save bitmap to stream |
298 | mapTexture.Save(imgstream, myImageCodecInfo, myEncoderParameters); | 291 | mapTexture.Save(imgstream, myImageCodecInfo, myEncoderParameters); |
299 | 292 | ||
@@ -332,16 +325,14 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap | |||
332 | // From msdn | 325 | // From msdn |
333 | private static ImageCodecInfo GetEncoderInfo(String mimeType) | 326 | private static ImageCodecInfo GetEncoderInfo(String mimeType) |
334 | { | 327 | { |
335 | int j; | ||
336 | ImageCodecInfo[] encoders; | 328 | ImageCodecInfo[] encoders; |
337 | encoders = ImageCodecInfo.GetImageEncoders(); | 329 | encoders = ImageCodecInfo.GetImageEncoders(); |
338 | for (j = 0; j < encoders.Length; ++j) | 330 | for (int j = 0; j < encoders.Length; ++j) |
339 | { | 331 | { |
340 | if (encoders[j].MimeType == mimeType) | 332 | if (encoders[j].MimeType == mimeType) |
341 | return encoders[j]; | 333 | return encoders[j]; |
342 | } | 334 | } |
343 | return null; | 335 | return null; |
344 | } | 336 | } |
345 | |||
346 | } | 337 | } |
347 | } | 338 | } |