aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/libTerrain/libTerrainTests/Program.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--libraries/libTerrain/libTerrainTests/Program.cs299
1 files changed, 0 insertions, 299 deletions
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}