public static Bitmap GetColoredHeightMap(int width, int height, MapData mapData)
        {
            var bitmap = new Bitmap(width, height);

            var tileList  = mapData.Tiles.AsList();
            var minHeight = tileList.Min(X => X.HeightValue);
            var maxHeight = tileList.Max(x => x.HeightValue);
            var sealevel  = mapData.SeaLevel;

            float deepWater    = sealevel / 2.0f;
            float shallowWater = sealevel;
            float landLevel    = (1.0f - sealevel);
            float sand         = sealevel + (landLevel / 6);
            float grass        = sealevel + (landLevel / 2);
            float forest       = sealevel + (2 * landLevel / 3);
            float rock         = sealevel + (5 * landLevel / 6);
            float snow         = sealevel + landLevel;

            for (var x = 0; x < width; x++)
            {
                for (var y = 0; y < height; y++)
                {
                    float value = mapData.Tiles[x, y].HeightValue;
                    // normalize
                    //value = (value - minHeight) / (maxHeight - minHeight);

                    Color color;
                    //if (value <= deepWater)
                    //{
                    //    //color = Color.FromArgb(0, 0, 127);
                    //    color = ColorHelpers.Lerp(Color.Black, Color.White, deepWater);
                    //}
                    //else if (value <= shallowWater)
                    //{
                    //    //color = Color.FromArgb(25, 25, 150);
                    //    color = ColorHelpers.Lerp(Color.Black, Color.White, shallowWater);
                    //}
                    //else if (value <= sand)
                    //{
                    //    //color = Color.FromArgb(240, 240, 64);
                    //    color = ColorHelpers.Lerp(Color.Black, Color.White, sand);
                    //}
                    //else if (value <= grass)
                    //{
                    //    //color = Color.FromArgb(50, 220, 20);
                    //    color = ColorHelpers.Lerp(Color.Black, Color.White, grass);
                    //}
                    //else if (value <= forest)
                    //{
                    //    //color = Color.FromArgb(16, 160, 0);
                    //    color = ColorHelpers.Lerp(Color.Black, Color.White, forest);
                    //}
                    //else if (value <= rock)
                    //{
                    //    //color = Color.FromArgb(127, 127, 127);
                    //    color = ColorHelpers.Lerp(Color.Black, Color.White, rock);
                    //}
                    //else
                    //{
                    //    //color = Color.FromArgb(255, 255, 255);
                    //    color = ColorHelpers.Lerp(Color.Black, Color.White, snow);
                    //}

                    // Clamps to 7 different color values
                    int roundedValue = (int)Math.Floor(value * 7);
                    color = ColorHelpers.Lerp(Color.Black, Color.White, 0.0f, 7.0f, roundedValue);

                    bitmap.SetPixel(x, y, color);
                }
            }

            return(bitmap);
        }
        public static Bitmap GetBiomeMap(int width, int height, Tile[,] tiles, float seaLevel)
        {
            var bitmap = new Bitmap(width, height);

            for (var x = 0; x < width; x++)
            {
                for (var y = 0; y < height; y++)
                {
                    Tile tile = tiles[x, y];

                    Color color;
                    if (tile.HeightValue > seaLevel)
                    {
                        if (tile.IsRiver)
                        {
                            float heatValue = tile.HeatValue;
                            int   heatType  = GetHeatType(heatValue);

                            if (heatType == (int)HeatType.Coldest)
                            {
                                color = ColorHelpers.Lerp(IceWater, ColdWater, heatValue / ColdestValue);
                            }
                            else if (heatType == (int)HeatType.Colder)
                            {
                                color = ColorHelpers.Lerp(ColdWater, RiverWater, (heatValue - ColdestValue) / (ColderValue - ColdestValue));
                            }
                            else if (heatType == (int)HeatType.Cold)
                            {
                                color = ColorHelpers.Lerp(RiverWater, ShallowWater, (heatValue - ColderValue) / (ColdValue - ColderValue));
                            }
                            else
                            {
                                color = ShallowWater;
                            }
                        }
                        else
                        {
                            BiomeType biomeType = GetBiomeType(tile);

                            switch (biomeType)
                            {
                            case BiomeType.Ice:
                                color = Ice;
                                break;

                            case BiomeType.BorealForest:
                                color = BorealForest;
                                break;

                            case BiomeType.Desert:
                                color = Desert;
                                break;

                            case BiomeType.Grassland:
                                color = Grassland;
                                break;

                            case BiomeType.SeasonalForest:
                                color = SeasonalForest;
                                break;

                            case BiomeType.Tundra:
                                color = Tundra;
                                break;

                            case BiomeType.Savanna:
                                color = Savanna;
                                break;

                            case BiomeType.TemperateRainforest:
                                color = TemperateRainforest;
                                break;

                            case BiomeType.TropicalRainforest:
                                color = TropicalRainforest;
                                break;

                            case BiomeType.Woodland:
                                color = Woodland;
                                break;

                            default:
                                color = Color.Black;
                                break;
                            }
                        }
                    }
                    else
                    {
                        // Deep
                        if (tile.HeatValue <= (seaLevel / 2))
                        {
                            color = DeepWater;
                        }
                        // Shallow
                        else
                        {
                            color = ShallowWater;
                        }
                    }

                    bitmap.SetPixel(x, y, color);
                }
            }

            return(bitmap);
        }