IFClite TypeScript API
    Preparing search index...

    Class MeshDataJs

    Individual mesh data with express ID and color (matches MeshData interface)

    Clone is derived so the three sites that used to enumerate all 21 fields by hand -- get, takeMesh and MeshCollection's own Clone -- reduce to .cloned(), mem::take and .clone(). Adding a field to #3199 meant editing three literals in lockstep; the allowlist row for this file records exactly that cost.

    To be precise about what this does and does not buy, because the obvious claim is wrong: an exhaustive struct literal that OMITS a field is a compile error, so those literals were never silently lossy. What they were is three places to edit for one field, and ..Default::default() is the shortcut a hurried author reaches for when the compiler complains -- which WOULD be silently lossy. Default is what makes takeMesh a one-liner, so the rule is: TWO literals remain, new and Default below (both spelled Self { .. }, which is why a grep for MeshDataJs { finds neither). Both must stay exhaustive AND must agree on every field new does not take as an argument. The compiler catches an omitted field in either; it cannot catch the two DISAGREEING, which is the failure the pair exists to prevent, so default_agrees_with_new_on_the_fields_new_does_not_take covers that. Never spread Default into new -- new is the only place a field's initial value is decided, so a field defaulted there is inert everywhere.

    Index
    color: Float32Array

    Get color as [r, g, b, a] array

    expressId: number

    Get express ID

    geometryClass: number

    Geometry provenance for the viewer's Model/Types switch (#957 follow-up): 0 = occurrence, 1 = orphan type geometry (no occurrence), 2 = instanced type geometry (hidden in Model mode, shown in Types mode).

    geometryItemId: number | undefined

    Source IfcRepresentationItem, or undefined where identity is merged away. Never set alongside materialId (#3199).

    hasTexture: boolean

    True when this mesh carries a surface texture (#961).

    ifcType: string

    Get IFC type name (e.g., "IfcWall", "IfcSpace")

    indices: Uint32Array

    Get indices as Uint32Array (copy to JS)

    localBounds: Float32Array<ArrayBufferLike> | undefined

    Local (pre-placement, object-space) AABB (issue #1474), WebGL Y-up, [minX,minY,minZ,maxX,maxY,maxZ]. undefined when not captured (wasm-bindgen maps Option::None to undefined, not null).

    localToWorld: Float64Array<ArrayBufferLike> | undefined

    The resolved IfcLocalPlacement chain for this mesh (issue #1474), row-major 4×4, WebGL Y-up. undefined when not captured (see local_bounds above).

    materialId: number | undefined

    IfcMaterial layer sliced, or undefined (#3199).

    metallic: number | undefined

    IFC-authored metallic/roughness (#5582). undefined when unauthored.

    normals: Float32Array

    Get normals as Float32Array (copy to JS)

    origin: Float64Array

    Per-element local-frame origin (Float64Array[3], WebGL Y-up, metres): world position of vertex i = origin + positions[3i..3i+3]. Returns [0,0,0] when positions are absolute (legacy / local frame off).

    positions: Float32Array

    Get positions as Float32Array (copy to JS)

    roughness: number | undefined
    shadingColor: Float32Array<ArrayBufferLike> | undefined

    Optional SurfaceColour for the "Shading" GLB-export choice — only present when the file authored a distinct DiffuseColour. JS sees undefined when absent (most files).

    textureHeight: number
    textureId: number

    Stable texture dedup key (IfcSurfaceTexture express id, #1781). 0 when the mesh is untextured.

    textureRepeatS: boolean

    Sampler wrap for the S axis (IfcSurfaceTexture.RepeatS): true = repeat.

    textureRepeatT: boolean

    Sampler wrap for the T axis (IfcSurfaceTexture.RepeatT): true = repeat.

    textureRgba: Uint8Array

    Decoded RGBA8 texture bytes (width*height*4). Empty when untextured.

    textureUrl: string | undefined

    External image reference (IfcImageTexture.URLReference, #1781) for the host to resolve — e.g. a sibling image inside the .ifcZIP. undefined for untextured meshes and Rust-decoded blob/pixel textures.

    textureWidth: number
    triangleCount: number

    Get triangle count

    uvs: Float32Array

    Per-vertex texture coordinates as Float32Array (u, v pairs). Empty when the mesh is untextured.

    vertexCount: number

    Get vertex count

    • Returns void

    • Returns void