A mesh in a SceneModel.

See @xeokit/sdk/model/scene for usage.

Properties

bin?: string

Free-form bin identifier this SceneMesh belongs to. Frozen at construction; the scene assigns no semantics to the value on its own.

The bin is a tag the caller stamps on the SceneMesh for downstream consumers to group by. A renderer — were it rendering this scene — is expected to honour the tag as follows:

  • Partition the visible SceneMeshes by bin value (a missing or empty bin is treated as the implicit "default" group).
  • Process the groups in an order the renderer documents (e.g. default first, then any meshes tagged "overlay" after, with the depth buffer cleared between groups so the overlay group reads as floating on top of the rest of the scene).
  • Honour any per-bin policy the renderer documents (depth clearing, depth-test enabled / disabled, picking priority, …).

Bin membership lives on SceneMesh rather than !scene.SceneObject | SceneObject because renderable batching happens at mesh granularity — a SceneMesh can be processed by a renderer without ever being assigned to a SceneObject, so this is the layer at which bin membership is meaningful. Tools that consume the scene but do not render it — model builders, exporters, format converters, structural inspectors — may use bin as a free-form classification, or ignore it. Loaders and exporters round-trip the value verbatim.

destroyed: boolean = false
geometry: SceneGeometry

!scene.SceneGeometry | SceneGeometry used by this SceneMesh.

id: string

Unique ID of this SceneMesh.

SceneMesh is stored by this ID in SceneModel.meshes.

material?: SceneMaterial

!scene.SceneMaterial | SceneMaterial used by this SceneMesh.

The material is the canonical home for PBR parameters — roughness, metallic, and the colour/normal/etc. textures all live there. A mesh without a material falls back to renderer defaults (moderately rough dielectric, no textures).

model: SceneModel

The SceneModel that contains this SceneMesh.

object: SceneObject

The !scene.SceneObject | SceneObject that uses this SceneMesh.

uniqueId: string

The global ID of this SceneMesh, unique among all SceneMeshes within the Scene, which is the concatenation of the SceneModel's ID and this SceneMesh's ID, separated by "__".

Accessors

  • get effectiveHatchPatternColor(): Float32Array<any>

    Effective hatch ink colour for this mesh as a four-float (r, g, b, opacity) array. All channels are in [0, 1]. Returns null when the mesh has no material attached.

    Returns Float32Array<any>

  • get effectiveHatchPatternCount(): number

    Effective number of hatch line families for this mesh (0..4). 0 means "no hatch — surface renders without overlay".

    Returns number

  • get effectiveHatchPatternFamilies(): Float32Array<any>

    Effective hatch line families for this mesh. Returns the attached material's pattern array when bound; otherwise null to signal "no per-mesh hatch — render the surface normally".

    Four families × four floats wide, zero-padded after the family count. Each family occupies four consecutive slots: [cos(angle), sin(angle), spacing, lineWidth]. Callers should consult effectiveHatchPatternCount for the in-use family count.

    Returns Float32Array<any>

  • get effectiveHatchPatternSpace(): number

    Effective hatch coordinate-space flag — 0 for screen space, 1 for world space. Returns 0 when the mesh has no material attached.

    Returns number

  • get effectiveLinePatternEntries(): Float32Array<any>

    Effective dash / gap pattern entries (line-width units) for this mesh. Returns the attached material's pattern array when bound; otherwise null to signal "no per-mesh pattern — inherit the View-level fallback".

    Eight entries wide, zero-padded after the pattern length. Callers should consult effectiveLinePatternLen to find the in-use count.

    Returns Float32Array<any>

  • get effectiveLinePatternLen(): number

    Effective dash / gap pattern length for this mesh. 0 means "no per-mesh pattern — inherit the View-level fallback"; any positive value overrides it.

    Returns number

  • get effectiveLinePatternPeriod(): number

    Effective dash / gap pattern period (sum of in-use entries, in line-width units) — the natural modulus base when walking the pattern along a segment. 0 when no per-mesh pattern is set.

    Returns number

  • get effectiveLineWidth(): number

    Effective per-mesh line thickness in pixels for the thick-line draw technique. Returns the attached material's lineWidth when one is bound; otherwise 0 to signal "fall back to the View's linesMaterial.lineWidth". The thick-line vertex shader implements that fallback.

    Returns number

  • get effectiveMetallic(): number

    Effective metallic factor — the material's metallic value if a material is attached, otherwise the renderer default (0.0).

    Returns number

  • get effectiveMetallicRoughnessTexture(): SceneTexture

    Effective metallic-roughness texture — the material's metallicRoughnessTexture if a material is attached, otherwise undefined. Channel layout follows glTF 2.0: G = roughness, B = metallic. Untextured meshes sample the per-batch MR atlas's white sentinel — a multiplicative passthrough.

    Returns SceneTexture

  • get effectiveNormalsTexture(): SceneTexture

    Effective tangent-space normal map — the material's normalsTexture if a material is attached, otherwise undefined. Encoded RGB with (x, y, z) = sample.rgb * 2 - 1. Untextured meshes sample the per-batch normal-map atlas's neutral sentinel (128, 128, 255, 255), which decodes to (0, 0, 1) — no perturbation.

    Returns SceneTexture

  • get effectiveOpacity(): number

    Gets the effective opacity factor for this SceneMesh, which is the opacity of the material if it has one, or the local opacity otherwise. This is a factor in range [0..1].

    Returns number

  • get effectiveRoughness(): number

    Effective microfacet roughness — the material's roughness if a material is attached, otherwise the renderer default (0.6).

    The renderer's Cook-Torrance BRDF reads this; meshes without a material render as a moderately-rough dielectric.

    Returns number

  • get effectiveTriplanarScale(): number

    Effective triplanar repeat distance — the material's triplanarScale if a material is attached, otherwise the renderer default (1.0). Read by the triplanar shader variant to convert world-space position into texture-sample coordinates; ignored on UV-bearing batches.

    Returns number

Methods

  • Sets the parent transform for this mesh.

    Parameters

    • parentTransformId: string

      The ID of the new parent transform, or null to detach.

    • Optionalopts: { preserveWorld?: boolean }

      Options to preserve world transformation.

    Returns SDKResult<any>