diff options
author | Justin Clark-Casey (justincc) | 2010-08-13 20:34:46 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-08-13 20:34:46 +0100 |
commit | 5f5c65e4bae1f2a84d6972697d0413137f6b1da1 (patch) | |
tree | 9d02b3aa7b4e6417ca4cf2661cc530d71637acab | |
parent | refactor: Use SOP.Flags rather than SOP.ObjectFlags (diff) | |
download | opensim-SC_OLD-5f5c65e4bae1f2a84d6972697d0413137f6b1da1.zip opensim-SC_OLD-5f5c65e4bae1f2a84d6972697d0413137f6b1da1.tar.gz opensim-SC_OLD-5f5c65e4bae1f2a84d6972697d0413137f6b1da1.tar.bz2 opensim-SC_OLD-5f5c65e4bae1f2a84d6972697d0413137f6b1da1.tar.xz |
refactor: move more map tile generation code from scene to IWorldMapModule
-rw-r--r-- | OpenSim/Region/Application/OpenSimBase.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | 17 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 27 |
4 files changed, 25 insertions, 32 deletions
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index f535fe8..e148cde 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -347,9 +347,13 @@ namespace OpenSim | |||
347 | // Prims have to be loaded after module configuration since some modules may be invoked during the load | 347 | // Prims have to be loaded after module configuration since some modules may be invoked during the load |
348 | scene.LoadPrimsFromStorage(regionInfo.originRegionID); | 348 | scene.LoadPrimsFromStorage(regionInfo.originRegionID); |
349 | 349 | ||
350 | // moved these here as the terrain texture has to be created after the modules are initialized | 350 | // moved these here as the map texture has to be created after the modules are initialized |
351 | // and has to happen before the region is registered with the grid. | 351 | // and has to happen before the region is registered with the grid. |
352 | scene.CreateTerrainTexture(); | 352 | IWorldMapModule mapModule = scene.RequestModuleInterface<IWorldMapModule>(); |
353 | if (mapModule != null) | ||
354 | mapModule.GenerateMaptile(); | ||
355 | else | ||
356 | m_log.WarnFormat("[STARTUP]: No map module available to generate map tile"); | ||
353 | 357 | ||
354 | // TODO : Try setting resource for region xstats here on scene | 358 | // TODO : Try setting resource for region xstats here on scene |
355 | MainServer.Instance.AddStreamHandler(new Region.Framework.Scenes.RegionStatsHandler(regionInfo)); | 359 | MainServer.Instance.AddStreamHandler(new Region.Framework.Scenes.RegionStatsHandler(regionInfo)); |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 9d9967a..f036d85 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -1000,11 +1000,24 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1000 | return responsemap; | 1000 | return responsemap; |
1001 | } | 1001 | } |
1002 | 1002 | ||
1003 | public void RegenerateMaptile(byte[] data) | 1003 | public void GenerateMaptile() |
1004 | { | 1004 | { |
1005 | // Cannot create a map for a nonexistant heightmap | ||
1006 | if (m_scene.Heightmap == null) | ||
1007 | return; | ||
1008 | |||
1009 | //create a texture asset of the terrain | ||
1010 | IMapImageGenerator terrain = m_scene.RequestModuleInterface<IMapImageGenerator>(); | ||
1011 | if (terrain == null) | ||
1012 | return; | ||
1013 | |||
1014 | byte[] data = terrain.WriteJpeg2000Image("defaultstripe.png"); | ||
1015 | if (data == null) | ||
1016 | return; | ||
1017 | |||
1005 | UUID lastMapRegionUUID = m_scene.RegionInfo.RegionSettings.TerrainImageID; | 1018 | UUID lastMapRegionUUID = m_scene.RegionInfo.RegionSettings.TerrainImageID; |
1006 | 1019 | ||
1007 | m_log.Debug("[MAPTILE]: STORING MAPTILE IMAGE"); | 1020 | m_log.Debug("[WORLDMAP]: STORING MAPTILE IMAGE"); |
1008 | 1021 | ||
1009 | m_scene.RegionInfo.RegionSettings.TerrainImageID = UUID.Random(); | 1022 | m_scene.RegionInfo.RegionSettings.TerrainImageID = UUID.Random(); |
1010 | 1023 | ||
diff --git a/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs b/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs index ac6afed..d6e31f4 100644 --- a/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs | |||
@@ -29,6 +29,9 @@ namespace OpenSim.Region.Framework.Interfaces | |||
29 | { | 29 | { |
30 | public interface IWorldMapModule | 30 | public interface IWorldMapModule |
31 | { | 31 | { |
32 | void RegenerateMaptile(byte[] data); | 32 | /// <summary> |
33 | /// Generate a map tile for the scene. a terrain texture for this scene | ||
34 | /// </summary> | ||
35 | void GenerateMaptile(); | ||
33 | } | 36 | } |
34 | } | 37 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index afdb95b..4d5c1e7 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1812,33 +1812,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1812 | 1812 | ||
1813 | } | 1813 | } |
1814 | 1814 | ||
1815 | /// <summary> | ||
1816 | /// Create a terrain texture for this scene | ||
1817 | /// </summary> | ||
1818 | public void CreateTerrainTexture() | ||
1819 | { | ||
1820 | //create a texture asset of the terrain | ||
1821 | IMapImageGenerator terrain = RequestModuleInterface<IMapImageGenerator>(); | ||
1822 | |||
1823 | // Cannot create a map for a nonexistant heightmap yet. | ||
1824 | if (Heightmap == null) | ||
1825 | return; | ||
1826 | |||
1827 | if (terrain == null) | ||
1828 | return; | ||
1829 | |||
1830 | byte[] data = terrain.WriteJpeg2000Image("defaultstripe.png"); | ||
1831 | if (data != null) | ||
1832 | { | ||
1833 | IWorldMapModule mapModule = RequestModuleInterface<IWorldMapModule>(); | ||
1834 | |||
1835 | if (mapModule != null) | ||
1836 | mapModule.RegenerateMaptile(data); | ||
1837 | else | ||
1838 | m_log.DebugFormat("[SCENE]: MapModule is null, can't save maptile"); | ||
1839 | } | ||
1840 | } | ||
1841 | |||
1842 | #endregion | 1815 | #endregion |
1843 | 1816 | ||
1844 | #region Load Land | 1817 | #region Load Land |