diff options
-rw-r--r-- | OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs | 18 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | 26 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Interfaces/ITerrain.cs | 1 | ||||
-rw-r--r-- | OpenSim/Services/GridService/HypergridLinker.cs | 17 | ||||
-rw-r--r-- | addon-modules/OpenSim.Modules.Warp3DCachedImageModule/src/Warp3DImageModule.cs | 354 | ||||
-rw-r--r-- | bin/OpenSimDefaults.ini | 26 | ||||
-rw-r--r-- | bin/config-include/SimBalanced.ini | 2 | ||||
-rw-r--r-- | bin/config-include/SimDefault.ini | 6 |
9 files changed, 253 insertions, 202 deletions
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs index ce82c26..f45161d 100644 --- a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs | |||
@@ -73,6 +73,11 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
73 | 73 | ||
74 | #region IMapImageGenerator Members | 74 | #region IMapImageGenerator Members |
75 | 75 | ||
76 | public Bitmap CreateMapTileForce() | ||
77 | { | ||
78 | return CreateMapTile(); | ||
79 | } | ||
80 | |||
76 | public Bitmap CreateMapTile() | 81 | public Bitmap CreateMapTile() |
77 | { | 82 | { |
78 | bool drawPrimVolume = true; | 83 | bool drawPrimVolume = true; |
diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs index ce5e167..fc09f32 100644 --- a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs +++ b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs | |||
@@ -149,9 +149,9 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
149 | 149 | ||
150 | List<string> renderers = RenderingLoader.ListRenderers(Util.ExecutingDirectory()); | 150 | List<string> renderers = RenderingLoader.ListRenderers(Util.ExecutingDirectory()); |
151 | if (renderers.Count > 0) | 151 | if (renderers.Count > 0) |
152 | m_log.Info("[MAPTILE]: Loaded prim mesher " + renderers[0]); | 152 | m_log.Info("[WARP 3D IMAGE MODULE]: Loaded prim mesher " + renderers[0]); |
153 | else | 153 | else |
154 | m_log.Info("[MAPTILE]: No prim mesher loaded, prim rendering will be disabled"); | 154 | m_log.Info("[WARP 3D IMAGE MODULE]: No prim mesher loaded, prim rendering will be disabled"); |
155 | 155 | ||
156 | m_scene.RegisterModuleInterface<IMapImageGenerator>(this); | 156 | m_scene.RegisterModuleInterface<IMapImageGenerator>(this); |
157 | } | 157 | } |
@@ -193,6 +193,13 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
193 | private float fov; | 193 | private float fov; |
194 | private bool orto; | 194 | private bool orto; |
195 | 195 | ||
196 | public Bitmap CreateMapTileForce() | ||
197 | { | ||
198 | m_log.Info("[WARP 3D IMAGE MODULE]: Forcing a map tile regenerate."); | ||
199 | File.Delete(System.IO.Path.Combine(m_cacheDirectory,"MAP-" + m_scene.RegionInfo.RegionID.ToString() + ".png")); | ||
200 | return CreateMapTile(); | ||
201 | } | ||
202 | |||
196 | public Bitmap CreateMapTile() | 203 | public Bitmap CreateMapTile() |
197 | { | 204 | { |
198 | List<string> renderers = RenderingLoader.ListRenderers(Util.ExecutingDirectory()); | 205 | List<string> renderers = RenderingLoader.ListRenderers(Util.ExecutingDirectory()); |
@@ -217,6 +224,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
217 | Bitmap tile = GenImage(); | 224 | Bitmap tile = GenImage(); |
218 | // image may be reloaded elsewhere, so no compression format | 225 | // image may be reloaded elsewhere, so no compression format |
219 | string filename = System.IO.Path.Combine(m_cacheDirectory,"MAP-" + m_scene.RegionInfo.RegionID.ToString() + ".png"); | 226 | string filename = System.IO.Path.Combine(m_cacheDirectory,"MAP-" + m_scene.RegionInfo.RegionID.ToString() + ".png"); |
227 | m_log.Info("[WARP 3D IMAGE MODULE]: Generating map tile " + filename); | ||
220 | tile.Save(filename, ImageFormat.Png); | 228 | tile.Save(filename, ImageFormat.Png); |
221 | m_primMesher = null; | 229 | m_primMesher = null; |
222 | return tile; | 230 | return tile; |
@@ -549,7 +557,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
549 | } | 557 | } |
550 | else | 558 | else |
551 | { | 559 | { |
552 | m_log.WarnFormat("[Warp3D] failed to get mesh or sculpt asset {0} of prim {1} at {2}", | 560 | m_log.WarnFormat("[WARP 3D IMAGE MODULE] failed to get mesh or sculpt asset {0} of prim {1} at {2}", |
553 | omvPrim.Sculpt.SculptTexture.ToString(), prim.Name, prim.GetWorldPosition().ToString()); | 561 | omvPrim.Sculpt.SculptTexture.ToString(), prim.Name, prim.GetWorldPosition().ToString()); |
554 | } | 562 | } |
555 | } | 563 | } |
@@ -805,11 +813,11 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
805 | } | 813 | } |
806 | catch (Exception e) | 814 | catch (Exception e) |
807 | { | 815 | { |
808 | 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); | 816 | m_log.WarnFormat("[WARP 3D IMAGE MODULE]: Failed to decode texture {0} for prim {1} at {2}, exception {3}", id.ToString(), sop.Name, sop.GetWorldPosition().ToString(), e.Message); |
809 | } | 817 | } |
810 | } | 818 | } |
811 | else | 819 | else |
812 | m_log.WarnFormat("[Warp3D]: missing texture {0} data for prim {1} at {2}", | 820 | m_log.WarnFormat("[WARP 3D IMAGE MODULE]: missing texture {0} data for prim {1} at {2}", |
813 | id.ToString(), sop.Name, sop.GetWorldPosition().ToString()); | 821 | id.ToString(), sop.Name, sop.GetWorldPosition().ToString()); |
814 | 822 | ||
815 | m_warpTextures[id.ToString()] = ret; | 823 | m_warpTextures[id.ToString()] = ret; |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 1dab18e..1d71857 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -1545,7 +1545,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1545 | if (consoleScene != null && consoleScene != m_scene) | 1545 | if (consoleScene != null && consoleScene != m_scene) |
1546 | return; | 1546 | return; |
1547 | 1547 | ||
1548 | m_scene.RegenerateMaptileAndReregister(this, null); | 1548 | GenerateMaptileForce(); |
1549 | //// This used to be GenerateMaptile(); | ||
1550 | //// m_scene.RegenerateMaptileAndReregister(this, null); | ||
1549 | } | 1551 | } |
1550 | 1552 | ||
1551 | public OSD HandleRemoteMapItemRequest(string path, OSD request, string endpoint) | 1553 | public OSD HandleRemoteMapItemRequest(string path, OSD request, string endpoint) |
@@ -1661,6 +1663,28 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1661 | return responsemap; | 1663 | return responsemap; |
1662 | } | 1664 | } |
1663 | 1665 | ||
1666 | private void GenerateMaptileForce() | ||
1667 | { | ||
1668 | // Cannot create a map for a nonexistent heightmap | ||
1669 | if (m_scene.Heightmap == null) | ||
1670 | return; | ||
1671 | |||
1672 | if (m_mapImageGenerator == null) | ||
1673 | { | ||
1674 | Console.WriteLine("No map image generator available for {0}", m_scene.Name); | ||
1675 | return; | ||
1676 | } | ||
1677 | m_log.DebugFormat("[WORLD MAP]: Generating map image for {0}", m_scene.Name); | ||
1678 | |||
1679 | using (Bitmap mapbmp = m_mapImageGenerator.CreateMapTileForce()) | ||
1680 | { | ||
1681 | GenerateMaptile(mapbmp); | ||
1682 | |||
1683 | if (m_mapImageServiceModule != null) | ||
1684 | m_mapImageServiceModule.UploadMapTile(m_scene, mapbmp); | ||
1685 | } | ||
1686 | } | ||
1687 | |||
1664 | public void GenerateMaptile() | 1688 | public void GenerateMaptile() |
1665 | { | 1689 | { |
1666 | // Cannot create a map for a nonexistent heightmap | 1690 | // Cannot create a map for a nonexistent heightmap |
diff --git a/OpenSim/Region/Framework/Interfaces/ITerrain.cs b/OpenSim/Region/Framework/Interfaces/ITerrain.cs index 815a2d8..2fc954a 100644 --- a/OpenSim/Region/Framework/Interfaces/ITerrain.cs +++ b/OpenSim/Region/Framework/Interfaces/ITerrain.cs | |||
@@ -74,6 +74,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
74 | 74 | ||
75 | public interface IMapImageGenerator | 75 | public interface IMapImageGenerator |
76 | { | 76 | { |
77 | System.Drawing.Bitmap CreateMapTileForce(); | ||
77 | System.Drawing.Bitmap CreateMapTile(); | 78 | System.Drawing.Bitmap CreateMapTile(); |
78 | System.Drawing.Bitmap CreateViewImage(Vector3 camPos, Vector3 camDir, float fov, int width, int height, bool useTextures); | 79 | System.Drawing.Bitmap CreateViewImage(Vector3 camPos, Vector3 camDir, float fov, int width, int height, bool useTextures); |
79 | byte[] WriteJpeg2000Image(); | 80 | byte[] WriteJpeg2000Image(); |
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 3c7295a..1791098 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs | |||
@@ -109,17 +109,14 @@ namespace OpenSim.Services.GridService | |||
109 | 109 | ||
110 | m_log.Debug("[HYPERGRID LINKER]: Loaded all services..."); | 110 | m_log.Debug("[HYPERGRID LINKER]: Loaded all services..."); |
111 | 111 | ||
112 | if (!string.IsNullOrEmpty(m_MapTileDirectory)) | 112 | try |
113 | { | 113 | { |
114 | try | 114 | Directory.CreateDirectory(m_MapTileDirectory); |
115 | { | 115 | } |
116 | Directory.CreateDirectory(m_MapTileDirectory); | 116 | catch (Exception e) |
117 | } | 117 | { |
118 | catch (Exception e) | 118 | m_log.WarnFormat("[HYPERGRID LINKER]: Could not create map tile storage directory {0}: {1}", m_MapTileDirectory, e); |
119 | { | 119 | m_MapTileDirectory = string.Empty; |
120 | m_log.WarnFormat("[HYPERGRID LINKER]: Could not create map tile storage directory {0}: {1}", m_MapTileDirectory, e); | ||
121 | m_MapTileDirectory = string.Empty; | ||
122 | } | ||
123 | } | 120 | } |
124 | 121 | ||
125 | if (MainConsole.Instance != null) | 122 | if (MainConsole.Instance != null) |
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; |
diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 1852438..e49fae9 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini | |||
@@ -433,7 +433,7 @@ | |||
433 | ; The module to use in order to generate map images. | 433 | ; The module to use in order to generate map images. |
434 | ; MapImageModule is the default. Warp3DImageModule is an alternative experimental module that can | 434 | ; MapImageModule is the default. Warp3DImageModule is an alternative experimental module that can |
435 | ; generate better images. | 435 | ; generate better images. |
436 | MapImageModule = "Warp3DImageModule" | 436 | MapImageModule = "Warp3DCachedImageModule" |
437 | 437 | ||
438 | ; World map blacklist timeout in seconds | 438 | ; World map blacklist timeout in seconds |
439 | ;BlacklistTimeout = 600 | 439 | ;BlacklistTimeout = 600 |
@@ -459,18 +459,18 @@ | |||
459 | 459 | ||
460 | ; Attempt to render meshes and sculpties on the map | 460 | ; Attempt to render meshes and sculpties on the map |
461 | RenderMeshes = false | 461 | RenderMeshes = false |
462 | 462 | ||
463 | ; warp3D rendering height limits for prims (relative to rez position not bounding box) | 463 | ; warp3D rendering height limits for prims (relative to rez position not bounding box) |
464 | ; prims above RenderMaxHeight are excluded | 464 | ; prims above RenderMaxHeight are excluded |
465 | ; valid values: 100 to 4086 | 465 | ; valid values: 100 to 4086 |
466 | ;RenderMaxHeight = 4086 | 466 | RenderMaxHeight = 4086 |
467 | 467 | ||
468 | ; prims below RenderMinHeight are excluded | 468 | ; prims below RenderMinHeight are excluded |
469 | ; valid values: -100 to RenderMaxHeight - 10 | 469 | ; valid values: -100 to RenderMaxHeight - 10 |
470 | ;RenderMinHeight = -100 | 470 | RenderMinHeight = -100 |
471 | 471 | ||
472 | ; Show NPCs as green world map dots | 472 | ; Show NPCs as green world map dots |
473 | ;ShowNPCs = true | 473 | ShowNPCs = false |
474 | 474 | ||
475 | ; where to store cached map tiles. | 475 | ; where to store cached map tiles. |
476 | CacheDirectory = "${Paths|CachePath}/MapImageCache" | 476 | CacheDirectory = "${Paths|CachePath}/MapImageCache" |
@@ -479,7 +479,7 @@ | |||
479 | enablePosition = true | 479 | enablePosition = true |
480 | 480 | ||
481 | ; Refresh the cached map tile once a month. | 481 | ; Refresh the cached map tile once a month. |
482 | ;RefreshEveryMonth = true | 482 | RefreshEveryMonth = false |
483 | 483 | ||
484 | ;# {MapColorWater} {} {Water color for textured and shaded maps} {"#1D475F"} | 484 | ;# {MapColorWater} {} {Water color for textured and shaded maps} {"#1D475F"} |
485 | ; MapColorWater = "#3399FF" | 485 | ; MapColorWater = "#3399FF" |
diff --git a/bin/config-include/SimBalanced.ini b/bin/config-include/SimBalanced.ini index fbf778f..f650ce5 100644 --- a/bin/config-include/SimBalanced.ini +++ b/bin/config-include/SimBalanced.ini | |||
@@ -168,7 +168,7 @@ | |||
168 | ; The module to use in order to generate map images. | 168 | ; The module to use in order to generate map images. |
169 | ; MapImageModule is the default. Warp3DImageModule is an alternative experimental module that can | 169 | ; MapImageModule is the default. Warp3DImageModule is an alternative experimental module that can |
170 | ; generate better images. | 170 | ; generate better images. |
171 | MapImageModule = "Warp3DImageModule" | 171 | MapImageModule = "Warp3DCachedImageModule" |
172 | 172 | ||
173 | ; World map blacklist timeout in seconds | 173 | ; World map blacklist timeout in seconds |
174 | ;BlacklistTimeout = 600 | 174 | ;BlacklistTimeout = 600 |
diff --git a/bin/config-include/SimDefault.ini b/bin/config-include/SimDefault.ini index 3f2e713..5413d9d 100644 --- a/bin/config-include/SimDefault.ini +++ b/bin/config-include/SimDefault.ini | |||
@@ -165,7 +165,7 @@ | |||
165 | ; The module to use in order to generate map images. | 165 | ; The module to use in order to generate map images. |
166 | ; MapImageModule is the default. Warp3DImageModule is an alternative experimental module that can | 166 | ; MapImageModule is the default. Warp3DImageModule is an alternative experimental module that can |
167 | ; generate better images. | 167 | ; generate better images. |
168 | MapImageModule = "MapImageModule" | 168 | MapImageModule = "Warp3DCachedImageModule" |
169 | 169 | ||
170 | ; World map blacklist timeout in seconds | 170 | ; World map blacklist timeout in seconds |
171 | ;BlacklistTimeout = 600 | 171 | ;BlacklistTimeout = 600 |
@@ -187,10 +187,10 @@ | |||
187 | TexturePrims = true | 187 | TexturePrims = true |
188 | 188 | ||
189 | ; Only texture prims that have a diagonal size greater than this number | 189 | ; Only texture prims that have a diagonal size greater than this number |
190 | TexturePrimSize = 48 | 190 | TexturePrimSize = 1 |
191 | 191 | ||
192 | ; Attempt to render meshes and sculpties on the map | 192 | ; Attempt to render meshes and sculpties on the map |
193 | RenderMeshes = false | 193 | RenderMeshes = true |
194 | 194 | ||
195 | ;UseAntiAliasing = true | 195 | ;UseAntiAliasing = true |
196 | 196 | ||