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
|
// Install terrain module in the simulator
|
||||||
lock(m_scene)
|
lock(m_scene)
|
||||||
{
|
{
|
||||||
|
if(m_scene.Bakedmap != null)
|
||||||
|
{
|
||||||
|
m_baked = m_scene.Bakedmap;
|
||||||
|
}
|
||||||
if (m_scene.Heightmap == null)
|
if (m_scene.Heightmap == null)
|
||||||
{
|
{
|
||||||
m_channel = new TerrainChannel(m_InitialTerrain, (int)m_scene.RegionInfo.RegionSizeX,
|
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.RegionSizeY,
|
||||||
(int)m_scene.RegionInfo.RegionSizeZ);
|
(int)m_scene.RegionInfo.RegionSizeZ);
|
||||||
m_scene.Heightmap = m_channel;
|
m_scene.Heightmap = m_channel;
|
||||||
|
|
||||||
UpdateBakedMap();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_channel = m_scene.Heightmap;
|
m_channel = m_scene.Heightmap;
|
||||||
UpdateBakedMap();
|
|
||||||
}
|
}
|
||||||
|
if(m_baked == null)
|
||||||
|
UpdateBakedMap();
|
||||||
|
|
||||||
m_scene.RegisterModuleInterface<ITerrainModule>(this);
|
m_scene.RegisterModuleInterface<ITerrainModule>(this);
|
||||||
m_scene.EventManager.OnNewClient += EventManager_OnNewClient;
|
m_scene.EventManager.OnNewClient += EventManager_OnNewClient;
|
||||||
|
@ -724,6 +731,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
||||||
m_baked = m_channel.MakeCopy();
|
m_baked = m_channel.MakeCopy();
|
||||||
m_painteffects[StandardTerrainEffects.Revert] = new RevertSphere(m_baked);
|
m_painteffects[StandardTerrainEffects.Revert] = new RevertSphere(m_baked);
|
||||||
m_floodeffects[StandardTerrainEffects.Revert] = new RevertArea(m_baked);
|
m_floodeffects[StandardTerrainEffects.Revert] = new RevertArea(m_baked);
|
||||||
|
m_scene.Bakedmap = m_baked;
|
||||||
|
m_scene.SaveBakedTerrain();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -2175,6 +2175,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
SimulationDataService.StoreTerrain(Heightmap.GetTerrainData(), RegionInfo.RegionID);
|
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)
|
public void StoreWindlightProfile(RegionLightShareData wl)
|
||||||
{
|
{
|
||||||
RegionInfo.WindlightSettings = wl;
|
RegionInfo.WindlightSettings = wl;
|
||||||
|
@ -2193,10 +2202,33 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override void LoadWorldMap()
|
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
|
try
|
||||||
{
|
{
|
||||||
TerrainData map = SimulationDataService.LoadTerrain(RegionInfo.RegionID, (int)RegionInfo.RegionSizeX, (int)RegionInfo.RegionSizeY, (int)RegionInfo.RegionSizeZ);
|
TerrainData map = SimulationDataService.LoadTerrain(RegionInfo.RegionID, (int)RegionInfo.RegionSizeX, (int)RegionInfo.RegionSizeY, (int)RegionInfo.RegionSizeZ);
|
||||||
if (map == null)
|
if (map == null)
|
||||||
|
{
|
||||||
|
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
|
// This should be in the Terrain module, but it isn't because
|
||||||
// the heightmap is needed _way_ before the modules are initialized...
|
// the heightmap is needed _way_ before the modules are initialized...
|
||||||
|
@ -2210,6 +2242,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
SimulationDataService.StoreTerrain(Heightmap.GetTerrainData(), RegionInfo.RegionID);
|
SimulationDataService.StoreTerrain(Heightmap.GetTerrainData(), RegionInfo.RegionID);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Heightmap = new TerrainChannel(map);
|
Heightmap = new TerrainChannel(map);
|
||||||
|
@ -2221,7 +2254,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
"[TERRAIN]: Scene.cs: LoadWorldMap() - Regenerating as failed with exception {0}{1}",
|
"[TERRAIN]: Scene.cs: LoadWorldMap() - Regenerating as failed with exception {0}{1}",
|
||||||
e.Message, e.StackTrace);
|
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
|
#pragma warning disable 0162
|
||||||
if ((int)Constants.RegionSize != 256)
|
if ((int)Constants.RegionSize != 256)
|
||||||
{
|
{
|
||||||
|
@ -2235,6 +2267,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_log.WarnFormat(
|
m_log.WarnFormat(
|
||||||
"[TERRAIN]: Scene.cs: LoadWorldMap() - Failed with exception {0}{1}", e.Message, e.StackTrace);
|
"[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>
|
/// <summary>
|
||||||
|
|
|
@ -153,6 +153,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
public ITerrainChannel Heightmap;
|
public ITerrainChannel Heightmap;
|
||||||
|
public ITerrainChannel Bakedmap;
|
||||||
|
|
||||||
/// <value>
|
/// <value>
|
||||||
/// Allows retrieval of land information for this scene.
|
/// Allows retrieval of land information for this scene.
|
||||||
|
|
Loading…
Reference in New Issue