Esempio n. 1
0
        public override ISubGenerator Build(int seed)
        {
            var np = _noiseBuilder.Random(new Rand(seed)).Build();
            var lp = _layerBuilder.Build();
            // TODO change rand approach
            var rnd2 = new RandomSeeded(seed);
            var sd   = new SegmentDivider(rnd2, 30, 1);
            var c    = new VoronoiConverter(sd);
            var g    = new VoronoiGenerator(c);
            var gg   = new VoronoiAreaGenerator(g, new Rand(seed));

            // todo Use parameters
            return(new MountainGenerator(new VisualLogger(), gg, np, lp)
            {
                Influence = _influence
            });
        }
Esempio n. 2
0
        private static ILayer printMountainProfile(int countOfCells, ISegmendDivider sd)
        {
            var l = new Layer2DObject(res);

            // TODO change rand approach

            var rnd = new Rand(seed);


            var c  = new VoronoiConverter(sd);
            var g  = new VoronoiGenerator(c);
            var gg = new VoronoiAreaGenerator(g, rnd);

            var vd = new VoronoiAreaDrawer();


            var areas = gg.GenerateAreas(res, res, countOfCells);

            vd.PrintToLayer(l, areas, Vector2.Zero);
            return(l);
        }
Esempio n. 3
0
        private static void printVoronoi(int countOfCells, ISegmendDivider sd)
        {
            var l = new Layer2DObject(res);

            // TODO change rand approach

            var rnd = new Rand(seed);


            var c  = new VoronoiConverter(sd);
            var g  = new VoronoiGenerator(c);
            var gg = new VoronoiAreaGenerator(g, rnd);

            var vd = new VoronoiAreaDrawer();

            var areas = gg.GenerateAreas(res, res * .5f, countOfCells);



            vd.PrintToLayer(l, areas, new Vector2());
            var vl = new VisualLogger();

            vl.Log(l, "profile");
        }
Esempio n. 4
0
        public VoronoiConverterTest()
        {
            var sg = new SegmentNoDivider();

            _voronoiConverter = new VoronoiConverter(sg);
        }