Exemple #1
0
    public IEnumerator FilterPixelate(int size)
    {
        //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] = triangles[i].value;
        }

        triangle_values = HeightMap.ApplyBoxBlur(size, triangle_values, mesh_size);
        //Debug.Log("Scale: " + scale+" k: "+k+ " scale result: " + (float)scale / (k) + " strength: " + 1 / (k * k * k));


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

        yield break;
    }