Пример #1
0
    private Texture2D GenerateColorTexture(float[,] heightMap, float[,] humidityMap)
    {
        int width  = heightMap.GetLength(0);
        int height = heightMap.GetLength(1);

        Texture2D texture = new Texture2D(width, height);

        for (int y = 0; y < height; y++)
        {
            for (int x = 0; x < width; x++)
            {
                RegionData currentRegion = regionMap.Evaluate(heightMap[x, y], humidityMap[x, y]);
                texture.SetPixel(x, y, currentRegion.mainColor);
            }
        }

        texture.filterMode = FilterMode.Point;
        texture.wrapMode   = TextureWrapMode.Clamp;
        texture.Apply();

        return(texture);
    }