* Drops Heightmap.Get/Heightmap.Set from IHeightmap interface.

* Adds Heightmap[x,y] to interface.
* MRM Scripts should utilize World.Heightmap[x,y] = 0.0; to replace set, and Val = World.Heightmap[x,y] to get.
0.6.5-rc1
Adam Frisby 2009-04-04 05:51:26 +00:00
parent 7f4bf5871d
commit fcbe7b9ed6
2 changed files with 28 additions and 5 deletions

View File

@ -31,13 +31,19 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{ {
public class Heightmap : IHeightmap public class Heightmap : IHeightmap
{ {
private Scene m_scene; private readonly Scene m_scene;
public Heightmap(Scene scene) public Heightmap(Scene scene)
{ {
m_scene = scene; m_scene = scene;
} }
public double this[int x, int y]
{
get { return Get(x, y); }
set { Set(x, y, value); }
}
public int Height public int Height
{ {
get { return m_scene.Heightmap.Height; } get { return m_scene.Heightmap.Height; }
@ -48,12 +54,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
get { return m_scene.Heightmap.Width; } get { return m_scene.Heightmap.Width; }
} }
public double Get(int x, int y) protected double Get(int x, int y)
{ {
return m_scene.Heightmap[x, y]; return m_scene.Heightmap[x, y];
} }
public void Set(int x, int y, double val) protected void Set(int x, int y, double val)
{ {
m_scene.Heightmap[x, y] = val; m_scene.Heightmap[x, y] = val;
} }

View File

@ -33,9 +33,26 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{ {
public interface IHeightmap public interface IHeightmap
{ {
/// <summary>
/// Returns [or sets] the heightmap value at specified coordinates.
/// </summary>
/// <param name="x">X Coordinate</param>
/// <param name="y">Y Coordinate</param>
/// <returns>A value in meters representing height. Can be negative. Value correlates with Z parameter in world coordinates</returns>
double this[int x, int y]
{
get;
set;
}
/// <summary>
/// The maximum height of the region (Y axis), exclusive. (eg Height = 256, max Y = 255). Minimum is always 0 inclusive.
/// </summary>
int Height { get; } int Height { get; }
/// <summary>
/// The maximum width of the region (X axis), exclusive. (eg Width = 256, max X = 255). Minimum is always 0 inclusive.
/// </summary>
int Width { get; } int Width { get; }
double Get(int x, int y);
void Set(int x, int y, double val);
} }
} }