* Renamed terrain functions to match OpenSim naming styles.

* Added capability to support minimum/maximum terrain limits (from the last 'bake')
afrisby
Adam Frisby 2007-07-21 22:20:22 +00:00
parent 1f17275a20
commit 4eb8ca49a9
7 changed files with 113 additions and 77 deletions

View File

@ -113,7 +113,7 @@ namespace OpenSim.Region.ClientStack
scene.LoadWorldMap(); scene.LoadWorldMap();
scene.PhysScene = GetPhysicsScene( ); scene.PhysScene = GetPhysicsScene( );
scene.PhysScene.SetTerrain(scene.Terrain.getHeights1D()); scene.PhysScene.SetTerrain(scene.Terrain.GetHeights1D());
scene.LoadPrimsFromStorage(); scene.LoadPrimsFromStorage();
//Master Avatar Setup //Master Avatar Setup

View File

@ -219,8 +219,8 @@ namespace OpenSim.Region.Environment.LandManagement
} }
} }
} }
landData.AABBMin = new LLVector3((float)(min_x * 4), (float)(min_y * 4), (float)m_world.Terrain.get((min_x * 4), (min_y * 4))); landData.AABBMin = new LLVector3((float)(min_x * 4), (float)(min_y * 4), (float)m_world.Terrain.GetHeight((min_x * 4), (min_y * 4)));
landData.AABBMax = new LLVector3((float)(max_x * 4), (float)(max_y * 4), (float)m_world.Terrain.get((max_x * 4), (max_y * 4))); landData.AABBMax = new LLVector3((float)(max_x * 4), (float)(max_y * 4), (float)m_world.Terrain.GetHeight((max_x * 4), (max_y * 4)));
landData.area = tempArea; landData.area = tempArea;
} }

View File

