Terrain: added [Terrain] section with an option to load an initial flat terrain. Default is still pinhead island. I much rather have a flat land in the beginning.
Conflicts: bin/OpenSim.ini.example0.7.3-post-fixes
parent
a5488650ff
commit
9a643a1bb9
|
@ -86,6 +86,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
||||||
private volatile bool m_tainted;
|
private volatile bool m_tainted;
|
||||||
private readonly Stack<LandUndoState> m_undo = new Stack<LandUndoState>(5);
|
private readonly Stack<LandUndoState> m_undo = new Stack<LandUndoState>(5);
|
||||||
|
|
||||||
|
private String m_InitialTerrain = "pinhead-island";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Human readable list of terrain file extensions that are supported.
|
/// Human readable list of terrain file extensions that are supported.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -109,6 +111,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
||||||
/// <param name="config">Config for the region</param>
|
/// <param name="config">Config for the region</param>
|
||||||
public void Initialise(IConfigSource config)
|
public void Initialise(IConfigSource config)
|
||||||
{
|
{
|
||||||
|
IConfig terrainConfig = config.Configs["Terrain"];
|
||||||
|
if (terrainConfig != null)
|
||||||
|
m_InitialTerrain = terrainConfig.GetString("InitialTerrain", m_InitialTerrain);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddRegion(Scene scene)
|
public void AddRegion(Scene scene)
|
||||||
|
@ -120,7 +125,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
||||||
{
|
{
|
||||||
if (m_scene.Heightmap == null)
|
if (m_scene.Heightmap == null)
|
||||||
{
|
{
|
||||||
m_channel = new TerrainChannel();
|
m_channel = new TerrainChannel(m_InitialTerrain);
|
||||||
m_scene.Heightmap = m_channel;
|
m_scene.Heightmap = m_channel;
|
||||||
m_revert = new TerrainChannel();
|
m_revert = new TerrainChannel();
|
||||||
UpdateRevertMap();
|
UpdateRevertMap();
|
||||||
|
|
|
@ -1583,8 +1583,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
double[,] map = SimulationDataService.LoadTerrain(RegionInfo.RegionID);
|
double[,] map = SimulationDataService.LoadTerrain(RegionInfo.RegionID);
|
||||||
if (map == null)
|
if (map == null)
|
||||||
{
|
{
|
||||||
m_log.Info("[TERRAIN]: No default terrain. Generating a new terrain.");
|
// This should be in the Terrain module, but it isn't because
|
||||||
Heightmap = new TerrainChannel();
|
// 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);
|
||||||
|
|
||||||
SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
|
SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,23 +46,20 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public TerrainChannel()
|
public TerrainChannel()
|
||||||
{
|
{
|
||||||
map = new double[Constants.RegionSize, Constants.RegionSize];
|
map = new double[Constants.RegionSize, Constants.RegionSize];
|
||||||
taint = new bool[Constants.RegionSize / 16,Constants.RegionSize / 16];
|
taint = new bool[Constants.RegionSize / 16, Constants.RegionSize / 16];
|
||||||
|
|
||||||
int x;
|
PinHeadIsland();
|
||||||
for (x = 0; x < Constants.RegionSize; x++)
|
|
||||||
{
|
|
||||||
int y;
|
|
||||||
for (y = 0; y < Constants.RegionSize; y++)
|
|
||||||
{
|
|
||||||
map[x, y] = TerrainUtil.PerlinNoise2D(x, y, 2, 0.125) * 10;
|
|
||||||
double spherFacA = TerrainUtil.SphericalFactor(x, y, Constants.RegionSize / 2.0, Constants.RegionSize / 2.0, 50) * 0.01;
|
|
||||||
double spherFacB = TerrainUtil.SphericalFactor(x, y, Constants.RegionSize / 2.0, Constants.RegionSize / 2.0, 100) * 0.001;
|
|
||||||
if (map[x, y] < spherFacA)
|
|
||||||
map[x, y] = spherFacA;
|
|
||||||
if (map[x, y] < spherFacB)
|
|
||||||
map[x, y] = spherFacB;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TerrainChannel(String type)
|
||||||
|
{
|
||||||
|
map = new double[Constants.RegionSize, Constants.RegionSize];
|
||||||
|
taint = new bool[Constants.RegionSize / 16, Constants.RegionSize / 16];
|
||||||
|
|
||||||
|
if (type.Equals("flat"))
|
||||||
|
FlatLand();
|
||||||
|
else
|
||||||
|
PinHeadIsland();
|
||||||
}
|
}
|
||||||
|
|
||||||
public TerrainChannel(double[,] import)
|
public TerrainChannel(double[,] import)
|
||||||
|
@ -238,5 +235,36 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void PinHeadIsland()
|
||||||
|
{
|
||||||
|
int x;
|
||||||
|
for (x = 0; x < Constants.RegionSize; x++)
|
||||||
|
{
|
||||||
|
int y;
|
||||||
|
for (y = 0; y < Constants.RegionSize; y++)
|
||||||
|
{
|
||||||
|
map[x, y] = TerrainUtil.PerlinNoise2D(x, y, 2, 0.125) * 10;
|
||||||
|
double spherFacA = TerrainUtil.SphericalFactor(x, y, Constants.RegionSize / 2.0, Constants.RegionSize / 2.0, 50) * 0.01;
|
||||||
|
double spherFacB = TerrainUtil.SphericalFactor(x, y, Constants.RegionSize / 2.0, Constants.RegionSize / 2.0, 100) * 0.001;
|
||||||
|
if (map[x, y] < spherFacA)
|
||||||
|
map[x, y] = spherFacA;
|
||||||
|
if (map[x, y] < spherFacB)
|
||||||
|
map[x, y] = spherFacB;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FlatLand()
|
||||||
|
{
|
||||||
|
int x;
|
||||||
|
for (x = 0; x < Constants.RegionSize; x++)
|
||||||
|
{
|
||||||
|
int y;
|
||||||
|
for (y = 0; y < Constants.RegionSize; y++)
|
||||||
|
map[x, y] = 21;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,6 @@
|
||||||
|
|
||||||
|
|
||||||
[Startup]
|
[Startup]
|
||||||
|
|
||||||
;# {ConsolePrompt} {} {ConsolePrompt} {} "Region (\R) "
|
;# {ConsolePrompt} {} {ConsolePrompt} {} "Region (\R) "
|
||||||
;; Console prompt
|
;; Console prompt
|
||||||
;; Certain special characters can be used to customize the prompt
|
;; Certain special characters can be used to customize the prompt
|
||||||
|
@ -773,6 +772,9 @@
|
||||||
;# {Enabled} {} {Enable Non Player Character (NPC) facilities} {true false} false
|
;# {Enabled} {} {Enable Non Player Character (NPC) facilities} {true false} false
|
||||||
; Enabled = false
|
; Enabled = false
|
||||||
|
|
||||||
|
[Terrain]
|
||||||
|
;# {InitialTerrain} {} {Initial terrain type} {pinhead-island flat} pinhead-island
|
||||||
|
; InitialTerrain = "pinhead-island"
|
||||||
|
|
||||||
[PrimLimitsModule]
|
[PrimLimitsModule]
|
||||||
;# {EnforcePrimLimits} {} {Enforce parcel prim limits} {true false} false
|
;# {EnforcePrimLimits} {} {Enforce parcel prim limits} {true false} false
|
||||||
|
|
|
@ -1512,6 +1512,9 @@
|
||||||
;; Enable Non Player Character (NPC) facilities
|
;; Enable Non Player Character (NPC) facilities
|
||||||
Enabled = false
|
Enabled = false
|
||||||
|
|
||||||
|
[Terrain]
|
||||||
|
InitialTerrain = "pinhead-island"
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; If you are using a simian grid frontend you can enable
|
;; If you are using a simian grid frontend you can enable
|
||||||
;; this module to upload tile images for the mapping fn
|
;; this module to upload tile images for the mapping fn
|
||||||
|
|
Loading…
Reference in New Issue