aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/bin/TerrainFilters/demofilter.cs
blob: 1fdfc95e0ae129397fbe5515f77e8e65c333b052 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System;
using libTerrain;
using OpenSim.Terrain;

/// <summary>
/// A Demonstration Filter
/// </summary>
public class DemoFilter : ITerrainFilter
{
    public void Filter(Channel heightmap, string[] args)
    {
        Console.WriteLine("Hello world");
    }

    public string Register()
    {
        return "demofilter";
    }

    public string Help()
    {
        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";
    }
}