aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rwxr-xr-xOpenSim/Region/Framework/Scenes/Scene.cs58
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs1
2 files changed, 49 insertions, 10 deletions
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.