Esempio n. 1
0
    public IEnumerator DeformVoronoi(int seed, float scale, float point_range, float strength)
    {
        //Just to make outside use easier
        //Make it at least 10
        scale /= 10;

        //All the heights of the triangles will bew stored in this array
        //It will be read to draw the triangles to the screen again
        float[] triangle_values = new float[triangles.Length];
        for (int i = 0; i < triangles.Length; i++)
        {
            triangle_values[i] = 1;
        }

        Debug.Log("Generated new terrain with scale of: " + scale);

        triangle_values = HeightMap.ApplyVoronoiNoise(seed, triangle_values, mesh_size, scale, point_range, strength);

        //Apply array to the triangles themselves
        for (int i = 0; i < triangles.Length; i++)
        {
            triangles[i].value *= triangle_values[i];
        }

        Debug.Log("Applied voronoi noise");
        yield break;
    }