Added (experimental) terrain elevate command to allow whole terrain to be elevated with positive or negative values

ThreadPoolClientBranch
Tedd Hansen 2008-01-16 21:21:31 +00:00
parent b33da2538e
commit 7fa6646d6f
2 changed files with 33 additions and 0 deletions

View File

@ -477,6 +477,7 @@ namespace OpenSim.Region.Terrain
resultText += "terrain erode thermal <talus> <rounds> <carry>\n";
resultText += "terrain erode hydraulic <rain> <evaporation> <solubility> <frequency> <rounds>\n";
resultText += "terrain multiply <val> - multiplies a terrain by <val>\n";
resultText += "terrain elevate <val> - elevates a terrain by <val>\n";
resultText += "terrain revert - reverts the terrain to the stored original\n";
resultText += "terrain bake - saves the current terrain into the revert map\n";
resultText +=
@ -524,6 +525,10 @@ namespace OpenSim.Region.Terrain
SetRange(Convert.ToSingle(args[1]), Convert.ToSingle(args[2]));
break;
case "elevate":
Elevate(Convert.ToSingle(args[1]));
break;
case "fill":
heightmap.Fill(Convert.ToDouble(args[1]));
tainted++;
@ -765,6 +770,16 @@ namespace OpenSim.Region.Terrain
tainted++;
}
/// <summary>
/// Adds meters (positive or negative) to terrain height
/// </summary>
/// <param name="meters">Positive or negative value to add to new array</param>
public void Elevate(float meters)
{
heightmap.Elevate((double)meters);
tainted++;
}
/// <summary>
/// Loads a file consisting of 256x256 doubles and imports it as an array into the map.
/// </summary>

View File

@ -96,6 +96,24 @@ namespace libTerrain
return this;
}
public Channel Elevate(double meters)
{
SetDiff();
int x, y;
for (x = 0; x < w; x++)
{
for (y = 0; y < h; y++)
{
map[x, y] += meters;
}
}
return this;
}
public Channel Clip()
{
int x, y;