* Updated demo filter to show more common usage (as well as embedding multiple filters in a single file)

Sugilite
Adam Frisby 2007-06-26 05:20:46 +00:00
parent 0ba98acc1c
commit 2989c22702
1 changed files with 26 additions and 0 deletions

View File

@ -22,3 +22,29 @@ public class DemoFilter : ITerrainFilter
return "demofilter - Does nothing\n"; 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 <theta> - Converts the heightmap to the functional output of a sine wave";
}
}