diff options
author | UbitUmarov | 2016-09-17 17:56:35 +0100 |
---|---|---|
committer | UbitUmarov | 2016-09-17 17:56:56 +0100 |
commit | 592a915d8d9335784998d02418d1eee757f76350 (patch) | |
tree | dcd814003dba0e708c9d40fdef109c0b041ad493 /OpenSim | |
parent | add load baked terrain methods. missing file (diff) | |
download | opensim-SC_OLD-592a915d8d9335784998d02418d1eee757f76350.zip opensim-SC_OLD-592a915d8d9335784998d02418d1eee757f76350.tar.gz opensim-SC_OLD-592a915d8d9335784998d02418d1eee757f76350.tar.bz2 opensim-SC_OLD-592a915d8d9335784998d02418d1eee757f76350.tar.xz |
add rest of wiring for terrain bake persistent store (mantis 8024 but not
using its code). Only did minor testing in MySQL
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | 21 | ||||
-rwxr-xr-x | OpenSim/Region/Framework/Scenes/Scene.cs | 58 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneBase.cs | 1 |
3 files changed, 64 insertions, 16 deletions
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index 69fa5f6..e21681d 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | |||
@@ -231,20 +231,27 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
231 | // Install terrain module in the simulator | 231 | // Install terrain module in the simulator |
232 | lock(m_scene) | 232 | lock(m_scene) |
233 | { | 233 | { |
234 | if(m_scene.Bakedmap != null) | ||
235 | { | ||
236 | m_baked = m_scene.Bakedmap; | ||
237 | } | ||
234 | if (m_scene.Heightmap == null) | 238 | if (m_scene.Heightmap == null) |
235 | { | 239 | { |
236 | m_channel = new TerrainChannel(m_InitialTerrain, (int)m_scene.RegionInfo.RegionSizeX, | 240 | if(m_baked != null) |
237 | (int)m_scene.RegionInfo.RegionSizeY, | 241 | m_channel = m_baked.MakeCopy(); |
238 | (int)m_scene.RegionInfo.RegionSizeZ); | 242 | else |
243 | m_channel = new TerrainChannel(m_InitialTerrain, | ||
244 | (int)m_scene.RegionInfo.RegionSizeX, | ||
245 | (int)m_scene.RegionInfo.RegionSizeY, | ||
246 | (int)m_scene.RegionInfo.RegionSizeZ); | ||
239 | m_scene.Heightmap = m_channel; | 247 | m_scene.Heightmap = m_channel; |
240 | |||
241 | UpdateBakedMap(); | ||
242 | } | 248 | } |
243 | else | 249 | else |
244 | { | 250 | { |
245 | m_channel = m_scene.Heightmap; | 251 | m_channel = m_scene.Heightmap; |
246 | UpdateBakedMap(); | ||
247 | } | 252 | } |
253 | if(m_baked == null) | ||
254 | UpdateBakedMap(); | ||
248 | 255 | ||
249 | m_scene.RegisterModuleInterface<ITerrainModule>(this); | 256 | m_scene.RegisterModuleInterface<ITerrainModule>(this); |
250 | m_scene.EventManager.OnNewClient += EventManager_OnNewClient; | 257 | m_scene.EventManager.OnNewClient += EventManager_OnNewClient; |
@@ -724,6 +731,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
724 | m_baked = m_channel.MakeCopy(); | 731 | m_baked = m_channel.MakeCopy(); |
725 | m_painteffects[StandardTerrainEffects.Revert] = new RevertSphere(m_baked); | 732 | m_painteffects[StandardTerrainEffects.Revert] = new RevertSphere(m_baked); |
726 | m_floodeffects[StandardTerrainEffects.Revert] = new RevertArea(m_baked); | 733 | m_floodeffects[StandardTerrainEffects.Revert] = new RevertArea(m_baked); |
734 | m_scene.Bakedmap = m_baked; | ||
735 | m_scene.SaveBakedTerrain(); | ||
727 | } | 736 | } |
728 | 737 | ||
729 | /// <summary> | 738 | /// <summary> |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index f7bfc24..168080f 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2175,6 +2175,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2175 | SimulationDataService.StoreTerrain(Heightmap.GetTerrainData(), RegionInfo.RegionID); | 2175 | SimulationDataService.StoreTerrain(Heightmap.GetTerrainData(), RegionInfo.RegionID); |
2176 | } | 2176 | } |
2177 | 2177 | ||
2178 | /// <summary> | ||
2179 | /// Store the terrain in the persistant data store | ||
2180 | /// </summary> | ||
2181 | public void SaveBakedTerrain() | ||
2182 | { | ||
2183 | if(Bakedmap != null) | ||
2184 | SimulationDataService.StoreBakedTerrain(Bakedmap.GetTerrainData(), RegionInfo.RegionID); | ||
2185 | } | ||
2186 | |||
2178 | public void StoreWindlightProfile(RegionLightShareData wl) | 2187 | public void StoreWindlightProfile(RegionLightShareData wl) |
2179 | { | 2188 | { |
2180 | RegionInfo.WindlightSettings = wl; | 2189 | RegionInfo.WindlightSettings = wl; |
@@ -2195,20 +2204,44 @@ namespace OpenSim.Region.Framework.Scenes | |||
2195 | { | 2204 | { |
2196 | try | 2205 | try |
2197 | { | 2206 | { |
2207 | Bakedmap = null; | ||
2208 | TerrainData map = SimulationDataService.LoadBakedTerrain(RegionInfo.RegionID, (int)RegionInfo.RegionSizeX, (int)RegionInfo.RegionSizeY, (int)RegionInfo.RegionSizeZ); | ||
2209 | if (map != null) | ||
2210 | { | ||
2211 | Bakedmap = new TerrainChannel(map); | ||
2212 | } | ||
2213 | } | ||
2214 | catch (Exception e) | ||
2215 | { | ||
2216 | m_log.WarnFormat( | ||
2217 | "[TERRAIN]: Scene.cs: LoadWorldMap() baked terrain - Failed with exception {0}{1}", e.Message, e.StackTrace); | ||
2218 | } | ||
2219 | |||
2220 | try | ||
2221 | { | ||
2198 | TerrainData map = SimulationDataService.LoadTerrain(RegionInfo.RegionID, (int)RegionInfo.RegionSizeX, (int)RegionInfo.RegionSizeY, (int)RegionInfo.RegionSizeZ); | 2222 | TerrainData map = SimulationDataService.LoadTerrain(RegionInfo.RegionID, (int)RegionInfo.RegionSizeX, (int)RegionInfo.RegionSizeY, (int)RegionInfo.RegionSizeZ); |
2199 | if (map == null) | 2223 | if (map == null) |
2200 | { | 2224 | { |
2201 | // This should be in the Terrain module, but it isn't because | 2225 | if(Bakedmap != null) |
2202 | // the heightmap is needed _way_ before the modules are initialized... | 2226 | { |
2203 | IConfig terrainConfig = m_config.Configs["Terrain"]; | 2227 | m_log.Warn("[TERRAIN]: terrain not found. Used stored baked terrain."); |
2204 | String m_InitialTerrain = "pinhead-island"; | 2228 | Heightmap = Bakedmap.MakeCopy(); |
2205 | if (terrainConfig != null) | 2229 | SimulationDataService.StoreTerrain(Heightmap.GetTerrainData(), RegionInfo.RegionID); |
2206 | m_InitialTerrain = terrainConfig.GetString("InitialTerrain", m_InitialTerrain); | 2230 | } |
2231 | else | ||
2232 | { | ||
2233 | // This should be in the Terrain module, but it isn't because | ||
2234 | // the heightmap is needed _way_ before the modules are initialized... | ||
2235 | IConfig terrainConfig = m_config.Configs["Terrain"]; | ||
2236 | String m_InitialTerrain = "pinhead-island"; | ||
2237 | if (terrainConfig != null) | ||
2238 | m_InitialTerrain = terrainConfig.GetString("InitialTerrain", m_InitialTerrain); | ||
2207 | 2239 | ||
2208 | m_log.InfoFormat("[TERRAIN]: No default terrain. Generating a new terrain {0}.", m_InitialTerrain); | 2240 | m_log.InfoFormat("[TERRAIN]: No default terrain. Generating a new terrain {0}.", m_InitialTerrain); |
2209 | Heightmap = new TerrainChannel(m_InitialTerrain, (int)RegionInfo.RegionSizeX, (int)RegionInfo.RegionSizeY, (int)RegionInfo.RegionSizeZ); | 2241 | Heightmap = new TerrainChannel(m_InitialTerrain, (int)RegionInfo.RegionSizeX, (int)RegionInfo.RegionSizeY, (int)RegionInfo.RegionSizeZ); |
2210 | 2242 | ||
2211 | SimulationDataService.StoreTerrain(Heightmap.GetTerrainData(), RegionInfo.RegionID); | 2243 | SimulationDataService.StoreTerrain(Heightmap.GetTerrainData(), RegionInfo.RegionID); |
2244 | } | ||
2212 | } | 2245 | } |
2213 | else | 2246 | else |
2214 | { | 2247 | { |
@@ -2221,7 +2254,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2221 | "[TERRAIN]: Scene.cs: LoadWorldMap() - Regenerating as failed with exception {0}{1}", | 2254 | "[TERRAIN]: Scene.cs: LoadWorldMap() - Regenerating as failed with exception {0}{1}", |
2222 | e.Message, e.StackTrace); | 2255 | e.Message, e.StackTrace); |
2223 | 2256 | ||
2224 | // Non standard region size. If there's an old terrain in the database, it might read past the buffer | ||
2225 | #pragma warning disable 0162 | 2257 | #pragma warning disable 0162 |
2226 | if ((int)Constants.RegionSize != 256) | 2258 | if ((int)Constants.RegionSize != 256) |
2227 | { | 2259 | { |
@@ -2235,6 +2267,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2235 | m_log.WarnFormat( | 2267 | m_log.WarnFormat( |
2236 | "[TERRAIN]: Scene.cs: LoadWorldMap() - Failed with exception {0}{1}", e.Message, e.StackTrace); | 2268 | "[TERRAIN]: Scene.cs: LoadWorldMap() - Failed with exception {0}{1}", e.Message, e.StackTrace); |
2237 | } | 2269 | } |
2270 | |||
2271 | if(Bakedmap == null && Heightmap != null) | ||
2272 | { | ||
2273 | Bakedmap = Heightmap.MakeCopy(); | ||
2274 | SimulationDataService.StoreBakedTerrain(Bakedmap.GetTerrainData(), RegionInfo.RegionID); | ||
2275 | } | ||
2238 | } | 2276 | } |
2239 | 2277 | ||
2240 | /// <summary> | 2278 | /// <summary> |
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index f420f69..1de55ec 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs | |||
@@ -153,6 +153,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
153 | } | 153 | } |
154 | 154 | ||
155 | public ITerrainChannel Heightmap; | 155 | public ITerrainChannel Heightmap; |
156 | public ITerrainChannel Bakedmap; | ||
156 | 157 | ||
157 | /// <value> | 158 | /// <value> |
158 | /// Allows retrieval of land information for this scene. | 159 | /// Allows retrieval of land information for this scene. |