Method GenerateMesh
| Edit this page View SourceGenerateMesh(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 |
| 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 |
| InvalidOperationException | No vertices or faces were generated. |
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. |