add rest of wiring for terrain bake persistent store (mantis 8024 but not
using its code). Only did minor testing in MySQLLSLKeyTest
parent
47ce0f8641
commit
592a915d8d
|
@ -231,20 +231,27 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
|||
// Install terrain module in the simulator
|
||||
lock(m_scene)
|
||||
{
|
||||
if(m_scene.Bakedmap != null)
|
||||
{
|
||||
m_baked = m_scene.Bakedmap;
|
||||
}
|
||||
if (m_scene.Heightmap == null)
|
||||
{
|
||||
m_channel = new TerrainChannel(m_InitialTerrain, (int)m_scene.RegionInfo.RegionSizeX,
|
||||
(int)m_scene.RegionInfo.RegionSizeY,
|
||||
(int)m_scene.RegionInfo.RegionSizeZ);
|
||||
if(m_baked != null)
|
||||
m_channel = m_baked.MakeCopy();
|
||||
else
|
||||
m_channel = new TerrainChannel(m_InitialTerrain,
|
||||
(int)m_scene.RegionInfo.RegionSizeX,
|
||||
(int)m_scene.RegionInfo.RegionSizeY,
|
||||
(int)m_scene.RegionInfo.RegionSizeZ);
|
||||
m_scene.Heightmap = m_channel;
|
||||
|
||||
UpdateBakedMap();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_channel = m_scene.Heightmap;
|
||||
UpdateBakedMap();
|
||||
}
|
||||
if(m_baked == null)
|
||||
UpdateBakedMap();
|
||||
|
||||
m_scene.RegisterModuleInterface<ITerrainModule>(this);
|
||||
m_scene.EventManager.OnNewClient += EventManager_OnNewClient;
|
||||
|
@ -724,6 +731,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
|||
m_baked = m_channel.MakeCopy();
|
||||
m_painteffects[StandardTerrainEffects.Revert] = new RevertSphere(m_baked);
|
||||
m_floodeffects[StandardTerrainEffects.Revert] = new RevertArea(m_baked);
|
||||
m_scene.Bakedmap = m_baked;
|
||||
m_scene.SaveBakedTerrain();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -2175,6 +2175,15 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
SimulationDataService.StoreTerrain(Heightmap.GetTerrainData(), RegionInfo.RegionID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Store the terrain in the persistant data store
|
||||
/// </summary>
|
||||
public void SaveBakedTerrain()
|
||||
{
|
||||
if(Bakedmap != null)
|
||||
SimulationDataService.StoreBakedTerrain(Bakedmap.GetTerrainData(), RegionInfo.RegionID);
|
||||
}
|
||||
|
||||
public void StoreWindlightProfile(RegionLightShareData wl)
|
||||
{
|
||||
RegionInfo.WindlightSettings = wl;
|
||||
|
@ -2193,22 +2202,46 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// </summary>
|
||||
public override void LoadWorldMap()
|
||||
{
|
||||
try
|
||||
{
|
||||
Bakedmap = null;
|
||||
TerrainData map = SimulationDataService.LoadBakedTerrain(RegionInfo.RegionID, (int)RegionInfo.RegionSizeX, (int)RegionInfo.RegionSizeY, (int)RegionInfo.RegionSizeZ);
|
||||
if (map != null)
|
||||
{
|
||||
Bakedmap = new TerrainChannel(map);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[TERRAIN]: Scene.cs: LoadWorldMap() baked terrain - Failed with exception {0}{1}", e.Message, e.StackTrace);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
TerrainData map = SimulationDataService.LoadTerrain(RegionInfo.RegionID, (int)RegionInfo.RegionSizeX, (int)RegionInfo.RegionSizeY, (int)RegionInfo.RegionSizeZ);
|
||||
if (map == null)
|
||||
{
|
||||
// This should be in the Terrain module, but it isn't because
|
||||
// the heightmap is needed _way_ before the modules are initialized...
|
||||
IConfig terrainConfig = m_config.Configs["Terrain"];
|
||||
String m_InitialTerrain = "pinhead-island";
|
||||
if (terrainConfig != null)
|
||||
m_InitialTerrain = terrainConfig.GetString("InitialTerrain", m_InitialTerrain);
|
||||
if(Bakedmap != null)
|
||||
{
|
||||
m_log.Warn("[TERRAIN]: terrain not found. Used stored baked terrain.");
|
||||
Heightmap = Bakedmap.MakeCopy();
|
||||
SimulationDataService.StoreTerrain(Heightmap.GetTerrainData(), RegionInfo.RegionID);
|
||||
}
|
||||
else
|
||||
{
|
||||
// This should be in the Terrain module, but it isn't because
|
||||
// the heightmap is needed _way_ before the modules are initialized...
|
||||
IConfig terrainConfig = m_config.Configs["Terrain"];
|
||||
String m_InitialTerrain = "pinhead-island";
|
||||
if (terrainConfig != null)
|
||||
m_InitialTerrain = terrainConfig.GetString("InitialTerrain", m_InitialTerrain);
|
||||
|
||||
m_log.InfoFormat("[TERRAIN]: No default terrain. Generating a new terrain {0}.", m_InitialTerrain);
|
||||
Heightmap = new TerrainChannel(m_InitialTerrain, (int)RegionInfo.RegionSizeX, (int)RegionInfo.RegionSizeY, (int)RegionInfo.RegionSizeZ);
|
||||
m_log.InfoFormat("[TERRAIN]: No default terrain. Generating a new terrain {0}.", m_InitialTerrain);
|
||||
Heightmap = new TerrainChannel(m_InitialTerrain, (int)RegionInfo.RegionSizeX, (int)RegionInfo.RegionSizeY, (int)RegionInfo.RegionSizeZ);
|
||||
|
||||
SimulationDataService.StoreTerrain(Heightmap.GetTerrainData(), RegionInfo.RegionID);
|
||||
SimulationDataService.StoreTerrain(Heightmap.GetTerrainData(), RegionInfo.RegionID);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2221,7 +2254,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
"[TERRAIN]: Scene.cs: LoadWorldMap() - Regenerating as failed with exception {0}{1}",
|
||||
e.Message, e.StackTrace);
|
||||
|
||||
// Non standard region size. If there's an old terrain in the database, it might read past the buffer
|
||||
#pragma warning disable 0162
|
||||
if ((int)Constants.RegionSize != 256)
|
||||
{
|
||||
|
@ -2235,6 +2267,12 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_log.WarnFormat(
|
||||
"[TERRAIN]: Scene.cs: LoadWorldMap() - Failed with exception {0}{1}", e.Message, e.StackTrace);
|
||||
}
|
||||
|
||||
if(Bakedmap == null && Heightmap != null)
|
||||
{
|
||||
Bakedmap = Heightmap.MakeCopy();
|
||||
SimulationDataService.StoreBakedTerrain(Bakedmap.GetTerrainData(), RegionInfo.RegionID);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -153,6 +153,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
|
||||
public ITerrainChannel Heightmap;
|
||||
public ITerrainChannel Bakedmap;
|
||||
|
||||
/// <value>
|
||||
/// Allows retrieval of land information for this scene.
|
||||
|
|
Loading…
Reference in New Issue