varregion: add ITerrainChannel.GetHeightAtXYZ() for eventual mesh terrain.
Implementation of same in TerrainChannel.cs. Check for bounds in TerrainChannel[x,y] to prevent array access exceptions.varregion
parent
7aa00632b9
commit
109136c074
|
@ -37,6 +37,8 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
|
|
||||||
double this[int x, int y] { get; set; }
|
double this[int x, int y] { get; set; }
|
||||||
|
|
||||||
|
float GetHeightAtXYZ(float x, float y, float z);
|
||||||
|
|
||||||
// Return the packaged terrain data for passing into lower levels of communication
|
// Return the packaged terrain data for passing into lower levels of communication
|
||||||
TerrainData GetTerrainData();
|
TerrainData GetTerrainData();
|
||||||
|
|
||||||
|
|
|
@ -156,7 +156,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// ITerrainChannel.this[x,y]
|
// ITerrainChannel.this[x,y]
|
||||||
public double this[int x, int y]
|
public double this[int x, int y]
|
||||||
{
|
{
|
||||||
get { return (double)m_terrainData[x, y]; }
|
get {
|
||||||
|
if (x < 0 || x >= Width || y < 0 || y >= Height)
|
||||||
|
return 0;
|
||||||
|
return (double)m_terrainData[x, y];
|
||||||
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (Double.IsNaN(value) || Double.IsInfinity(value))
|
if (Double.IsNaN(value) || Double.IsInfinity(value))
|
||||||
|
@ -166,6 +170,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ITerrainChannel.GetHieghtAtXYZ(x, y, z)
|
||||||
|
public float GetHeightAtXYZ(float x, float y, float z)
|
||||||
|
{
|
||||||
|
if (x < 0 || x >= Width || y < 0 || y >= Height)
|
||||||
|
return 0;
|
||||||
|
return m_terrainData[(int)x, (int)y];
|
||||||
|
}
|
||||||
|
|
||||||
// ITerrainChannel.Tainted()
|
// ITerrainChannel.Tainted()
|
||||||
public bool Tainted(int x, int y)
|
public bool Tainted(int x, int y)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue