ExportFormat

Specifies the structural format used when exporting a mesh

This enum specifies the desired export format of Operation::Export. Determines if the result is indexed or unrolled, if they are triangles or polys, if we create a half-edge topology, etc.

Note:
by default, no vertex positions or tracking IDs are exported. ExportOption is used to specify exactly how positions and any other attributes are exported (in addition to other post-processing options like guaranteed manifoldness).

Signature

// Specifies the structural format used when exporting a mesh
enum ExportFormat:
    Triangles = 1000
    Polygons = 1001
    IndexedTriangles = 2000
    IndexedPolygons = 2001
    HalfedgeExplicit = 3000
    HalfedgeImplicitOpposite = 3001
    HalfedgeImplicitNext = 3002
    DefectNetwork = 9001

Triangles

Export a mesh as unrolled triangles. Triangulates polygons before export.

For example, with ExportOption::VertexPositionF32, this format populates DataSlot::TrianglesF32.

Note:
all desired extra attributes, including positions must be configured using ExportOption.

Polygons

Export a mesh as unrolled polygons. Unrolled polygons are effectively flat lists of half-edge attributes.

Populates DataSlot::PrimitiveSize to define how many contiguous attributes belong to the same polygon. For example, with ExportOption::VertexPositionF32, this format also populates DataSlot::PositionsF32. The polygon sizes then dictate which PositionsF32 belong to which polygon (in order).

Note:
depending on the export options, these polygons might not be convex. They will never have holes, though.

IndexedTriangles

Export a mesh as triangles with vertex indices. Triangulates polygons before export.

Populates DataSlot::TrianglesIndexed to index into other attributes.

For example, with ExportOption::VertexPositionF32, this format populates DataSlot::PositionsF32.

IndexedPolygons

Export a mesh as polygons with vertex indices.

Populates DataSlot::PrimitiveSize to define how many contiguous indices belong to the same polygon. The vertex indices themselves are stored in DataSlot::HalfedgeToVertex. These can then used to access vertex attributes. For example, with ExportOption::VertexPositionF32, this format populates DataSlot::PositionsF32.

HalfedgeExplicit

Export a mesh as a half-edge data structure with explicit halfedge relations. Populates DataSlot::HalfedgeToVertex, DataSlot::HalfedgeToNextHalfedge, and DataSlot::HalfedgeToOppositeHalfedge. Other half-edge relations can be added via ExportOption.

Note:
as always, vertex attributes are opt-in. For example, with ExportOption::VertexPositionF32, this format populates DataSlot::PositionsF32.

HalfedgeImplicitOpposite

Export a mesh as a half-edge data structure with implicit-opposite halfedge relations. Populates DataSlot::HalfedgeToVertex, DataSlot::HalfedgeToNextHalfedge. Other half-edge relations can be added via ExportOption.

"Implicit-opposite" means that halfedges are stored next to their opposite. This effectively means that we're storing edges as (halfedge, opposite halfedge) pairs. "opposite(h)" is a trivial "h ^ 1" (bitwise xor). "edge(h)" is "h >> 1". "halfedges(e)" is "(e * 2 + 0, e * 2 + 1)".

Note:
as always, vertex attributes are opt-in. For example, with ExportOption::VertexPositionF32, this format populates DataSlot::PositionsF32.
⚠ Warning

This feature is in-progress and not implemented yet. Please contact us with your use case and we might be able to fast-track it.

HalfedgeImplicitNext

Export a mesh as a half-edge data structure with implicit-next halfedge relations. Populates DataSlot::PrimitiveSize, DataSlot::HalfedgeToVertex, DataSlot::HalfedgeToOppositeHalfedge. Other half-edge relations can be added via ExportOption.

"Implicit-next" means that halfedges belonging to the same polygon are stored contiguously in-order. Given the polygon size "s" and the relative index "i" of the halfedge inside the polygon, the next halfedge is simply "(i + 1) % s" in local terms. For efficient random access, a prefix sum of the polygon sizes is advisable.

Note:
as always, vertex attributes are opt-in. For example, with ExportOption::VertexPositionF32, this format populates DataSlot::PositionsF32.
⚠ Warning

This feature is in-progress and not implemented yet. Please contact us with your use case and we might be able to fast-track it.

DefectNetwork

Exports a graph that represents the defect network of a mesh.

The vertex type must be specified using an ExportOption, e.g. with ExportOption::VertexPositionF32, this format populates DataSlot::PositionsF32. The graph itself is represented as indexed segments, i.e. DataSlot::SegmentsIndexed. The defect value is stored per-segment in DataSlot::Defects.