From 46381da9abf56eeeb524dc0adcaf1019b5398e4e Mon Sep 17 00:00:00 2001
From: Adam Frisby
Date: Tue, 12 Jun 2007 23:48:03 +0000
Subject: * Importing libTerrain-BSD into libraries folder
---
libraries/libTerrain/libTerrainTests/Program.cs | 299 +++++++++++++++++++++
.../libTerrainTests/Properties/AssemblyInfo.cs | 33 +++
.../libTerrain/libTerrainTests/libTerrain.csproj | 75 ++++++
.../libTerrainTests/libTerrainTests.csproj | 56 ++++
4 files changed, 463 insertions(+)
create mode 100644 libraries/libTerrain/libTerrainTests/Program.cs
create mode 100644 libraries/libTerrain/libTerrainTests/Properties/AssemblyInfo.cs
create mode 100644 libraries/libTerrain/libTerrainTests/libTerrain.csproj
create mode 100644 libraries/libTerrain/libTerrainTests/libTerrainTests.csproj
(limited to 'libraries/libTerrain/libTerrainTests')
diff --git a/libraries/libTerrain/libTerrainTests/Program.cs b/libraries/libTerrain/libTerrainTests/Program.cs
new file mode 100644
index 0000000..cf3da3d
--- /dev/null
+++ b/libraries/libTerrain/libTerrainTests/Program.cs
@@ -0,0 +1,299 @@
+/*
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of libTerrain nor the names of
+ its contributors may be used to endorse or promote products
+ derived from this software without specific prior written
+ permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using libTerrain;
+
+namespace libTerrainTests
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ System.Console.WriteLine("Starting tests...");
+
+ Channel test;
+
+ try
+ {
+ System.Console.WriteLine("Blank Heightmap");
+ test = new Channel();
+ test.fill(0);
+ test.saveImage("test_blank.png");
+ }
+ catch (Exception e)
+ {
+ System.Console.WriteLine("Unhandled exception: " + e.ToString());
+ }
+
+
+ try
+ {
+ System.Console.WriteLine("Grayscale Cube");
+ test = new Channel();
+ test.fill(0);
+ test.gradientCube();
+ test.saveImage("test_cube.png");
+
+ test.Polar();
+ test.saveImage("test_polarcube.png");
+ }
+ catch (Exception e)
+ {
+ System.Console.WriteLine("Unhandled exception: " + e.ToString());
+ }
+
+ try
+ {
+ System.Console.WriteLine("Spiral Planters");
+ test = new Channel();
+ test.fill(0);
+
+ test.SpiralPlanter(200, Math.PI / 15, 0.75, 0, 0);
+ test.normalise();
+ //test.Spiral(192, 192, 50);
+ test.saveImage("test_spiral.png");
+ }
+ catch (Exception e)
+ {
+ System.Console.WriteLine("Unhandled exception: " + e.ToString());
+ }
+
+ try
+ {
+ System.Console.WriteLine("Spiral Cells");
+ test = new Channel();
+ test.fill(0);
+
+ double[] c = new double[2];
+ c[0] = -1;
+ c[1] = 1;
+
+ test.SpiralCells(200, Math.PI / 15, 0.75, 0, 0, c);
+ test.normalise();
+ //test.Spiral(192, 192, 50);
+ test.saveImage("test_spiralcells.png");
+
+ test.fill(0);
+ test.SpiralCells(30, Math.PI / 30, 0, 75, 0, c);
+ test.normalise();
+ //test.Spiral(192, 192, 50);
+ test.saveImage("test_circlecells.png");
+
+ }
+ catch (Exception e)
+ {
+ System.Console.WriteLine("Unhandled exception: " + e.ToString());
+ }
+
+ try
+ {
+ System.Console.WriteLine("Fracturing");
+ test = new Channel();
+ test.fill(0);
+ test.fracture(300, 0, 1);
+ test.saveImage("test_fracture.png");
+ }
+ catch (Exception e)
+ {
+ System.Console.WriteLine("Unhandled exception: " + e.ToString());
+ }
+
+ try
+ {
+ System.Console.WriteLine("Voronoi (Flat)");
+ test = new Channel();
+ test.fill(0);
+ test.voroflatDiagram(64, 384);
+ test.saveImage("test_voroflat.png");
+ }
+ catch (Exception e)
+ {
+ System.Console.WriteLine("Unhandled exception: " + e.ToString());
+ }
+
+
+ try
+ {
+ System.Console.WriteLine("Voronoi (Flat / Fixnormal)");
+ test = new Channel();
+ test.fill(0);
+ test.voroflatDiagram(64, 384);
+ test ^= 4;
+ test.normalise();
+ test.saveImage("test_voroflatfixnormal.png");
+ }
+ catch (Exception e)
+ {
+ System.Console.WriteLine("Unhandled exception: " + e.ToString());
+ }
+
+ try
+ {
+ System.Console.WriteLine("File Import (Mask Flatten)");
+ test = new Channel();
+ Channel test2;
+ test2 = test.loadImage("test_chained_aerobic.png");
+
+ test.fill(0);
+ test.voroflatDiagram(64, 384);
+ test ^= 4;
+ test.normalise();
+
+ test.smooth(4);
+ test.normalise();
+
+ test.saveImage("test_flatmask.png");
+ test2.flatten(test, 1.0);
+
+ test2.saveImage("test_fileflatmask.png");
+ }
+ catch (Exception e)
+ {
+ System.Console.WriteLine("Unhandled exception: " + e.ToString());
+ }
+
+ try
+ {
+ System.Console.WriteLine("Worms");
+ test = new Channel();
+ test.worms(100, 10, 20.0, 16, false);
+ test.normalise();
+ test.saveImage("test_worms.png");
+ }
+ catch (Exception e)
+ {
+ System.Console.WriteLine("Unhandled exception: " + e.ToString());
+ }
+
+ try
+ {
+ System.Console.WriteLine("Noise");
+ test = new Channel();
+ test.noise();
+ test.saveImage("test_noise.png");
+ }
+ catch (Exception e)
+ {
+ System.Console.WriteLine("Unhandled exception: " + e.ToString());
+ }
+
+ try
+ {
+ System.Console.WriteLine("Hills (Spherical)");
+ test = new Channel();
+ test.hillsSpheres(200, 20, 30, true, true, false);
+ test.saveImage("test_hillspheres.png");
+ }
+ catch (Exception e)
+ {
+ System.Console.WriteLine("Unhandled exception: " + e.ToString());
+ }
+
+ try
+ {
+ System.Console.WriteLine("Hills (Blocks)");
+ test = new Channel();
+ test.hillsBlocks(200, 20, 30, true, true, false);
+// test.hillsSpheres(200, 20, 30, true, true, false);
+ test.saveImage("test_hillblocks.png");
+ }
+ catch (Exception e)
+ {
+ System.Console.WriteLine("Unhandled exception: " + e.ToString());
+ }
+
+ try
+ {
+ System.Console.WriteLine("Hills (Cones)");
+ test = new Channel();
+ test.fill(0);
+ test.hillsCones(200, 20, 30, true, true, false);
+ test.normalise();
+ test.saveImage("test_hillcones.png");
+ }
+ catch (Exception e)
+ {
+ System.Console.WriteLine("Unhandled exception: " + e.ToString());
+ }
+
+ try
+ {
+ System.Console.WriteLine("Voronoi Diagram");
+ test = new Channel();
+ double[] c = new double[2];
+ c[0] = -1;
+ c[1] = 1;
+ test.voronoiDiagram(4, 128, c);
+ test.saveImage("test_voronoi.png");
+ }
+ catch (Exception e)
+ {
+ System.Console.WriteLine("Unhandled exception: " + e.ToString());
+ }
+
+ try
+ {
+ System.Console.WriteLine("Raising Terrain");
+ test = new Channel();
+ test.fill(0);
+ test.raise(128, 128, 64, 1.0);
+ test.normalise();
+ test.saveImage("test_raise.png");
+ }
+ catch (Exception e)
+ {
+ System.Console.WriteLine("Unhandled exception: " + e.ToString());
+ }
+
+ try
+ {
+ System.Console.WriteLine("Flattening Terrain (unmasked)");
+ test = new Channel();
+ test.noise();
+ test.flatten(128, 128, 64, 1.0);
+ test.normalise();
+ test.saveImage("test_flatten.png");
+ }
+ catch (Exception e)
+ {
+ System.Console.WriteLine("Unhandled exception: " + e.ToString());
+ }
+
+
+
+ System.Console.WriteLine("Done");
+ }
+ }
+}
diff --git a/libraries/libTerrain/libTerrainTests/Properties/AssemblyInfo.cs b/libraries/libTerrain/libTerrainTests/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..09e0845
--- /dev/null
+++ b/libraries/libTerrain/libTerrainTests/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("libTerrainTests")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("libTerrainTests")]
+[assembly: AssemblyCopyright("Copyright © 2007")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("528417c9-dd71-487e-8e0b-e8e42e52fa10")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/libraries/libTerrain/libTerrainTests/libTerrain.csproj b/libraries/libTerrain/libTerrainTests/libTerrain.csproj
new file mode 100644
index 0000000..047ad02
--- /dev/null
+++ b/libraries/libTerrain/libTerrainTests/libTerrain.csproj
@@ -0,0 +1,75 @@
+
+
+ Debug
+ AnyCPU
+ 8.0.50727
+ 2.0
+ {EEC06368-30E8-42E8-A23C-2C9D139AD495}
+ Library
+ Properties
+ libTerrain
+ libTerrain
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/libraries/libTerrain/libTerrainTests/libTerrainTests.csproj b/libraries/libTerrain/libTerrainTests/libTerrainTests.csproj
new file mode 100644
index 0000000..4227155
--- /dev/null
+++ b/libraries/libTerrain/libTerrainTests/libTerrainTests.csproj
@@ -0,0 +1,56 @@
+
+
+ Debug
+ AnyCPU
+ 8.0.50727
+ 2.0
+ {7214C9E2-1390-41BD-BFFC-83FA5931C5CF}
+ Exe
+ Properties
+ libTerrainTests
+ libTerrainTests
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+ {EEC06368-30E8-42E8-A23C-2C9D139AD495}
+ libTerrain-BSD
+
+
+
+
+
+
+
+
\ No newline at end of file
--
cgit v1.1