Exemplo n.º 1
0
    /// <summary>
    /// Generate a mesh using an advanced Marching Cubes algorithm, allowing for different angels.
    /// </summary>
    /// <param name="data3D">The 3D data representation of the image (or of anything else if you want).</param>
    /// <param name="threshold">Value between 0 and 1. A good value here is normally 0.5 Different values will create (in average) more steap or less cheap angles.</param>
    /// <param name="maxHeight">The maximum height the mesh will have</param>
    /// <param name="alwaysDrawBottomCube">With this parameter set the lowest place of cubes is always drawn. Making sure there are no "holes"</param>
    /// <returns>Returns a mesh being made with the advanced marching cubes representing the image.</returns>

    public static Mesh GenerateMarshingCubesAdvanced(Data3D data3D, float threshold, int maxHeight, bool alwaysDrawBottomCube = true)
    {
        float starty = 0.5f * maxHeight + 1;

        if (alwaysDrawBottomCube)
        {
            starty = starty - 0.5f;
        }
        return(MeshGenerator.ConstructMarchingCubesYZSwitched(data3D, new Vector3(0, starty, 0), Color.white, threshold));
    }