diff options
author | onefang | 2020-09-10 21:27:22 +1000 |
---|---|---|
committer | onefang | 2020-09-10 21:27:22 +1000 |
commit | ac4793dd0d7942846b76d307c3d048e9b316954f (patch) | |
tree | 2a4269c0263fa65652094b7c0126b37e88e63794 /OpenSim/Region/CoreModules | |
parent | Warp3DCachedImageModule from Christopher Latza. (diff) | |
download | opensim-SC-ac4793dd0d7942846b76d307c3d048e9b316954f.zip opensim-SC-ac4793dd0d7942846b76d307c3d048e9b316954f.tar.gz opensim-SC-ac4793dd0d7942846b76d307c3d048e9b316954f.tar.bz2 opensim-SC-ac4793dd0d7942846b76d307c3d048e9b316954f.tar.xz |
Various map generation tweaks.
Fix up Warp3DCachedImageModule to work with my directory structure.
Remove some excess code from it.
Clean up maptile directory creation code.
When the generate map command is given, generate the map.
The month check seems a bit dodgy, but I'll let it ride for now.
Diffstat (limited to 'OpenSim/Region/CoreModules')
3 files changed, 43 insertions, 6 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 |