From 2989c227020ec363fefd83d1d78e243ebcd7bfd7 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Tue, 26 Jun 2007 05:20:46 +0000 Subject: [PATCH] * Updated demo filter to show more common usage (as well as embedding multiple filters in a single file) --- bin/TerrainFilters/demofilter.cs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/bin/TerrainFilters/demofilter.cs b/bin/TerrainFilters/demofilter.cs index 79b8d056cb..1fdfc95e0a 100644 --- a/bin/TerrainFilters/demofilter.cs +++ b/bin/TerrainFilters/demofilter.cs @@ -22,3 +22,29 @@ public class DemoFilter : ITerrainFilter return "demofilter - Does nothing\n"; } } + +public class SineFilter : ITerrainFilter +{ + public void Filter(Channel heightmap, string[] args) + { + double max = heightmap.findMax(); + + for (int x = 0; x < heightmap.w; x++) + { + for (int y = 0; y < heightmap.h; y++) + { + heightmap.set(x,y,((Math.Sin(heightmap.get(x,y) * Convert.ToDouble(args[1])) + 1) / 2) * max); + } + } + } + + public string Register() + { + return "sinefilter"; + } + + public string Help() + { + return "sinefilter - Converts the heightmap to the functional output of a sine wave"; + } +} \ No newline at end of file