@ -54,32 +54,32 @@ namespace OpenSim.Region.Environment.Scenes
{ {
case 0: case 0:
// flatten terrain // flatten terrain
Terrain.flatten(north, west, size, (double)seconds / 5.0); Terrain.FlattenTerrain(north, west, size, (double)seconds / 5.0);
RegenerateTerrain(true, (int)north, (int)west); RegenerateTerrain(true, (int)north, (int)west);
break; break;
case 1: case 1:
// raise terrain // raise terrain
Terrain.raise(north, west, size, (double)seconds / 5.0); Terrain.RaiseTerrain(north, west, size, (double)seconds / 5.0);
RegenerateTerrain(true, (int)north, (int)west); RegenerateTerrain(true, (int)north, (int)west);
break; break;
case 2: case 2:
//lower terrain //lower terrain
Terrain.lower(north, west, size, (double)seconds / 5.0); Terrain.LowerTerrain(north, west, size, (double)seconds / 5.0);
RegenerateTerrain(true, (int)north, (int)west); RegenerateTerrain(true, (int)north, (int)west);
break; break;
case 3: case 3:
// smooth terrain // smooth terrain
Terrain.smooth(north, west, size, (double)seconds / 5.0); Terrain.SmoothTerrain(north, west, size, (double)seconds / 5.0);
RegenerateTerrain(true, (int)north, (int)west); RegenerateTerrain(true, (int)north, (int)west);
break; break;
case 4: case 4:
// noise // noise
Terrain.noise(north, west, size, (double)seconds / 5.0); Terrain.NoiseTerrain(north, west, size, (double)seconds / 5.0);
RegenerateTerrain(true, (int)north, (int)west); RegenerateTerrain(true, (int)north, (int)west);
break; break;
case 5: case 5:
// revert // revert
Terrain.revert(north, west, size, (double)seconds / 5.0); Terrain.RevertTerrain(north, west, size, (double)seconds / 5.0);
RegenerateTerrain(true, (int)north, (int)west); RegenerateTerrain(true, (int)north, (int)west);
break; break;

View File

@ -239,10 +239,10 @@ namespace OpenSim.Region.Environment.Scenes
{ {
lock (m_syncRoot) lock (m_syncRoot)
{ {
phyScene.SetTerrain(Terrain.getHeights1D()); phyScene.SetTerrain(Terrain.GetHeights1D());
} }
storageManager.DataStore.StoreTerrain(Terrain.getHeights2DD()); storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD());
ForEachScenePresence(delegate(ScenePresence presence) ForEachScenePresence(delegate(ScenePresence presence)
{ {
@ -295,14 +295,14 @@ namespace OpenSim.Region.Environment.Scenes
{ {
try try
{ {
Terrain.hills(); Terrain.HillsGenerator();
lock (m_syncRoot) lock (m_syncRoot)
{ {
phyScene.SetTerrain(Terrain.getHeights1D()); phyScene.SetTerrain(Terrain.GetHeights1D());
} }
storageManager.DataStore.StoreTerrain(Terrain.getHeights2DD()); storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD());
ForEachScenePresence(delegate(ScenePresence presence) ForEachScenePresence(delegate(ScenePresence presence)
{ {
@ -328,12 +328,12 @@ namespace OpenSim.Region.Environment.Scenes
{ {
try try
{ {
Terrain.setHeights2D(newMap); Terrain.SetHeights2D(newMap);
lock (m_syncRoot) lock (m_syncRoot)
{ {
phyScene.SetTerrain(Terrain.getHeights1D()); phyScene.SetTerrain(Terrain.GetHeights1D());
} }
storageManager.DataStore.StoreTerrain(Terrain.getHeights2DD()); storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD());
ForEachScenePresence(delegate(ScenePresence presence) ForEachScenePresence(delegate(ScenePresence presence)
{ {
@ -395,28 +395,28 @@ namespace OpenSim.Region.Environment.Scenes
if (string.IsNullOrEmpty(m_regInfo.estateSettings.terrainFile)) if (string.IsNullOrEmpty(m_regInfo.estateSettings.terrainFile))
{ {
Console.WriteLine("No default terrain, procedurally generating..."); Console.WriteLine("No default terrain, procedurally generating...");
Terrain.hills(); Terrain.HillsGenerator();
storageManager.DataStore.StoreTerrain(Terrain.getHeights2DD()); storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD());
} }
else else
{ {
try try
{ {
Terrain.loadFromFileF32(m_regInfo.estateSettings.terrainFile); Terrain.LoadFromFileF32(m_regInfo.estateSettings.terrainFile);
Terrain *= m_regInfo.estateSettings.terrainMultiplier; Terrain *= m_regInfo.estateSettings.terrainMultiplier;
} }
catch catch
{ {
Console.WriteLine("Unable to load default terrain, procedurally generating instead..."); Console.WriteLine("Unable to load default terrain, procedurally generating instead...");
Terrain.hills(); Terrain.HillsGenerator();
} }
storageManager.DataStore.StoreTerrain(Terrain.getHeights2DD()); storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD());
} }
} }
else else
{ {
Terrain.setHeights2D(map); Terrain.SetHeights2D(map);
} }
CreateTerrainTexture(); CreateTerrainTexture();
@ -433,7 +433,7 @@ namespace OpenSim.Region.Environment.Scenes
public void CreateTerrainTexture() public void CreateTerrainTexture()
{ {
//create a texture asset of the terrain //create a texture asset of the terrain
byte[] data = Terrain.exportJpegImage("defaultstripe.png"); byte[] data = Terrain.ExportJpegImage("defaultstripe.png");
m_regInfo.estateSettings.terrainImageID = LLUUID.Random(); m_regInfo.estateSettings.terrainImageID = LLUUID.Random();
AssetBase asset = new AssetBase(); AssetBase asset = new AssetBase();
asset.FullID = m_regInfo.estateSettings.terrainImageID; asset.FullID = m_regInfo.estateSettings.terrainImageID;

View File

@ -81,7 +81,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="RemoteClient">Client to send to</param> /// <param name="RemoteClient">Client to send to</param>
public virtual void SendLayerData(IClientAPI RemoteClient) public virtual void SendLayerData(IClientAPI RemoteClient)
{ {
RemoteClient.SendLayerData(Terrain.getHeights1D()); RemoteClient.SendLayerData(Terrain.GetHeights1D());
} }
/// <summary> /// <summary>
@ -92,7 +92,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="RemoteClient">The client to send to</param> /// <param name="RemoteClient">The client to send to</param>
public virtual void SendLayerData(int px, int py, IClientAPI RemoteClient) public virtual void SendLayerData(int px, int py, IClientAPI RemoteClient)
{ {
RemoteClient.SendLayerData(px, py, Terrain.getHeights1D()); RemoteClient.SendLayerData(px, py, Terrain.GetHeights1D());
} }
#endregion #endregion

View File

@ -36,7 +36,7 @@ namespace SimpleApp
map[i] = 25f; map[i] = 25f;
} }
this.Terrain.setHeights1D(map); this.Terrain.GetHeights1D(map);
this.CreateTerrainTexture(); this.CreateTerrainTexture();
} }

View File

@ -68,6 +68,17 @@ namespace OpenSim.Region.Terrain
/// </summary> /// </summary>
public Channel watermap; public Channel watermap;
/// <summary>
/// Max amount the terrain can be raised from the revert parameters
/// </summary>
public double maxRaise = 500.0;
/// <summary>
/// Min amount the terrain can be lowered from the revert parameters
/// </summary>
public double minLower = 500.0;
/// <summary> /// <summary>
/// Whether or not the terrain has been modified since it was last saved and sent to the Physics engine. /// Whether or not the terrain has been modified since it was last saved and sent to the Physics engine.
/// Counts the number of modifications since the last save. (0 = Untainted) /// Counts the number of modifications since the last save. (0 = Untainted)
@ -88,11 +99,34 @@ namespace OpenSim.Region.Terrain
tainted++; tainted++;
} }
/// <summary>
/// Checks to make sure the terrain is within baked values +/- maxRaise/minLower
/// </summary>
public void CheckHeightValues()
{
int x, y;
for (x = 0; x < w; x++)
{
for (y = 0; y < h; y++)
{
if ((heightmap.get(x, y) > revertmap.get(x, y) + maxRaise))
{
heightmap.map[x, y] = revertmap(x, y) + maxRaise;
}
if ((heightmap.get(x, y) > revertmap.get(x, y) - minLower))
{
heightmap.map[x, y] = revertmap(x, y) - minLower;
}
}
}
}
/// <summary> /// <summary>
/// Converts the heightmap to a 65536 value 1D floating point array /// Converts the heightmap to a 65536 value 1D floating point array
/// </summary> /// </summary>
/// <returns>A float[65536] array containing the heightmap</returns> /// <returns>A float[65536] array containing the heightmap</returns>
public float[] getHeights1D() public float[] GetHeights1D()
{ {
float[] heights = new float[w * h]; float[] heights = new float[w * h];
int i; int i;
@ -109,7 +143,7 @@ namespace OpenSim.Region.Terrain
/// Converts the heightmap to a 256x256 value 2D floating point array. /// Converts the heightmap to a 256x256 value 2D floating point array.
/// </summary> /// </summary>
/// <returns>An array of 256,256 values containing the heightmap</returns> /// <returns>An array of 256,256 values containing the heightmap</returns>
public float[,] getHeights2D() public float[,] GetHeights2D()
{ {
float[,] heights = new float[w, h]; float[,] heights = new float[w, h];
int x, y; int x, y;
@ -127,7 +161,7 @@ namespace OpenSim.Region.Terrain
/// Converts the heightmap to a 256x256 value 2D floating point array. Double precision version. /// Converts the heightmap to a 256x256 value 2D floating point array. Double precision version.
/// </summary> /// </summary>
/// <returns>An array of 256,256 values containing the heightmap</returns> /// <returns>An array of 256,256 values containing the heightmap</returns>
public double[,] getHeights2DD() public double[,] GetHeights2DD()
{ {
return heightmap.map; return heightmap.map;
} }
@ -136,7 +170,7 @@ namespace OpenSim.Region.Terrain
/// Imports a 1D floating point array into the 2D heightmap array /// Imports a 1D floating point array into the 2D heightmap array
/// </summary> /// </summary>
/// <param name="heights">The array to import (must have 65536 members)</param> /// <param name="heights">The array to import (must have 65536 members)</param>
public void setHeights1D(float[] heights) public void GetHeights1D(float[] heights)
{ {
int i; int i;
for (i = 0; i < w * h; i++) for (i = 0; i < w * h; i++)
@ -151,7 +185,7 @@ namespace OpenSim.Region.Terrain
/// Loads a 2D array of values into the heightmap /// Loads a 2D array of values into the heightmap
/// </summary> /// </summary>
/// <param name="heights">An array of 256,256 float values</param> /// <param name="heights">An array of 256,256 float values</param>
public void setHeights2D(float[,] heights) public void SetHeights2D(float[,] heights)
{ {
int x, y; int x, y;
for (x = 0; x < w; x++) for (x = 0; x < w; x++)
@ -161,6 +195,7 @@ namespace OpenSim.Region.Terrain
heightmap.set(x, y, (double)heights[x, y]); heightmap.set(x, y, (double)heights[x, y]);
} }
} }
SaveRevertMap();
tainted++; tainted++;
} }
@ -168,7 +203,7 @@ namespace OpenSim.Region.Terrain
/// Loads a 2D array of values into the heightmap (Double Precision Version) /// Loads a 2D array of values into the heightmap (Double Precision Version)
/// </summary> /// </summary>
/// <param name="heights">An array of 256,256 float values</param> /// <param name="heights">An array of 256,256 float values</param>
public void setHeights2D(double[,] heights) public void SetHeights2D(double[,] heights)
{ {
int x, y; int x, y;
for (x = 0; x < w; x++) for (x = 0; x < w; x++)
@ -178,13 +213,14 @@ namespace OpenSim.Region.Terrain
heightmap.set(x, y, heights[x, y]); heightmap.set(x, y, heights[x, y]);
} }
} }
SaveRevertMap();
tainted++; tainted++;
} }
/// <summary> /// <summary>
/// Swaps the two heightmap buffers (the 'revert map' and the heightmap) /// Swaps the two heightmap buffers (the 'revert map' and the heightmap)
/// </summary> /// </summary>
public void swapRevertMaps() public void SwapRevertMaps()
{ {
Channel backup = heightmap.copy(); Channel backup = heightmap.copy();
heightmap = revertmap; heightmap = revertmap;
@ -194,7 +230,7 @@ namespace OpenSim.Region.Terrain
/// <summary> /// <summary>
/// Saves the current heightmap into the revertmap /// Saves the current heightmap into the revertmap
/// </summary> /// </summary>
public void saveRevertMap() public void SaveRevertMap()
{ {
revertmap = heightmap.copy(); revertmap = heightmap.copy();
} }
@ -239,20 +275,20 @@ namespace OpenSim.Region.Terrain
return false; return false;
case "revert": case "revert":
swapRevertMaps(); SwapRevertMaps();
saveRevertMap(); SaveRevertMap();
break; break;
case "bake": case "bake":
saveRevertMap(); SaveRevertMap();
break; break;
case "seed": case "seed":
setSeed(Convert.ToInt32(args[1])); SetSeed(Convert.ToInt32(args[1]));
break; break;
case "erode": case "erode":
return consoleErosion(args, ref resultText); return ConsoleErosion(args, ref resultText);
case "voronoi": case "voronoi":
double[] c = new double[2]; double[] c = new double[2];
@ -262,14 +298,14 @@ namespace OpenSim.Region.Terrain
break; break;
case "hills": case "hills":
return consoleHills(args, ref resultText); return ConsoleHills(args, ref resultText);
case "regenerate": case "regenerate":
hills(); HillsGenerator();
break; break;
case "rescale": case "rescale":
setRange(Convert.ToSingle(args[1]), Convert.ToSingle(args[2])); SetRange(Convert.ToSingle(args[1]), Convert.ToSingle(args[2]));
break; break;
case "multiply": case "multiply":
@ -282,15 +318,15 @@ namespace OpenSim.Region.Terrain
switch (args[1].ToLower()) switch (args[1].ToLower())
{ {
case "f32": case "f32":
loadFromFileF32(args[2]); LoadFromFileF32(args[2]);
break; break;
case "f64": case "f64":
loadFromFileF64(args[2]); LoadFromFileF64(args[2]);
break; break;
case "raw": case "raw":
loadFromFileSLRAW(args[2]); LoadFromFileSLRAW(args[2]);
break; break;
case "img": case "img":
@ -308,15 +344,15 @@ namespace OpenSim.Region.Terrain
switch (args[1].ToLower()) switch (args[1].ToLower())
{ {
case "f32": case "f32":
writeToFileF32(args[2]); WriteToFileF32(args[2]);
break; break;
case "f64": case "f64":
writeToFileF64(args[2]); WriteToFileF64(args[2]);
break; break;
case "grdmap": case "grdmap":
exportImage(args[2], args[3]); ExportImage(args[2], args[3]);
break; break;
case "png": case "png":
@ -324,11 +360,11 @@ namespace OpenSim.Region.Terrain
break; break;
case "raw": case "raw":
writeToFileRAW(args[2]); WriteToFileRAW(args[2]);
break; break;
case "hiraw": case "hiraw":
writeToFileHiRAW(args[2]); WriteToFileHiRAW(args[2]);
break; break;
default: default:
@ -366,7 +402,7 @@ namespace OpenSim.Region.Terrain
} }
} }
private bool consoleErosion(string[] args, ref string resultText) private bool ConsoleErosion(string[] args, ref string resultText)
{ {
switch (args[1].ToLower()) switch (args[1].ToLower())
{ {
@ -384,10 +420,10 @@ namespace OpenSim.Region.Terrain
return true; return true;
} }
private bool consoleHills(string[] args, ref string resultText) private bool ConsoleHills(string[] args, ref string resultText)
{ {
Random RandomClass = new Random(); Random RandomClass = new Random();
setSeed(RandomClass.Next()); SetSeed(RandomClass.Next());
int count; int count;
double sizeMin; double sizeMin;
double sizeRange; double sizeRange;
@ -441,7 +477,7 @@ namespace OpenSim.Region.Terrain
/// </summary> /// </summary>
/// <param name="min">Minimum value of the new array</param> /// <param name="min">Minimum value of the new array</param>
/// <param name="max">Maximum value of the new array</param> /// <param name="max">Maximum value of the new array</param>
public void setRange(float min, float max) public void SetRange(float min, float max)
{ {
heightmap.normalise((double)min, (double)max); heightmap.normalise((double)min, (double)max);
tainted++; tainted++;
@ -452,7 +488,7 @@ namespace OpenSim.Region.Terrain
/// </summary> /// </summary>
/// <remarks>TODO: Move this to libTerrain itself</remarks> /// <remarks>TODO: Move this to libTerrain itself</remarks>
/// <param name="filename">The filename of the double array to import</param> /// <param name="filename">The filename of the double array to import</param>
public void loadFromFileF64(string filename) public void LoadFromFileF64(string filename)
{ {
FileInfo file = new FileInfo(filename); FileInfo file = new FileInfo(filename);
FileStream s = file.Open(FileMode.Open, FileAccess.Read); FileStream s = file.Open(FileMode.Open, FileAccess.Read);
@ -477,7 +513,7 @@ namespace OpenSim.Region.Terrain
/// </summary> /// </summary>
/// <remarks>TODO: Move this to libTerrain itself</remarks> /// <remarks>TODO: Move this to libTerrain itself</remarks>
/// <param name="filename">The filename of the float array to import</param> /// <param name="filename">The filename of the float array to import</param>
public void loadFromFileF32(string filename) public void LoadFromFileF32(string filename)
{ {
FileInfo file = new FileInfo(filename); FileInfo file = new FileInfo(filename);
FileStream s = file.Open(FileMode.Open, FileAccess.Read); FileStream s = file.Open(FileMode.Open, FileAccess.Read);
@ -502,7 +538,7 @@ namespace OpenSim.Region.Terrain
/// </summary> /// </summary>
/// <remarks>This file format stinks and is best avoided.</remarks> /// <remarks>This file format stinks and is best avoided.</remarks>
/// <param name="filename">A path to the .RAW format</param> /// <param name="filename">A path to the .RAW format</param>
public void loadFromFileSLRAW(string filename) public void LoadFromFileSLRAW(string filename)
{ {
FileInfo file = new FileInfo(filename); FileInfo file = new FileInfo(filename);
FileStream s = file.Open(FileMode.Open, FileAccess.Read); FileStream s = file.Open(FileMode.Open, FileAccess.Read);
@ -527,7 +563,7 @@ namespace OpenSim.Region.Terrain
/// Writes the current terrain heightmap to disk, in the format of a 65536 entry double[] array. /// Writes the current terrain heightmap to disk, in the format of a 65536 entry double[] array.
/// </summary> /// </summary>
/// <param name="filename">The desired output filename</param> /// <param name="filename">The desired output filename</param>
public void writeToFileF64(string filename) public void WriteToFileF64(string filename)
{ {
FileInfo file = new FileInfo(filename); FileInfo file = new FileInfo(filename);
FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write); FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write);
@ -550,7 +586,7 @@ namespace OpenSim.Region.Terrain
/// Writes the current terrain heightmap to disk, in the format of a 65536 entry float[] array /// Writes the current terrain heightmap to disk, in the format of a 65536 entry float[] array
/// </summary> /// </summary>
/// <param name="filename">The desired output filename</param> /// <param name="filename">The desired output filename</param>
public void writeToFileF32(string filename) public void WriteToFileF32(string filename)
{ {
FileInfo file = new FileInfo(filename); FileInfo file = new FileInfo(filename);
FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write); FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write);
@ -574,7 +610,7 @@ namespace OpenSim.Region.Terrain
/// (is also editable in an image application) /// (is also editable in an image application)
/// </summary> /// </summary>
/// <param name="filename">Filename to write to</param> /// <param name="filename">Filename to write to</param>
public void writeToFileRAW(string filename) public void WriteToFileRAW(string filename)
{ {
FileInfo file = new FileInfo(filename); FileInfo file = new FileInfo(filename);
FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write); FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write);
@ -639,7 +675,7 @@ namespace OpenSim.Region.Terrain
/// </summary> /// </summary>
/// <remarks>Does not calculate the revert map</remarks> /// <remarks>Does not calculate the revert map</remarks>
/// <param name="filename">The filename to output to</param> /// <param name="filename">The filename to output to</param>
public void writeToFileHiRAW(string filename) public void WriteToFileHiRAW(string filename)
{ {
FileInfo file = new FileInfo(filename); FileInfo file = new FileInfo(filename);
FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write); FileStream s = file.Open(FileMode.CreateNew, FileAccess.Write);
@ -712,7 +748,7 @@ namespace OpenSim.Region.Terrain
/// Sets the random seed to be used by procedural functions which involve random numbers. /// Sets the random seed to be used by procedural functions which involve random numbers.
/// </summary> /// </summary>
/// <param name="val">The desired seed</param> /// <param name="val">The desired seed</param>
public void setSeed(int val) public void SetSeed(int val)
{ {
heightmap.seed = val; heightmap.seed = val;
} }
@ -724,7 +760,7 @@ namespace OpenSim.Region.Terrain
/// <param name="ry">Center of the sphere on the Y axis</param> /// <param name="ry">Center of the sphere on the Y axis</param>
/// <param name="size">The radius of the sphere</param> /// <param name="size">The radius of the sphere</param>
/// <param name="amount">Scale the height of the sphere by this amount (recommended 0..2)</param> /// <param name="amount">Scale the height of the sphere by this amount (recommended 0..2)</param>
public void raise(double rx, double ry, double size, double amount) public void RaiseTerrain(double rx, double ry, double size, double amount)
{ {
lock (heightmap) lock (heightmap)
{ {
@ -741,7 +777,7 @@ namespace OpenSim.Region.Terrain
/// <param name="ry">The center of the sphere at the Y axis</param> /// <param name="ry">The center of the sphere at the Y axis</param>
/// <param name="size">The radius of the sphere in meters</param> /// <param name="size">The radius of the sphere in meters</param>
/// <param name="amount">Scale the height of the sphere by this amount (recommended 0..2)</param> /// <param name="amount">Scale the height of the sphere by this amount (recommended 0..2)</param>
public void lower(double rx, double ry, double size, double amount) public void LowerTerrain(double rx, double ry, double size, double amount)
{ {
lock (heightmap) lock (heightmap)
{ {
@ -758,7 +794,7 @@ namespace OpenSim.Region.Terrain
/// <param name="ry">Center of sphere</param> /// <param name="ry">Center of sphere</param>
/// <param name="size">Radius of the sphere</param> /// <param name="size">Radius of the sphere</param>
/// <param name="amount">Thickness of the mask (0..2 recommended)</param> /// <param name="amount">Thickness of the mask (0..2 recommended)</param>
public void flatten(double rx, double ry, double size, double amount) public void FlattenTerrain(double rx, double ry, double size, double amount)
{ {
lock (heightmap) lock (heightmap)
{ {
@ -775,7 +811,7 @@ namespace OpenSim.Region.Terrain
/// <param name="ry">Center of the bounding sphere</param> /// <param name="ry">Center of the bounding sphere</param>
/// <param name="size">The radius of the sphere</param> /// <param name="size">The radius of the sphere</param>
/// <param name="amount">Strength of the mask (0..2) recommended</param> /// <param name="amount">Strength of the mask (0..2) recommended</param>
public void noise(double rx, double ry, double size, double amount) public void NoiseTerrain(double rx, double ry, double size, double amount)
{ {
lock (heightmap) lock (heightmap)
{ {
@ -798,7 +834,7 @@ namespace OpenSim.Region.Terrain
/// <param name="ry">Center of the bounding sphere</param> /// <param name="ry">Center of the bounding sphere</param>
/// <param name="size">The radius of the sphere</param> /// <param name="size">The radius of the sphere</param>
/// <param name="amount">Strength of the mask (0..2) recommended</param> /// <param name="amount">Strength of the mask (0..2) recommended</param>
public void revert(double rx, double ry, double size, double amount) public void RevertTerrain(double rx, double ry, double size, double amount)
{ {
lock (heightmap) lock (heightmap)
{ {
@ -818,7 +854,7 @@ namespace OpenSim.Region.Terrain
/// <param name="ry">Center of the sphere</param> /// <param name="ry">Center of the sphere</param>
/// <param name="size">Radius of the sphere</param> /// <param name="size">Radius of the sphere</param>
/// <param name="amount">Thickness of the mask (0..2 recommended)</param> /// <param name="amount">Thickness of the mask (0..2 recommended)</param>
public void smooth(double rx, double ry, double size, double amount) public void SmoothTerrain(double rx, double ry, double size, double amount)
{ {
lock (heightmap) lock (heightmap)
{ {
@ -837,7 +873,7 @@ namespace OpenSim.Region.Terrain
/// <summary> /// <summary>
/// Generates a simple set of hills in the shape of an island /// Generates a simple set of hills in the shape of an island
/// </summary> /// </summary>
public void hills() public void HillsGenerator()
{ {
lock (heightmap) lock (heightmap)
{ {
@ -855,7 +891,7 @@ namespace OpenSim.Region.Terrain
/// <param name="x">X coord</param> /// <param name="x">X coord</param>
/// <param name="y">Y coord</param> /// <param name="y">Y coord</param>
/// <returns>Height at specified coordinates</returns> /// <returns>Height at specified coordinates</returns>
public double get(int x, int y) public double GetHeight(int x, int y)
{ {
return heightmap.get(x, y); return heightmap.get(x, y);
} }
@ -866,11 +902,11 @@ namespace OpenSim.Region.Terrain
/// <param name="meep">The heightfield</param> /// <param name="meep">The heightfield</param>
/// <param name="val">The multiplier</param> /// <param name="val">The multiplier</param>
/// <returns></returns> /// <returns></returns>
public static TerrainEngine operator *(TerrainEngine meep, Double val) public static TerrainEngine operator *(TerrainEngine terrain, Double val)
{ {
meep.heightmap *= val; terrain.heightmap *= val;
meep.tainted++; terrain.tainted++;
return meep; return terrain;
} }
/// <summary> /// <summary>
@ -878,7 +914,7 @@ namespace OpenSim.Region.Terrain
/// </summary> /// </summary>
/// <param name="filename">The destination filename for the image</param> /// <param name="filename">The destination filename for the image</param>
/// <param name="gradientmap">A 1x*height* image which contains the colour gradient to export with. Must be at least 1x2 pixels, 1x256 or more is ideal.</param> /// <param name="gradientmap">A 1x*height* image which contains the colour gradient to export with. Must be at least 1x2 pixels, 1x256 or more is ideal.</param>
public void exportImage(string filename, string gradientmap) public void ExportImage(string filename, string gradientmap)
{ {
try try
{ {
@ -917,7 +953,7 @@ namespace OpenSim.Region.Terrain
/// Exports the current heightmap in Jpeg2000 format to a byte[] /// Exports the current heightmap in Jpeg2000 format to a byte[]
/// </summary> /// </summary>
/// <param name="gradientmap">A 1x*height* image which contains the colour gradient to export with. Must be at least 1x2 pixels, 1x256 or more is ideal.</param> /// <param name="gradientmap">A 1x*height* image which contains the colour gradient to export with. Must be at least 1x2 pixels, 1x256 or more is ideal.</param>
public byte[] exportJpegImage(string gradientmap) public byte[] ExportJpegImage(string gradientmap)
{ {
byte[] imageData = null; byte[] imageData = null;
try try