ZLab.Discrete ZLab.Discrete
ZLab.Discrete ZLab.Discrete
Developed by Zeke Zhang

Search Results for

    Edit this page

    Method GenerateMesh

    | Edit this page View Source

    GenerateMesh(ReadOnlySpan<Vector3>, ReadOnlySpan<Vector3>, CordSystem)

    Generates a single mesh from a set of voxels. Internal faces are culled using ZLab.Discrete.Algorithms.Encoding.Morton occupancy set (O(1) neighbor checks).

    Declaration
    public static MeshF GenerateMesh(ReadOnlySpan<Vector3> origins, ReadOnlySpan<Vector3> voxelSizes, CordSystem cordSystem = CordSystem.RightHanded)
    Parameters
    Type Name Description
    ReadOnlySpan<Vector3> origins

    Voxel origins

    ReadOnlySpan<Vector3> voxelSizes

    Per-voxel sizes; must match origins length.

    CordSystem cordSystem

    Coordinate system for winding (right- or left-handed).

    Returns
    Type Description
    MeshF

    A single combined mesh.

    Remarks

    If voxelSizes differ, culling is disabled and all six faces per voxel are emitted.

    Origin convention: the culled path treats origin of voxels as the minimum corner of the cell.

    Exceptions
    Type Condition
    ArgumentException

    Lengths of origins and voxelSizes differ.

    InvalidOperationException

    No vertices or faces were generated.

    | Edit this page View Source

    GenerateMesh(ReadOnlySpan<Vector3>, Vector3, CordSystem)

    Generates a single mesh from a set of voxels, assuming a uniform voxelSize. Internal faces are culled using ZLab.Discrete.Algorithms.Encoding.Morton occupancy set (O(1) neighbor checks).

    Declaration
    public static MeshF GenerateMesh(ReadOnlySpan<Vector3> origins, Vector3 voxelSize, CordSystem cordSystem = CordSystem.RightHanded)
    Parameters
    Type Name Description
    ReadOnlySpan<Vector3> origins

    Voxel origins

    Vector3 voxelSize

    Uniform voxel size for all voxels.

    CordSystem cordSystem

    Coordinate system for winding (right- or left-handed).

    Returns
    Type Description
    MeshF

    A single combined mesh.

    Remarks

    Origin convention: the culled path treats origin of voxels as the minimum corner of the cell.

    Exceptions
    Type Condition
    InvalidOperationException

    No vertices or faces were generated.