private void OnAreaNoiseReceived(object areaNoise)
    {
        this.areaNoise = (AreaNoise)areaNoise;
        received       = true;

        UpdateArea();
    }
    public static Texture2D GenerateFromNoise(AreaNoise noiseArea)
    {
        int resolution = noiseArea.area.GetLength(0);

        Color[] colors = new Color[resolution * resolution];

        for (int yIndex = 0; yIndex < resolution; yIndex++)
        {
            for (int xIndex = 0; xIndex < resolution; xIndex++)
            {
                colors[yIndex * resolution + xIndex] = Color.Lerp(Color.black, Color.white, Mathf.InverseLerp(noiseArea.minHeight, noiseArea.maxHeight, noiseArea.area[xIndex, yIndex]));
            }
        }

        return(GenerateFromColors(colors, resolution));
    }
    public void DisplayInEditor()
    {
        textureDetails.AttachToMaterial(areaMaterial);
        textureDetails.RefreshHeights(areaMaterial, areaNoiseDetails.minHeight, areaNoiseDetails.maxHeight);

        AreaNoise noiseArea = NoiseController.BuildNoiseArea(areaDetails.verticesPerLine, areaNoiseDetails, Vector2.zero);

        if (displayMode == DisplayMode.Noise)
        {
            DisplayMap(TextureController.GenerateFromNoise(noiseArea));
        }
        else if (displayMode == DisplayMode.Mesh)
        {
            DisplayMesh(MeshController.BuildMesh(noiseArea.area, previevLOD, areaDetails));
        }
        else if (displayMode == DisplayMode.Falloff)
        {
            DisplayMap(TextureController.GenerateFromNoise(new AreaNoise(FalloffController.GenerateFalloffArea(areaDetails.verticesPerLine), 0, 1)));
        }
    }
 public void RequestMesh(AreaNoise noiseArea, AreaDetails areaSettings)
 {
     requested = true;
     ThreadHandler.RequestDetails(() => MeshController.BuildMesh(noiseArea.area, lod, areaSettings), OnMeshDetailsReceived);
 }