aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/libTerrain
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/libTerrain')
-rw-r--r--libraries/libTerrain/libTerrain.sln26
-rw-r--r--libraries/libTerrain/libTerrain/Bitmap/Bitmap.cs77
-rw-r--r--libraries/libTerrain/libTerrain/Channel/Channel.cs66
-rw-r--r--libraries/libTerrain/libTerrain/Channel/Common.cs228
-rw-r--r--libraries/libTerrain/libTerrain/Channel/Editing/Flatten.cs102
-rw-r--r--libraries/libTerrain/libTerrain/Channel/Editing/Raise.cs117
-rw-r--r--libraries/libTerrain/libTerrain/Channel/File.cs75
-rw-r--r--libraries/libTerrain/libTerrain/Channel/Generators/Cellular.cs1
-rw-r--r--libraries/libTerrain/libTerrain/Channel/Generators/Fracture.cs113
-rw-r--r--libraries/libTerrain/libTerrain/Channel/Generators/Gradient.cs67
-rw-r--r--libraries/libTerrain/libTerrain/Channel/Generators/HillPlanter.cs278
-rw-r--r--libraries/libTerrain/libTerrain/Channel/Generators/Midpoint.cs1
-rw-r--r--libraries/libTerrain/libTerrain/Channel/Generators/Mountain.cs1
-rw-r--r--libraries/libTerrain/libTerrain/Channel/Generators/Noise.cs57
-rw-r--r--libraries/libTerrain/libTerrain/Channel/Generators/Spiral.cs152
-rw-r--r--libraries/libTerrain/libTerrain/Channel/Generators/Voronoi.cs212
-rw-r--r--libraries/libTerrain/libTerrain/Channel/Generators/Worms.cs75
-rw-r--r--libraries/libTerrain/libTerrain/Channel/Grid.cs264
-rw-r--r--libraries/libTerrain/libTerrain/Channel/Manipulators/AerobicErosion.cs170
-rw-r--r--libraries/libTerrain/libTerrain/Channel/Manipulators/HydraulicErosion.cs1
-rw-r--r--libraries/libTerrain/libTerrain/Channel/Manipulators/ThermalWeathering.cs113
-rw-r--r--libraries/libTerrain/libTerrain/Channel/Neighbours.cs144
-rw-r--r--libraries/libTerrain/libTerrain/Channel/Operators.cs221
-rw-r--r--libraries/libTerrain/libTerrain/Properties/AssemblyInfo.cs35
-rw-r--r--libraries/libTerrain/libTerrain/TODO.txt42
-rw-r--r--libraries/libTerrain/libTerrain/Test/SimpleTerrain.cs47
-rw-r--r--libraries/libTerrain/libTerrain/Tools/Point2D.cs49
-rw-r--r--libraries/libTerrain/libTerrain/Tools/Tools.cs60
-rw-r--r--libraries/libTerrain/libTerrain/libTerrain-BSD.csproj75
-rw-r--r--libraries/libTerrain/libTerrainTests/Program.cs299
-rw-r--r--libraries/libTerrain/libTerrainTests/Properties/AssemblyInfo.cs33
-rw-r--r--libraries/libTerrain/libTerrainTests/libTerrain.csproj75
-rw-r--r--libraries/libTerrain/libTerrainTests/libTerrainTests.csproj56
33 files changed, 0 insertions, 3332 deletions
diff --git a/libraries/libTerrain/libTerrain.sln b/libraries/libTerrain/libTerrain.sln
deleted file mode 100644
index 3ccfe23..0000000
--- a/libraries/libTerrain/libTerrain.sln
+++ /dev/null
@@ -1,26 +0,0 @@
1
2Microsoft Visual Studio Solution File, Format Version 9.00
3# Visual Studio 2005
4Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "libTerrainTests", "libTerrainTests\libTerrainTests.csproj", "{7214C9E2-1390-41BD-BFFC-83FA5931C5CF}"
5EndProject
6Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "libTerrain-BSD", "libTerrain\libTerrain-BSD.csproj", "{EEC06368-30E8-42E8-A23C-2C9D139AD495}"
7EndProject
8Global
9 GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 Debug|Any CPU = Debug|Any CPU
11 Release|Any CPU = Release|Any CPU
12 EndGlobalSection
13 GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 {7214C9E2-1390-41BD-BFFC-83FA5931C5CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 {7214C9E2-1390-41BD-BFFC-83FA5931C5CF}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 {7214C9E2-1390-41BD-BFFC-83FA5931C5CF}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 {7214C9E2-1390-41BD-BFFC-83FA5931C5CF}.Release|Any CPU.Build.0 = Release|Any CPU
18 {EEC06368-30E8-42E8-A23C-2C9D139AD495}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19 {EEC06368-30E8-42E8-A23C-2C9D139AD495}.Debug|Any CPU.Build.0 = Debug|Any CPU
20 {EEC06368-30E8-42E8-A23C-2C9D139AD495}.Release|Any CPU.ActiveCfg = Release|Any CPU
21 {EEC06368-30E8-42E8-A23C-2C9D139AD495}.Release|Any CPU.Build.0 = Release|Any CPU
22 EndGlobalSection
23 GlobalSection(SolutionProperties) = preSolution
24 HideSolutionNode = FALSE
25 EndGlobalSection
26EndGlobal
diff --git a/libraries/libTerrain/libTerrain/Bitmap/Bitmap.cs b/libraries/libTerrain/libTerrain/Bitmap/Bitmap.cs
deleted file mode 100644
index 923da47..0000000
--- a/libraries/libTerrain/libTerrain/Bitmap/Bitmap.cs
+++ /dev/null
@@ -1,77 +0,0 @@
1/*
2Redistribution and use in source and binary forms, with or without
3modification, are permitted provided that the following conditions are
4met:
5
6 * Redistributions of source code must retain the above copyright
7 notice, this list of conditions and the following disclaimer.
8
9 * Redistributions in binary form must reproduce the above
10 copyright notice, this list of conditions and the following
11 disclaimer in the documentation and/or other materials provided
12 with the distribution.
13
14 * Neither the name of libTerrain nor the names of
15 its contributors may be used to endorse or promote products
16 derived from this software without specific prior written
17 permission.
18
19THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30*/
31
32using System;
33using System.Collections.Generic;
34using System.Text;
35using System.Drawing;
36
37namespace libTerrain
38{
39 class Raster
40 {
41 int w;
42 int h;
43 Bitmap bmp;
44
45 public Raster(int width, int height)
46 {
47 w = width;
48 h = height;
49 bmp = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
50 }
51
52 public Channel toChannel()
53 {
54 Channel chan = new Channel(bmp.Width, bmp.Height);
55
56 int x, y;
57 for (x = 0; x < bmp.Width; x++)
58 {
59 for (y = 0; y < bmp.Height; y++)
60 {
61 Color val = bmp.GetPixel(x, y);
62 chan.map[x, y] = (((double)val.R + (double)val.G + (double)val.B) / 3.0) / 255.0;
63 }
64 }
65
66 return chan;
67 }
68
69 public void drawText(string txt, string font, double size)
70 {
71 Graphics gd = Graphics.FromImage(bmp);
72 //gd.DrawString(txt,
73
74
75 }
76 }
77}
diff --git a/libraries/libTerrain/libTerrain/Channel/Channel.cs b/libraries/libTerrain/libTerrain/Channel/Channel.cs
deleted file mode 100644
index 9849ef2..0000000
--- a/libraries/libTerrain/libTerrain/Channel/Channel.cs
+++ /dev/null
@@ -1,66 +0,0 @@
1/*
2Redistribution and use in source and binary forms, with or without
3modification, are permitted provided that the following conditions are
4met:
5
6 * Redistributions of source code must retain the above copyright
7 notice, this list of conditions and the following disclaimer.
8
9 * Redistributions in binary form must reproduce the above
10 copyright notice, this list of conditions and the following
11 disclaimer in the documentation and/or other materials provided
12 with the distribution.
13
14 * Neither the name of libTerrain nor the names of
15 its contributors may be used to endorse or promote products
16 derived from this software without specific prior written
17 permission.
18
19THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30*/
31
32using System;
33using System.Collections.Generic;
34using System.Text;
35
36
37/* Channel
38 * A channel is a single heightmap array
39 * */
40
41namespace libTerrain
42{
43 partial class Channel
44 {
45 public double[,] map;
46 public int w;
47 public int h;
48
49 public int seed = 1338; // One better than 1337
50
51 public Channel()
52 {
53 w = 256;
54 h = 256;
55 map = new double[w, h];
56 }
57
58 public Channel(int width, int height)
59 {
60 w = width;
61 h = height;
62 map = new double[w, h];
63 }
64
65 }
66}
diff --git a/libraries/libTerrain/libTerrain/Channel/Common.cs b/libraries/libTerrain/libTerrain/Channel/Common.cs
deleted file mode 100644
index 438359c..0000000
--- a/libraries/libTerrain/libTerrain/Channel/Common.cs
+++ /dev/null
@@ -1,228 +0,0 @@
1/*
2Redistribution and use in source and binary forms, with or without
3modification, are permitted provided that the following conditions are
4met:
5
6 * Redistributions of source code must retain the above copyright
7 notice, this list of conditions and the following disclaimer.
8
9 * Redistributions in binary form must reproduce the above
10 copyright notice, this list of conditions and the following
11 disclaimer in the documentation and/or other materials provided
12 with the distribution.
13
14 * Neither the name of libTerrain nor the names of
15 its contributors may be used to endorse or promote products
16 derived from this software without specific prior written
17 permission.
18
19THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30*/
31
32
33using System;
34using System.Collections.Generic;
35using System.Text;
36
37namespace libTerrain
38{
39 public partial class Channel
40 {
41 public int getWidth()
42 {
43 return w;
44 }
45 public int getHeight()
46 {
47 return h;
48 }
49
50 public Channel copy()
51 {
52 Channel x = new Channel(w, h);
53 x.map = (double[,])this.map.Clone();
54 return x;
55 }
56
57 public void set(int x, int y, double val)
58 {
59 if (x >= w)
60 throw new Exception("Bounds error while setting pixel (width)");
61 if (y >= h)
62 throw new Exception("Bounds error while setting pixel (height)");
63 if (x < 0)
64 throw new Exception("Bounds error while setting pixel (width)");
65 if (y < 0)
66 throw new Exception("Bounds error while setting pixel (height)");
67
68 map[x, y] = val;
69 }
70
71 public void setClip(int x, int y, double val)
72 {
73 if (x >= w)
74 throw new Exception("Bounds error while setting pixel (width)");
75 if (y >= h)
76 throw new Exception("Bounds error while setting pixel (height)");
77 if (x < 0)
78 throw new Exception("Bounds error while setting pixel (width)");
79 if (y < 0)
80 throw new Exception("Bounds error while setting pixel (height)");
81
82 if (val > 1.0)
83 val = 1.0;
84 if (val < 0.0)
85 val = 0.0;
86
87 map[x, y] = val;
88 }
89
90 private double getBilinearInterpolate(double x, double y)
91 {
92 if (x > w - 2.0)
93 x = w - 2.0;
94 if (y > h - 2.0)
95 y = h - 2.0;
96 if (x < 0.0)
97 x = 0.0;
98 if (y < 0.0)
99 y = 0.0;
100
101 int STEP_SIZE = 1;
102 double h00 = get((int)x, (int)y);
103 double h10 = get((int)x + STEP_SIZE, (int)y);
104 double h01 = get((int)x, (int)y + STEP_SIZE);
105 double h11 = get((int)x + STEP_SIZE, (int)y + STEP_SIZE);
106 double h1 = h00;
107 double h2 = h10;
108 double h3 = h01;
109 double h4 = h11;
110 double a00 = h1;
111 double a10 = h2 - h1;
112 double a01 = h3 - h1;
113 double a11 = h1 - h2 - h3 + h4;
114 double partialx = x - (int)x;
115 double partialz = y - (int)y;
116 double hi = a00 + (a10 * partialx) + (a01 * partialz) + (a11 * partialx * partialz);
117 return hi;
118 }
119
120 public double get(int x, int y)
121 {
122 if (x >= w)
123 x = w - 1;
124 if (y >= h)
125 y = h - 1;
126 if (x < 0)
127 x = 0;
128 if (y < 0)
129 y = 0;
130 return map[x, y];
131 }
132
133 public void setWrap(int x, int y, double val)
134 {
135 map[x % w, y % h] = val;
136 }
137
138 public void setWrapClip(int x, int y, double val)
139 {
140 if (val > 1.0)
141 val = 1.0;
142 if (val < 0.0)
143 val = 0.0;
144
145 map[x % w, y % h] = val;
146 }
147
148 public void fill(double val)
149 {
150 int x, y;
151 for (x = 0; x < w; x++)
152 {
153 for (y = 0; y < h; y++)
154 {
155 map[x, y] = val;
156 }
157 }
158 }
159
160 public void fill(double min, double max, double val)
161 {
162 int x, y;
163 for (x = 0; x < w; x++)
164 {
165 for (y = 0; y < h; y++)
166 {
167 if (map[x, y] >= min && map[x, y] <= max)
168 map[x, y] = val;
169 }
170 }
171 }
172
173 public double findMax()
174 {
175 int x, y;
176 double max = double.MinValue;
177
178 for (x = 0; x < w; x++)
179 {
180 for (y = 0; y < h; y++)
181 {
182 if (map[x, y] > max)
183 max = map[x, y];
184 }
185 }
186
187 return max;
188 }
189
190 public double findMin()
191 {
192 int x, y;
193 double min = double.MaxValue;
194
195 for (x = 0; x < w; x++)
196 {
197 for (y = 0; y < h; y++)
198 {
199 if (map[x, y] < min)
200 min = map[x, y];
201 }
202 }
203
204 return min;
205 }
206
207 public double sum()
208 {
209 int x, y;
210 double sum = 0.0;
211
212 for (x = 0; x < w; x++)
213 {
214 for (y = 0; y < h; y++)
215 {
216 sum += map[x, y];
217 }
218 }
219
220 return sum;
221 }
222
223 public double avg()
224 {
225 return sum() / (w * h);
226 }
227 }
228}
diff --git a/libraries/libTerrain/libTerrain/Channel/Editing/Flatten.cs b/libraries/libTerrain/libTerrain/Channel/Editing/Flatten.cs
deleted file mode 100644
index 5e5254d..0000000
--- a/libraries/libTerrain/libTerrain/Channel/Editing/Flatten.cs
+++ /dev/null
@@ -1,102 +0,0 @@
1/*
2Redistribution and use in source and binary forms, with or without
3modification, are permitted provided that the following conditions are
4met:
5
6 * Redistributions of source code must retain the above copyright
7 notice, this list of conditions and the following disclaimer.
8
9 * Redistributions in binary form must reproduce the above
10 copyright notice, this list of conditions and the following
11 disclaimer in the documentation and/or other materials provided
12 with the distribution.
13
14 * Neither the name of libTerrain nor the names of
15 its contributors may be used to endorse or promote products
16 derived from this software without specific prior written
17 permission.
18
19THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30*/
31
32
33using System;
34using System.Collections.Generic;
35using System.Text;
36
37namespace libTerrain
38{
39 partial class Channel
40 {
41 /// <summary>
42 /// Flattens the area underneath rx,ry by moving it to the average of the area. Uses a spherical mask provided by the raise() function.
43 /// </summary>
44 /// <param name="rx">The X coordinate of the terrain mask</param>
45 /// <param name="ry">The Y coordinate of the terrain mask</param>
46 /// <param name="size">The size of the terrain mask</param>
47 /// <param name="amount">The scale of the terrain mask</param>
48 public void flatten(double rx, double ry, double size, double amount)
49 {
50 // Generate the mask
51 Channel temp = new Channel(w, h);
52 temp.fill(0);
53 temp.raise(rx, ry, size, amount);
54 temp.normalise();
55 double total_mod = temp.sum();
56
57 // Establish the average height under the area
58 Channel newmap = new Channel(w, h);
59 newmap.map = (double[,])map.Clone();
60
61 newmap *= temp;
62
63 double total_terrain = newmap.sum();
64 double avg_height = total_terrain / total_mod;
65
66 // Create a flat terrain using the average height
67 Channel flat = new Channel(w, h);
68 flat.fill(avg_height);
69
70 // Blend the current terrain with the average height terrain
71 // using the "raised" empty terrain as a mask
72 blend(flat, temp);
73
74 }
75
76 public void flatten(Channel mask, double amount)
77 {
78 // Generate the mask
79 Channel temp = mask * amount;
80 temp.clip(0, 1); // Cut off out-of-bounds values
81
82 double total_mod = temp.sum();
83
84 // Establish the average height under the area
85 Channel map = new Channel(w, h);
86 map.map = (double[,])this.map.Clone();
87
88 map *= temp;
89
90 double total_terrain = map.sum();
91 double avg_height = total_terrain / total_mod;
92
93 // Create a flat terrain using the average height
94 Channel flat = new Channel(w, h);
95 flat.fill(avg_height);
96
97 // Blend the current terrain with the average height terrain
98 // using the "raised" empty terrain as a mask
99 blend(flat, temp);
100 }
101 }
102} \ No newline at end of file
diff --git a/libraries/libTerrain/libTerrain/Channel/Editing/Raise.cs b/libraries/libTerrain/libTerrain/Channel/Editing/Raise.cs
deleted file mode 100644
index ce1ce98..0000000
--- a/libraries/libTerrain/libTerrain/Channel/Editing/Raise.cs
+++ /dev/null
@@ -1,117 +0,0 @@
1/*
2Redistribution and use in source and binary forms, with or without
3modification, are permitted provided that the following conditions are
4met:
5
6 * Redistributions of source code must retain the above copyright
7 notice, this list of conditions and the following disclaimer.
8
9 * Redistributions in binary form must reproduce the above
10 copyright notice, this list of conditions and the following
11 disclaimer in the documentation and/or other materials provided
12 with the distribution.
13
14 * Neither the name of libTerrain nor the names of
15 its contributors may be used to endorse or promote products
16 derived from this software without specific prior written
17 permission.
18
19THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30*/
31
32
33using System;
34using System.Collections.Generic;
35using System.Text;
36
37namespace libTerrain
38{
39 partial class Channel
40 {
41 /// <summary>
42 /// Raises land around the selection
43 /// </summary>
44 /// <param name="rx">The center the X coordinate of where you wish to raise the land</param>
45 /// <param name="ry">The center the Y coordinate of where you wish to raise the land</param>
46 /// <param name="size">The radius of the dimple</param>
47 /// <param name="amount">How much impact to add to the terrain (0..2 usually)</param>
48 public void raise(double rx, double ry, double size, double amount)
49 {
50 raiseSphere(rx, ry, size, amount);
51 }
52
53 /// <summary>
54 /// Raises land in a sphere around the selection
55 /// </summary>
56 /// <param name="rx">The center the X coordinate of where you wish to raise the land</param>
57 /// <param name="ry">The center the Y coordinate of where you wish to raise the land</param>
58 /// <param name="size">The radius of the sphere dimple</param>
59 /// <param name="amount">How much impact to add to the terrain (0..2 usually)</param>
60 public void raiseSphere(double rx, double ry, double size, double amount)
61 {
62 int x, y;
63 for (x = 0; x < w; x++)
64 {
65 for (y = 0; y < h; y++)
66 {
67 double z = size;
68 z *= z;
69 z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry));
70
71 if (z < 0)
72 z = 0;
73
74 map[x, y] += z * amount;
75 }
76 }
77 }
78
79 /// <summary>
80 /// Lowers land in a sphere around the selection
81 /// </summary>
82 /// <param name="rx">The center the X coordinate of where you wish to lower the land</param>
83 /// <param name="ry">The center the Y coordinate of where you wish to lower the land</param>
84 /// <param name="size">The radius of the sphere dimple</param>
85 /// <param name="amount">How much impact to remove from the terrain (0..2 usually)</param>
86 public void lower(double rx, double ry, double size, double amount)
87 {
88 lowerSphere(rx, ry, size, amount);
89 }
90
91 /// <summary>
92 /// Lowers land in a sphere around the selection
93 /// </summary>
94 /// <param name="rx">The center the X coordinate of where you wish to lower the land</param>
95 /// <param name="ry">The center the Y coordinate of where you wish to lower the land</param>
96 /// <param name="size">The radius of the sphere dimple</param>
97 /// <param name="amount">How much impact to remove from the terrain (0..2 usually)</param>
98 public void lowerSphere(double rx, double ry, double size, double amount)
99 {
100 int x, y;
101 for (x = 0; x < w; x++)
102 {
103 for (y = 0; y < h; y++)
104 {
105 double z = size;
106 z *= z;
107 z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry));
108
109 if (z < 0)
110 z = 0;
111
112 map[x, y] -= z * amount;
113 }
114 }
115 }
116 }
117} \ No newline at end of file
diff --git a/libraries/libTerrain/libTerrain/Channel/File.cs b/libraries/libTerrain/libTerrain/Channel/File.cs
deleted file mode 100644
index 4163a5f..0000000
--- a/libraries/libTerrain/libTerrain/Channel/File.cs
+++ /dev/null
@@ -1,75 +0,0 @@
1/*
2Redistribution and use in source and binary forms, with or without
3modification, are permitted provided that the following conditions are
4met:
5
6 * Redistributions of source code must retain the above copyright
7 notice, this list of conditions and the following disclaimer.
8
9 * Redistributions in binary form must reproduce the above
10 copyright notice, this list of conditions and the following
11 disclaimer in the documentation and/or other materials provided
12 with the distribution.
13
14 * Neither the name of libTerrain nor the names of
15 its contributors may be used to endorse or promote products
16 derived from this software without specific prior written
17 permission.
18
19THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30*/
31
32using System;
33using System.Collections.Generic;
34using System.Text;
35using System.Drawing;
36
37namespace libTerrain
38{
39 partial class Channel
40 {
41 public Channel loadImage(string filename)
42 {
43 Bitmap bit = new Bitmap(filename);
44 Channel chan = new Channel(bit.Width, bit.Height);
45
46 int x, y;
47 for (x = 0; x < bit.Width; x++)
48 {
49 for (y = 0; y < bit.Height; y++)
50 {
51 Color val = bit.GetPixel(x, y);
52 chan.map[x, y] = (((double)val.R + (double)val.G + (double)val.B) / 3.0) / 255.0;
53 }
54 }
55
56 return chan;
57 }
58
59 public void saveImage(string filename)
60 {
61 Bitmap bit = new Bitmap(w, h, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
62 int x, y;
63 for (x = 0; x < w; x++)
64 {
65 for (y = 0; y < h; y++)
66 {
67 int val = Math.Min(255, (int)(map[x,y] * 255));
68 Color col = Color.FromArgb(val,val,val);
69 bit.SetPixel(x, y, col);
70 }
71 }
72 bit.Save(filename);
73 }
74 }
75}
diff --git a/libraries/libTerrain/libTerrain/Channel/Generators/Cellular.cs b/libraries/libTerrain/libTerrain/Channel/Generators/Cellular.cs
deleted file mode 100644
index 0cec05d..0000000
--- a/libraries/libTerrain/libTerrain/Channel/Generators/Cellular.cs
+++ /dev/null
@@ -1 +0,0 @@
1/* Needs BSD rewrite */ \ No newline at end of file
diff --git a/libraries/libTerrain/libTerrain/Channel/Generators/Fracture.cs b/libraries/libTerrain/libTerrain/Channel/Generators/Fracture.cs
deleted file mode 100644
index 2a24ecf..0000000
--- a/libraries/libTerrain/libTerrain/Channel/Generators/Fracture.cs
+++ /dev/null
@@ -1,113 +0,0 @@
1/*
2Redistribution and use in source and binary forms, with or without
3modification, are permitted provided that the following conditions are
4met:
5
6 * Redistributions of source code must retain the above copyright
7 notice, this list of conditions and the following disclaimer.
8
9 * Redistributions in binary form must reproduce the above
10 copyright notice, this list of conditions and the following
11 disclaimer in the documentation and/or other materials provided
12 with the distribution.
13
14 * Neither the name of libTerrain nor the names of
15 its contributors may be used to endorse or promote products
16 derived from this software without specific prior written
17 permission.
18
19THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30*/
31
32using System;
33using System.Collections.Generic;
34using System.Text;
35
36namespace libTerrain
37{
38 partial class Channel
39 {
40 /// <summary>
41 /// Produces a set of coordinates defined by an edge point. Eg - 0 = 0,0. 256 = 0,256. 512 = 256,256
42 /// Assumes a 256^2 heightmap. This needs fixing for input values of w,h
43 /// </summary>
44 /// <param name="val"></param>
45 /// <param name="w"></param>
46 /// <param name="h"></param>
47 /// <returns></returns>
48 private int[] radialEdge256(int val)
49 {
50 // Four cases:
51 // 1. 000..255 return 0,val
52 // 2. 256..511 return val - 256,255
53 // 3. 512..767 return 255, val - 511
54 // 4. 768..1023 return val - 768,0
55
56 int[] ret = new int[2];
57
58 if (val < 256)
59 {
60 ret[0] = 0;
61 ret[1] = val;
62 return ret;
63 }
64 if (val < 512)
65 {
66 ret[0] = (val % 256);
67 ret[1] = 255;
68 return ret;
69 }
70 if (val < 768)
71 {
72 ret[0] = 255;
73 ret[1] = 255 - (val % 256);
74 return ret;
75 }
76 if (val < 1024)
77 {
78 ret[0] = 255 - (val % 256);
79 ret[1] = 255;
80 return ret;
81 }
82
83 throw new Exception("Out of bounds parameter (val)");
84 }
85 public void fracture(int number, double scalemin, double scalemax)
86 {
87 Random rand = new Random(seed);
88
89 for (int i = 0; i < number; i++)
90 {
91 int[] a, b;
92
93 a = radialEdge256(rand.Next(1023)); // TODO: Broken
94 b = radialEdge256(rand.Next(1023)); // TODO: Broken
95 double z = rand.NextDouble();
96
97 for (int x = 0; x < w; x++)
98 {
99 for (int y = 0; y < h; y++)
100 {
101 double miny = Tools.linearInterpolate(a[1], b[1], (double)x / (double)w);
102
103 if (y > miny)
104 {
105 map[x, y] += Tools.linearInterpolate(scalemin, scalemax, z);
106 }
107 }
108 }
109 }
110 normalise();
111 }
112 }
113} \ No newline at end of file
diff --git a/libraries/libTerrain/libTerrain/Channel/Generators/Gradient.cs b/libraries/libTerrain/libTerrain/Channel/Generators/Gradient.cs
deleted file mode 100644
index 8f45bf7..0000000
--- a/libraries/libTerrain/libTerrain/Channel/Generators/Gradient.cs
+++ /dev/null
@@ -1,67 +0,0 @@
1/*
2Redistribution and use in source and binary forms, with or without
3modification, are permitted provided that the following conditions are
4met:
5
6 * Redistributions of source code must retain the above copyright
7 notice, this list of conditions and the following disclaimer.
8
9 * Redistributions in binary form must reproduce the above
10 copyright notice, this list of conditions and the following
11 disclaimer in the documentation and/or other materials provided
12 with the distribution.
13
14 * Neither the name of libTerrain nor the names of
15 its contributors may be used to endorse or promote products
16 derived from this software without specific prior written
17 permission.
18
19THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30*/
31
32using System;
33using System.Collections.Generic;
34using System.Text;
35
36namespace libTerrain
37{
38 partial class Channel
39 {
40
41 public void gradientCube()
42 {
43 int x, y;
44 for (x = 0; x < w; x++)
45 {
46 for (y = 0; y < h; y++)
47 {
48 map[x, y] = x*y;
49 }
50 }
51 normalise();
52 }
53
54 public void gradientStripe()
55 {
56 int x, y;
57 for (x = 0; x < w; x++)
58 {
59 for (y = 0; y < h; y++)
60 {
61 map[x, y] = x;
62 }
63 }
64 normalise();
65 }
66 }
67} \ No newline at end of file
diff --git a/libraries/libTerrain/libTerrain/Channel/Generators/HillPlanter.cs b/libraries/libTerrain/libTerrain/Channel/Generators/HillPlanter.cs
deleted file mode 100644
index 9316911..0000000
--- a/libraries/libTerrain/libTerrain/Channel/Generators/HillPlanter.cs
+++ /dev/null
@@ -1,278 +0,0 @@
1/*
2Redistribution and use in source and binary forms, with or without
3modification, are permitted provided that the following conditions are
4met:
5
6 * Redistributions of source code must retain the above copyright
7 notice, this list of conditions and the following disclaimer.
8
9 * Redistributions in binary form must reproduce the above
10 copyright notice, this list of conditions and the following
11 disclaimer in the documentation and/or other materials provided
12 with the distribution.
13
14 * Neither the name of libTerrain nor the names of
15 its contributors may be used to endorse or promote products
16 derived from this software without specific prior written
17 permission.
18
19THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30*/
31
32using System;
33using System.Collections.Generic;
34using System.Text;
35
36namespace libTerrain
37{
38 partial class Channel
39 {
40 /// <summary>
41 /// Generates a series of spheres which are then either max()'d or added together. Inspired by suggestion from jh.
42 /// </summary>
43 /// <remarks>3-Clause BSD Licensed</remarks>
44 /// <param name="number">The number of hills to generate</param>
45 /// <param name="scale_min">The minimum size of each hill</param>
46 /// <param name="scale_range">The maximum size of each hill</param>
47 /// <param name="island">Whether to bias hills towards the center of the map</param>
48 /// <param name="additive">Whether to add hills together or to pick the largest value</param>
49 /// <param name="noisy">Generates hill-shaped noise instead of consistent hills</param>
50 public void hillsSpheres(int number, double scale_min, double scale_range, bool island, bool additive, bool noisy)
51 {
52 Random random = new Random(seed);
53
54 int x, y;
55 int i;
56
57 for (i = 0; i < number; i++)
58 {
59 double rx = Math.Min(255.0, random.NextDouble() * w);
60 double ry = Math.Min(255.0, random.NextDouble() * h);
61 double rand = random.NextDouble();
62
63 if (island)
64 {
65 // Move everything towards the center
66 rx -= w / 2;
67 rx /= 2;
68 rx += w / 2;
69
70 ry -= h / 2;
71 ry /= 2;
72 ry += h / 2;
73 }
74
75 for (x = 0; x < w; x++)
76 {
77 for (y = 0; y < h; y++)
78 {
79 if (noisy)
80 rand = random.NextDouble();
81
82 double z = (scale_min + (scale_range * rand));
83 z *= z;
84 z -= ((x - rx) * (x - rx)) + ((y - ry) * (y - ry));
85
86 if (z < 0)
87 z = 0;
88
89 if (additive)
90 {
91 map[x, y] += z;
92 }
93 else
94 {
95 map[x, y] = Math.Max(map[x, y], z);
96 }
97 }
98 }
99 }
100
101 normalise();
102 }
103
104 /// <summary>
105 /// Generates a series of cones which are then either max()'d or added together. Inspired by suggestion from jh.
106 /// </summary>
107 /// <remarks>3-Clause BSD Licensed</remarks>
108 /// <param name="number">The number of hills to generate</param>
109 /// <param name="scale_min">The minimum size of each hill</param>
110 /// <param name="scale_range">The maximum size of each hill</param>
111 /// <param name="island">Whether to bias hills towards the center of the map</param>
112 /// <param name="additive">Whether to add hills together or to pick the largest value</param>
113 /// <param name="noisy">Generates hill-shaped noise instead of consistent hills</param>
114 public void hillsCones(int number, double scale_min, double scale_range, bool island, bool additive, bool noisy)
115 {
116 Random random = new Random(seed);
117
118 int x, y;
119 int i;
120
121 for (i = 0; i < number; i++)
122 {
123 double rx = Math.Min(255.0, random.NextDouble() * w);
124 double ry = Math.Min(255.0, random.NextDouble() * h);
125 double rand = random.NextDouble();
126
127 if (island)
128 {
129 // Move everything towards the center
130 rx -= w / 2;
131 rx /= 2;
132 rx += w / 2;
133
134 ry -= h / 2;
135 ry /= 2;
136 ry += h / 2;
137 }
138
139 for (x = 0; x < w; x++)
140 {
141 for (y = 0; y < h; y++)
142 {
143 if (noisy)
144 rand = random.NextDouble();
145
146 double z = (scale_min + (scale_range * rand));
147 z -= Math.Sqrt(((x - rx) * (x - rx)) + ((y - ry) * (y - ry)));
148
149 if (z < 0)
150 z = 0;
151
152 if (additive)
153 {
154 map[x, y] += z;
155 }
156 else
157 {
158 map[x, y] = Math.Max(map[x, y], z);
159 }
160 }
161 }
162 }
163
164 normalise();
165 }
166
167 public void hillsBlocks(int number, double scale_min, double scale_range, bool island, bool additive, bool noisy)
168 {
169 Random random = new Random(seed);
170
171 int x, y;
172 int i;
173
174 for (i = 0; i < number; i++)
175 {
176 double rx = Math.Min(255.0, random.NextDouble() * w);
177 double ry = Math.Min(255.0, random.NextDouble() * h);
178 double rand = random.NextDouble();
179
180 if (island)
181 {
182 // Move everything towards the center
183 rx -= w / 2;
184 rx /= 2;
185 rx += w / 2;
186
187 ry -= h / 2;
188 ry /= 2;
189 ry += h / 2;
190 }
191
192 for (x = 0; x < w; x++)
193 {
194 for (y = 0; y < h; y++)
195 {
196 if (noisy)
197 rand = random.NextDouble();
198
199 double z = (scale_min + (scale_range * rand));
200 z -= Math.Abs(x-rx) + Math.Abs(y-ry);
201 //z -= Math.Sqrt(((x - rx) * (x - rx)) + ((y - ry) * (y - ry)));
202
203 if (z < 0)
204 z = 0;
205
206 if (additive)
207 {
208 map[x, y] += z;
209 }
210 else
211 {
212 map[x, y] = Math.Max(map[x, y], z);
213 }
214 }
215 }
216 }
217
218 normalise();
219 }
220
221 public void hillsSquared(int number, double scale_min, double scale_range, bool island, bool additive, bool noisy)
222 {
223 Random random = new Random(seed);
224
225 int x, y;
226 int i;
227
228 for (i = 0; i < number; i++)
229 {
230 double rx = Math.Min(255.0, random.NextDouble() * w);
231 double ry = Math.Min(255.0, random.NextDouble() * h);
232 double rand = random.NextDouble();
233
234 if (island)
235 {
236 // Move everything towards the center
237 rx -= w / 2;
238 rx /= 2;
239 rx += w / 2;
240
241 ry -= h / 2;
242 ry /= 2;
243 ry += h / 2;
244 }
245
246 for (x = 0; x < w; x++)
247 {
248 for (y = 0; y < h; y++)
249 {
250 if (noisy)
251 rand = random.NextDouble();
252
253 double z = (scale_min + (scale_range * rand));
254 z *= z * z * z;
255 double dx = Math.Abs(x - rx);
256 double dy = Math.Abs(y - ry);
257 z -= (dx * dx * dx * dx) + (dy * dy * dy * dy);
258
259 if (z < 0)
260 z = 0;
261
262 if (additive)
263 {
264 map[x, y] += z;
265 }
266 else
267 {
268 map[x, y] = Math.Max(map[x, y], z);
269 }
270 }
271 }
272 }
273
274 normalise();
275 }
276
277 }
278}
diff --git a/libraries/libTerrain/libTerrain/Channel/Generators/Midpoint.cs b/libraries/libTerrain/libTerrain/Channel/Generators/Midpoint.cs
deleted file mode 100644
index 0cec05d..0000000
--- a/libraries/libTerrain/libTerrain/Channel/Generators/Midpoint.cs
+++ /dev/null
@@ -1 +0,0 @@
1/* Needs BSD rewrite */ \ No newline at end of file
diff --git a/libraries/libTerrain/libTerrain/Channel/Generators/Mountain.cs b/libraries/libTerrain/libTerrain/Channel/Generators/Mountain.cs
deleted file mode 100644
index 0cec05d..0000000
--- a/libraries/libTerrain/libTerrain/Channel/Generators/Mountain.cs
+++ /dev/null
@@ -1 +0,0 @@
1/* Needs BSD rewrite */ \ No newline at end of file
diff --git a/libraries/libTerrain/libTerrain/Channel/Generators/Noise.cs b/libraries/libTerrain/libTerrain/Channel/Generators/Noise.cs
deleted file mode 100644
index 7789d3e..0000000
--- a/libraries/libTerrain/libTerrain/Channel/Generators/Noise.cs
+++ /dev/null
@@ -1,57 +0,0 @@
1/*
2Redistribution and use in source and binary forms, with or without
3modification, are permitted provided that the following conditions are
4met:
5
6 * Redistributions of source code must retain the above copyright
7 notice, this list of conditions and the following disclaimer.
8
9 * Redistributions in binary form must reproduce the above
10 copyright notice, this list of conditions and the following
11 disclaimer in the documentation and/or other materials provided
12 with the distribution.
13
14 * Neither the name of libTerrain nor the names of
15 its contributors may be used to endorse or promote products
16 derived from this software without specific prior written
17 permission.
18
19THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30*/
31
32using System;
33using System.Collections.Generic;
34using System.Text;
35
36namespace libTerrain
37{
38 partial class Channel
39 {
40 /// <summary>
41 /// Fills a channel with 0..1 noise
42 /// </summary>
43 /// <remarks>3-Clause BSD Licensed</remarks>
44 public void noise()
45 {
46 Random rand = new Random(seed);
47 int x, y;
48 for (x = 0; x < w; x++)
49 {
50 for (y = 0; y < h; y++)
51 {
52 map[x, y] = rand.NextDouble();
53 }
54 }
55 }
56 }
57}
diff --git a/libraries/libTerrain/libTerrain/Channel/Generators/Spiral.cs b/libraries/libTerrain/libTerrain/Channel/Generators/Spiral.cs
deleted file mode 100644
index ede4600..0000000
--- a/libraries/libTerrain/libTerrain/Channel/Generators/Spiral.cs
+++ /dev/null
@@ -1,152 +0,0 @@
1/*
2Redistribution and use in source and binary forms, with or without
3modification, are permitted provided that the following conditions are
4met:
5
6 * Redistributions of source code must retain the above copyright
7 notice, this list of conditions and the following disclaimer.
8
9 * Redistributions in binary form must reproduce the above
10 copyright notice, this list of conditions and the following
11 disclaimer in the documentation and/or other materials provided
12 with the distribution.
13
14 * Neither the name of libTerrain nor the names of
15 its contributors may be used to endorse or promote products
16 derived from this software without specific prior written
17 permission.
18
19THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30*/
31
32using System;
33using System.Collections.Generic;
34using System.Text;
35
36namespace libTerrain
37{
38 partial class Channel
39 {
40 private double[] coordinatesToPolar(int x, int y)
41 {
42
43 double theta = Math.Atan2(x - (w / 2), y - (h / 2));
44 double rx = (double)x - ((double)w / 2);
45 double ry = (double)y - ((double)h / 2);
46 double r = Math.Sqrt((rx * rx) + (ry * ry));
47
48 double[] coords = new double[2];
49 coords[0] = r;
50 coords[1] = theta;
51 return coords;
52 }
53
54 public int[] polarToCoordinates(double r, double theta) {
55 double nx;
56 double ny;
57
58 nx = (double)r * Math.Cos(theta);
59 ny = (double)r * Math.Sin(theta);
60
61 nx += w / 2;
62 ny += h / 2;
63
64 if (nx >= w)
65 nx = w - 1;
66
67 if (ny >= h)
68 ny = h - 1;
69
70 if (nx < 0)
71 nx = 0;
72
73 if (ny < 0)
74 ny = 0;
75
76 int[] coords = new int[2];
77 coords[0] = (int)nx;
78 coords[1] = (int)ny;
79 return coords;
80 }
81
82 public void Polar()
83 {
84 Channel n = this.copy();
85
86 int x, y;
87 for (x = 0; x < w; x++)
88 {
89 for (y = 0; y < h; y++)
90 {
91 double[] coords = coordinatesToPolar(x,y);
92
93 coords[0] += w / 2.0;
94 coords[1] += h / 2.0;
95
96 map[x, y] = n.map[(int)coords[0] % n.w, (int)coords[1] % n.h];
97 }
98 }
99 }
100
101 public void SpiralPlanter(int steps, double incAngle, double incRadius, double offsetRadius, double offsetAngle)
102 {
103 int i;
104 double r = offsetRadius;
105 double theta = offsetAngle;
106 for (i = 0; i < steps; i++)
107 {
108 r += incRadius;
109 theta += incAngle;
110
111 int[] coords = polarToCoordinates(r,theta);
112 raise(coords[0], coords[1], 20, 1);
113 }
114 }
115
116 public void SpiralCells(int steps, double incAngle, double incRadius, double offsetRadius, double offsetAngle, double[] c)
117 {
118 List<Point2D> points = new List<Point2D>();
119
120 int i;
121 double r = offsetRadius;
122 double theta = offsetAngle;
123 for (i = 0; i < steps; i++)
124 {
125 r += incRadius;
126 theta += incAngle;
127
128 int[] coords = polarToCoordinates(r, theta);
129 points.Add(new Point2D(coords[0],coords[1]));
130 }
131
132 voronoiDiagram(points, c);
133 }
134
135 public void Spiral(double wid, double hig, double offset)
136 {
137 int x, y, z;
138 z = 0;
139 for (x = 0; x < w; x++)
140 {
141 for (y = 0; y < h; y++)
142 {
143 z++;
144 double dx = Math.Abs((w / 2) - x);
145 double dy = Math.Abs((h / 2) - y);
146 map[x, y] += Math.Sin(dx / wid) + Math.Cos(dy / hig);
147 }
148 }
149 normalise();
150 }
151 }
152} \ No newline at end of file
diff --git a/libraries/libTerrain/libTerrain/Channel/Generators/Voronoi.cs b/libraries/libTerrain/libTerrain/Channel/Generators/Voronoi.cs
deleted file mode 100644
index df21ecc..0000000
--- a/libraries/libTerrain/libTerrain/Channel/Generators/Voronoi.cs
+++ /dev/null
@@ -1,212 +0,0 @@
1/*
2Redistribution and use in source and binary forms, with or without
3modification, are permitted provided that the following conditions are
4met:
5
6 * Redistributions of source code must retain the above copyright
7 notice, this list of conditions and the following disclaimer.
8
9 * Redistributions in binary form must reproduce the above
10 copyright notice, this list of conditions and the following
11 disclaimer in the documentation and/or other materials provided
12 with the distribution.
13
14 * Neither the name of libTerrain nor the names of
15 its contributors may be used to endorse or promote products
16 derived from this software without specific prior written
17 permission.
18
19THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30*/
31
32using System;
33using System.Collections.Generic;
34using System.Text;
35
36namespace libTerrain
37{
38 partial class Channel
39 {
40 /// <summary>
41 /// Generates a Voronoi diagram (sort of a stained glass effect) which will fill the entire channel
42 /// </summary>
43 /// <remarks>3-Clause BSD Licensed</remarks>
44 /// <param name="pointsPerBlock">The number of generator points in each block</param>
45 /// <param name="blockSize">A multiple of the channel width and height which will have voronoi points generated in it.
46 /// <para>This is to ensure a more even distribution of the points than pure random allocation.</para></param>
47 /// <param name="c">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.</param>
48 public void voronoiDiagram(int pointsPerBlock, int blockSize, double[] c)
49 {
50 List<Point2D> points = new List<Point2D>();
51 Random generator = new Random(seed);
52
53 // Generate the emitter points
54 int x, y, i;
55 for (x = -blockSize; x < w + blockSize; x += blockSize)
56 {
57 for (y = -blockSize; y < h + blockSize; y += blockSize)
58 {
59 for (i = 0; i < pointsPerBlock; i++)
60 {
61 double pX = x + (generator.NextDouble() * (double)blockSize);
62 double pY = y + (generator.NextDouble() * (double)blockSize);
63
64 points.Add(new Point2D(pX, pY));
65 }
66 }
67 }
68
69 double[] distances = new double[points.Count];
70
71 // Calculate the distance each pixel is from an emitter
72 for (x = 0; x < w; x++)
73 {
74 for (y = 0; y < h; y++)
75 {
76 for (i = 0; i < points.Count; i++)
77 {
78 double dx, dy;
79 dx = Math.Abs((double)x - points[i].x);
80 dy = Math.Abs((double)y - points[i].y);
81
82 distances[i] = (dx * dx + dy * dy);
83 }
84
85 Array.Sort(distances);
86
87 double f = 0.0;
88
89 // Multiply the distances with their 'c' counterpart
90 // ordering the distances descending
91 for (i = 0; i < c.Length; i++)
92 {
93 if (i >= points.Count)
94 break;
95
96 f += c[i] * distances[i];
97 }
98
99 map[x, y] = f;
100 }
101 }
102
103 // Normalise the result
104 normalise();
105 }
106
107 public void voronoiDiagram(List<Point2D> points, double[] c)
108 {
109
110 Random generator = new Random(seed);
111 int x, y, i;
112 double[] distances = new double[points.Count];
113
114 // Calculate the distance each pixel is from an emitter
115 for (x = 0; x < w; x++)
116 {
117 for (y = 0; y < h; y++)
118 {
119 for (i = 0; i < points.Count; i++)
120 {
121 double dx, dy;
122 dx = Math.Abs((double)x - points[i].x);
123 dy = Math.Abs((double)y - points[i].y);
124
125 distances[i] = (dx * dx + dy * dy);
126 }
127
128 Array.Sort(distances);
129
130 double f = 0.0;
131
132 // Multiply the distances with their 'c' counterpart
133 // ordering the distances descending
134 for (i = 0; i < c.Length; i++)
135 {
136 if (i >= points.Count)
137 break;
138
139 f += c[i] * distances[i];
140 }
141
142 map[x, y] = f;
143 }
144 }
145
146 // Normalise the result
147 normalise();
148 }
149
150 public void voroflatDiagram(int pointsPerBlock, int blockSize)
151 {
152 List<Point2D> points = new List<Point2D>();
153 Random generator = new Random(seed);
154
155 // Generate the emitter points
156 int x, y, i;
157 for (x = -blockSize; x < w + blockSize; x += blockSize)
158 {
159 for (y = -blockSize; y < h + blockSize; y += blockSize)
160 {
161 for (i = 0; i < pointsPerBlock; i++)
162 {
163 double pX = x + (generator.NextDouble() * (double)blockSize);
164 double pY = y + (generator.NextDouble() * (double)blockSize);
165
166 points.Add(new Point2D(pX, pY));
167 }
168 }
169 }
170
171 double[] distances = new double[points.Count];
172
173 // Calculate the distance each pixel is from an emitter
174 for (x = 0; x < w; x++)
175 {
176 for (y = 0; y < h; y++)
177 {
178 for (i = 0; i < points.Count; i++)
179 {
180 double dx, dy;
181 dx = Math.Abs((double)x - points[i].x);
182 dy = Math.Abs((double)y - points[i].y);
183
184 distances[i] = (dx * dx + dy * dy);
185 }
186
187 //Array.Sort(distances);
188
189 double f = 0.0;
190
191 double min = double.MaxValue;
192 for (int j = 0; j < distances.Length;j++ )
193 {
194 if (distances[j] < min)
195 {
196 min = distances[j];
197 f = j;
198 }
199 }
200
201 // Multiply the distances with their 'c' counterpart
202 // ordering the distances descending
203
204 map[x, y] = f;
205 }
206 }
207
208 // Normalise the result
209 normalise();
210 }
211 }
212}
diff --git a/libraries/libTerrain/libTerrain/Channel/Generators/Worms.cs b/libraries/libTerrain/libTerrain/Channel/Generators/Worms.cs
deleted file mode 100644
index a54c946..0000000
--- a/libraries/libTerrain/libTerrain/Channel/Generators/Worms.cs
+++ /dev/null
@@ -1,75 +0,0 @@
1/*
2Redistribution and use in source and binary forms, with or without
3modification, are permitted provided that the following conditions are
4met:
5
6 * Redistributions of source code must retain the above copyright
7 notice, this list of conditions and the following disclaimer.
8
9 * Redistributions in binary form must reproduce the above
10 copyright notice, this list of conditions and the following
11 disclaimer in the documentation and/or other materials provided
12 with the distribution.
13
14 * Neither the name of libTerrain nor the names of
15 its contributors may be used to endorse or promote products
16 derived from this software without specific prior written
17 permission.
18
19THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30*/
31
32using System;
33using System.Collections.Generic;
34using System.Text;
35
36namespace libTerrain
37{
38 partial class Channel
39 {
40 /// <summary>
41 /// Generates 'number' of worms which navigate randomly around the landscape creating terrain as they go.
42 /// </summary>
43 /// <param name="number">The number of worms which will traverse the map</param>
44 /// <param name="rounds">The number of steps each worm will traverse</param>
45 /// <param name="movement">The maximum distance each worm will move each step</param>
46 /// <param name="size">The size of the area around the worm modified</param>
47 /// <param name="centerspawn">Do worms start in the middle, or randomly?</param>
48 public void worms(int number, int rounds, double movement, double size, bool centerspawn)
49 {
50 Random random = new Random(seed);
51 int i, j;
52
53 for (i = 0; i < number; i++)
54 {
55 double rx, ry;
56 if (centerspawn)
57 {
58 rx = w / 2.0;
59 ry = h / 2.0;
60 }
61 else
62 {
63 rx = random.NextDouble() * (w - 1);
64 ry = random.NextDouble() * (h - 1);
65 }
66 for (j = 0; j < rounds; j++)
67 {
68 rx += (random.NextDouble() * movement) - (movement / 2.0);
69 ry += (random.NextDouble() * movement) - (movement / 2.0);
70 raise(rx, ry, size, 1.0);
71 }
72 }
73 }
74 }
75} \ No newline at end of file
diff --git a/libraries/libTerrain/libTerrain/Channel/Grid.cs b/libraries/libTerrain/libTerrain/Channel/Grid.cs
deleted file mode 100644
index 41d20f6..0000000
--- a/libraries/libTerrain/libTerrain/Channel/Grid.cs
+++ /dev/null
@@ -1,264 +0,0 @@
1/*
2Redistribution and use in source and binary forms, with or without
3modification, are permitted provided that the following conditions are
4met:
5
6 * Redistributions of source code must retain the above copyright
7 notice, this list of conditions and the following disclaimer.
8
9 * Redistributions in binary form must reproduce the above
10 copyright notice, this list of conditions and the following
11 disclaimer in the documentation and/or other materials provided
12 with the distribution.
13
14 * Neither the name of libTerrain nor the names of
15 its contributors may be used to endorse or promote products
16 derived from this software without specific prior written
17 permission.
18
19THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30*/
31
32using System;
33using System.Collections.Generic;
34using System.Text;
35
36namespace libTerrain
37{
38 partial class Channel
39 {
40 public Channel normalise()
41 {
42 double max = findMax();
43 double min = findMin();
44
45 int x, y;
46
47 for (x = 0; x < w; x++)
48 {
49 for (y = 0; y < h; y++)
50 {
51 map[x, y] = (map[x, y] - min) * (1.0 / (max - min));
52 }
53 }
54
55 return this;
56 }
57
58 public Channel normalise(double minv, double maxv)
59 {
60 double max = findMax();
61 double min = findMin();
62
63 int x, y;
64
65 for (x = 0; x < w; x++)
66 {
67 for (y = 0; y < h; y++)
68 {
69 double val = (map[x, y] - min) * (1.0 / max - min);
70 val *= maxv - minv;
71 val += minv;
72
73 map[x, y] = val;
74 }
75 }
76
77 return this;
78 }
79
80 public Channel clip()
81 {
82 int x, y;
83
84 for (x = 0; x < w; x++)
85 {
86 for (y = 0; y < h; y++)
87 {
88 setClip(x, y, map[x, y]);
89 }
90 }
91
92 return this;
93 }
94
95 public Channel clip(double min, double max)
96 {
97 int x, y;
98 for (x = 0; x < w; x++)
99 {
100 for (y = 0; y < h; y++)
101 {
102 double val = map[x, y];
103 if (val > max) val = max;
104 if (val < min) val = min;
105 map[x, y] = val;
106 }
107 }
108 return this;
109 }
110
111 public Channel crop(int x1, int y1, int x2, int y2)
112 {
113 int width = x1 - x2 + 1;
114 int height = y1 - y2 + 1;
115 Channel chan = new Channel(width, height);
116
117 int x, y;
118 int nx, ny;
119
120 nx = 0;
121 for (x = x1; x < x2; x++)
122 {
123 ny = 0;
124 for (y = y1; y < y2; y++)
125 {
126 chan.map[nx, ny] = map[x, y];
127
128 ny++;
129 }
130 nx++;
131 }
132
133 return this;
134 }
135
136 public Channel addClip(Channel other)
137 {
138 int x, y;
139 for (x = 0; x < w; x++)
140 {
141 for (y = 0; y < h; y++)
142 {
143 map[x, y] = other.map[x, y];
144 if (map[x, y] > 1)
145 map[x, y] = 1;
146 if (map[x, y] < 0)
147 map[x, y] = 0;
148 }
149 }
150 return this;
151 }
152
153 public void smooth(double amount)
154 {
155 double area = amount;
156 double step = amount / 4.0;
157
158 double[,] manipulate = new double[w, h];
159 int x, y;
160 double n, l;
161 for (x = 0; x < w; x++)
162 {
163 for (y = 0; y < h; y++)
164 {
165 double average = 0.0;
166 int avgsteps = 0;
167
168 for (n = 0.0 - area; n < area; n += step)
169 {
170 for (l = 0.0 - area; l < area; l += step)
171 {
172 avgsteps++;
173 average += getBilinearInterpolate(x + n, y + l);
174 }
175 }
176
177 manipulate[x, y] = average / avgsteps;
178 }
179 }
180 map = manipulate;
181 }
182
183 public void pertubation(double amount)
184 {
185 // Simple pertubation filter
186 double[,] manipulated = new double[w, h];
187 Random generator = new Random(seed); // Seeds FTW!
188 //double amount = 8.0;
189
190 int x, y;
191 for (x = 0; x < w; x++)
192 {
193 for (y = 0; y < h; y++)
194 {
195 double offset_x = (double)x + (generator.NextDouble() * amount) - (amount / 2.0);
196 double offset_y = (double)y + (generator.NextDouble() * amount) - (amount / 2.0);
197 double p = getBilinearInterpolate(offset_x, offset_y);
198 manipulated[x, y] = p;
199 }
200 }
201 map = manipulated;
202 }
203
204 public void pertubationMask(Channel mask)
205 {
206 // Simple pertubation filter
207 double[,] manipulated = new double[w, h];
208 Random generator = new Random(seed); // Seeds FTW!
209 //double amount = 8.0;
210
211 double amount;
212
213 int x, y;
214 for (x = 0; x < w; x++)
215 {
216 for (y = 0; y < h; y++)
217 {
218 amount = mask.map[x, y];
219 double offset_x = (double)x + (generator.NextDouble() * amount) - (amount / 2.0);
220 double offset_y = (double)y + (generator.NextDouble() * amount) - (amount / 2.0);
221
222 if (offset_x > w)
223 offset_x = w - 1;
224 if (offset_y > h)
225 offset_y = h - 1;
226 if (offset_y < 0)
227 offset_y = 0;
228 if (offset_x < 0)
229 offset_x = 0;
230
231 double p = getBilinearInterpolate(offset_x, offset_y);
232 manipulated[x, y] = p;
233 }
234 }
235 map = manipulated;
236 }
237
238 public Channel blend(Channel other, double amount)
239 {
240 int x, y;
241 for (x = 0; x < w; x++)
242 {
243 for (y = 0; y < h; y++)
244 {
245 map[x, y] = Tools.linearInterpolate(map[x,y],other.map[x,y],amount);
246 }
247 }
248 return this;
249 }
250
251 public Channel blend(Channel other, Channel amount)
252 {
253 int x, y;
254 for (x = 0; x < w; x++)
255 {
256 for (y = 0; y < h; y++)
257 {
258 map[x, y] = Tools.linearInterpolate(map[x, y], other.map[x, y], amount.map[x,y]);
259 }
260 }
261 return this;
262 }
263 }
264}
diff --git a/libraries/libTerrain/libTerrain/Channel/Manipulators/AerobicErosion.cs b/libraries/libTerrain/libTerrain/Channel/Manipulators/AerobicErosion.cs
deleted file mode 100644
index ebeabe9..0000000
--- a/libraries/libTerrain/libTerrain/Channel/Manipulators/AerobicErosion.cs
+++ /dev/null
@@ -1,170 +0,0 @@
1/*
2Redistribution and use in source and binary forms, with or without
3modification, are permitted provided that the following conditions are
4met:
5
6 * Redistributions of source code must retain the above copyright
7 notice, this list of conditions and the following disclaimer.
8
9 * Redistributions in binary form must reproduce the above
10 copyright notice, this list of conditions and the following
11 disclaimer in the documentation and/or other materials provided
12 with the distribution.
13
14 * Neither the name of libTerrain nor the names of
15 its contributors may be used to endorse or promote products
16 derived from this software without specific prior written
17 permission.
18
19THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30*/
31
32using System;
33using System.Collections.Generic;
34using System.Text;
35
36namespace libTerrain
37{
38 partial class Channel
39 {
40 // Ideas for Aerobic erosion
41 //
42 // Unlike thermal (gravity) and hydraulic (water suspension)
43 // aerobic erosion should displace mass by moving sediment
44 // in "hops". The length of the hop being dictated by the
45 // presence of sharp cliffs and wind speed.
46
47 // The ability to pickup sediment is defined by the total
48 // surface area, such that:
49 // 0 0 0
50 // 0 1 0
51 // 0 0 0
52 // Would be the best possible value for sediment to be
53 // picked up (total difference = 8) and flatter land
54 // will erode less quickly.
55
56 // Suspended particles assist the erosion process by hitting
57 // the surface and chiselling additional particles off faster
58 // than alone.
59
60 // Particles are deposited when one of two conditions is met
61 // First:
62 // When particles hit a wall - such that the
63 // wind direction points at a difference >= the
64 // deposition mininum talus.
65 // Second:
66 // When wind speed is lowered to below the minimum
67 // required for transit. An idea for this is to
68 // use the navier-stokes algorithms for simulating
69 // pressure across the terrain.
70
71 /// <summary>
72 /// An experimental erosion algorithm developed by Adam. Moves sediment by factoring the surface area of each height point.
73 /// </summary>
74 /// <param name="windspeed">0..1 The speed of the wind</param>
75 /// <param name="pickup_talus_minimum">The minimum angle at which rock is eroded 0..1 (recommended: <= 0.30)</param>
76 /// <param name="drop_talus_minimum">The minimum angle at which rock is dropped 0..1 (recommended: >= 0.00)</param>
77 /// <param name="carry">The percentage of rock which can be picked up to pickup 0..1</param>
78 /// <param name="rounds">The number of erosion rounds (recommended: 25+)</param>
79 /// <param name="lowest">Drop sediment at the lowest point?</param>
80 public void AerobicErosion(double windspeed, double pickup_talus_minimum, double drop_talus_minimum, double carry, int rounds, bool lowest)
81 {
82 Channel wind = new Channel(w, h) ;
83 Channel sediment = new Channel(w, h);
84 int x, y, i, j;
85
86 wind = this.copy();
87 wind.normalise(); // Cheap wind calculations
88 wind *= windspeed;
89 wind.pertubation(30); // Can do better later
90
91 for (i = 0; i < rounds; i++)
92 {
93 // Convert some rocks to sand
94 for (x = 1; x < w - 1; x++)
95 {
96 for (y = 1; y < h - 1; y++)
97 {
98 double me = get(x, y);
99 double surfacearea = 0.3; // Everything will erode even if it's flat. Just slower.
100
101 for (j = 0; j < 9; j++)
102 {
103 int[] coords = neighbours(NEIGHBOURS.NEIGHBOUR_MOORE, j);
104 double target = get(x + coords[0], y + coords[1]);
105
106 surfacearea += Math.Abs(target - me);
107 }
108
109 double amount = surfacearea * wind.map[x, y] * carry;
110
111 if (amount < 0)
112 amount = 0;
113
114 if (surfacearea > pickup_talus_minimum)
115 {
116 this.map[x, y] -= amount;
117 sediment.map[x, y] += amount;
118 }
119 }
120 }
121 sediment.pertubation(10); // Sediment is blown around a bit
122 sediment.seed++;
123 wind.pertubation(15); // So is the wind
124 wind.seed++;
125
126 // Convert some sand to rock
127 for (x = 1; x < w - 1; x++)
128 {
129 for (y = 1; y < h - 1; y++)
130 {
131 double me = get(x, y);
132 double surfacearea = 0.01; // Flat land does not get deposition
133 double min = double.MaxValue;
134 int[] minside = new int[2];
135
136 for (j = 0; j < 9; j++)
137 {
138 int[] coords = neighbours(NEIGHBOURS.NEIGHBOUR_MOORE, j);
139 double target = get(x + coords[0], y + coords[1]);
140
141 surfacearea += Math.Abs(target - me);
142
143 if (target < min && lowest)
144 {
145 minside = (int[])coords.Clone();
146 min = target;
147 }
148 }
149
150 double amount = surfacearea * (1.0 - wind.map[x, y]) * carry;
151
152 if (amount < 0)
153 amount = 0;
154
155 if (surfacearea > drop_talus_minimum)
156 {
157 this.map[x + minside[0], y + minside[1]] += amount;
158 sediment.map[x, y] -= amount;
159 }
160 }
161 }
162
163 }
164
165 Channel myself = this;
166 myself += sediment;
167 myself.normalise();
168 }
169 }
170} \ No newline at end of file
diff --git a/libraries/libTerrain/libTerrain/Channel/Manipulators/HydraulicErosion.cs b/libraries/libTerrain/libTerrain/Channel/Manipulators/HydraulicErosion.cs
deleted file mode 100644
index 0cec05d..0000000
--- a/libraries/libTerrain/libTerrain/Channel/Manipulators/HydraulicErosion.cs
+++ /dev/null
@@ -1 +0,0 @@
1/* Needs BSD rewrite */ \ No newline at end of file
diff --git a/libraries/libTerrain/libTerrain/Channel/Manipulators/ThermalWeathering.cs b/libraries/libTerrain/libTerrain/Channel/Manipulators/ThermalWeathering.cs
deleted file mode 100644
index 0cae56d..0000000
--- a/libraries/libTerrain/libTerrain/Channel/Manipulators/ThermalWeathering.cs
+++ /dev/null
@@ -1,113 +0,0 @@
1/*
2Redistribution and use in source and binary forms, with or without
3modification, are permitted provided that the following conditions are
4met:
5
6 * Redistributions of source code must retain the above copyright
7 notice, this list of conditions and the following disclaimer.
8
9 * Redistributions in binary form must reproduce the above
10 copyright notice, this list of conditions and the following
11 disclaimer in the documentation and/or other materials provided
12 with the distribution.
13
14 * Neither the name of libTerrain nor the names of
15 its contributors may be used to endorse or promote products
16 derived from this software without specific prior written
17 permission.
18
19THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30*/
31
32using System;
33using System.Collections.Generic;
34using System.Text;
35
36namespace libTerrain
37{
38 partial class Channel
39 {
40 /// <summary>
41 /// A thermal weathering implementation based on Musgrave's original 1989 algorithm. This is Adam's custom implementation which may differ slightly from the original.
42 /// </summary>
43 /// <param name="talus">The rock angle (represented as a dy/dx ratio) at which point it will be succeptible to breakage</param>
44 /// <param name="rounds">The number of erosion rounds</param>
45 /// <param name="c">The amount of rock to carry each round</param>
46 public Channel thermalWeathering(double talus, int rounds, double c)
47 {
48 double[,] lastFrame;
49 double[,] thisFrame;
50
51 lastFrame = (double[,])map.Clone();
52 thisFrame = (double[,])map.Clone();
53
54 NEIGHBOURS type = NEIGHBOURS.NEIGHBOUR_MOORE; // Using moore neighbourhood (twice as computationally expensive)
55 int NEIGHBOUR_ME = 4; // I am always 4 in both systems.
56
57 int NEIGHBOUR_MAX = type == NEIGHBOURS.NEIGHBOUR_MOORE ? 9 : 5;
58
59 int frames = rounds; // Number of thermal erosion iterations to run
60 int i, j;
61 int x, y;
62
63 for (i = 0; i < frames; i++)
64 {
65 for (x = 0; x < w; x++)
66 {
67 for (y = 0; y < h; y++)
68 {
69 for (j = 0; j < NEIGHBOUR_MAX; j++)
70 {
71 if (j != NEIGHBOUR_ME)
72 {
73 int[] coords = neighbours(type, j);
74
75 coords[0] += x;
76 coords[1] += y;
77
78 if (coords[0] > w - 1)
79 coords[0] = w - 1;
80 if (coords[1] > h - 1)
81 coords[1] = h - 1;
82 if (coords[0] < 0)
83 coords[0] = 0;
84 if (coords[1] < 0)
85 coords[1] = 0;
86
87 double heightF = thisFrame[x, y];
88 double target = thisFrame[coords[0], coords[1]];
89
90 if (target > heightF + talus)
91 {
92 double calc = c * ((target - heightF) - talus);
93 heightF += calc;
94 target -= calc;
95 }
96
97 thisFrame[x, y] = heightF;
98 thisFrame[coords[0], coords[1]] = target;
99
100 }
101 }
102 }
103 }
104 lastFrame = (double[,])thisFrame.Clone();
105 }
106
107 map = thisFrame;
108
109 normalise(); // Just to guaruntee a smooth 0..1 value
110 return this;
111 }
112 }
113}
diff --git a/libraries/libTerrain/libTerrain/Channel/Neighbours.cs b/libraries/libTerrain/libTerrain/Channel/Neighbours.cs
deleted file mode 100644
index f2b4aed..0000000
--- a/libraries/libTerrain/libTerrain/Channel/Neighbours.cs
+++ /dev/null
@@ -1,144 +0,0 @@
1/*
2Redistribution and use in source and binary forms, with or without
3modification, are permitted provided that the following conditions are
4met:
5
6 * Redistributions of source code must retain the above copyright
7 notice, this list of conditions and the following disclaimer.
8
9 * Redistributions in binary form must reproduce the above
10 copyright notice, this list of conditions and the following
11 disclaimer in the documentation and/or other materials provided
12 with the distribution.
13
14 * Neither the name of libTerrain nor the names of
15 its contributors may be used to endorse or promote products
16 derived from this software without specific prior written
17 permission.
18
19THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30*/
31
32using System;
33using System.Collections.Generic;
34using System.Text;
35
36namespace libTerrain
37{
38 partial class Channel
39 {
40 enum NEIGHBOURS
41 {
42 NEIGHBOUR_MOORE,
43 NEIGHBOUR_VONNEUMANN
44 };
45
46 private int[] neighbours(NEIGHBOURS type, int index)
47 {
48 int[] coord = new int[2];
49
50 index++;
51
52 switch (type)
53 {
54 case NEIGHBOURS.NEIGHBOUR_MOORE:
55 switch (index)
56 {
57 case 1:
58 coord[0] = -1;
59 coord[1] = -1;
60 break;
61
62 case 2:
63 coord[0] = -0;
64 coord[1] = -1;
65 break;
66
67 case 3:
68 coord[0] = +1;
69 coord[1] = -1;
70 break;
71
72 case 4:
73 coord[0] = -1;
74 coord[1] = -0;
75 break;
76
77 case 5:
78 coord[0] = -0;
79 coord[1] = -0;
80 break;
81
82 case 6:
83 coord[0] = +1;
84 coord[1] = -0;
85 break;
86
87 case 7:
88 coord[0] = -1;
89 coord[1] = +1;
90 break;
91
92 case 8:
93 coord[0] = -0;
94 coord[1] = +1;
95 break;
96
97 case 9:
98 coord[0] = +1;
99 coord[1] = +1;
100 break;
101
102 default:
103 break;
104 }
105 break;
106
107 case NEIGHBOURS.NEIGHBOUR_VONNEUMANN:
108 switch (index)
109 {
110 case 1:
111 coord[0] = 0;
112 coord[1] = -1;
113 break;
114
115 case 2:
116 coord[0] = -1;
117 coord[1] = 0;
118 break;
119
120 case 3:
121 coord[0] = +1;
122 coord[1] = 0;
123 break;
124
125 case 4:
126 coord[0] = 0;
127 coord[1] = +1;
128 break;
129
130 case 5:
131 coord[0] = -0;
132 coord[1] = -0;
133 break;
134
135 default:
136 break;
137 }
138 break;
139 }
140
141 return coord;
142 }
143 }
144}
diff --git a/libraries/libTerrain/libTerrain/Channel/Operators.cs b/libraries/libTerrain/libTerrain/Channel/Operators.cs
deleted file mode 100644
index 81db690..0000000
--- a/libraries/libTerrain/libTerrain/Channel/Operators.cs
+++ /dev/null
@@ -1,221 +0,0 @@
1/*
2Redistribution and use in source and binary forms, with or without
3modification, are permitted provided that the following conditions are
4met:
5
6 * Redistributions of source code must retain the above copyright
7 notice, this list of conditions and the following disclaimer.
8
9 * Redistributions in binary form must reproduce the above
10 copyright notice, this list of conditions and the following
11 disclaimer in the documentation and/or other materials provided
12 with the distribution.
13
14 * Neither the name of libTerrain nor the names of
15 its contributors may be used to endorse or promote products
16 derived from this software without specific prior written
17 permission.
18
19THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30*/
31
32using System;
33using System.Collections.Generic;
34using System.Text;
35
36namespace libTerrain
37{
38 partial class Channel
39 {
40 /* Operator combination of channel datatypes */
41
42 public static Channel operator +(Channel A, Channel B)
43 {
44 if (A.h != B.h)
45 throw new Exception("Cannot add heightmaps, of different height.");
46 if (A.w != B.w)
47 throw new Exception("Cannot add heightmaps, of different width.");
48
49 int x, y;
50
51 for (x = 0; x < A.w; x++)
52 {
53 for (y = 0; y < A.h; y++)
54 {
55 A.map[x, y] += B.map[x, y];
56 }
57 }
58
59 return A;
60 }
61
62 public static Channel operator *(Channel A, Channel B)
63 {
64 if (A.h != B.h)
65 throw new Exception("Cannot multiply heightmaps, of different height.");
66 if (A.w != B.w)
67 throw new Exception("Cannot multiply heightmaps, of different width.");
68
69 int x, y;
70
71 for (x = 0; x < A.w; x++)
72 {
73 for (y = 0; y < A.h; y++)
74 {
75 A.map[x, y] *= B.map[x, y];
76 }
77 }
78
79 return A;
80 }
81
82 public static Channel operator -(Channel A, Channel B)
83 {
84 if (A.h != B.h)
85 throw new Exception("Cannot subtract heightmaps, of different height.");
86 if (A.w != B.w)
87 throw new Exception("Cannot subtract heightmaps, of different width.");
88
89 int x, y;
90
91 for (x = 0; x < A.w; x++)
92 {
93 for (y = 0; y < A.h; y++)
94 {
95 A.map[x, y] -= B.map[x, y];
96 }
97 }
98
99 return A;
100 }
101
102 public static Channel operator /(Channel A, Channel B)
103 {
104 if (A.h != B.h)
105 throw new Exception("Cannot divide heightmaps, of different height.");
106 if (A.w != B.w)
107 throw new Exception("Cannot divide heightmaps, of different width.");
108
109 int x, y;
110
111 for (x = 0; x < A.w; x++)
112 {
113 for (y = 0; y < A.h; y++)
114 {
115 A.map[x, y] /= B.map[x, y];
116 }
117 }
118
119 return A;
120 }
121
122 public static Channel operator ^(Channel A, Channel B)
123 {
124 if (A.h != B.h)
125 throw new Exception("Cannot divide heightmaps, of different height.");
126 if (A.w != B.w)
127 throw new Exception("Cannot divide heightmaps, of different width.");
128
129 int x, y;
130
131 for (x = 0; x < A.w; x++)
132 {
133 for (y = 0; y < A.h; y++)
134 {
135 A.map[x, y] = Math.Pow(A.map[x,y],B.map[x, y]);
136 }
137 }
138
139 return A;
140 }
141
142
143 /* Operator combination of channel and double datatypes */
144
145 public static Channel operator +(Channel A, double B)
146 {
147 int x, y;
148
149 for (x = 0; x < A.w; x++)
150 {
151 for (y = 0; y < A.h; y++)
152 {
153 A.map[x, y] += B;
154 }
155 }
156
157 return A;
158 }
159
160 public static Channel operator -(Channel A, double B)
161 {
162 int x, y;
163
164 for (x = 0; x < A.w; x++)
165 {
166 for (y = 0; y < A.h; y++)
167 {
168 A.map[x, y] -= B;
169 }
170 }
171
172 return A;
173 }
174
175 public static Channel operator *(Channel A, double B)
176 {
177 int x, y;
178
179 for (x = 0; x < A.w; x++)
180 {
181 for (y = 0; y < A.h; y++)
182 {
183 A.map[x, y] *= B;
184 }
185 }
186
187 return A;
188 }
189
190 public static Channel operator /(Channel A, double B)
191 {
192 int x, y;
193
194 for (x = 0; x < A.w; x++)
195 {
196 for (y = 0; y < A.h; y++)
197 {
198 A.map[x, y] /= B;
199 }
200 }
201
202 return A;
203 }
204
205 public static Channel operator ^(Channel A, double B)
206 {
207 int x, y;
208
209 for (x = 0; x < A.w; x++)
210 {
211 for (y = 0; y < A.h; y++)
212 {
213 A.map[x, y] = Math.Pow(A.map[x,y],B);
214 }
215 }
216
217 return A;
218 }
219
220 }
221}
diff --git a/libraries/libTerrain/libTerrain/Properties/AssemblyInfo.cs b/libraries/libTerrain/libTerrain/Properties/AssemblyInfo.cs
deleted file mode 100644
index d47f359..0000000
--- a/libraries/libTerrain/libTerrain/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,35 +0,0 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("libTerrain")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("")]
12[assembly: AssemblyProduct("libTerrain")]
13[assembly: AssemblyCopyright("Copyright © 2007")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("69f89dd2-fbd1-400e-bb0d-ac73b80853de")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32// You can specify all the values or you can default the Revision and Build Numbers
33// by using the '*' as shown below:
34[assembly: AssemblyVersion("1.0.0.0")]
35[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/libraries/libTerrain/libTerrain/TODO.txt b/libraries/libTerrain/libTerrain/TODO.txt
deleted file mode 100644
index e1998ac..0000000
--- a/libraries/libTerrain/libTerrain/TODO.txt
+++ /dev/null
@@ -1,42 +0,0 @@
1TODO
2 Anyone is free to take on one of these projects
3 since implementations offer differ in results
4 the more the merrier.
5
6 New Generators
7
8 * Musgraves multifractal suite
9 * Hybrid Multifractal
10 * Ridged Multifractal
11 * Heterogenous procedural terrain
12
13 Example implementation:
14 http://cobweb.ecn.purdue.edu/~ebertd/texture/1stEdition/musgrave/musgrave.c
15
16 * Ken Perlin's noise functions
17 * Perlin noise
18 * Original
19 * Improved versions
20
21 * Port the libnoise.sourceforge.net generators
22
23 * Cellular / Organic Generators
24 **ADDED CELLULAR.CS** // Adam Frisby <adam@deepthink.com.au> (20/03/2007)
25
26 * Finish porting the procedurality code in
27 /branches/proceduality/
28 currently Java, but porting is easy enough
29 mostly a case of find/search/replace.
30
31 Improvements
32
33 * HillPlanter.cs
34 * Add rectangular & square hills
35
36 * Voronoi.cs
37 * Add different distance metrics
38 Currently using Eulicidean distance
39 Want:
40 * Manhattan Distance
41 * Camberra Distance
42 * Chebychev Distance \ No newline at end of file
diff --git a/libraries/libTerrain/libTerrain/Test/SimpleTerrain.cs b/libraries/libTerrain/libTerrain/Test/SimpleTerrain.cs
deleted file mode 100644
index 9f0967b..0000000
--- a/libraries/libTerrain/libTerrain/Test/SimpleTerrain.cs
+++ /dev/null
@@ -1,47 +0,0 @@
1/*
2Redistribution and use in source and binary forms, with or without
3modification, are permitted provided that the following conditions are
4met:
5
6 * Redistributions of source code must retain the above copyright
7 notice, this list of conditions and the following disclaimer.
8
9 * Redistributions in binary form must reproduce the above
10 copyright notice, this list of conditions and the following
11 disclaimer in the documentation and/or other materials provided
12 with the distribution.
13
14 * Neither the name of libTerrain nor the names of
15 its contributors may be used to endorse or promote products
16 derived from this software without specific prior written
17 permission.
18
19THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30*/
31
32using System;
33using System.Collections.Generic;
34using System.Text;
35
36namespace libTerrain.Test
37{
38 class SimpleTerrain
39 {
40 public SimpleTerrain()
41 {
42 Channel terrain = new Channel(256, 256);
43 terrain.fill(0.5);
44 terrain.thermalWeathering(0.1, 50, 0.1);
45 }
46 }
47}
diff --git a/libraries/libTerrain/libTerrain/Tools/Point2D.cs b/libraries/libTerrain/libTerrain/Tools/Point2D.cs
deleted file mode 100644
index 69c1148..0000000
--- a/libraries/libTerrain/libTerrain/Tools/Point2D.cs
+++ /dev/null
@@ -1,49 +0,0 @@
1/*
2Redistribution and use in source and binary forms, with or without
3modification, are permitted provided that the following conditions are
4met:
5
6 * Redistributions of source code must retain the above copyright
7 notice, this list of conditions and the following disclaimer.
8
9 * Redistributions in binary form must reproduce the above
10 copyright notice, this list of conditions and the following
11 disclaimer in the documentation and/or other materials provided
12 with the distribution.
13
14 * Neither the name of libTerrain nor the names of
15 its contributors may be used to endorse or promote products
16 derived from this software without specific prior written
17 permission.
18
19THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30*/
31
32using System;
33using System.Collections.Generic;
34using System.Text;
35
36namespace libTerrain
37{
38 public class Point2D
39 {
40 public double x;
41 public double y;
42
43 public Point2D(double X, double Y)
44 {
45 x = X;
46 y = Y;
47 }
48 }
49}
diff --git a/libraries/libTerrain/libTerrain/Tools/Tools.cs b/libraries/libTerrain/libTerrain/Tools/Tools.cs
deleted file mode 100644
index 3f7ab68..0000000
--- a/libraries/libTerrain/libTerrain/Tools/Tools.cs
+++ /dev/null
@@ -1,60 +0,0 @@
1/*
2Redistribution and use in source and binary forms, with or without
3modification, are permitted provided that the following conditions are
4met:
5
6 * Redistributions of source code must retain the above copyright
7 notice, this list of conditions and the following disclaimer.
8
9 * Redistributions in binary form must reproduce the above
10 copyright notice, this list of conditions and the following
11 disclaimer in the documentation and/or other materials provided
12 with the distribution.
13
14 * Neither the name of libTerrain nor the names of
15 its contributors may be used to endorse or promote products
16 derived from this software without specific prior written
17 permission.
18
19THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30*/
31
32using System;
33using System.Collections.Generic;
34using System.Text;
35
36namespace libTerrain
37{
38 class Tools
39 {
40 public static double linearInterpolate(double a, double b, double amount)
41 {
42 return a + ((b - a) * amount);
43 }
44 public static double exponentialInterpolate(double a, double b, double amount)
45 {
46 a = Math.Pow(a, amount);
47 b = Math.Pow(b - a, 1.0 - amount);
48 return a+b;
49 }
50 public static int powerOf2Log2(int n) {
51 for (int i = 0; i < 31; i++) {
52 if ((n & 1) == 1) {
53 return i;
54 }
55 n >>= 1;
56 }
57 return 0;
58 }
59 }
60}
diff --git a/libraries/libTerrain/libTerrain/libTerrain-BSD.csproj b/libraries/libTerrain/libTerrain/libTerrain-BSD.csproj
deleted file mode 100644
index df6d651..0000000
--- a/libraries/libTerrain/libTerrain/libTerrain-BSD.csproj
+++ /dev/null
@@ -1,75 +0,0 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <ProductVersion>8.0.50727</ProductVersion>
6 <SchemaVersion>2.0</SchemaVersion>
7 <ProjectGuid>{EEC06368-30E8-42E8-A23C-2C9D139AD495}</ProjectGuid>
8 <OutputType>Library</OutputType>
9 <AppDesignerFolder>Properties</AppDesignerFolder>
10 <RootNamespace>libTerrain</RootNamespace>
11 <AssemblyName>libTerrain-BSD</AssemblyName>
12 </PropertyGroup>
13 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
14 <DebugSymbols>true</DebugSymbols>
15 <DebugType>full</DebugType>
16 <Optimize>false</Optimize>
17 <OutputPath>bin\Debug\</OutputPath>
18 <DefineConstants>DEBUG;TRACE</DefineConstants>
19 <ErrorReport>prompt</ErrorReport>
20 <WarningLevel>4</WarningLevel>
21 </PropertyGroup>
22 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
23 <DebugType>pdbonly</DebugType>
24 <Optimize>true</Optimize>
25 <OutputPath>bin\Release\</OutputPath>
26 <DefineConstants>TRACE</DefineConstants>
27 <ErrorReport>prompt</ErrorReport>
28 <WarningLevel>4</WarningLevel>
29 </PropertyGroup>
30 <ItemGroup>
31 <Reference Include="System" />
32 <Reference Include="System.Data" />
33 <Reference Include="System.Drawing" />
34 <Reference Include="System.Xml" />
35 </ItemGroup>
36 <ItemGroup>
37 <Compile Include="Bitmap\Bitmap.cs" />
38 <Compile Include="Channel\Channel.cs" />
39 <Compile Include="Channel\Common.cs" />
40 <Compile Include="Channel\Editing\Flatten.cs" />
41 <Compile Include="Channel\Editing\Raise.cs" />
42 <Compile Include="Channel\File.cs" />
43 <Compile Include="Channel\Generators\Cellular.cs" />
44 <Compile Include="Channel\Generators\Fracture.cs" />
45 <Compile Include="Channel\Generators\Gradient.cs" />
46 <Compile Include="Channel\Generators\HillPlanter.cs" />
47 <Compile Include="Channel\Generators\Midpoint.cs" />
48 <Compile Include="Channel\Generators\Mountain.cs" />
49 <Compile Include="Channel\Generators\Noise.cs" />
50 <Compile Include="Channel\Generators\Spiral.cs" />
51 <Compile Include="Channel\Generators\Voronoi.cs" />
52 <Compile Include="Channel\Generators\Worms.cs" />
53 <Compile Include="Channel\Grid.cs" />
54 <Compile Include="Channel\Manipulators\AerobicErosion.cs" />
55 <Compile Include="Channel\Manipulators\HydraulicErosion.cs" />
56 <Compile Include="Channel\Manipulators\ThermalWeathering.cs" />
57 <Compile Include="Channel\Neighbours.cs" />
58 <Compile Include="Channel\Operators.cs" />
59 <Compile Include="Properties\AssemblyInfo.cs" />
60 <Compile Include="Test\SimpleTerrain.cs" />
61 <Compile Include="Tools\Point2D.cs" />
62 <Compile Include="Tools\Tools.cs" />
63 </ItemGroup>
64 <ItemGroup>
65 <Content Include="TODO.txt" />
66 </ItemGroup>
67 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
68 <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
69 Other similar extension points exist, see Microsoft.Common.targets.
70 <Target Name="BeforeBuild">
71 </Target>
72 <Target Name="AfterBuild">
73 </Target>
74 -->
75</Project> \ No newline at end of file
diff --git a/libraries/libTerrain/libTerrainTests/Program.cs b/libraries/libTerrain/libTerrainTests/Program.cs
deleted file mode 100644
index cf3da3d..0000000
--- a/libraries/libTerrain/libTerrainTests/Program.cs
+++ /dev/null
@@ -1,299 +0,0 @@
1/*
2Redistribution and use in source and binary forms, with or without
3modification, are permitted provided that the following conditions are
4met:
5
6 * Redistributions of source code must retain the above copyright
7 notice, this list of conditions and the following disclaimer.
8
9 * Redistributions in binary form must reproduce the above
10 copyright notice, this list of conditions and the following
11 disclaimer in the documentation and/or other materials provided
12 with the distribution.
13
14 * Neither the name of libTerrain nor the names of
15 its contributors may be used to endorse or promote products
16 derived from this software without specific prior written
17 permission.
18
19THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30*/
31
32
33using System;
34using System.Collections.Generic;
35using System.Text;
36using libTerrain;
37
38namespace libTerrainTests
39{
40 class Program
41 {
42 static void Main(string[] args)
43 {
44 System.Console.WriteLine("Starting tests...");
45
46 Channel test;
47
48 try
49 {
50 System.Console.WriteLine("Blank Heightmap");
51 test = new Channel();
52 test.fill(0);
53 test.saveImage("test_blank.png");
54 }
55 catch (Exception e)
56 {
57 System.Console.WriteLine("Unhandled exception: " + e.ToString());
58 }
59
60
61 try
62 {
63 System.Console.WriteLine("Grayscale Cube");
64 test = new Channel();
65 test.fill(0);
66 test.gradientCube();
67 test.saveImage("test_cube.png");
68
69 test.Polar();
70 test.saveImage("test_polarcube.png");
71 }
72 catch (Exception e)
73 {
74 System.Console.WriteLine("Unhandled exception: " + e.ToString());
75 }
76
77 try
78 {
79 System.Console.WriteLine("Spiral Planters");
80 test = new Channel();
81 test.fill(0);
82
83 test.SpiralPlanter(200, Math.PI / 15, 0.75, 0, 0);
84 test.normalise();
85 //test.Spiral(192, 192, 50);
86 test.saveImage("test_spiral.png");
87 }
88 catch (Exception e)
89 {
90 System.Console.WriteLine("Unhandled exception: " + e.ToString());
91 }
92
93 try
94 {
95 System.Console.WriteLine("Spiral Cells");
96 test = new Channel();
97 test.fill(0);
98
99 double[] c = new double[2];
100 c[0] = -1;
101 c[1] = 1;
102
103 test.SpiralCells(200, Math.PI / 15, 0.75, 0, 0, c);
104 test.normalise();
105 //test.Spiral(192, 192, 50);
106 test.saveImage("test_spiralcells.png");
107
108 test.fill(0);
109 test.SpiralCells(30, Math.PI / 30, 0, 75, 0, c);
110 test.normalise();
111 //test.Spiral(192, 192, 50);
112 test.saveImage("test_circlecells.png");
113
114 }
115 catch (Exception e)
116 {
117 System.Console.WriteLine("Unhandled exception: " + e.ToString());
118 }
119
120 try
121 {
122 System.Console.WriteLine("Fracturing");
123 test = new Channel();
124 test.fill(0);
125 test.fracture(300, 0, 1);
126 test.saveImage("test_fracture.png");
127 }
128 catch (Exception e)
129 {
130 System.Console.WriteLine("Unhandled exception: " + e.ToString());
131 }
132
133 try
134 {
135 System.Console.WriteLine("Voronoi (Flat)");
136 test = new Channel();
137 test.fill(0);
138 test.voroflatDiagram(64, 384);
139 test.saveImage("test_voroflat.png");
140 }
141 catch (Exception e)
142 {
143 System.Console.WriteLine("Unhandled exception: " + e.ToString());
144 }
145
146
147 try
148 {
149 System.Console.WriteLine("Voronoi (Flat / Fixnormal)");
150 test = new Channel();
151 test.fill(0);
152 test.voroflatDiagram(64, 384);
153 test ^= 4;
154 test.normalise();
155 test.saveImage("test_voroflatfixnormal.png");
156 }
157 catch (Exception e)
158 {
159 System.Console.WriteLine("Unhandled exception: " + e.ToString());
160 }
161
162 try
163 {
164 System.Console.WriteLine("File Import (Mask Flatten)");
165 test = new Channel();
166 Channel test2;
167 test2 = test.loadImage("test_chained_aerobic.png");
168
169 test.fill(0);
170 test.voroflatDiagram(64, 384);
171 test ^= 4;
172 test.normalise();
173
174 test.smooth(4);
175 test.normalise();
176
177 test.saveImage("test_flatmask.png");
178 test2.flatten(test, 1.0);
179
180 test2.saveImage("test_fileflatmask.png");
181 }
182 catch (Exception e)
183 {
184 System.Console.WriteLine("Unhandled exception: " + e.ToString());
185 }
186
187 try
188 {
189 System.Console.WriteLine("Worms");
190 test = new Channel();
191 test.worms(100, 10, 20.0, 16, false);
192 test.normalise();
193 test.saveImage("test_worms.png");
194 }
195 catch (Exception e)
196 {
197 System.Console.WriteLine("Unhandled exception: " + e.ToString());
198 }
199
200 try
201 {
202 System.Console.WriteLine("Noise");
203 test = new Channel();
204 test.noise();
205 test.saveImage("test_noise.png");
206 }
207 catch (Exception e)
208 {
209 System.Console.WriteLine("Unhandled exception: " + e.ToString());
210 }
211
212 try
213 {
214 System.Console.WriteLine("Hills (Spherical)");
215 test = new Channel();
216 test.hillsSpheres(200, 20, 30, true, true, false);
217 test.saveImage("test_hillspheres.png");
218 }
219 catch (Exception e)
220 {
221 System.Console.WriteLine("Unhandled exception: " + e.ToString());
222 }
223
224 try
225 {
226 System.Console.WriteLine("Hills (Blocks)");
227 test = new Channel();
228 test.hillsBlocks(200, 20, 30, true, true, false);
229// test.hillsSpheres(200, 20, 30, true, true, false);
230 test.saveImage("test_hillblocks.png");
231 }
232 catch (Exception e)
233 {
234 System.Console.WriteLine("Unhandled exception: " + e.ToString());
235 }
236
237 try
238 {
239 System.Console.WriteLine("Hills (Cones)");
240 test = new Channel();
241 test.fill(0);
242 test.hillsCones(200, 20, 30, true, true, false);
243 test.normalise();
244 test.saveImage("test_hillcones.png");
245 }
246 catch (Exception e)
247 {
248 System.Console.WriteLine("Unhandled exception: " + e.ToString());
249 }
250
251 try
252 {
253 System.Console.WriteLine("Voronoi Diagram");
254 test = new Channel();
255 double[] c = new double[2];
256 c[0] = -1;
257 c[1] = 1;
258 test.voronoiDiagram(4, 128, c);
259 test.saveImage("test_voronoi.png");
260 }
261 catch (Exception e)
262 {
263 System.Console.WriteLine("Unhandled exception: " + e.ToString());
264 }
265
266 try
267 {
268 System.Console.WriteLine("Raising Terrain");
269 test = new Channel();
270 test.fill(0);
271 test.raise(128, 128, 64, 1.0);
272 test.normalise();
273 test.saveImage("test_raise.png");
274 }
275 catch (Exception e)
276 {
277 System.Console.WriteLine("Unhandled exception: " + e.ToString());
278 }
279
280 try
281 {
282 System.Console.WriteLine("Flattening Terrain (unmasked)");
283 test = new Channel();
284 test.noise();
285 test.flatten(128, 128, 64, 1.0);
286 test.normalise();
287 test.saveImage("test_flatten.png");
288 }
289 catch (Exception e)
290 {
291 System.Console.WriteLine("Unhandled exception: " + e.ToString());
292 }
293
294
295
296 System.Console.WriteLine("Done");
297 }
298 }
299}
diff --git a/libraries/libTerrain/libTerrainTests/Properties/AssemblyInfo.cs b/libraries/libTerrain/libTerrainTests/Properties/AssemblyInfo.cs
deleted file mode 100644
index 09e0845..0000000
--- a/libraries/libTerrain/libTerrainTests/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,33 +0,0 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("libTerrainTests")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("")]
12[assembly: AssemblyProduct("libTerrainTests")]
13[assembly: AssemblyCopyright("Copyright © 2007")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("528417c9-dd71-487e-8e0b-e8e42e52fa10")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("1.0.0.0")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/libraries/libTerrain/libTerrainTests/libTerrain.csproj b/libraries/libTerrain/libTerrainTests/libTerrain.csproj
deleted file mode 100644
index 047ad02..0000000
--- a/libraries/libTerrain/libTerrainTests/libTerrain.csproj
+++ /dev/null
@@ -1,75 +0,0 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <ProductVersion>8.0.50727</ProductVersion>
6 <SchemaVersion>2.0</SchemaVersion>
7 <ProjectGuid>{EEC06368-30E8-42E8-A23C-2C9D139AD495}</ProjectGuid>
8 <OutputType>Library</OutputType>
9 <AppDesignerFolder>Properties</AppDesignerFolder>
10 <RootNamespace>libTerrain</RootNamespace>
11 <AssemblyName>libTerrain</AssemblyName>
12 </PropertyGroup>
13 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
14 <DebugSymbols>true</DebugSymbols>
15 <DebugType>full</DebugType>
16 <Optimize>false</Optimize>
17 <OutputPath>bin\Debug\</OutputPath>
18 <DefineConstants>DEBUG;TRACE</DefineConstants>
19 <ErrorReport>prompt</ErrorReport>
20 <WarningLevel>4</WarningLevel>
21 </PropertyGroup>
22 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
23 <DebugType>pdbonly</DebugType>
24 <Optimize>true</Optimize>
25 <OutputPath>bin\Release\</OutputPath>
26 <DefineConstants>TRACE</DefineConstants>
27 <ErrorReport>prompt</ErrorReport>
28 <WarningLevel>4</WarningLevel>
29 </PropertyGroup>
30 <ItemGroup>
31 <Reference Include="System" />
32 <Reference Include="System.Data" />
33 <Reference Include="System.Drawing" />
34 <Reference Include="System.Xml" />
35 </ItemGroup>
36 <ItemGroup>
37 <Compile Include="Bitmap\Bitmap.cs" />
38 <Compile Include="Channel\Channel.cs" />
39 <Compile Include="Channel\Common.cs" />
40 <Compile Include="Channel\Editing\Flatten.cs" />
41 <Compile Include="Channel\Editing\Raise.cs" />
42 <Compile Include="Channel\File.cs" />
43 <Compile Include="Channel\Generators\Cellular.cs" />
44 <Compile Include="Channel\Generators\Fracture.cs" />
45 <Compile Include="Channel\Generators\Gradient.cs" />
46 <Compile Include="Channel\Generators\HillPlanter.cs" />
47 <Compile Include="Channel\Generators\Midpoint.cs" />
48 <Compile Include="Channel\Generators\Mountain.cs" />
49 <Compile Include="Channel\Generators\Noise.cs" />
50 <Compile Include="Channel\Generators\Spiral.cs" />
51 <Compile Include="Channel\Generators\Voronoi.cs" />
52 <Compile Include="Channel\Generators\Worms.cs" />
53 <Compile Include="Channel\Grid.cs" />
54 <Compile Include="Channel\Manipulators\AerobicErosion.cs" />
55 <Compile Include="Channel\Manipulators\HydraulicErosion.cs" />
56 <Compile Include="Channel\Manipulators\ThermalWeathering.cs" />
57 <Compile Include="Channel\Neighbours.cs" />
58 <Compile Include="Channel\Operators.cs" />
59 <Compile Include="Properties\AssemblyInfo.cs" />
60 <Compile Include="Test\SimpleTerrain.cs" />
61 <Compile Include="Tools\Point2D.cs" />
62 <Compile Include="Tools\Tools.cs" />
63 </ItemGroup>
64 <ItemGroup>
65 <Content Include="TODO.txt" />
66 </ItemGroup>
67 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
68 <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
69 Other similar extension points exist, see Microsoft.Common.targets.
70 <Target Name="BeforeBuild">
71 </Target>
72 <Target Name="AfterBuild">
73 </Target>
74 -->
75</Project> \ No newline at end of file
diff --git a/libraries/libTerrain/libTerrainTests/libTerrainTests.csproj b/libraries/libTerrain/libTerrainTests/libTerrainTests.csproj
deleted file mode 100644
index 4227155..0000000
--- a/libraries/libTerrain/libTerrainTests/libTerrainTests.csproj
+++ /dev/null
@@ -1,56 +0,0 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup>
3 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <ProductVersion>8.0.50727</ProductVersion>
6 <SchemaVersion>2.0</SchemaVersion>
7 <ProjectGuid>{7214C9E2-1390-41BD-BFFC-83FA5931C5CF}</ProjectGuid>
8 <OutputType>Exe</OutputType>
9 <AppDesignerFolder>Properties</AppDesignerFolder>
10 <RootNamespace>libTerrainTests</RootNamespace>
11 <AssemblyName>libTerrainTests</AssemblyName>
12 </PropertyGroup>
13 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
14 <DebugSymbols>true</DebugSymbols>
15 <DebugType>full</DebugType>
16 <Optimize>false</Optimize>
17 <OutputPath>bin\Debug\</OutputPath>
18 <DefineConstants>DEBUG;TRACE</DefineConstants>
19 <ErrorReport>prompt</ErrorReport>
20 <WarningLevel>4</WarningLevel>
21 </PropertyGroup>
22 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
23 <DebugType>pdbonly</DebugType>
24 <Optimize>true</Optimize>
25 <OutputPath>bin\Release\</OutputPath>
26 <DefineConstants>TRACE</DefineConstants>
27 <ErrorReport>prompt</ErrorReport>
28 <WarningLevel>4</WarningLevel>
29 </PropertyGroup>
30 <ItemGroup>
31 <Reference Include="System" />
32 <Reference Include="System.Data" />
33 <Reference Include="System.Xml" />
34 </ItemGroup>
35 <ItemGroup>
36 <Compile Include="Program.cs" />
37 <Compile Include="Properties\AssemblyInfo.cs" />
38 </ItemGroup>
39 <ItemGroup>
40 <ProjectReference Include="..\libTerrain\libTerrain-BSD.csproj">
41 <Project>{EEC06368-30E8-42E8-A23C-2C9D139AD495}</Project>
42 <Name>libTerrain-BSD</Name>
43 </ProjectReference>
44 </ItemGroup>
45 <ItemGroup>
46 <Content Include="libTerrain.csproj" />
47 </ItemGroup>
48 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
49 <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
50 Other similar extension points exist, see Microsoft.Common.targets.
51 <Target Name="BeforeBuild">
52 </Target>
53 <Target Name="AfterBuild">
54 </Target>
55 -->
56</Project> \ No newline at end of file