Skip to content
Shapemetry

Types - OBJ

API reference for ./io/obj on @huukhanhnguyen/types — the option and result records of @huukhanhnguyen/io's OBJ reader/writer.

See the Guide for the package's role.

API reference

Signatures are generated from the live package .d.ts - not hand-written.

ObjOptions

type

type ObjOptions
// = {
    /** Material records to resolve Kd/d/Pr/Pm from. A material referenced by a
     *  mesh but missing here still gets a `newmtl` block (neutral defaults) so
     *  every `usemtl` in the OBJ has a matching entry. */
    materials?: MaterialData[];
    /** File name the OBJ's `mtllib` line points at. Default "model.mtl". */
    mtlFileName?: string;
    /** Expand BlockEntity placements — OBJ has no instancing slot. */
    definitions?: Map<string, BlockDefinition> | ReadonlyMap<string, BlockDefinition>;
    /**
     * Tessellator for `entitiesToObj`'s B-rep `faceEntity` branch — this package
     * holds no face tessellator (same contract as {@link entitiesToUsda}'s
     * `UsdOptions.tessellate`). Absent, faces are skipped; stream meshEntity
     * n-gons still emit.
     */
    tessellate?: (face: Entity) => MeshEntity | undefined;
}

ObjResult

type

type ObjResult
// = {
    obj: string;
    mtl: string;
}

ObjWriter

type

type ObjWriter
// = {
    lines: string[];
    vertexCount: number;
    usedMaterials: Set<string>;
    objNameOf: (name: string) => string;
}
Last updated: 📖 1 min readEdit on GitHub