示例#1
0
        public static MapHeights createHills(int w, int h)
        {
            MapHeights perlin = MapHeights.createPerlinNoise(w, h, (double)((int)(100000f / Form1.CELL_SIZE)) / 100000f, 5, 35);

            perlin.SimpleTransform(1);
            perlin.Smooth(0, .1, 8);
            perlin.Smooth(0, .2, 2);
            perlin.normalizeWithExtention(-.1, .38, .9);
            return(perlin);
        }
示例#2
0
        public static MapHeights createMountains(int w, int h)
        {
            MapHeights perlin  = MapHeights.createPerlinNoise(w, h, (double)((int)(100000f / Form1.CELL_SIZE)) / 100000, 10, 25);
            MapHeights diamond = MapHeights.createDiamondSquare(w, h, .9);

            perlin.normalizeWithExtention(0, 1, .95);
            diamond.normalizeWithExtention(-.1, .4, .95);
            MapHeights union = createUnion(
                true,
                (int i, int j, MapHeights[] maps) =>
            {
                return(maps[0][i, j] + maps[1][i, j] * (maps[0][i, j] + 1.1) / 2.1f);
            },
                perlin,
                diamond);

            union.SimpleTransform(1);
            union.Loosening(0.4, 1, 0.03, 1);
            union.Loosening(0.7, 1, 0.08, 2);
            union.Smooth(0.4, 1, 1);
            union.normalizeWithExtention(-.5, 1, .97);
            return(union);
        }