コード例 #1
0
        public IGameObject Generate()
        {
            var arr = Generate(GridSize, Seed);

            arr = PostModifications.NormalizeAndFlatten(arr, GridSize, Flattening, Height);
            arr = Utils.ShiftTerrain(arr);
            HeightMapGenerator.Generate(_graphicDevice, arr, "Simplex Noise");
            return(new PrimitiveBase(_graphicDevice, _graphicDeviceManeger, arr, GridSize));
        }
コード例 #2
0
        private float[][] GenerateVertices(int gridSize)
        {
            var arr = Utils.GetEmptyArray(gridSize, gridSize);


            for (var i = 0; i < Iterations; i++)
            {
                var   centerX = Rand.Next(0, MapSize);
                var   centerY = Rand.Next(0, MapSize);
                float radius  = (float)(Rand.Next(RadiusMin * 100, RadiusMax * 100)) / 100;

                arr = RaiseHill(arr, radius, centerX, centerY);
            }

            arr = PostModifications.NormalizeAndFlatten(arr, MapSize, Flattening, Height);
            return(arr);
        }