* Updated demo filter to show more common usage (as well as embedding multiple filters in a single file)
parent
0ba98acc1c
commit
2989c22702
|
@ -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 <theta> - Converts the heightmap to the functional output of a sine wave";
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue