From f84937367f7180140bd17444d507977f9b7e3d2e Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sat, 21 Jul 2007 22:25:42 +0000 Subject: [PATCH] * Deleted libTerrain-BSD.dll * Added libTerrain to BasicTerrain directly as a subfolder --- .../Terrain.BasicTerrain/TerrainEngine.cs | 4 +- .../libTerrainBSD/Bitmap/Bitmap.cs | 77 +++++ .../libTerrainBSD/Channel/Channel.cs | 66 +++++ .../libTerrainBSD/Channel/Common.cs | 228 ++++++++++++++ .../libTerrainBSD/Channel/Editing/Flatten.cs | 102 +++++++ .../libTerrainBSD/Channel/Editing/Raise.cs | 142 +++++++++ .../libTerrainBSD/Channel/File.cs | 75 +++++ .../Channel/Generators/Cellular.cs | 1 + .../Channel/Generators/Fracture.cs | 113 +++++++ .../Channel/Generators/Gradient.cs | 67 +++++ .../Channel/Generators/HillPlanter.cs | 278 ++++++++++++++++++ .../Channel/Generators/Midpoint.cs | 1 + .../Channel/Generators/Mountain.cs | 1 + .../libTerrainBSD/Channel/Generators/Noise.cs | 57 ++++ .../Channel/Generators/Spiral.cs | 152 ++++++++++ .../Channel/Generators/Voronoi.cs | 212 +++++++++++++ .../libTerrainBSD/Channel/Generators/Worms.cs | 75 +++++ .../libTerrainBSD/Channel/Grid.cs | 264 +++++++++++++++++ .../Channel/Manipulators/AerobicErosion.cs | 170 +++++++++++ .../Channel/Manipulators/HydraulicErosion.cs | 1 + .../Channel/Manipulators/ThermalWeathering.cs | 113 +++++++ .../libTerrainBSD/Channel/Neighbours.cs | 144 +++++++++ .../libTerrainBSD/Channel/Operators.cs | 221 ++++++++++++++ .../libTerrainBSD/Tools/Point2D.cs | 49 +++ .../libTerrainBSD/Tools/Tools.cs | 60 ++++ bin/libTerrain-BSD.dll | Bin 32768 -> 0 bytes prebuild.xml | 1 - 27 files changed, 2671 insertions(+), 3 deletions(-) create mode 100644 OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Bitmap/Bitmap.cs create mode 100644 OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Channel.cs create mode 100644 OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Common.cs create mode 100644 OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs create mode 100644 OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Raise.cs create mode 100644 OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/File.cs create mode 100644 OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Cellular.cs create mode 100644 OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs create mode 100644 OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Gradient.cs create mode 100644 OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/HillPlanter.cs create mode 100644 OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Midpoint.cs create mode 100644 OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Mountain.cs create mode 100644 OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Noise.cs create mode 100644 OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Spiral.cs create mode 100644 OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Voronoi.cs create mode 100644 OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Worms.cs create mode 100644 OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Grid.cs create mode 100644 OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/AerobicErosion.cs create mode 100644 OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/HydraulicErosion.cs create mode 100644 OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/ThermalWeathering.cs create mode 100644 OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Neighbours.cs create mode 100644 OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Operators.cs create mode 100644 OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Point2D.cs create mode 100644 OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Tools.cs delete mode 100644 bin/libTerrain-BSD.dll diff --git a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs index f965c41955..7eb90a8af3 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs @@ -111,11 +111,11 @@ namespace OpenSim.Region.Terrain { if ((heightmap.get(x, y) > revertmap.get(x, y) + maxRaise)) { - heightmap.map[x, y] = revertmap(x, y) + maxRaise; + heightmap.map[x, y] = revertmap.get(x, y) + maxRaise; } if ((heightmap.get(x, y) > revertmap.get(x, y) - minLower)) { - heightmap.map[x, y] = revertmap(x, y) - minLower; + heightmap.map[x, y] = revertmap.get(x, y) - minLower; } } } diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Bitmap/Bitmap.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Bitmap/Bitmap.cs new file mode 100644 index 0000000000..923da47b86 --- /dev/null +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Bitmap/Bitmap.cs @@ -0,0 +1,77 @@ +/* +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of libTerrain nor the names of + its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +using System; +using System.Collections.Generic; +using System.Text; +using System.Drawing; + +namespace libTerrain +{ + class Raster + { + int w; + int h; + Bitmap bmp; + + public Raster(int width, int height) + { + w = width; + h = height; + bmp = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format24bppRgb); + } + + public Channel toChannel() + { + Channel chan = new Channel(bmp.Width, bmp.Height); + + int x, y; + for (x = 0; x < bmp.Width; x++) + { + for (y = 0; y < bmp.Height; y++) + { + Color val = bmp.GetPixel(x, y); + chan.map[x, y] = (((double)val.R + (double)val.G + (double)val.B) / 3.0) / 255.0; + } + } + + return chan; + } + + public void drawText(string txt, string font, double size) + { + Graphics gd = Graphics.FromImage(bmp); + //gd.DrawString(txt, + + + } + } +} diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Channel.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Channel.cs new file mode 100644 index 0000000000..9849ef2f9f --- /dev/null +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Channel.cs @@ -0,0 +1,66 @@ +/* +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of libTerrain nor the names of + its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +using System; +using System.Collections.Generic; +using System.Text; + + +/* Channel + * A channel is a single heightmap array + * */ + +namespace libTerrain +{ + partial class Channel + { + public double[,] map; + public int w; + public int h; + + public int seed = 1338; // One better than 1337 + + public Channel() + { + w = 256; + h = 256; + map = new double[w, h]; + } + + public Channel(int width, int height) + { + w = width; + h = height; + map = new double[w, h]; + } + + } +} diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Common.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Common.cs new file mode 100644 index 0000000000..438359ce8c --- /dev/null +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Common.cs @@ -0,0 +1,228 @@ +/* +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of libTerrain nor the names of + its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +using System; +using System.Collections.Generic; +using System.Text; + +namespace libTerrain +{ + public partial class Channel + { + public int getWidth() + { + return w; + } + public int getHeight() + { + return h; + } + + 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) + { + if (x >= w) + throw new Exception("Bounds error while setting pixel (width)"); + if (y >= h) + throw new Exception("Bounds error while setting pixel (height)"); + if (x < 0) + throw new Exception("Bounds error while setting pixel (width)"); + if (y < 0) + throw new Exception("Bounds error while setting pixel (height)"); + + map[x, y] = val; + } + + public void setClip(int x, int y, double val) + { + if (x >= w) + throw new Exception("Bounds error while setting pixel (width)"); + if (y >= h) + throw new Exception("Bounds error while setting pixel (height)"); + if (x < 0) + throw new Exception("Bounds error while setting pixel (width)"); + if (y < 0) + throw new Exception("Bounds error while setting pixel (height)"); + + if (val > 1.0) + val = 1.0; + if (val < 0.0) + val = 0.0; + + map[x, y] = val; + } + + private double getBilinearInterpolate(double x, double y) + { + if (x > w - 2.0) + x = w - 2.0; + if (y > h - 2.0) + y = h - 2.0; + if (x < 0.0) + x = 0.0; + 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); + double h1 = h00; + double h2 = h10; + double h3 = h01; + double h4 = h11; + double a00 = h1; + double a10 = h2 - h1; + double a01 = h3 - h1; + double a11 = h1 - h2 - h3 + h4; + double partialx = x - (int)x; + double partialz = y - (int)y; + double hi = a00 + (a10 * partialx) + (a01 * partialz) + (a11 * partialx * partialz); + return hi; + } + + public double get(int x, int y) + { + if (x >= w) + x = w - 1; + if (y >= h) + y = h - 1; + if (x < 0) + x = 0; + if (y < 0) + y = 0; + return map[x, y]; + } + + public void setWrap(int x, int y, double val) + { + map[x % w, y % h] = val; + } + + public void setWrapClip(int x, int y, double val) + { + if (val > 1.0) + val = 1.0; + if (val < 0.0) + val = 0.0; + + map[x % w, y % h] = val; + } + + public void fill(double val) + { + int x, y; + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + map[x, y] = val; + } + } + } + + public void fill(double min, double max, double val) + { + int x, y; + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + if (map[x, y] >= min && map[x, y] <= max) + map[x, y] = val; + } + } + } + + public double findMax() + { + int x, y; + double max = double.MinValue; + + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + if (map[x, y] > max) + max = map[x, y]; + } + } + + return max; + } + + public double findMin() + { + int x, y; + double min = double.MaxValue; + + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + if (map[x, y] < min) + min = map[x, y]; + } + } + + return min; + } + + public double sum() + { + int x, y; + double sum = 0.0; + + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + sum += map[x, y]; + } + } + + return sum; + } + + public double avg() + { + 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 new file mode 100644 index 0000000000..5e5254d223 --- /dev/null +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Flatten.cs @@ -0,0 +1,102 @@ +/* +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of libTerrain nor the names of + its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +using System; +using System.Collections.Generic; +using System.Text; + +namespace libTerrain +{ + partial class Channel + { + /// + /// Flattens the area underneath rx,ry by moving it to the average of the area. Uses a spherical mask provided by the raise() function. + /// + /// The X coordinate of the terrain mask + /// 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) + { + // 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(); + + // Establish the average height under the area + Channel newmap = new Channel(w, h); + newmap.map = (double[,])map.Clone(); + + newmap *= temp; + + 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); + + // Blend the current terrain with the average height terrain + // using the "raised" empty terrain as a mask + blend(flat, temp); + + } + + public void flatten(Channel mask, double amount) + { + // Generate the mask + Channel temp = mask * amount; + temp.clip(0, 1); // Cut off out-of-bounds values + + double total_mod = temp.sum(); + + // Establish the average height under the area + Channel map = new Channel(w, h); + map.map = (double[,])this.map.Clone(); + + map *= temp; + + 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); + + // Blend the current terrain with the average height terrain + // using the "raised" empty terrain as a mask + 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 new file mode 100644 index 0000000000..21d26452d0 --- /dev/null +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Editing/Raise.cs @@ -0,0 +1,142 @@ +/* +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of libTerrain nor the names of + its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +using System; +using System.Collections.Generic; +using System.Text; + +namespace libTerrain +{ + partial class Channel + { + /// + /// Raises land around the selection + /// + /// The center the X coordinate of where you wish to raise the land + /// 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) + { + raiseSphere(rx, ry, size, amount); + } + + /// + /// Raises land in a sphere around the selection + /// + /// The center the X coordinate of where you wish to raise the land + /// 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) + { + int x, y; + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + double z = size; + z *= z; + z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry)); + + if (z < 0) + z = 0; + + map[x, y] += z * amount; + } + } + } + + /// + /// Raises land in a cone around the selection + /// + /// The center the X coordinate of where you wish to raise the land + /// 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) + { + int x, y; + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + double z = size; + z -= Math.Sqrt(((x - rx) * (x - rx)) + ((y - ry) * (y - ry))); + + if (z < 0) + z = 0; + + map[x, y] += z * amount; + } + } + } + + /// + /// Lowers land in a sphere around the selection + /// + /// The center the X coordinate of where you wish to lower the land + /// 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) + { + lowerSphere(rx, ry, size, amount); + } + + /// + /// Lowers land in a sphere around the selection + /// + /// The center the X coordinate of where you wish to lower the land + /// 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) + { + int x, y; + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + double z = size; + z *= z; + z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry)); + + if (z < 0) + z = 0; + + map[x, y] -= z * amount; + } + } + } + } +} \ No newline at end of file diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/File.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/File.cs new file mode 100644 index 0000000000..4163a5fbe9 --- /dev/null +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/File.cs @@ -0,0 +1,75 @@ +/* +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of libTerrain nor the names of + its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +using System; +using System.Collections.Generic; +using System.Text; +using System.Drawing; + +namespace libTerrain +{ + partial class Channel + { + public Channel loadImage(string filename) + { + Bitmap bit = new Bitmap(filename); + Channel chan = new Channel(bit.Width, bit.Height); + + int x, y; + for (x = 0; x < bit.Width; x++) + { + for (y = 0; y < bit.Height; y++) + { + Color val = bit.GetPixel(x, y); + chan.map[x, y] = (((double)val.R + (double)val.G + (double)val.B) / 3.0) / 255.0; + } + } + + return chan; + } + + public void saveImage(string filename) + { + Bitmap bit = new Bitmap(w, h, System.Drawing.Imaging.PixelFormat.Format24bppRgb); + int x, y; + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + int val = Math.Min(255, (int)(map[x,y] * 255)); + Color col = Color.FromArgb(val,val,val); + bit.SetPixel(x, y, col); + } + } + bit.Save(filename); + } + } +} diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Cellular.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Cellular.cs new file mode 100644 index 0000000000..0cec05d3dd --- /dev/null +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Cellular.cs @@ -0,0 +1 @@ +/* Needs BSD rewrite */ \ No newline at end of file diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs new file mode 100644 index 0000000000..2a24ecf14a --- /dev/null +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs @@ -0,0 +1,113 @@ +/* +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of libTerrain nor the names of + its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +using System; +using System.Collections.Generic; +using System.Text; + +namespace libTerrain +{ + partial class Channel + { + /// + /// Produces a set of coordinates defined by an edge point. Eg - 0 = 0,0. 256 = 0,256. 512 = 256,256 + /// Assumes a 256^2 heightmap. This needs fixing for input values of w,h + /// + /// + /// + /// + /// + private int[] radialEdge256(int val) + { + // Four cases: + // 1. 000..255 return 0,val + // 2. 256..511 return val - 256,255 + // 3. 512..767 return 255, val - 511 + // 4. 768..1023 return val - 768,0 + + int[] ret = new int[2]; + + if (val < 256) + { + ret[0] = 0; + ret[1] = val; + return ret; + } + if (val < 512) + { + ret[0] = (val % 256); + ret[1] = 255; + return ret; + } + if (val < 768) + { + ret[0] = 255; + ret[1] = 255 - (val % 256); + return ret; + } + if (val < 1024) + { + ret[0] = 255 - (val % 256); + ret[1] = 255; + return ret; + } + + throw new Exception("Out of bounds parameter (val)"); + } + public void fracture(int number, double scalemin, double scalemax) + { + Random rand = new Random(seed); + + for (int i = 0; i < number; i++) + { + int[] a, b; + + 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++) + { + for (int y = 0; y < h; y++) + { + double miny = Tools.linearInterpolate(a[1], b[1], (double)x / (double)w); + + if (y > miny) + { + map[x, y] += Tools.linearInterpolate(scalemin, scalemax, z); + } + } + } + } + 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 new file mode 100644 index 0000000000..8f45bf7749 --- /dev/null +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Gradient.cs @@ -0,0 +1,67 @@ +/* +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of libTerrain nor the names of + its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +using System; +using System.Collections.Generic; +using System.Text; + +namespace libTerrain +{ + partial class Channel + { + + public void gradientCube() + { + int x, y; + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + map[x, y] = x*y; + } + } + normalise(); + } + + public void gradientStripe() + { + int x, y; + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + map[x, y] = x; + } + } + 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 new file mode 100644 index 0000000000..9316911db3 --- /dev/null +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/HillPlanter.cs @@ -0,0 +1,278 @@ +/* +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of libTerrain nor the names of + its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +using System; +using System.Collections.Generic; +using System.Text; + +namespace libTerrain +{ + partial class Channel + { + /// + /// Generates a series of spheres which are then either max()'d or added together. Inspired by suggestion from jh. + /// + /// 3-Clause BSD Licensed + /// The number of hills to generate + /// The minimum size of each hill + /// The maximum size of each hill + /// 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) + { + Random random = new Random(seed); + + int x, y; + int i; + + for (i = 0; i < number; i++) + { + double rx = Math.Min(255.0, random.NextDouble() * w); + double ry = Math.Min(255.0, random.NextDouble() * h); + double rand = random.NextDouble(); + + if (island) + { + // Move everything towards the center + rx -= w / 2; + rx /= 2; + rx += w / 2; + + ry -= h / 2; + ry /= 2; + ry += h / 2; + } + + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + if (noisy) + rand = random.NextDouble(); + + double z = (scale_min + (scale_range * rand)); + z *= z; + z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry)); + + if (z < 0) + z = 0; + + if (additive) + { + map[x, y] += z; + } + else + { + map[x, y] = Math.Max(map[x, y], z); + } + } + } + } + + normalise(); + } + + /// + /// Generates a series of cones which are then either max()'d or added together. Inspired by suggestion from jh. + /// + /// 3-Clause BSD Licensed + /// The number of hills to generate + /// The minimum size of each hill + /// The maximum size of each hill + /// 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) + { + Random random = new Random(seed); + + int x, y; + int i; + + for (i = 0; i < number; i++) + { + double rx = Math.Min(255.0, random.NextDouble() * w); + double ry = Math.Min(255.0, random.NextDouble() * h); + double rand = random.NextDouble(); + + if (island) + { + // Move everything towards the center + rx -= w / 2; + rx /= 2; + rx += w / 2; + + ry -= h / 2; + ry /= 2; + ry += h / 2; + } + + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + if (noisy) + rand = random.NextDouble(); + + double z = (scale_min + (scale_range * rand)); + z -= Math.Sqrt(((x - rx) * (x - rx)) + ((y - ry) * (y - ry))); + + if (z < 0) + z = 0; + + if (additive) + { + map[x, y] += z; + } + else + { + map[x, y] = Math.Max(map[x, y], z); + } + } + } + } + + normalise(); + } + + public void hillsBlocks(int number, double scale_min, double scale_range, bool island, bool additive, bool noisy) + { + Random random = new Random(seed); + + int x, y; + int i; + + for (i = 0; i < number; i++) + { + double rx = Math.Min(255.0, random.NextDouble() * w); + double ry = Math.Min(255.0, random.NextDouble() * h); + double rand = random.NextDouble(); + + if (island) + { + // Move everything towards the center + rx -= w / 2; + rx /= 2; + rx += w / 2; + + ry -= h / 2; + ry /= 2; + ry += h / 2; + } + + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + if (noisy) + rand = random.NextDouble(); + + double z = (scale_min + (scale_range * rand)); + z -= Math.Abs(x-rx) + Math.Abs(y-ry); + //z -= Math.Sqrt(((x - rx) * (x - rx)) + ((y - ry) * (y - ry))); + + if (z < 0) + z = 0; + + if (additive) + { + map[x, y] += z; + } + else + { + map[x, y] = Math.Max(map[x, y], z); + } + } + } + } + + normalise(); + } + + public void hillsSquared(int number, double scale_min, double scale_range, bool island, bool additive, bool noisy) + { + Random random = new Random(seed); + + int x, y; + int i; + + for (i = 0; i < number; i++) + { + double rx = Math.Min(255.0, random.NextDouble() * w); + double ry = Math.Min(255.0, random.NextDouble() * h); + double rand = random.NextDouble(); + + if (island) + { + // Move everything towards the center + rx -= w / 2; + rx /= 2; + rx += w / 2; + + ry -= h / 2; + ry /= 2; + ry += h / 2; + } + + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + if (noisy) + rand = random.NextDouble(); + + double z = (scale_min + (scale_range * rand)); + z *= z * z * z; + double dx = Math.Abs(x - rx); + double dy = Math.Abs(y - ry); + z -= (dx * dx * dx * dx) + (dy * dy * dy * dy); + + if (z < 0) + z = 0; + + if (additive) + { + map[x, y] += z; + } + else + { + map[x, y] = Math.Max(map[x, y], z); + } + } + } + } + + normalise(); + } + + } +} diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Midpoint.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Midpoint.cs new file mode 100644 index 0000000000..0cec05d3dd --- /dev/null +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Midpoint.cs @@ -0,0 +1 @@ +/* Needs BSD rewrite */ \ No newline at end of file diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Mountain.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Mountain.cs new file mode 100644 index 0000000000..0cec05d3dd --- /dev/null +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Mountain.cs @@ -0,0 +1 @@ +/* Needs BSD rewrite */ \ No newline at end of file diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Noise.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Noise.cs new file mode 100644 index 0000000000..7789d3e067 --- /dev/null +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Noise.cs @@ -0,0 +1,57 @@ +/* +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of libTerrain nor the names of + its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +using System; +using System.Collections.Generic; +using System.Text; + +namespace libTerrain +{ + partial class Channel + { + /// + /// Fills a channel with 0..1 noise + /// + /// 3-Clause BSD Licensed + public void noise() + { + Random rand = new Random(seed); + int x, y; + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + map[x, y] = rand.NextDouble(); + } + } + } + } +} diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Spiral.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Spiral.cs new file mode 100644 index 0000000000..ede4600c90 --- /dev/null +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Spiral.cs @@ -0,0 +1,152 @@ +/* +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of libTerrain nor the names of + its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +using System; +using System.Collections.Generic; +using System.Text; + +namespace libTerrain +{ + partial class Channel + { + private double[] coordinatesToPolar(int x, int y) + { + + double theta = Math.Atan2(x - (w / 2), y - (h / 2)); + double rx = (double)x - ((double)w / 2); + double ry = (double)y - ((double)h / 2); + double r = Math.Sqrt((rx * rx) + (ry * ry)); + + double[] coords = new double[2]; + coords[0] = r; + coords[1] = theta; + return coords; + } + + public int[] polarToCoordinates(double r, double theta) { + double nx; + double ny; + + nx = (double)r * Math.Cos(theta); + ny = (double)r * Math.Sin(theta); + + nx += w / 2; + ny += h / 2; + + if (nx >= w) + nx = w - 1; + + if (ny >= h) + ny = h - 1; + + if (nx < 0) + nx = 0; + + if (ny < 0) + ny = 0; + + int[] coords = new int[2]; + coords[0] = (int)nx; + coords[1] = (int)ny; + return coords; + } + + public void Polar() + { + Channel n = this.copy(); + + int x, y; + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + double[] coords = coordinatesToPolar(x,y); + + coords[0] += w / 2.0; + coords[1] += h / 2.0; + + map[x, y] = n.map[(int)coords[0] % n.w, (int)coords[1] % n.h]; + } + } + } + + public void SpiralPlanter(int steps, double incAngle, double incRadius, double offsetRadius, double offsetAngle) + { + int i; + double r = offsetRadius; + double theta = offsetAngle; + for (i = 0; i < steps; i++) + { + r += incRadius; + theta += incAngle; + + int[] coords = polarToCoordinates(r,theta); + raise(coords[0], coords[1], 20, 1); + } + } + + public void SpiralCells(int steps, double incAngle, double incRadius, double offsetRadius, double offsetAngle, double[] c) + { + List points = new List(); + + int i; + double r = offsetRadius; + double theta = offsetAngle; + for (i = 0; i < steps; i++) + { + r += incRadius; + theta += incAngle; + + int[] coords = polarToCoordinates(r, theta); + points.Add(new Point2D(coords[0],coords[1])); + } + + voronoiDiagram(points, c); + } + + public void Spiral(double wid, double hig, double offset) + { + int x, y, z; + z = 0; + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + z++; + double dx = Math.Abs((w / 2) - x); + double dy = Math.Abs((h / 2) - y); + map[x, y] += Math.Sin(dx / wid) + Math.Cos(dy / hig); + } + } + 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 new file mode 100644 index 0000000000..df21ecc1e7 --- /dev/null +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Voronoi.cs @@ -0,0 +1,212 @@ +/* +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of libTerrain nor the names of + its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +using System; +using System.Collections.Generic; +using System.Text; + +namespace libTerrain +{ + partial class Channel + { + /// + /// Generates a Voronoi diagram (sort of a stained glass effect) which will fill the entire channel + /// + /// 3-Clause BSD Licensed + /// The number of generator points in each block + /// 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) + { + List points = new List(); + Random generator = new Random(seed); + + // Generate the emitter points + int x, y, i; + for (x = -blockSize; x < w + blockSize; x += blockSize) + { + for (y = -blockSize; y < h + blockSize; y += blockSize) + { + for (i = 0; i < pointsPerBlock; i++) + { + double pX = x + (generator.NextDouble() * (double)blockSize); + double pY = y + (generator.NextDouble() * (double)blockSize); + + points.Add(new Point2D(pX, pY)); + } + } + } + + double[] distances = new double[points.Count]; + + // Calculate the distance each pixel is from an emitter + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + for (i = 0; i < points.Count; i++) + { + double dx, dy; + dx = Math.Abs((double)x - points[i].x); + dy = Math.Abs((double)y - points[i].y); + + distances[i] = (dx * dx + dy * dy); + } + + Array.Sort(distances); + + double f = 0.0; + + // Multiply the distances with their 'c' counterpart + // ordering the distances descending + for (i = 0; i < c.Length; i++) + { + if (i >= points.Count) + break; + + f += c[i] * distances[i]; + } + + map[x, y] = f; + } + } + + // Normalise the result + normalise(); + } + + public void voronoiDiagram(List points, double[] c) + { + + Random generator = new Random(seed); + int x, y, i; + double[] distances = new double[points.Count]; + + // Calculate the distance each pixel is from an emitter + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + for (i = 0; i < points.Count; i++) + { + double dx, dy; + dx = Math.Abs((double)x - points[i].x); + dy = Math.Abs((double)y - points[i].y); + + distances[i] = (dx * dx + dy * dy); + } + + Array.Sort(distances); + + double f = 0.0; + + // Multiply the distances with their 'c' counterpart + // ordering the distances descending + for (i = 0; i < c.Length; i++) + { + if (i >= points.Count) + break; + + f += c[i] * distances[i]; + } + + map[x, y] = f; + } + } + + // Normalise the result + normalise(); + } + + public void voroflatDiagram(int pointsPerBlock, int blockSize) + { + List points = new List(); + Random generator = new Random(seed); + + // Generate the emitter points + int x, y, i; + for (x = -blockSize; x < w + blockSize; x += blockSize) + { + for (y = -blockSize; y < h + blockSize; y += blockSize) + { + for (i = 0; i < pointsPerBlock; i++) + { + double pX = x + (generator.NextDouble() * (double)blockSize); + double pY = y + (generator.NextDouble() * (double)blockSize); + + points.Add(new Point2D(pX, pY)); + } + } + } + + double[] distances = new double[points.Count]; + + // Calculate the distance each pixel is from an emitter + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + for (i = 0; i < points.Count; i++) + { + double dx, dy; + dx = Math.Abs((double)x - points[i].x); + dy = Math.Abs((double)y - points[i].y); + + distances[i] = (dx * dx + dy * dy); + } + + //Array.Sort(distances); + + double f = 0.0; + + double min = double.MaxValue; + for (int j = 0; j < distances.Length;j++ ) + { + if (distances[j] < min) + { + min = distances[j]; + f = j; + } + } + + // Multiply the distances with their 'c' counterpart + // ordering the distances descending + + map[x, y] = f; + } + } + + // Normalise the result + normalise(); + } + } +} diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Worms.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Worms.cs new file mode 100644 index 0000000000..a54c946c98 --- /dev/null +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Worms.cs @@ -0,0 +1,75 @@ +/* +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of libTerrain nor the names of + its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +using System; +using System.Collections.Generic; +using System.Text; + +namespace libTerrain +{ + partial class Channel + { + /// + /// Generates 'number' of worms which navigate randomly around the landscape creating terrain as they go. + /// + /// The number of worms which will traverse the map + /// The number of steps each worm will traverse + /// 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) + { + Random random = new Random(seed); + int i, j; + + for (i = 0; i < number; i++) + { + double rx, ry; + if (centerspawn) + { + rx = w / 2.0; + ry = h / 2.0; + } + else + { + rx = random.NextDouble() * (w - 1); + ry = random.NextDouble() * (h - 1); + } + for (j = 0; j < rounds; j++) + { + rx += (random.NextDouble() * movement) - (movement / 2.0); + ry += (random.NextDouble() * movement) - (movement / 2.0); + raise(rx, ry, size, 1.0); + } + } + } + } +} \ No newline at end of file diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Grid.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Grid.cs new file mode 100644 index 0000000000..41d20f6201 --- /dev/null +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Grid.cs @@ -0,0 +1,264 @@ +/* +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of libTerrain nor the names of + its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +using System; +using System.Collections.Generic; +using System.Text; + +namespace libTerrain +{ + partial class Channel + { + public Channel normalise() + { + double max = findMax(); + double min = findMin(); + + int x, y; + + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + map[x, y] = (map[x, y] - min) * (1.0 / (max - min)); + } + } + + return this; + } + + public Channel normalise(double minv, double maxv) + { + double max = findMax(); + double min = findMin(); + + int x, y; + + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + double val = (map[x, y] - min) * (1.0 / max - min); + val *= maxv - minv; + val += minv; + + map[x, y] = val; + } + } + + return this; + } + + public Channel clip() + { + int x, y; + + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + setClip(x, y, map[x, y]); + } + } + + return this; + } + + public Channel clip(double min, double max) + { + int x, y; + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + double val = map[x, y]; + if (val > max) val = max; + if (val < min) val = min; + map[x, y] = val; + } + } + return this; + } + + public Channel crop(int x1, int y1, int x2, int y2) + { + int width = x1 - x2 + 1; + int height = y1 - y2 + 1; + Channel chan = new Channel(width, height); + + int x, y; + int nx, ny; + + nx = 0; + for (x = x1; x < x2; x++) + { + ny = 0; + for (y = y1; y < y2; y++) + { + chan.map[nx, ny] = map[x, y]; + + ny++; + } + nx++; + } + + return this; + } + + public Channel addClip(Channel other) + { + int x, y; + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + map[x, y] = other.map[x, y]; + if (map[x, y] > 1) + map[x, y] = 1; + if (map[x, y] < 0) + map[x, y] = 0; + } + } + return this; + } + + public void smooth(double amount) + { + double area = amount; + double step = amount / 4.0; + + double[,] manipulate = new double[w, h]; + int x, y; + double n, l; + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + double average = 0.0; + int avgsteps = 0; + + for (n = 0.0 - area; n < area; n += step) + { + for (l = 0.0 - area; l < area; l += step) + { + avgsteps++; + average += getBilinearInterpolate(x + n, y + l); + } + } + + manipulate[x, y] = average / avgsteps; + } + } + map = manipulate; + } + + public void pertubation(double amount) + { + // Simple pertubation filter + double[,] manipulated = new double[w, h]; + Random generator = new Random(seed); // Seeds FTW! + //double amount = 8.0; + + int x, y; + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + 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); + manipulated[x, y] = p; + } + } + map = manipulated; + } + + public void pertubationMask(Channel mask) + { + // Simple pertubation filter + double[,] manipulated = new double[w, h]; + Random generator = new Random(seed); // Seeds FTW! + //double amount = 8.0; + + double amount; + + int x, y; + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + amount = mask.map[x, y]; + double offset_x = (double)x + (generator.NextDouble() * amount) - (amount / 2.0); + double offset_y = (double)y + (generator.NextDouble() * amount) - (amount / 2.0); + + if (offset_x > w) + offset_x = w - 1; + if (offset_y > h) + offset_y = h - 1; + if (offset_y < 0) + offset_y = 0; + if (offset_x < 0) + offset_x = 0; + + double p = getBilinearInterpolate(offset_x, offset_y); + manipulated[x, y] = p; + } + } + map = manipulated; + } + + public Channel blend(Channel other, double amount) + { + int x, y; + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + map[x, y] = Tools.linearInterpolate(map[x,y],other.map[x,y],amount); + } + } + return this; + } + + public Channel blend(Channel other, Channel amount) + { + int x, y; + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + map[x, y] = Tools.linearInterpolate(map[x, y], other.map[x, y], amount.map[x,y]); + } + } + return this; + } + } +} diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/AerobicErosion.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/AerobicErosion.cs new file mode 100644 index 0000000000..ebeabe9c6d --- /dev/null +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/AerobicErosion.cs @@ -0,0 +1,170 @@ +/* +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of libTerrain nor the names of + its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +using System; +using System.Collections.Generic; +using System.Text; + +namespace libTerrain +{ + partial class Channel + { + // Ideas for Aerobic erosion + // + // Unlike thermal (gravity) and hydraulic (water suspension) + // aerobic erosion should displace mass by moving sediment + // in "hops". The length of the hop being dictated by the + // presence of sharp cliffs and wind speed. + + // The ability to pickup sediment is defined by the total + // surface area, such that: + // 0 0 0 + // 0 1 0 + // 0 0 0 + // Would be the best possible value for sediment to be + // picked up (total difference = 8) and flatter land + // will erode less quickly. + + // Suspended particles assist the erosion process by hitting + // the surface and chiselling additional particles off faster + // than alone. + + // Particles are deposited when one of two conditions is met + // First: + // When particles hit a wall - such that the + // wind direction points at a difference >= the + // deposition mininum talus. + // Second: + // When wind speed is lowered to below the minimum + // required for transit. An idea for this is to + // use the navier-stokes algorithms for simulating + // pressure across the terrain. + + /// + /// An experimental erosion algorithm developed by Adam. Moves sediment by factoring the surface area of each height point. + /// + /// 0..1 The speed of the wind + /// The minimum angle at which rock is eroded 0..1 (recommended: <= 0.30) + /// The minimum angle at which rock is dropped 0..1 (recommended: >= 0.00) + /// 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) + { + 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 *= windspeed; + wind.pertubation(30); // Can do better later + + for (i = 0; i < rounds; i++) + { + // Convert some rocks to sand + for (x = 1; x < w - 1; x++) + { + for (y = 1; y < h - 1; 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]); + + surfacearea += Math.Abs(target - me); + } + + double amount = surfacearea * wind.map[x, y] * carry; + + if (amount < 0) + amount = 0; + + if (surfacearea > pickup_talus_minimum) + { + this.map[x, y] -= amount; + sediment.map[x, y] += amount; + } + } + } + sediment.pertubation(10); // Sediment is blown around a bit + sediment.seed++; + wind.pertubation(15); // So is the wind + wind.seed++; + + // Convert some sand to rock + for (x = 1; x < w - 1; x++) + { + for (y = 1; y < h - 1; 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]); + + surfacearea += Math.Abs(target - me); + + if (target < min && lowest) + { + minside = (int[])coords.Clone(); + min = target; + } + } + + double amount = surfacearea * (1.0 - wind.map[x, y]) * carry; + + if (amount < 0) + amount = 0; + + if (surfacearea > drop_talus_minimum) + { + this.map[x + minside[0], y + minside[1]] += amount; + sediment.map[x, y] -= amount; + } + } + } + + } + + Channel myself = this; + myself += sediment; + 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 new file mode 100644 index 0000000000..0cec05d3dd --- /dev/null +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/HydraulicErosion.cs @@ -0,0 +1 @@ +/* Needs BSD rewrite */ \ No newline at end of file diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/ThermalWeathering.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/ThermalWeathering.cs new file mode 100644 index 0000000000..0cae56d2bf --- /dev/null +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Manipulators/ThermalWeathering.cs @@ -0,0 +1,113 @@ +/* +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of libTerrain nor the names of + its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +using System; +using System.Collections.Generic; +using System.Text; + +namespace libTerrain +{ + partial class Channel + { + /// + /// A thermal weathering implementation based on Musgrave's original 1989 algorithm. This is Adam's custom implementation which may differ slightly from the original. + /// + /// 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) + { + double[,] lastFrame; + double[,] thisFrame; + + lastFrame = (double[,])map.Clone(); + thisFrame = (double[,])map.Clone(); + + NEIGHBOURS type = NEIGHBOURS.NEIGHBOUR_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 frames = rounds; // Number of thermal erosion iterations to run + int i, j; + int x, y; + + for (i = 0; i < frames; i++) + { + for (x = 0; x < w; x++) + { + for (y = 0; y < h; y++) + { + for (j = 0; j < NEIGHBOUR_MAX; j++) + { + if (j != NEIGHBOUR_ME) + { + int[] coords = neighbours(type, j); + + coords[0] += x; + coords[1] += y; + + if (coords[0] > w - 1) + coords[0] = w - 1; + if (coords[1] > h - 1) + coords[1] = h - 1; + if (coords[0] < 0) + coords[0] = 0; + if (coords[1] < 0) + coords[1] = 0; + + double heightF = thisFrame[x, y]; + double target = thisFrame[coords[0], coords[1]]; + + if (target > heightF + talus) + { + double calc = c * ((target - heightF) - talus); + heightF += calc; + target -= calc; + } + + thisFrame[x, y] = heightF; + thisFrame[coords[0], coords[1]] = target; + + } + } + } + } + lastFrame = (double[,])thisFrame.Clone(); + } + + map = thisFrame; + + 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 new file mode 100644 index 0000000000..f2b4aedca7 --- /dev/null +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Neighbours.cs @@ -0,0 +1,144 @@ +/* +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of libTerrain nor the names of + its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +using System; +using System.Collections.Generic; +using System.Text; + +namespace libTerrain +{ + partial class Channel + { + enum NEIGHBOURS + { + NEIGHBOUR_MOORE, + NEIGHBOUR_VONNEUMANN + }; + + private int[] neighbours(NEIGHBOURS type, int index) + { + int[] coord = new int[2]; + + index++; + + switch (type) + { + case NEIGHBOURS.NEIGHBOUR_MOORE: + switch (index) + { + case 1: + coord[0] = -1; + coord[1] = -1; + break; + + case 2: + coord[0] = -0; + coord[1] = -1; + break; + + case 3: + coord[0] = +1; + coord[1] = -1; + break; + + case 4: + coord[0] = -1; + coord[1] = -0; + break; + + case 5: + coord[0] = -0; + coord[1] = -0; + break; + + case 6: + coord[0] = +1; + coord[1] = -0; + break; + + case 7: + coord[0] = -1; + coord[1] = +1; + break; + + case 8: + coord[0] = -0; + coord[1] = +1; + break; + + case 9: + coord[0] = +1; + coord[1] = +1; + break; + + default: + break; + } + break; + + case NEIGHBOURS.NEIGHBOUR_VONNEUMANN: + switch (index) + { + case 1: + coord[0] = 0; + coord[1] = -1; + break; + + case 2: + coord[0] = -1; + coord[1] = 0; + break; + + case 3: + coord[0] = +1; + coord[1] = 0; + break; + + case 4: + coord[0] = 0; + coord[1] = +1; + break; + + case 5: + coord[0] = -0; + coord[1] = -0; + break; + + default: + break; + } + break; + } + + return coord; + } + } +} diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Operators.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Operators.cs new file mode 100644 index 0000000000..81db690ced --- /dev/null +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Operators.cs @@ -0,0 +1,221 @@ +/* +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of libTerrain nor the names of + its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +using System; +using System.Collections.Generic; +using System.Text; + +namespace libTerrain +{ + partial class Channel + { + /* Operator combination of channel datatypes */ + + public static Channel operator +(Channel A, Channel B) + { + if (A.h != B.h) + throw new Exception("Cannot add heightmaps, of different height."); + if (A.w != B.w) + throw new Exception("Cannot add heightmaps, of different width."); + + int x, y; + + for (x = 0; x < A.w; x++) + { + for (y = 0; y < A.h; y++) + { + A.map[x, y] += B.map[x, y]; + } + } + + return A; + } + + public static Channel operator *(Channel A, Channel B) + { + if (A.h != B.h) + throw new Exception("Cannot multiply heightmaps, of different height."); + if (A.w != B.w) + throw new Exception("Cannot multiply heightmaps, of different width."); + + int x, y; + + for (x = 0; x < A.w; x++) + { + for (y = 0; y < A.h; y++) + { + A.map[x, y] *= B.map[x, y]; + } + } + + return A; + } + + public static Channel operator -(Channel A, Channel B) + { + if (A.h != B.h) + throw new Exception("Cannot subtract heightmaps, of different height."); + if (A.w != B.w) + throw new Exception("Cannot subtract heightmaps, of different width."); + + int x, y; + + for (x = 0; x < A.w; x++) + { + for (y = 0; y < A.h; y++) + { + A.map[x, y] -= B.map[x, y]; + } + } + + return A; + } + + public static Channel operator /(Channel A, Channel B) + { + if (A.h != B.h) + throw new Exception("Cannot divide heightmaps, of different height."); + if (A.w != B.w) + throw new Exception("Cannot divide heightmaps, of different width."); + + int x, y; + + for (x = 0; x < A.w; x++) + { + for (y = 0; y < A.h; y++) + { + A.map[x, y] /= B.map[x, y]; + } + } + + return A; + } + + public static Channel operator ^(Channel A, Channel B) + { + if (A.h != B.h) + throw new Exception("Cannot divide heightmaps, of different height."); + if (A.w != B.w) + throw new Exception("Cannot divide heightmaps, of different width."); + + int x, y; + + for (x = 0; x < A.w; x++) + { + for (y = 0; y < A.h; y++) + { + A.map[x, y] = Math.Pow(A.map[x,y],B.map[x, y]); + } + } + + return A; + } + + + /* Operator combination of channel and double datatypes */ + + public static Channel operator +(Channel A, double B) + { + int x, y; + + for (x = 0; x < A.w; x++) + { + for (y = 0; y < A.h; y++) + { + A.map[x, y] += B; + } + } + + return A; + } + + public static Channel operator -(Channel A, double B) + { + int x, y; + + for (x = 0; x < A.w; x++) + { + for (y = 0; y < A.h; y++) + { + A.map[x, y] -= B; + } + } + + return A; + } + + public static Channel operator *(Channel A, double B) + { + int x, y; + + for (x = 0; x < A.w; x++) + { + for (y = 0; y < A.h; y++) + { + A.map[x, y] *= B; + } + } + + return A; + } + + public static Channel operator /(Channel A, double B) + { + int x, y; + + for (x = 0; x < A.w; x++) + { + for (y = 0; y < A.h; y++) + { + A.map[x, y] /= B; + } + } + + return A; + } + + public static Channel operator ^(Channel A, double B) + { + int x, y; + + for (x = 0; x < A.w; x++) + { + for (y = 0; y < A.h; y++) + { + A.map[x, y] = Math.Pow(A.map[x,y],B); + } + } + + return A; + } + + } +} diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Point2D.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Point2D.cs new file mode 100644 index 0000000000..69c1148b7a --- /dev/null +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Point2D.cs @@ -0,0 +1,49 @@ +/* +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of libTerrain nor the names of + its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +using System; +using System.Collections.Generic; +using System.Text; + +namespace libTerrain +{ + public class Point2D + { + public double x; + public double y; + + public Point2D(double X, double Y) + { + x = X; + y = Y; + } + } +} diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Tools.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Tools.cs new file mode 100644 index 0000000000..3f7ab6831f --- /dev/null +++ b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Tools/Tools.cs @@ -0,0 +1,60 @@ +/* +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of libTerrain nor the names of + its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +using System; +using System.Collections.Generic; +using System.Text; + +namespace libTerrain +{ + class Tools + { + public static double linearInterpolate(double a, double b, double amount) + { + return a + ((b - a) * amount); + } + public static double exponentialInterpolate(double a, double b, double amount) + { + a = Math.Pow(a, amount); + b = Math.Pow(b - a, 1.0 - amount); + return a+b; + } + public static int powerOf2Log2(int n) { + for (int i = 0; i < 31; i++) { + if ((n & 1) == 1) { + return i; + } + n >>= 1; + } + return 0; + } + } +} diff --git a/bin/libTerrain-BSD.dll b/bin/libTerrain-BSD.dll deleted file mode 100644 index d9b95fca5c286b7a028993ffc2a47c8848277b63..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32768 zcmeHv3wRvWmFB5OS5?1cl^R-rZD=Fg2+Nk`wrm6@NU|(Hz;6j#E!mM<>XOvZ>Xy4( zeqab@$Rrac8JOVk0UtO4lFTqk7$yS=uh~GBBs0mf2}=^W8-f5IOAQizFzXpHO#-bo(DudUyuvc zKm_jHE6t+MKG5C4rQ<}+tccmyCx{}b`}P>og4u0vg(rw0LFKZ5Z?0fOt!3v(8Tb>M z0MI66b@>J+t_0D6)?%qR3QX{J90l%k06*W=1%GOnOFJ*e%x;gKi}0wwBCo- ziZuFkP7JbY2aT&~S;Q7;Kb^_U)y1v=KFYdmIl%olg7 zgGt3>M#s;lWN=o1?p-u#5R_y%b>kjn@Rgvi)^Fj zm8cJ?&26}adHrO~2MK{)5@~^;a1e~&h zlTWG3*cbBXkH)##RK7wSk!Kb++|6BY)99@~2tISerptVr(RU z?0BeUSv=fwp=v;9tPH~x0yQ^7W+*d^Y9YXnp!$&E3hvY`0hFQ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