コード例 #1
0
ファイル: Overworld.cs プロジェクト: svifylabs/dwarfcorp
        public static void CreateOceanLand(GraphicsDevice graphicsDevice)
        {
            PlayState.SeaLevel = 0.17f;
            int size = 512;

            Map = new MapData[size, size];

            for (int x = 0; x < size; x++)
            {
                for (int y = 0; y < size; y++)
                {
                    Map[x, y].Biome       = Biome.Grassland;
                    Map[x, y].Erosion     = 1.0f;
                    Map[x, y].Weathering  = 0;
                    Map[x, y].Faults      = 1.0f;
                    Map[x, y].Temperature = size;
                    Map[x, y].Rainfall    = size;
                    Map[x, y].Height      = 0.05f; //ComputeHeight(x, y, size0, size0, 5.0f, false);
                }
            }

            Color[] worldData = new Color[size * size];
            WorldGeneratorState.worldMap = new Texture2D(graphicsDevice, size, size);
            Overworld.TextureFromHeightMap("Height", Overworld.Map, Overworld.ScalarFieldType.Height, Overworld.Map.GetLength(0), Overworld.Map.GetLength(1), null, worldData, WorldGeneratorState.worldMap, PlayState.SeaLevel);
            Overworld.Name = "flat";
        }
コード例 #2
0
ファイル: Overworld.cs プロジェクト: svifylabs/dwarfcorp
        public static void CreateHillsLand(GraphicsDevice graphics)
        {
            PlayState.SeaLevel = 0.17f;
            int size = 512;

            Map = new MapData[size, size];

            for (int x = 0; x < size; x++)
            {
                for (int y = 0; y < size; y++)
                {
                    float temp   = ComputeHeight(x, y, size, size, 3.0f, false);
                    float rain   = ComputeHeight(x, y, size, size, 2.0f, false);
                    float height = ComputeHeight(x, y, size, size, 1.6f, false);
                    Map[x, y].Erosion     = 1.0f;
                    Map[x, y].Weathering  = 0;
                    Map[x, y].Faults      = 1.0f;
                    Map[x, y].Temperature = (float)(temp * 1.0f);
                    Map[x, y].Rainfall    = (float)(rain * 1.0f);
                    Map[x, y].Biome       = GetBiome(temp, rain, height);
                    Map[x, y].Height      = height;
                }
            }

            Color[] worldData = new Color[size * size];
            WorldGeneratorState.worldMap = new Texture2D(graphics, size, size);
            Overworld.TextureFromHeightMap("Height", Overworld.Map, Overworld.ScalarFieldType.Height, Overworld.Map.GetLength(0), Overworld.Map.GetLength(1), null, worldData, WorldGeneratorState.worldMap, PlayState.SeaLevel);
            Overworld.Name = "hills" + PlayState.Random.Next(9999);
        }
コード例 #3
0
ファイル: Overworld.cs プロジェクト: svifylabs/dwarfcorp
        public static void CreateCliffsLand(GraphicsDevice graphicsDevice)
        {
            PlayState.SeaLevel = 0.17f;
            int size = 512;

            Map = new MapData[size, size];

            for (int x = 0; x < size; x++)
            {
                for (int y = 0; y < size; y++)
                {
                    float height = ComputeHeight(x * 1.0f, y * 2.0f, size, size, 1.0f, false);
                    float level  = (int)(height / 0.15f) * 0.15f + 0.08f;


                    Map[x, y].Height      = level;
                    Map[x, y].Biome       = Biome.Forest;
                    Map[x, y].Erosion     = 1.0f;
                    Map[x, y].Weathering  = 0;
                    Map[x, y].Faults      = 1.0f;
                    Map[x, y].Temperature = 0.6f;
                    Map[x, y].Rainfall    = 0.6f;
                }
            }


            Color[] worldData = new Color[size * size];
            WorldGeneratorState.worldMap = new Texture2D(graphicsDevice, size, size);
            Overworld.TextureFromHeightMap("Height", Overworld.Map, Overworld.ScalarFieldType.Height, Overworld.Map.GetLength(0), Overworld.Map.GetLength(1), null, worldData, WorldGeneratorState.worldMap, PlayState.SeaLevel);
            Overworld.Name = "Cliffs_" + PlayState.Random.Next(9999);
        }
コード例 #4
0
        public static void CreateUniformLand(GraphicsDevice graphics)
        {
            int size = 512;

            Map = new MapData[size, size];

            for (int x = 0; x < size; x++)
            {
                for (int y = 0; y < size; y++)
                {
                    Map[x, y].Biome       = Biome.Desert;
                    Map[x, y].Erosion     = 1.0f;
                    Map[x, y].Weathering  = 0.0f;
                    Map[x, y].Faults      = 1.0f;
                    Map[x, y].Temperature = size;
                    Map[x, y].Rainfall    = size;
                    Map[x, y].Height      = 0.3f; //ComputeHeight(x, y, size0, size0, 5.0f, false);
                }
            }

            Color[] worldData = new Color[size * size];
            WorldGeneratorState.worldMap = new Texture2D(graphics, size, size);
            Overworld.TextureFromHeightMap("Height", Overworld.Map, Overworld.ScalarFieldType.Height, Overworld.Map.GetLength(0), Overworld.Map.GetLength(1), null, worldData, WorldGeneratorState.worldMap, 0.17f);
            Overworld.Name = "flat_" + MathFunctions.Random.Next(9999);
        }
コード例 #5
0
ファイル: OverworldFile.cs プロジェクト: svifylabs/dwarfcorp
            public Texture2D CreateTexture(GraphicsDevice device, int width, int height)
            {
                Texture2D toReturn = null;

                Overworld.MapData[,] mapData = CreateMap();
                toReturn = new Texture2D(device, width, height);
                System.Threading.Mutex imageMutex = new System.Threading.Mutex();
                Color[] worldData = new Color[width * height];
                Overworld.TextureFromHeightMap("Height", mapData, Overworld.ScalarFieldType.Height, width, height, imageMutex, worldData, toReturn, PlayState.SeaLevel);

                return(toReturn);
            }