From b8da9c3a64b84ab14642bad8c79d3b2ed62e62fb Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Mon, 23 Jul 2007 05:29:52 +0000 Subject: * Major style changes in libTerrain.Channel - now uses .NET-style naming syntax. * Issue#218 - Updated mySQL region table. --- .../libTerrainBSD/Channel/Common.cs | 42 +++++++++++----------- .../libTerrainBSD/Channel/Editing/Flatten.cs | 28 +++++++-------- .../libTerrainBSD/Channel/Editing/Raise.cs | 14 ++++---- .../libTerrainBSD/Channel/File.cs | 4 +-- .../libTerrainBSD/Channel/Generators/Fracture.cs | 10 +++--- .../libTerrainBSD/Channel/Generators/Gradient.cs | 8 ++--- .../Channel/Generators/HillPlanter.cs | 16 ++++----- .../libTerrainBSD/Channel/Generators/Noise.cs | 2 +- .../libTerrainBSD/Channel/Generators/Spiral.cs | 18 +++++----- .../libTerrainBSD/Channel/Generators/Voronoi.cs | 12 +++---- .../libTerrainBSD/Channel/Generators/Worms.cs | 4 +-- .../libTerrainBSD/Channel/Grid.cs | 38 ++++++++++---------- .../Channel/Manipulators/AerobicErosion.cs | 30 ++++++++-------- .../Channel/Manipulators/HydraulicErosion.cs | 14 ++++---- .../Channel/Manipulators/ThermalWeathering.cs | 10 +++--- .../libTerrainBSD/Channel/Neighbours.cs | 12 +++---- 16 files changed, 131 insertions(+), 131 deletions(-) (limited to 'OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel') diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Common.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Common.cs index d56f7a5..0d6d0fc 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Common.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Common.cs @@ -35,23 +35,23 @@ namespace libTerrain { public partial class Channel { - public int getWidth() + public int GetWidth() { return w; } - public int getHeight() + public int GetHeight() { return h; } - public Channel copy() + public Channel Copy() { Channel x = new Channel(w, h); x.map = (double[,])this.map.Clone(); return x; } - public void set(int x, int y, double val) + public void Set(int x, int y, double val) { if (x >= w) throw new Exception("Bounds error while setting pixel (width)"); @@ -65,7 +65,7 @@ namespace libTerrain map[x, y] = val; } - public void setClip(int x, int y, double val) + public void SetClip(int x, int y, double val) { if (x >= w) throw new Exception("Bounds error while setting pixel (width)"); @@ -84,7 +84,7 @@ namespace libTerrain map[x, y] = val; } - private double getBilinearInterpolate(double x, double y) + private double GetBilinearInterpolate(double x, double y) { if (x > w - 2.0) x = w - 2.0; @@ -95,11 +95,11 @@ namespace libTerrain if (y < 0.0) y = 0.0; - int STEP_SIZE = 1; - double h00 = get((int)x, (int)y); - double h10 = get((int)x + STEP_SIZE, (int)y); - double h01 = get((int)x, (int)y + STEP_SIZE); - double h11 = get((int)x + STEP_SIZE, (int)y + STEP_SIZE); + int stepSize = 1; + double h00 = Get((int)x, (int)y); + double h10 = Get((int)x + stepSize, (int)y); + double h01 = Get((int)x, (int)y + stepSize); + double h11 = Get((int)x + stepSize, (int)y + stepSize); double h1 = h00; double h2 = h10; double h3 = h01; @@ -114,7 +114,7 @@ namespace libTerrain return hi; } - public double get(int x, int y) + public double Get(int x, int y) { if (x >= w) x = w - 1; @@ -127,12 +127,12 @@ namespace libTerrain return map[x, y]; } - public void setWrap(int x, int y, double val) + public void SetWrap(int x, int y, double val) { map[x % w, y % h] = val; } - public void setWrapClip(int x, int y, double val) + public void SetWrapClip(int x, int y, double val) { if (val > 1.0) val = 1.0; @@ -142,7 +142,7 @@ namespace libTerrain map[x % w, y % h] = val; } - public void fill(double val) + public void Fill(double val) { int x, y; for (x = 0; x < w; x++) @@ -154,7 +154,7 @@ namespace libTerrain } } - public void fill(double min, double max, double val) + public void Fill(double min, double max, double val) { int x, y; for (x = 0; x < w; x++) @@ -167,7 +167,7 @@ namespace libTerrain } } - public double findMax() + public double FindMax() { int x, y; double max = double.MinValue; @@ -184,7 +184,7 @@ namespace libTerrain return max; } - public double findMin() + public double FindMin() { int x, y; double min = double.MaxValue; @@ -201,7 +201,7 @@ namespace libTerrain return min; } - public double sum() + public double Sum() { int x, y; double sum = 0.0; @@ -217,9 +217,9 @@ namespace libTerrain return sum; } - public double avg() + public double Avg() { - return sum() / (w * h); + return Sum() / (w * h); } } } diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs index eaca695..57ba729 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs @@ -42,14 +42,14 @@ namespace libTerrain /// The Y coordinate of the terrain mask /// The size of the terrain mask /// The scale of the terrain mask - public void flatten(double rx, double ry, double size, double amount) + public void Flatten(double rx, double ry, double size, double amount) { // Generate the mask Channel temp = new Channel(w, h); - temp.fill(0); - temp.raise(rx, ry, size, amount); - temp.normalise(); - double total_mod = temp.sum(); + temp.Fill(0); + temp.Raise(rx, ry, size, amount); + temp.Normalise(); + double total_mod = temp.Sum(); // Establish the average height under the area Channel newmap = new Channel(w, h); @@ -57,26 +57,26 @@ namespace libTerrain newmap *= temp; - double total_terrain = newmap.sum(); + double total_terrain = newmap.Sum(); double avg_height = total_terrain / total_mod; // Create a flat terrain using the average height Channel flat = new Channel(w, h); - flat.fill(avg_height); + flat.Fill(avg_height); // Blend the current terrain with the average height terrain // using the "raised" empty terrain as a mask - blend(flat, temp); + Blend(flat, temp); } - public void flatten(Channel mask, double amount) + public void Flatten(Channel mask, double amount) { // Generate the mask Channel temp = mask * amount; - temp.clip(0, 1); // Cut off out-of-bounds values + temp.Clip(0, 1); // Cut off out-of-bounds values - double total_mod = temp.sum(); + double total_mod = temp.Sum(); // Establish the average height under the area Channel map = new Channel(w, h); @@ -84,16 +84,16 @@ namespace libTerrain map *= temp; - double total_terrain = map.sum(); + double total_terrain = map.Sum(); double avg_height = total_terrain / total_mod; // Create a flat terrain using the average height Channel flat = new Channel(w, h); - flat.fill(avg_height); + flat.Fill(avg_height); // Blend the current terrain with the average height terrain // using the "raised" empty terrain as a mask - blend(flat, temp); + Blend(flat, temp); } } } \ No newline at end of file diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Raise.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Raise.cs index d47f8fb..7bccef3 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Raise.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Raise.cs @@ -42,9 +42,9 @@ namespace libTerrain /// The center the Y coordinate of where you wish to raise the land /// The radius of the dimple /// How much impact to add to the terrain (0..2 usually) - public void raise(double rx, double ry, double size, double amount) + public void Raise(double rx, double ry, double size, double amount) { - raiseSphere(rx, ry, size, amount); + RaiseSphere(rx, ry, size, amount); } /// @@ -54,7 +54,7 @@ namespace libTerrain /// The center the Y coordinate of where you wish to raise the land /// The radius of the sphere dimple /// How much impact to add to the terrain (0..2 usually) - public void raiseSphere(double rx, double ry, double size, double amount) + public void RaiseSphere(double rx, double ry, double size, double amount) { int x, y; for (x = 0; x < w; x++) @@ -80,7 +80,7 @@ namespace libTerrain /// The center the Y coordinate of where you wish to raise the land /// The radius of the cone /// How much impact to add to the terrain (0..2 usually) - public void raiseCone(double rx, double ry, double size, double amount) + public void RaiseCone(double rx, double ry, double size, double amount) { int x, y; for (x = 0; x < w; x++) @@ -105,9 +105,9 @@ namespace libTerrain /// The center the Y coordinate of where you wish to lower the land /// The radius of the sphere dimple /// How much impact to remove from the terrain (0..2 usually) - public void lower(double rx, double ry, double size, double amount) + public void Lower(double rx, double ry, double size, double amount) { - lowerSphere(rx, ry, size, amount); + LowerSphere(rx, ry, size, amount); } /// @@ -117,7 +117,7 @@ namespace libTerrain /// The center the Y coordinate of where you wish to lower the land /// The radius of the sphere dimple /// How much impact to remove from the terrain (0..2 usually) - public void lowerSphere(double rx, double ry, double size, double amount) + public void LowerSphere(double rx, double ry, double size, double amount) { int x, y; for (x = 0; x < w; x++) diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/File.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/File.cs index a27671d..e09dc5a 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/File.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/File.cs @@ -35,7 +35,7 @@ namespace libTerrain { partial class Channel { - public Channel loadImage(string filename) + public Channel LoadImage(string filename) { Bitmap bit = new Bitmap(filename); Channel chan = new Channel(bit.Width, bit.Height); @@ -53,7 +53,7 @@ namespace libTerrain return chan; } - public void saveImage(string filename) + public void SaveImage(string filename) { Bitmap bit = new Bitmap(w, h, System.Drawing.Imaging.PixelFormat.Format24bppRgb); int x, y; diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs index 24a8fc4..b585caa 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs @@ -42,7 +42,7 @@ namespace libTerrain /// /// /// - private int[] radialEdge256(int val) + private int[] RadialEdge256(int val) { // Four cases: // 1. 000..255 return 0,val @@ -79,7 +79,7 @@ namespace libTerrain throw new Exception("Out of bounds parameter (val)"); } - public void fracture(int number, double scalemin, double scalemax) + public void Fracture(int number, double scalemin, double scalemax) { Random rand = new Random(seed); @@ -87,8 +87,8 @@ namespace libTerrain { int[] a, b; - a = radialEdge256(rand.Next(1023)); // TODO: Broken - b = radialEdge256(rand.Next(1023)); // TODO: Broken + a = RadialEdge256(rand.Next(1023)); // TODO: Broken + b = RadialEdge256(rand.Next(1023)); // TODO: Broken double z = rand.NextDouble(); for (int x = 0; x < w; x++) @@ -104,7 +104,7 @@ namespace libTerrain } } } - normalise(); + Normalise(); } } } \ No newline at end of file diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Gradient.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Gradient.cs index c2ad882..0c9b3c3 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Gradient.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Gradient.cs @@ -35,7 +35,7 @@ namespace libTerrain partial class Channel { - public void gradientCube() + public void GradientCube() { int x, y; for (x = 0; x < w; x++) @@ -45,10 +45,10 @@ namespace libTerrain map[x, y] = x*y; } } - normalise(); + Normalise(); } - public void gradientStripe() + public void GradientStripe() { int x, y; for (x = 0; x < w; x++) @@ -58,7 +58,7 @@ namespace libTerrain map[x, y] = x; } } - normalise(); + Normalise(); } } } \ No newline at end of file diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/HillPlanter.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/HillPlanter.cs index e8a660f..3b8e963 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/HillPlanter.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/HillPlanter.cs @@ -44,7 +44,7 @@ namespace libTerrain /// Whether to bias hills towards the center of the map /// Whether to add hills together or to pick the largest value /// Generates hill-shaped noise instead of consistent hills - public void hillsSpheres(int number, double scale_min, double scale_range, bool island, bool additive, bool noisy) + public void HillsSpheres(int number, double scale_min, double scale_range, bool island, bool additive, bool noisy) { Random random = new Random(seed); @@ -95,7 +95,7 @@ namespace libTerrain } } - normalise(); + Normalise(); } /// @@ -108,7 +108,7 @@ namespace libTerrain /// Whether to bias hills towards the center of the map /// Whether to add hills together or to pick the largest value /// Generates hill-shaped noise instead of consistent hills - public void hillsCones(int number, double scale_min, double scale_range, bool island, bool additive, bool noisy) + public void HillsCones(int number, double scale_min, double scale_range, bool island, bool additive, bool noisy) { Random random = new Random(seed); @@ -158,10 +158,10 @@ namespace libTerrain } } - normalise(); + Normalise(); } - public void hillsBlocks(int number, double scale_min, double scale_range, bool island, bool additive, bool noisy) + public void HillsBlocks(int number, double scale_min, double scale_range, bool island, bool additive, bool noisy) { Random random = new Random(seed); @@ -212,10 +212,10 @@ namespace libTerrain } } - normalise(); + Normalise(); } - public void hillsSquared(int number, double scale_min, double scale_range, bool island, bool additive, bool noisy) + public void HillsSquared(int number, double scale_min, double scale_range, bool island, bool additive, bool noisy) { Random random = new Random(seed); @@ -268,7 +268,7 @@ namespace libTerrain } } - normalise(); + Normalise(); } } diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Noise.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Noise.cs index e95fb2e..ebb1771 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Noise.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Noise.cs @@ -38,7 +38,7 @@ namespace libTerrain /// Fills a channel with 0..1 noise /// /// 3-Clause BSD Licensed - public void noise() + public void Noise() { Random rand = new Random(seed); int x, y; diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Spiral.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Spiral.cs index 04ac283..aeff730 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Spiral.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Spiral.cs @@ -34,7 +34,7 @@ namespace libTerrain { partial class Channel { - private double[] coordinatesToPolar(int x, int y) + private double[] CoordinatesToPolar(int x, int y) { double theta = Math.Atan2(x - (w / 2), y - (h / 2)); @@ -48,7 +48,7 @@ namespace libTerrain return coords; } - public int[] polarToCoordinates(double r, double theta) { + public int[] PolarToCoordinates(double r, double theta) { double nx; double ny; @@ -78,14 +78,14 @@ namespace libTerrain public void Polar() { - Channel n = this.copy(); + Channel n = this.Copy(); int x, y; for (x = 0; x < w; x++) { for (y = 0; y < h; y++) { - double[] coords = coordinatesToPolar(x,y); + double[] coords = CoordinatesToPolar(x,y); coords[0] += w / 2.0; coords[1] += h / 2.0; @@ -105,8 +105,8 @@ namespace libTerrain r += incRadius; theta += incAngle; - int[] coords = polarToCoordinates(r,theta); - raise(coords[0], coords[1], 20, 1); + int[] coords = PolarToCoordinates(r,theta); + Raise(coords[0], coords[1], 20, 1); } } @@ -122,11 +122,11 @@ namespace libTerrain r += incRadius; theta += incAngle; - int[] coords = polarToCoordinates(r, theta); + int[] coords = PolarToCoordinates(r, theta); points.Add(new Point2D(coords[0],coords[1])); } - voronoiDiagram(points, c); + VoronoiDiagram(points, c); } public void Spiral(double wid, double hig, double offset) @@ -143,7 +143,7 @@ namespace libTerrain map[x, y] += Math.Sin(dx / wid) + Math.Cos(dy / hig); } } - normalise(); + Normalise(); } } } \ No newline at end of file diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Voronoi.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Voronoi.cs index fdd369b..e973d14 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Voronoi.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Voronoi.cs @@ -42,7 +42,7 @@ namespace libTerrain /// A multiple of the channel width and height which will have voronoi points generated in it. /// This is to ensure a more even distribution of the points than pure random allocation. /// The Voronoi diagram type. Usually an array with values consisting of [-1,1]. Experiment with the chain, you can have as many values as you like. - public void voronoiDiagram(int pointsPerBlock, int blockSize, double[] c) + public void VoronoiDiagram(int pointsPerBlock, int blockSize, double[] c) { List points = new List(); Random generator = new Random(seed); @@ -98,10 +98,10 @@ namespace libTerrain } // Normalise the result - normalise(); + Normalise(); } - public void voronoiDiagram(List points, double[] c) + public void VoronoiDiagram(List points, double[] c) { Random generator = new Random(seed); @@ -141,10 +141,10 @@ namespace libTerrain } // Normalise the result - normalise(); + Normalise(); } - public void voroflatDiagram(int pointsPerBlock, int blockSize) + public void VoroflatDiagram(int pointsPerBlock, int blockSize) { List points = new List(); Random generator = new Random(seed); @@ -203,7 +203,7 @@ namespace libTerrain } // Normalise the result - normalise(); + Normalise(); } } } diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Worms.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Worms.cs index 38c8001..38a8023 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Worms.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Worms.cs @@ -42,7 +42,7 @@ namespace libTerrain /// The maximum distance each worm will move each step /// The size of the area around the worm modified /// Do worms start in the middle, or randomly? - public void worms(int number, int rounds, double movement, double size, bool centerspawn) + public void Worms(int number, int rounds, double movement, double size, bool centerspawn) { Random random = new Random(seed); int i, j; @@ -64,7 +64,7 @@ namespace libTerrain { rx += (random.NextDouble() * movement) - (movement / 2.0); ry += (random.NextDouble() * movement) - (movement / 2.0); - raise(rx, ry, size, 1.0); + Raise(rx, ry, size, 1.0); } } } diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Grid.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Grid.cs index 5ba4ca6..a9106b4 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Grid.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Grid.cs @@ -34,10 +34,10 @@ namespace libTerrain { partial class Channel { - public Channel normalise() + public Channel Normalise() { - double max = findMax(); - double min = findMin(); + double max = FindMax(); + double min = FindMin(); int x, y; @@ -52,10 +52,10 @@ namespace libTerrain return this; } - public Channel normalise(double minv, double maxv) + public Channel Normalise(double minv, double maxv) { - double max = findMax(); - double min = findMin(); + double max = FindMax(); + double min = FindMin(); int x, y; @@ -74,7 +74,7 @@ namespace libTerrain return this; } - public Channel clip() + public Channel Clip() { int x, y; @@ -82,14 +82,14 @@ namespace libTerrain { for (y = 0; y < h; y++) { - setClip(x, y, map[x, y]); + SetClip(x, y, map[x, y]); } } return this; } - public Channel clip(double min, double max) + public Channel Clip(double min, double max) { int x, y; for (x = 0; x < w; x++) @@ -105,7 +105,7 @@ namespace libTerrain return this; } - public Channel crop(int x1, int y1, int x2, int y2) + public Channel Crop(int x1, int y1, int x2, int y2) { int width = x1 - x2 + 1; int height = y1 - y2 + 1; @@ -130,7 +130,7 @@ namespace libTerrain return this; } - public Channel addClip(Channel other) + public Channel AddClip(Channel other) { int x, y; for (x = 0; x < w; x++) @@ -147,7 +147,7 @@ namespace libTerrain return this; } - public void smooth(double amount) + public void Smooth(double amount) { double area = amount; double step = amount / 4.0; @@ -167,7 +167,7 @@ namespace libTerrain for (l = 0.0 - area; l < area; l += step) { avgsteps++; - average += getBilinearInterpolate(x + n, y + l); + average += GetBilinearInterpolate(x + n, y + l); } } @@ -177,7 +177,7 @@ namespace libTerrain map = manipulate; } - public void pertubation(double amount) + public void Pertubation(double amount) { // Simple pertubation filter double[,] manipulated = new double[w, h]; @@ -191,14 +191,14 @@ namespace libTerrain { double offset_x = (double)x + (generator.NextDouble() * amount) - (amount / 2.0); double offset_y = (double)y + (generator.NextDouble() * amount) - (amount / 2.0); - double p = getBilinearInterpolate(offset_x, offset_y); + double p = GetBilinearInterpolate(offset_x, offset_y); manipulated[x, y] = p; } } map = manipulated; } - public void pertubationMask(Channel mask) + public void PertubationMask(Channel mask) { // Simple pertubation filter double[,] manipulated = new double[w, h]; @@ -225,14 +225,14 @@ namespace libTerrain if (offset_x < 0) offset_x = 0; - double p = getBilinearInterpolate(offset_x, offset_y); + double p = GetBilinearInterpolate(offset_x, offset_y); manipulated[x, y] = p; } } map = manipulated; } - public Channel blend(Channel other, double amount) + public Channel Blend(Channel other, double amount) { int x, y; for (x = 0; x < w; x++) @@ -245,7 +245,7 @@ namespace libTerrain return this; } - public Channel blend(Channel other, Channel amount) + public Channel Blend(Channel other, Channel amount) { int x, y; for (x = 0; x < w; x++) diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/AerobicErosion.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/AerobicErosion.cs index 97c2762..198c337 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/AerobicErosion.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/AerobicErosion.cs @@ -74,14 +74,14 @@ namespace libTerrain /// The percentage of rock which can be picked up to pickup 0..1 /// The number of erosion rounds (recommended: 25+) /// Drop sediment at the lowest point? - public void AerobicErosion(double windspeed, double pickup_talus_minimum, double drop_talus_minimum, double carry, int rounds, bool lowest, bool usingFluidDynamics) + public void AerobicErosion(double windspeed, double pickupTalusMinimum, double dropTalusMinimum, double carry, int rounds, bool lowest, bool usingFluidDynamics) { Channel wind = new Channel(w, h) ; Channel sediment = new Channel(w, h); int x, y, i, j; - wind = this.copy(); - wind.normalise(); // Cheap wind calculations + wind = this.Copy(); + wind.Normalise(); // Cheap wind calculations wind *= windspeed; if (usingFluidDynamics) @@ -90,7 +90,7 @@ namespace libTerrain } else { - wind.pertubation(30); // Can do better later + wind.Pertubation(30); // Can do better later } for (i = 0; i < rounds; i++) @@ -100,13 +100,13 @@ namespace libTerrain { for (y = 1; y < h - 1; y++) { - double me = get(x, y); + double me = Get(x, y); double surfacearea = 0.3; // Everything will erode even if it's flat. Just slower. for (j = 0; j < 9; j++) { - int[] coords = neighbours(NEIGHBOURS.NEIGHBOUR_MOORE, j); - double target = get(x + coords[0], y + coords[1]); + int[] coords = Neighbours(NeighbourSystem.Moore, j); + double target = Get(x + coords[0], y + coords[1]); surfacearea += Math.Abs(target - me); } @@ -116,7 +116,7 @@ namespace libTerrain if (amount < 0) amount = 0; - if (surfacearea > pickup_talus_minimum) + if (surfacearea > pickupTalusMinimum) { this.map[x, y] -= amount; sediment.map[x, y] += amount; @@ -131,9 +131,9 @@ namespace libTerrain } else { - wind.pertubation(15); // Can do better later + wind.Pertubation(15); // Can do better later wind.seed++; - sediment.pertubation(10); // Sediment is blown around a bit + sediment.Pertubation(10); // Sediment is blown around a bit sediment.seed++; } @@ -142,15 +142,15 @@ namespace libTerrain { for (y = 1; y < h - 1; y++) { - double me = get(x, y); + double me = Get(x, y); double surfacearea = 0.01; // Flat land does not get deposition double min = double.MaxValue; int[] minside = new int[2]; for (j = 0; j < 9; j++) { - int[] coords = neighbours(NEIGHBOURS.NEIGHBOUR_MOORE, j); - double target = get(x + coords[0], y + coords[1]); + int[] coords = Neighbours(NeighbourSystem.Moore, j); + double target = Get(x + coords[0], y + coords[1]); surfacearea += Math.Abs(target - me); @@ -166,7 +166,7 @@ namespace libTerrain if (amount < 0) amount = 0; - if (surfacearea > drop_talus_minimum) + if (surfacearea > dropTalusMinimum) { this.map[x + minside[0], y + minside[1]] += amount; sediment.map[x, y] -= amount; @@ -178,7 +178,7 @@ namespace libTerrain Channel myself = this; myself += sediment; - myself.normalise(); + myself.Normalise(); } } } \ No newline at end of file diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/HydraulicErosion.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/HydraulicErosion.cs index e3463c1..5ace241 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/HydraulicErosion.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/HydraulicErosion.cs @@ -34,17 +34,17 @@ namespace libTerrain { partial class Channel { - public void hydraulicErosion(Channel rain, double evaporation, double solubility, int frequency, int rounds) + public void HydraulicErosion(Channel rain, double evaporation, double solubility, int frequency, int rounds) { Channel water = new Channel(w, h); Channel sediment = new Channel(w, h); Channel terrain = this; Channel waterFlow = new Channel(w, h); - NEIGHBOURS type = NEIGHBOURS.NEIGHBOUR_MOORE; + NeighbourSystem type = NeighbourSystem.Moore; int NEIGHBOUR_ME = 4; - int NEIGHBOUR_MAX = type == NEIGHBOURS.NEIGHBOUR_MOORE ? 9 : 5; + int NEIGHBOUR_MAX = type == NeighbourSystem.Moore ? 9 : 5; for (int i = 0; i < rounds; i++) { @@ -66,7 +66,7 @@ namespace libTerrain { if (j != NEIGHBOUR_ME) { - int[] coords = neighbours(type, j); + int[] coords = Neighbours(type, j); coords[0] += x; coords[1] += y; @@ -107,13 +107,13 @@ namespace libTerrain { if (j != NEIGHBOUR_ME) { - int[] coords = neighbours(type, j); + int[] coords = Neighbours(type, j); coords[0] += x; coords[1] += y; if (diffs[j] > 0) { - waterFlow.setWrap(coords[0], coords[1], waterFlow.map[coords[0], coords[1]] + diffs[j] * totalInverseDiff); + waterFlow.SetWrap(coords[0], coords[1], waterFlow.map[coords[0], coords[1]] + diffs[j] * totalInverseDiff); } } } @@ -121,7 +121,7 @@ namespace libTerrain } water += waterFlow; - waterFlow.fill(0); + waterFlow.Fill(0); water *= evaporation; diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/ThermalWeathering.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/ThermalWeathering.cs index 7514971..449bf85 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/ThermalWeathering.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/ThermalWeathering.cs @@ -40,7 +40,7 @@ namespace libTerrain /// The rock angle (represented as a dy/dx ratio) at which point it will be succeptible to breakage /// The number of erosion rounds /// The amount of rock to carry each round - public Channel thermalWeathering(double talus, int rounds, double c) + public Channel ThermalWeathering(double talus, int rounds, double c) { double[,] lastFrame; double[,] thisFrame; @@ -48,10 +48,10 @@ namespace libTerrain lastFrame = (double[,])map.Clone(); thisFrame = (double[,])map.Clone(); - NEIGHBOURS type = NEIGHBOURS.NEIGHBOUR_MOORE; // Using moore neighbourhood (twice as computationally expensive) + NeighbourSystem type = NeighbourSystem.Moore; // Using moore neighbourhood (twice as computationally expensive) int NEIGHBOUR_ME = 4; // I am always 4 in both systems. - int NEIGHBOUR_MAX = type == NEIGHBOURS.NEIGHBOUR_MOORE ? 9 : 5; + int NEIGHBOUR_MAX = type == NeighbourSystem.Moore ? 9 : 5; int frames = rounds; // Number of thermal erosion iterations to run int i, j; @@ -67,7 +67,7 @@ namespace libTerrain { if (j != NEIGHBOUR_ME) { - int[] coords = neighbours(type, j); + int[] coords = Neighbours(type, j); coords[0] += x; coords[1] += y; @@ -103,7 +103,7 @@ namespace libTerrain map = thisFrame; - normalise(); // Just to guaruntee a smooth 0..1 value + Normalise(); // Just to guaruntee a smooth 0..1 value return this; } } diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Neighbours.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Neighbours.cs index cb63d21..6dc2e30 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Neighbours.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Neighbours.cs @@ -34,13 +34,13 @@ namespace libTerrain { partial class Channel { - enum NEIGHBOURS + enum NeighbourSystem { - NEIGHBOUR_MOORE, - NEIGHBOUR_VONNEUMANN + Moore, + VonNeumann }; - private int[] neighbours(NEIGHBOURS type, int index) + private int[] Neighbours(NeighbourSystem type, int index) { int[] coord = new int[2]; @@ -48,7 +48,7 @@ namespace libTerrain switch (type) { - case NEIGHBOURS.NEIGHBOUR_MOORE: + case NeighbourSystem.Moore: switch (index) { case 1: @@ -101,7 +101,7 @@ namespace libTerrain } break; - case NEIGHBOURS.NEIGHBOUR_VONNEUMANN: + case NeighbourSystem.VonNeumann: switch (index) { case 1: -- cgit v1.1