From fcbe7b9ed63eb4a64a241113421125c3ecf844b8 Mon Sep 17 00:00:00 2001
From: Adam Frisby
Date: Sat, 4 Apr 2009 05:51:26 +0000
Subject: * 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.
---
.../Scripting/Minimodule/Heightmap.cs | 12 +++++++++---
.../Scripting/Minimodule/IHeightmap.cs | 21 +++++++++++++++++++--
2 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Heightmap.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Heightmap.cs
index 2f6c204..875de50 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Heightmap.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Heightmap.cs
@@ -31,13 +31,19 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
public class Heightmap : IHeightmap
{
- private Scene m_scene;
+ private readonly Scene m_scene;
public Heightmap(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
{
get { return m_scene.Heightmap.Height; }
@@ -48,12 +54,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
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];
}
- public void Set(int x, int y, double val)
+ protected void Set(int x, int y, double val)
{
m_scene.Heightmap[x, y] = val;
}
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IHeightmap.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IHeightmap.cs
index 37cf8ae..afea12b 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/IHeightmap.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/IHeightmap.cs
@@ -33,9 +33,26 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
public interface IHeightmap
{
+ ///
+ /// Returns [or sets] the heightmap value at specified coordinates.
+ ///
+ /// X Coordinate
+ /// Y Coordinate
+ /// A value in meters representing height. Can be negative. Value correlates with Z parameter in world coordinates
+ double this[int x, int y]
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// The maximum height of the region (Y axis), exclusive. (eg Height = 256, max Y = 255). Minimum is always 0 inclusive.
+ ///
int Height { get; }
+
+ ///
+ /// The maximum width of the region (X axis), exclusive. (eg Width = 256, max X = 255). Minimum is always 0 inclusive.
+ ///
int Width { get; }
- double Get(int x, int y);
- void Set(int x, int y, double val);
}
}
--
cgit v1.1