From c070d2bbf3eca682166d9e1875aff194c61c3154 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sat, 7 Apr 2007 17:30:11 +0000 Subject: ZOMG Comments! --- OpenSim.Terrain.BasicTerrain/Normalise.cs | 19 +++++++++++++++++++ OpenSim.Terrain.BasicTerrain/TerrainEngine.cs | 20 ++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/OpenSim.Terrain.BasicTerrain/Normalise.cs b/OpenSim.Terrain.BasicTerrain/Normalise.cs index 507795b..0d37f44 100644 --- a/OpenSim.Terrain.BasicTerrain/Normalise.cs +++ b/OpenSim.Terrain.BasicTerrain/Normalise.cs @@ -6,6 +6,10 @@ namespace OpenSim.Terrain.BasicTerrain { static class Normalise { + /// + /// Converts the heightmap to values ranging from 0..1 + /// + /// The heightmap to be normalised public static void normalise(float[,] map) { double max = findMax(map); @@ -24,6 +28,11 @@ namespace OpenSim.Terrain.BasicTerrain } } + /// + /// Converts the heightmap to values ranging from 0.. + /// + /// The heightmap to be normalised + /// The new maximum height value of the map public static void normalise(float[,] map, double newmax) { double max = findMax(map); @@ -42,6 +51,11 @@ namespace OpenSim.Terrain.BasicTerrain } } + /// + /// Finds the largest value in the heightmap + /// + /// The heightmap + /// The highest value public static double findMax(float[,] map) { int x, y; @@ -61,6 +75,11 @@ namespace OpenSim.Terrain.BasicTerrain return max; } + /// + /// Finds the lowest value in a heightmap + /// + /// The heightmap + /// The minimum value public static double findMin(float[,] map) { int x, y; diff --git a/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs b/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs index 45da742..87dbf7e 100644 --- a/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs +++ b/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs @@ -7,10 +7,19 @@ namespace OpenSim.Terrain { public class TerrainEngine { + /// + /// A [normally] 256x256 heightmap + /// public float[,] map; + /// + /// A 256x256 heightmap storing water height values + /// public float[,] water; int w, h; + /// + /// Generate a new TerrainEngine instance and creates a new heightmap + /// public TerrainEngine() { w = 256; @@ -90,6 +99,14 @@ namespace OpenSim.Terrain RaiseLower.raiseSphere(this.map, rx, ry, size, amount); } } + + /// + /// Lowers the land in a sphere around the specified coordinates + /// + /// The center of the sphere at the X axis + /// The center of the sphere at the Y axis + /// The radius of the sphere in meters + /// Scale the height of the sphere by this amount (recommended 0..2) public void lower(double rx, double ry, double size, double amount) { lock (map) @@ -98,6 +115,9 @@ namespace OpenSim.Terrain } } + /// + /// Generates a simple set of hills in the shape of an island + /// public void hills() { lock (map) -- cgit v1.1