A mesh in a SceneModel.

See @xeokit/sdk/scene for usage.

Properties

destroyed: boolean = false
geometry: SceneGeometry

SceneGeometry used by this SceneMesh.

id: string

Unique ID of this SceneMesh.

SceneMesh is stored by this ID in SceneModel.meshes.

material?: SceneMaterial

SceneMaterial used by this SceneMesh.

model: SceneModel

The SceneModel that contains this SceneMesh.

object: SceneObject

The SceneObject that uses this SceneMesh.

Accessors

  • get geometryId(): string

    Gets the ID of the SceneGeometry used by this SceneMesh.

    Returns string

  • set geometryId(value: string): void

    Sets the SceneGeometry used by this SceneMesh.

    The SceneMesh will already have the SceneGeometry it was created with, and then you can change it to a different SceneGeometry using this setter.

    This mechanism allows you to dynamically switch the geometric representation of a SceneMesh at runtime.

    When the switch succeeds, SceneMesh.geometry will reference the new SceneGeometry and an SceneEvents.onSceneMeshGeometryChanged event is dispatched on the Scene.

    If the given geometryId is invalid, such as when the SceneGeometry does not exist in the SceneModel, an error will be logged and the SceneGeometry will not be changed.

    Note that you cannot destroy a SceneGeometry that is currently in use by a SceneMesh.

    Parameters

    • value: string

      The ID of the new SceneGeometry to use. Must exist in the SceneModel.

    Returns void

  • get globalColor(): Vec3

    Gets the global RGB color for this SceneMesh, which is the color of the material if it has one, or the local color otherwise.

    Returns Vec3

  • get globalOpacity(): number

    Gets the global 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 materialId(): string

    Gets the ID of the SceneMaterial used by this SceneMesh.

    Returns string

  • set materialId(value: string): void

    Sets the SceneMaterial used by this SceneMesh.

    The SceneMesh will already have the SceneMaterial it was created with, and then you can change it to a different SceneMaterial using this setter.

    This mechanism allows you to dynamically switch the geometric representation of a SceneMesh at runtime.

    When the switch succeeds, SceneMesh.material will reference the new SceneMaterial and an SceneEvents.onSceneMeshMaterialChanged event is dispatched on the Scene.

    If the given materialId is invalid, such as when the SceneMaterial does not exist in the SceneModel, an error will be logged and the SceneMaterial will not be changed.

    Note that you cannot destroy a SceneMaterial that is currently in use by a SceneMesh.

    Parameters

    • value: string

      The ID of the new SceneMaterial to use. Must exist in the SceneModel.

    Returns void

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>