diff options
Diffstat (limited to 'addon-modules/OpenSim.Modules.Warp3DCachedImageModule')
-rw-r--r-- | addon-modules/OpenSim.Modules.Warp3DCachedImageModule/src/Warp3DImageModule.cs | 354 |
1 files changed, 185 insertions, 169 deletions
diff --git a/addon-modules/OpenSim.Modules.Warp3DCachedImageModule/src/Warp3DImageModule.cs b/addon-modules/OpenSim.Modules.Warp3DCachedImageModule/src/Warp3DImageModule.cs index 8e50a16..05d5ab2 100644 --- a/addon-modules/OpenSim.Modules.Warp3DCachedImageModule/src/Warp3DImageModule.cs +++ b/addon-modules/OpenSim.Modules.Warp3DCachedImageModule/src/Warp3DImageModule.cs | |||
@@ -42,8 +42,8 @@ using Mono.Addins; | |||
42 | using OpenSim.Framework; | 42 | using OpenSim.Framework; |
43 | using OpenSim.Region.Framework.Interfaces; | 43 | using OpenSim.Region.Framework.Interfaces; |
44 | using OpenSim.Region.Framework.Scenes; | 44 | using OpenSim.Region.Framework.Scenes; |
45 | using OpenSim.Region.PhysicsModules.SharedBase; | 45 | ////using OpenSim.Region.PhysicsModules.SharedBase; |
46 | using OpenSim.Services.Interfaces; | 46 | ////using OpenSim.Services.Interfaces; |
47 | 47 | ||
48 | using OpenMetaverse; | 48 | using OpenMetaverse; |
49 | using OpenMetaverse.Assets; | 49 | using OpenMetaverse.Assets; |
@@ -52,18 +52,18 @@ using OpenMetaverse.Rendering; | |||
52 | using OpenMetaverse.StructuredData; | 52 | using OpenMetaverse.StructuredData; |
53 | 53 | ||
54 | using WarpRenderer = Warp3D.Warp3D; | 54 | using WarpRenderer = Warp3D.Warp3D; |
55 | using System.Drawing.Drawing2D; | 55 | using System.Drawing.Drawing2D; |
56 | 56 | ||
57 | [assembly: Addin("Warp3DCachedImageModule", "1.1")] | 57 | [assembly: Addin("Warp3DCachedImageModule", "1.1")] |
58 | [assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)] | 58 | [assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)] |
59 | namespace OpenSim.Region.CoreModules.World.Warp3DMap | 59 | namespace OpenSim.Region.CoreModules.World.Warp3DMap |
60 | { | 60 | { |
61 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "Warp3DCachedImageModule")] | 61 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "Warp3DCachedImageModule")] |
62 | public class Warp3DImageModule : IMapImageGenerator, INonSharedRegionModule | 62 | public class Warp3DImageModule : IMapImageGenerator, INonSharedRegionModule |
63 | { | 63 | { |
64 | private static readonly Color4 WATER_COLOR = new Color4(29, 72, 96, 216); | 64 | private static readonly Color4 WATER_COLOR = new Color4(29, 72, 96, 216); |
65 | // private static readonly Color4 WATER_COLOR = new Color4(29, 72, 96, 128); | 65 | // private static readonly Color4 WATER_COLOR = new Color4(29, 72, 96, 128); |
66 | 66 | ||
67 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 67 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
68 | 68 | ||
69 | #pragma warning disable 414 | 69 | #pragma warning disable 414 |
@@ -87,19 +87,19 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
87 | private float m_texturePrimSize = 48f; // size of prim before we consider texturing it | 87 | private float m_texturePrimSize = 48f; // size of prim before we consider texturing it |
88 | private bool m_renderMeshes = false; // true if to render meshes rather than just bounding boxes | 88 | private bool m_renderMeshes = false; // true if to render meshes rather than just bounding boxes |
89 | private float m_renderMinHeight = -100f; | 89 | private float m_renderMinHeight = -100f; |
90 | private float m_renderMaxHeight = 4096f; | 90 | private float m_renderMaxHeight = 4096f; |
91 | 91 | ||
92 | private String m_cacheDirectory = ""; | 92 | private String m_cacheDirectory = ""; |
93 | private bool m_enable_date = false; | 93 | //// private bool m_enable_date = false; |
94 | private bool m_enable_regionName = false; | 94 | //// private bool m_enable_regionName = false; |
95 | private bool m_enable_regionPosition = false; | 95 | private bool m_enable_regionPosition = false; |
96 | private bool m_enable_refreshEveryMonth = false; | 96 | private bool m_enable_refreshEveryMonth = false; |
97 | private bool m_enable_HostedBy = false; | 97 | //// private bool m_enable_HostedBy = false; |
98 | private String m_enable_HostedByText = ""; | 98 | //// private String m_enable_HostedByText = ""; |
99 | 99 | ||
100 | private bool m_Enabled = false; | 100 | private bool m_Enabled = false; |
101 | 101 | ||
102 | // private Bitmap lastImage = null; | 102 | // private Bitmap lastImage = null; |
103 | private DateTime lastImageTime = DateTime.MinValue; | 103 | private DateTime lastImageTime = DateTime.MinValue; |
104 | 104 | ||
105 | #region Region Module interface | 105 | #region Region Module interface |
@@ -129,22 +129,22 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
129 | m_texturePrimSize = | 129 | m_texturePrimSize = |
130 | Util.GetConfigVarFromSections<float>(m_config, "TexturePrimSize", configSections, m_texturePrimSize); | 130 | Util.GetConfigVarFromSections<float>(m_config, "TexturePrimSize", configSections, m_texturePrimSize); |
131 | m_renderMeshes = | 131 | m_renderMeshes = |
132 | Util.GetConfigVarFromSections<bool>(m_config, "RenderMeshes", configSections, m_renderMeshes); | 132 | Util.GetConfigVarFromSections<bool>(m_config, "RenderMeshes", configSections, m_renderMeshes); |
133 | m_cacheDirectory = | 133 | m_cacheDirectory = |
134 | Util.GetConfigVarFromSections<string>(m_config, "CacheDirectory", configSections, System.IO.Path.Combine(new DirectoryInfo(".").FullName, "MapImageCache")); | 134 | Util.GetConfigVarFromSections<string>(m_config, "CacheDirectory", configSections, System.IO.Path.Combine(Util.cacheDir(), "MapImageCache")); |
135 | 135 | ||
136 | 136 | ||
137 | m_enable_date = Util.GetConfigVarFromSections<bool>(m_config, "enableDate", configSections, false); | 137 | //// m_enable_date = Util.GetConfigVarFromSections<bool>(m_config, "enableDate", configSections, false); |
138 | m_enable_regionName = Util.GetConfigVarFromSections<bool>(m_config, "enableName", configSections, false); | 138 | //// m_enable_regionName = Util.GetConfigVarFromSections<bool>(m_config, "enableName", configSections, false); |
139 | m_enable_regionPosition = Util.GetConfigVarFromSections<bool>(m_config, "enablePosition", configSections, false); | 139 | m_enable_regionPosition = Util.GetConfigVarFromSections<bool>(m_config, "enablePosition", configSections, false); |
140 | m_enable_refreshEveryMonth = Util.GetConfigVarFromSections<bool>(m_config, "RefreshEveryMonth", configSections, true); | 140 | m_enable_refreshEveryMonth = Util.GetConfigVarFromSections<bool>(m_config, "RefreshEveryMonth", configSections, true); |
141 | m_enable_HostedBy = Util.GetConfigVarFromSections<bool>(m_config, "enableHostedBy", configSections, false); | 141 | //// m_enable_HostedBy = Util.GetConfigVarFromSections<bool>(m_config, "enableHostedBy", configSections, false); |
142 | m_enable_HostedByText = Util.GetConfigVarFromSections<String>(m_config, "HosterText", configSections, String.Empty); | 142 | //// m_enable_HostedByText = Util.GetConfigVarFromSections<String>(m_config, "HosterText", configSections, String.Empty); |
143 | 143 | ||
144 | m_renderMaxHeight = Util.GetConfigVarFromSections<float>(m_config, "RenderMaxHeight", configSections, m_renderMaxHeight); | 144 | m_renderMaxHeight = Util.GetConfigVarFromSections<float>(m_config, "RenderMaxHeight", configSections, m_renderMaxHeight); |
145 | m_renderMinHeight = Util.GetConfigVarFromSections<float>(m_config, "RenderMinHeight", configSections, m_renderMinHeight); | 145 | m_renderMinHeight = Util.GetConfigVarFromSections<float>(m_config, "RenderMinHeight", configSections, m_renderMinHeight); |
146 | 146 | ||
147 | if (!Directory.Exists(m_cacheDirectory)) | 147 | if (!Directory.Exists(m_cacheDirectory)) |
148 | Directory.CreateDirectory(m_cacheDirectory); | 148 | Directory.CreateDirectory(m_cacheDirectory); |
149 | 149 | ||
150 | if (m_renderMaxHeight < 100f) | 150 | if (m_renderMaxHeight < 100f) |
@@ -167,9 +167,9 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
167 | 167 | ||
168 | List<string> renderers = RenderingLoader.ListRenderers(Util.ExecutingDirectory()); | 168 | List<string> renderers = RenderingLoader.ListRenderers(Util.ExecutingDirectory()); |
169 | if (renderers.Count > 0) | 169 | if (renderers.Count > 0) |
170 | m_log.Info("[MAPTILE]: Loaded prim mesher " + renderers[0]); | 170 | m_log.Info("[WARP 3D CACHED IMAGE MODULE]: Loaded prim mesher " + renderers[0]); |
171 | else | 171 | else |
172 | m_log.Info("[MAPTILE]: No prim mesher loaded, prim rendering will be disabled"); | 172 | m_log.Info("[WARP 3D CACHED IMAGE MODULE]: No prim mesher loaded, prim rendering will be disabled"); |
173 | 173 | ||
174 | m_scene.RegisterModuleInterface<IMapImageGenerator>(this); | 174 | m_scene.RegisterModuleInterface<IMapImageGenerator>(this); |
175 | } | 175 | } |
@@ -192,7 +192,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
192 | 192 | ||
193 | public string Name | 193 | public string Name |
194 | { | 194 | { |
195 | get { return "Warp3DImageModule"; } | 195 | get { return "Warp3DCachedImageModule"; } |
196 | } | 196 | } |
197 | 197 | ||
198 | public Type ReplaceableInterface | 198 | public Type ReplaceableInterface |
@@ -209,134 +209,150 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
209 | private int viewWitdh = 256; | 209 | private int viewWitdh = 256; |
210 | private int viewHeight = 256; | 210 | private int viewHeight = 256; |
211 | private float fov; | 211 | private float fov; |
212 | private bool orto; | 212 | private bool orto; |
213 | 213 | ||
214 | public static string fillInt(int _i, int _l) | 214 | /* |
215 | { | 215 | public static string fillInt(int _i, int _l) |
216 | String _return = _i.ToString(); | 216 | { |
217 | 217 | String _return = _i.ToString(); | |
218 | while (_return.Length < _l) | 218 | |
219 | { | 219 | while (_return.Length < _l) |
220 | _return = 0 + _return; | 220 | { |
221 | } | 221 | _return = 0 + _return; |
222 | 222 | } | |
223 | return _return; | 223 | |
224 | } | 224 | return _return; |
225 | 225 | } | |
226 | public static int getCurrentUnixTime() | 226 | |
227 | { | 227 | public static int getCurrentUnixTime() |
228 | return (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds; | 228 | { |
229 | } | 229 | return (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds; |
230 | 230 | } | |
231 | public static String unixTimeToDateString(int unixTime) | ||
232 | { | ||
233 | DateTime unixStart = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc); | ||
234 | long unixTimeStampInTicks = (long)(unixTime * TimeSpan.TicksPerSecond); | ||
235 | DateTime _date = new DateTime(unixStart.Ticks + unixTimeStampInTicks, System.DateTimeKind.Utc); | ||
236 | |||
237 | return fillInt(_date.Day, 2) + "." + fillInt(_date.Month, 2) + "." + fillInt(_date.Year, 4) + " " + fillInt(_date.Hour, 2) + ":" + fillInt(_date.Minute, 2); | ||
238 | } | ||
239 | |||
240 | private void writeDateOnMap(ref Bitmap _map) | ||
241 | { | ||
242 | RectangleF rectf = new RectangleF(2, 1, 200, 25); | ||
243 | |||
244 | Graphics g = Graphics.FromImage(_map); | ||
245 | g.SmoothingMode = SmoothingMode.AntiAlias; | ||
246 | g.InterpolationMode = InterpolationMode.HighQualityBicubic; | ||
247 | g.PixelOffsetMode = PixelOffsetMode.HighQuality; | ||
248 | g.DrawString(unixTimeToDateString(getCurrentUnixTime()), new Font("Arial", 8), Brushes.White, rectf); | ||
249 | g.Flush(); | ||
250 | } | ||
251 | |||
252 | private void writeNameOnMap(ref Bitmap _map) | ||
253 | { | ||
254 | RectangleF rectf = new RectangleF(2, m_scene.RegionInfo.RegionSizeX - 15, 200, 25); | ||
255 | |||
256 | Graphics g = Graphics.FromImage(_map); | ||
257 | g.SmoothingMode = SmoothingMode.AntiAlias; | ||
258 | g.InterpolationMode = InterpolationMode.HighQualityBicubic; | ||
259 | g.PixelOffsetMode = PixelOffsetMode.HighQuality; | ||
260 | g.DrawString(m_scene.Name, new Font("Arial", 8), Brushes.White, rectf); | ||
261 | g.Flush(); | ||
262 | } | ||
263 | |||
264 | private void writePositionOnMap(ref Bitmap _map) | ||
265 | { | ||
266 | RectangleF rectf = new RectangleF(m_scene.RegionInfo.RegionSizeY - 85, m_scene.RegionInfo.RegionSizeX - 15, 80, 25); | ||
267 | |||
268 | Graphics g = Graphics.FromImage(_map); | ||
269 | g.SmoothingMode = SmoothingMode.AntiAlias; | ||
270 | g.InterpolationMode = InterpolationMode.HighQualityBicubic; | ||
271 | g.PixelOffsetMode = PixelOffsetMode.HighQuality; | ||
272 | g.DrawString(m_scene.RegionInfo.RegionLocX + ", " + m_scene.RegionInfo.RegionLocY, new Font("Arial", 8), Brushes.White, rectf); | ||
273 | g.Flush(); | ||
274 | } | ||
275 | |||
276 | private void writeHostedByOnMap(ref Bitmap _map) | ||
277 | { | ||
278 | RectangleF rectf = new RectangleF(2, m_scene.RegionInfo.RegionSizeX - 15, 200, 25); | ||
279 | |||
280 | Graphics g = Graphics.FromImage(_map); | ||
281 | g.SmoothingMode = SmoothingMode.AntiAlias; | ||
282 | g.InterpolationMode = InterpolationMode.HighQualityBicubic; | ||
283 | g.PixelOffsetMode = PixelOffsetMode.HighQuality; | ||
284 | g.DrawString(m_enable_HostedByText, new Font("Arial", 8), Brushes.Gray, rectf); | ||
285 | g.Flush(); | ||
286 | } | ||
287 | 231 | ||
232 | public static String unixTimeToDateString(int unixTime) | ||
233 | { | ||
234 | DateTime unixStart = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc); | ||
235 | long unixTimeStampInTicks = (long)(unixTime * TimeSpan.TicksPerSecond); | ||
236 | DateTime _date = new DateTime(unixStart.Ticks + unixTimeStampInTicks, System.DateTimeKind.Utc); | ||
237 | |||
238 | return fillInt(_date.Day, 2) + "." + fillInt(_date.Month, 2) + "." + fillInt(_date.Year, 4) + " " + fillInt(_date.Hour, 2) + ":" + fillInt(_date.Minute, 2); | ||
239 | } | ||
240 | |||
241 | private void writeDateOnMap(ref Bitmap _map) | ||
242 | { | ||
243 | RectangleF rectf = new RectangleF(2, 1, 200, 25); | ||
244 | |||
245 | Graphics g = Graphics.FromImage(_map); | ||
246 | g.SmoothingMode = SmoothingMode.AntiAlias; | ||
247 | g.InterpolationMode = InterpolationMode.HighQualityBicubic; | ||
248 | g.PixelOffsetMode = PixelOffsetMode.HighQuality; | ||
249 | g.DrawString(unixTimeToDateString(getCurrentUnixTime()), new Font("Arial", 8), Brushes.White, rectf); | ||
250 | g.Flush(); | ||
251 | } | ||
252 | |||
253 | private void writeNameOnMap(ref Bitmap _map) | ||
254 | { | ||
255 | RectangleF rectf = new RectangleF(2, m_scene.RegionInfo.RegionSizeX - 15, 200, 25); | ||
256 | |||
257 | Graphics g = Graphics.FromImage(_map); | ||
258 | g.SmoothingMode = SmoothingMode.AntiAlias; | ||
259 | g.InterpolationMode = InterpolationMode.HighQualityBicubic; | ||
260 | g.PixelOffsetMode = PixelOffsetMode.HighQuality; | ||
261 | g.DrawString(m_scene.Name, new Font("Arial", 8), Brushes.White, rectf); | ||
262 | g.Flush(); | ||
263 | } | ||
264 | */ | ||
265 | |||
266 | private void writePositionOnMap(ref Bitmap _map) | ||
267 | { | ||
268 | RectangleF rectf = new RectangleF(m_scene.RegionInfo.RegionSizeY - 85, m_scene.RegionInfo.RegionSizeX - 15, 80, 25); | ||
269 | |||
270 | Graphics g = Graphics.FromImage(_map); | ||
271 | g.SmoothingMode = SmoothingMode.AntiAlias; | ||
272 | g.InterpolationMode = InterpolationMode.HighQualityBicubic; | ||
273 | g.PixelOffsetMode = PixelOffsetMode.HighQuality; | ||
274 | g.DrawString(m_scene.RegionInfo.RegionLocX + ", " + m_scene.RegionInfo.RegionLocY, new Font("Arial", 8), Brushes.White, rectf); | ||
275 | g.Flush(); | ||
276 | } | ||
277 | |||
278 | /* | ||
279 | private void writeHostedByOnMap(ref Bitmap _map) | ||
280 | { | ||
281 | RectangleF rectf = new RectangleF(2, m_scene.RegionInfo.RegionSizeX - 15, 200, 25); | ||
282 | |||
283 | Graphics g = Graphics.FromImage(_map); | ||
284 | g.SmoothingMode = SmoothingMode.AntiAlias; | ||
285 | g.InterpolationMode = InterpolationMode.HighQualityBicubic; | ||
286 | g.PixelOffsetMode = PixelOffsetMode.HighQuality; | ||
287 | g.DrawString(m_enable_HostedByText, new Font("Arial", 8), Brushes.Gray, rectf); | ||
288 | g.Flush(); | ||
289 | } | ||
290 | */ | ||
291 | |||
292 | public Bitmap CreateMapTileForce() | ||
293 | { | ||
294 | m_log.Info("[WARP 3D CACHED IMAGE MODULE]: Forcing a map tile regenerate."); | ||
295 | File.Delete(System.IO.Path.Combine(m_cacheDirectory, m_scene.RegionInfo.RegionID + ".bmp")); | ||
296 | return CreateMapTile(); | ||
297 | } | ||
288 | 298 | ||
289 | public Bitmap CreateMapTile() | 299 | public Bitmap CreateMapTile() |
290 | { | 300 | { |
291 | if ((File.GetCreationTime(System.IO.Path.Combine(m_cacheDirectory, m_scene.RegionInfo.RegionID + ".bmp")).Month != DateTime.Now.Month) && m_enable_refreshEveryMonth == true) | 301 | if ((File.GetCreationTime(System.IO.Path.Combine(m_cacheDirectory, m_scene.RegionInfo.RegionID + ".bmp")).Month != DateTime.Now.Month) && (m_enable_refreshEveryMonth == true)) |
292 | File.Delete(System.IO.Path.Combine(m_cacheDirectory, m_scene.RegionInfo.RegionID + ".bmp")); | 302 | { |
293 | 303 | m_log.InfoFormat("[WARP 3D CACHED IMAGE MODULE]: Clearing old map tile out of cache {0} {1}.", | |
294 | if (File.Exists(System.IO.Path.Combine(m_cacheDirectory, m_scene.RegionInfo.RegionID + ".bmp"))) | 304 | File.GetCreationTime(System.IO.Path.Combine(m_cacheDirectory, m_scene.RegionInfo.RegionID + ".bmp")).Month, DateTime.Now.Month); |
295 | { | 305 | File.Delete(System.IO.Path.Combine(m_cacheDirectory, m_scene.RegionInfo.RegionID + ".bmp")); |
296 | return new Bitmap(System.IO.Path.Combine(m_cacheDirectory, m_scene.RegionInfo.RegionID + ".bmp")); | 306 | } |
297 | } | 307 | |
298 | else | 308 | if (File.Exists(System.IO.Path.Combine(m_cacheDirectory, m_scene.RegionInfo.RegionID + ".bmp"))) |
299 | { | 309 | { |
300 | List<string> renderers = RenderingLoader.ListRenderers(Util.ExecutingDirectory()); | 310 | return new Bitmap(System.IO.Path.Combine(m_cacheDirectory, m_scene.RegionInfo.RegionID + ".bmp")); |
301 | if (renderers.Count > 0) | 311 | } |
302 | { | 312 | else |
303 | m_primMesher = RenderingLoader.LoadRenderer(renderers[0]); | 313 | { |
304 | } | 314 | m_log.Info("[WARP 3D CACHED IMAGE MODULE]: Actually generating a map tile."); |
305 | 315 | List<string> renderers = RenderingLoader.ListRenderers(Util.ExecutingDirectory()); | |
306 | cameraPos = new Vector3( | 316 | if (renderers.Count > 0) |
307 | (m_scene.RegionInfo.RegionSizeX) * 0.5f, | 317 | { |
308 | (m_scene.RegionInfo.RegionSizeY) * 0.5f, | 318 | m_primMesher = RenderingLoader.LoadRenderer(renderers[0]); |
309 | m_cameraHeight); | 319 | } |
310 | 320 | ||
311 | cameraDir = -Vector3.UnitZ; | 321 | cameraPos = new Vector3( |
312 | viewWitdh = (int)m_scene.RegionInfo.RegionSizeX; | 322 | (m_scene.RegionInfo.RegionSizeX) * 0.5f, |
313 | viewHeight = (int)m_scene.RegionInfo.RegionSizeY; | 323 | (m_scene.RegionInfo.RegionSizeY) * 0.5f, |
314 | orto = true; | 324 | m_cameraHeight); |
315 | 325 | ||
316 | // fov = warp_Math.rad2deg(2f * (float)Math.Atan2(viewWitdh, 4096f)); | 326 | cameraDir = -Vector3.UnitZ; |
317 | // orto = false; | 327 | viewWitdh = (int)m_scene.RegionInfo.RegionSizeX; |
318 | 328 | viewHeight = (int)m_scene.RegionInfo.RegionSizeY; | |
319 | Bitmap tile = GenImage(); | 329 | orto = true; |
320 | 330 | ||
321 | if (m_enable_date) | 331 | // fov = warp_Math.rad2deg(2f * (float)Math.Atan2(viewWitdh, 4096f)); |
322 | writeDateOnMap(ref tile); | 332 | // orto = false; |
323 | 333 | ||
324 | if (m_enable_regionName) | 334 | Bitmap tile = GenImage(); |
325 | writeNameOnMap(ref tile); | 335 | |
326 | 336 | //// if (m_enable_date) | |
327 | if (m_enable_regionPosition) | 337 | //// writeDateOnMap(ref tile); |
328 | writePositionOnMap(ref tile); | 338 | |
329 | 339 | //// if (m_enable_regionName) | |
330 | if (m_enable_HostedBy) | 340 | //// writeNameOnMap(ref tile); |
331 | writeHostedByOnMap(ref tile); | 341 | |
332 | 342 | if (m_enable_regionPosition) | |
333 | tile.Save(System.IO.Path.Combine(m_cacheDirectory, m_scene.RegionInfo.RegionID + ".bmp")); | 343 | writePositionOnMap(ref tile); |
334 | 344 | ||
335 | // image may be reloaded elsewhere, so no compression format | 345 | //// if (m_enable_HostedBy) |
336 | string filename = "MAP-" + m_scene.RegionInfo.RegionID.ToString() + ".png"; | 346 | //// writeHostedByOnMap(ref tile); |
337 | tile.Save(filename, ImageFormat.Png); | 347 | |
338 | m_primMesher = null; | 348 | tile.Save(System.IO.Path.Combine(m_cacheDirectory, m_scene.RegionInfo.RegionID + ".bmp")); |
339 | return tile; | 349 | |
350 | // image may be reloaded elsewhere, so no compression format | ||
351 | string filename = System.IO.Path.Combine(m_cacheDirectory, "MAP-" + m_scene.RegionInfo.RegionID.ToString() + ".png"); | ||
352 | m_log.Info("[WARP 3D CACHED IMAGE MODULE]: Generating map tile " + filename); | ||
353 | tile.Save(filename, ImageFormat.Png); | ||
354 | m_primMesher = null; | ||
355 | return tile; | ||
340 | } | 356 | } |
341 | } | 357 | } |
342 | 358 | ||
@@ -420,7 +436,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
420 | catch (Exception e) | 436 | catch (Exception e) |
421 | { | 437 | { |
422 | // JPEG2000 encoder failed | 438 | // JPEG2000 encoder failed |
423 | m_log.Error("[WARP 3D IMAGE MODULE]: Failed generating terrain map: ", e); | 439 | m_log.Error("[WARP 3D CACHED IMAGE MODULE]: Failed generating terrain map: ", e); |
424 | } | 440 | } |
425 | 441 | ||
426 | return null; | 442 | return null; |
@@ -599,7 +615,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
599 | tu = -2f * scaledPos.X; | 615 | tu = -2f * scaledPos.X; |
600 | tv = scaledPos.Y * v.Normal.Z - scaledPos.Z * v.Normal.Y; | 616 | tv = scaledPos.Y * v.Normal.Z - scaledPos.Z * v.Normal.Y; |
601 | } | 617 | } |
602 | else | 618 | else |
603 | { | 619 | { |
604 | tu = 2f * scaledPos.X; | 620 | tu = 2f * scaledPos.X; |
605 | tv = -scaledPos.Y * v.Normal.Z + scaledPos.Z * v.Normal.Y; | 621 | tv = -scaledPos.Y * v.Normal.Z + scaledPos.Z * v.Normal.Y; |
@@ -667,7 +683,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
667 | } | 683 | } |
668 | else | 684 | else |
669 | { | 685 | { |
670 | m_log.WarnFormat("[Warp3D] failed to get mesh or sculpt asset {0} of prim {1} at {2}", | 686 | m_log.WarnFormat("[WARP 3D CACHED IMAGE MODULE] failed to get mesh or sculpt asset {0} of prim {1} at {2}", |
671 | omvPrim.Sculpt.SculptTexture.ToString(), prim.Name, prim.GetWorldPosition().ToString()); | 687 | omvPrim.Sculpt.SculptTexture.ToString(), prim.Name, prim.GetWorldPosition().ToString()); |
672 | } | 688 | } |
673 | } | 689 | } |
@@ -923,11 +939,11 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
923 | } | 939 | } |
924 | catch (Exception e) | 940 | catch (Exception e) |
925 | { | 941 | { |
926 | m_log.WarnFormat("[Warp3D]: Failed to decode texture {0} for prim {1} at {2}, exception {3}", id.ToString(), sop.Name, sop.GetWorldPosition().ToString(), e.Message); | 942 | m_log.WarnFormat("[WARP 3D CACHED IMAGE MODULE]: Failed to decode texture {0} for prim {1} at {2}, exception {3}", id.ToString(), sop.Name, sop.GetWorldPosition().ToString(), e.Message); |
927 | } | 943 | } |
928 | } | 944 | } |
929 | else | 945 | else |
930 | m_log.WarnFormat("[Warp3D]: missing texture {0} data for prim {1} at {2}", | 946 | m_log.WarnFormat("[WARP 3D CACHED IMAGE MODULE]: missing texture {0} data for prim {1} at {2}", |
931 | id.ToString(), sop.Name, sop.GetWorldPosition().ToString()); | 947 | id.ToString(), sop.Name, sop.GetWorldPosition().ToString()); |
932 | 948 | ||
933 | m_warpTextures[id.ToString()] = ret; | 949 | m_warpTextures[id.ToString()] = ret; |
@@ -1041,7 +1057,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
1041 | catch (Exception ex) | 1057 | catch (Exception ex) |
1042 | { | 1058 | { |
1043 | m_log.WarnFormat( | 1059 | m_log.WarnFormat( |
1044 | "[WARP 3D IMAGE MODULE]: Error decoding JPEG2000 texture {0} ({1} bytes): {2}", | 1060 | "[WARP 3D CACHED IMAGE MODULE]: Error decoding JPEG2000 texture {0} ({1} bytes): {2}", |
1045 | textureID, j2kData.Length, ex.Message); | 1061 | textureID, j2kData.Length, ex.Message); |
1046 | 1062 | ||
1047 | width = 0; | 1063 | width = 0; |