From 7c897043bab19bf748ac3078a05a74969c409fa7 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Wed, 23 Apr 2008 10:55:04 +0000 Subject: * Removing old libTerrainBSD and associated Plugin & Project. * Updated prebuild.xml accordingly. --- .../libTerrainBSD/Channel/Generators/Cellular.cs | 28 -- .../libTerrainBSD/Channel/Generators/Fracture.cs | 142 ----------- .../libTerrainBSD/Channel/Generators/Gradient.cs | 60 ----- .../Channel/Generators/HillPlanter.cs | 281 --------------------- .../libTerrainBSD/Channel/Generators/Midpoint.cs | 28 -- .../libTerrainBSD/Channel/Generators/Mountain.cs | 28 -- .../libTerrainBSD/Channel/Generators/Noise.cs | 53 ---- .../libTerrainBSD/Channel/Generators/Spiral.cs | 156 ------------ .../libTerrainBSD/Channel/Generators/Voronoi.cs | 211 ---------------- .../libTerrainBSD/Channel/Generators/Worms.cs | 71 ------ 10 files changed, 1058 deletions(-) delete mode 100644 OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Cellular.cs delete mode 100644 OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs delete mode 100644 OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Gradient.cs delete mode 100644 OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/HillPlanter.cs delete mode 100644 OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Midpoint.cs delete mode 100644 OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Mountain.cs delete mode 100644 OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Noise.cs delete mode 100644 OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Spiral.cs delete mode 100644 OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Voronoi.cs delete mode 100644 OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Worms.cs (limited to 'OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators') diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Cellular.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Cellular.cs deleted file mode 100644 index 06e7e3c..0000000 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Cellular.cs +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * 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 the OpenSim Project 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 DEVELOPERS ``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 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. - */ - -/* TODO: Needs BSD rewrite */ diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs deleted file mode 100644 index 3e1c34c..0000000 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Fracture.cs +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * 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 the OpenSim Project 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 DEVELOPERS ``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 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; - -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) - { - SetDiff(); - - 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(); - double u = rand.NextDouble(); - double v = 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 (v >= 0.5) - { - if (u >= 0.5) - { - if (y > miny) - { - map[x, y] += Tools.LinearInterpolate(scalemin, scalemax, z); - } - } - else - { - if (y < miny) - { - map[x, y] += Tools.LinearInterpolate(scalemin, scalemax, z); - } - } - } - else - { - if (u >= 0.5) - { - if (x > miny) - { - map[x, y] += Tools.LinearInterpolate(scalemin, scalemax, z); - } - } - else - { - if (x < miny) - { - map[x, y] += Tools.LinearInterpolate(scalemin, scalemax, z); - } - } - } - } - } - } - Normalise(); - } - } -} diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Gradient.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Gradient.cs deleted file mode 100644 index afe0877..0000000 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Gradient.cs +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * 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 the OpenSim Project 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 DEVELOPERS ``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 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. - */ - -namespace libTerrain -{ - partial class Channel - { - public void GradientCube() - { - SetDiff(); - - 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(); - } - } -} diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/HillPlanter.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/HillPlanter.cs deleted file mode 100644 index 82b0cfd..0000000 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/HillPlanter.cs +++ /dev/null @@ -1,281 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * 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 the OpenSim Project 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 DEVELOPERS ``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 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; - -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) - { - SetDiff(); - - 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) - { - SetDiff(); - - 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) - { - SetDiff(); - - 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) - { - SetDiff(); - - 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 deleted file mode 100644 index 06e7e3c..0000000 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Midpoint.cs +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * 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 the OpenSim Project 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 DEVELOPERS ``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 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. - */ - -/* TODO: Needs BSD rewrite */ diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Mountain.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Mountain.cs deleted file mode 100644 index 06e7e3c..0000000 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Mountain.cs +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * 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 the OpenSim Project 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 DEVELOPERS ``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 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. - */ - -/* TODO: Needs BSD rewrite */ diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Noise.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Noise.cs deleted file mode 100644 index 10e8160..0000000 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Noise.cs +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * 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 the OpenSim Project 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 DEVELOPERS ``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 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; - -namespace libTerrain -{ - partial class Channel - { - /// - /// Fills a channel with 0..1 noise - /// - /// 3-Clause BSD Licensed - public void Noise() - { - SetDiff(); - - 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 deleted file mode 100644 index a516d8d..0000000 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Spiral.cs +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * 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 the OpenSim Project 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 DEVELOPERS ``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 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; - -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() - { - SetDiff(); - - Channel n = 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) - { - SetDiff(); - - 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) - { - SetDiff(); - - 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) - { - SetDiff(); - - 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(); - } - } -} diff --git a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Voronoi.cs b/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Voronoi.cs deleted file mode 100644 index a4966a4..0000000 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Voronoi.cs +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * 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 the OpenSim Project 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 DEVELOPERS ``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 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; - -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) - { - SetDiff(); - - 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) - { - SetDiff(); - - 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) - { - SetDiff(); - - 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 deleted file mode 100644 index d9f0990..0000000 --- a/OpenSim/Region/Terrain.BasicTerrain/libTerrainBSD/Channel/Generators/Worms.cs +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * 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 the OpenSim Project 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 DEVELOPERS ``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 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; - -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) - { - SetDiff(); - - 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); - } - } - } - } -} -- cgit v1.1