A model in a Scene

See @xeokit/scene for usage.

Hierarchy

  • Component
    • SceneModel

Properties

built: boolean

Indicates if this SceneModel has already been built.

destroyed: boolean

Indicates if this SceneModel has been destroyed.

  • Set true by SceneModel.destroy.
  • Don't create anything more in this SceneModel once it's destroyed.
dirty: boolean
edgeThreshold: number

The edge threshold for automatic edge primitive generation.

geometries: {
    [key: string]: SceneGeometry;
}

Geometries within this SceneModel, each mapped to SceneGeometry.id.

Type declaration

globalizedIds: boolean

Whether IDs of SceneObjects are globalized.

When globalized, the IDs are prefixed with the value of SceneModel.id

This is false by default.

id: string

Unique ID of this SceneModel.

SceneModel are stored against this ID in Scene.models.

layerId?: string

If we want to view this SceneModel with a Viewer, an optional ID of a ViewLayer to view it in.

meshes: {
    [key: string]: SceneMesh;
}

SceneMeshes within this SceneModel, each mapped to SceneMesh.id.

Type declaration

objects: {
    [key: string]: SceneObject;
}

SceneObjects within this SceneModel, each mapped to SceneObject.id.

Type declaration

objectsList: SceneObject[]

List of SceneObjects within this SceneModel.

quantizationRanges: {
    [key: string]: SceneQuantizationRange;
}

@xeokit/scene!SceneQuantizationRange | SceneQuantizationRanges within this SceneModel, each mapped to @xeokit/scene!SceneQuantizationRange.id | SceneQuantizationRange.id.

Type declaration

  • [key: string]: SceneQuantizationRange
rendererModel: RendererModel

Internal interface through which a SceneModel can load updated content into a renderers.

retained: boolean

TODO

scene: Scene

The Scene that contains this SceneModel.

Statistics on this SceneModel.

streamParams?: SceneModelStreamParams

Indicates what renderer resources will need to be allocated in a Viewer's Renderer to support progressive loading for the SceneModel.

See @xeokit/scene for usage.

textureSets: {
    [key: string]: SceneTextureSet;
}

TextureSets within this SceneModel, each mapped to SceneTextureSet.id.

Type declaration

textures: {
    [key: string]: SceneTexture;
}

Textures within this SceneModel, each mapped to SceneTexture.id.

Type declaration

tiles: {
    [key: string]: SceneTile;
}

The @xeokit/scene!SceneTile | Tiles used by this SceneModel, each mapped to @xeokit/scene!SceneTile.id | SceneTile.id.

Type declaration

  • [key: string]: SceneTile
tilesList: SceneTile[]

The @xeokit/scene!SceneTile | Tiles used by this SceneModel.

Accessors

  • get aabb(): FloatArrayParam
  • Gets the axis-aligned 3D World-space boundary of this SceneModel.

    Returns FloatArrayParam

Methods

  • Finalizes this SceneModel, readying it for use.

    Usage

    sceneMode.onBuilt.subscribe(()=>{
    // Our SceneModel is built and ready to use
    });

    myScene.onModelCreated.subscribe((sceneModel)=>{
    // Another way to subscribe to SceneModel readiness
    });

    mySceneModel.build().then((result) => { // Asynchronous (texture compression etc).
    if (result instanceof SDKError) {
    console.log(result.message);
    } else {
    // Now we can do things with our SceneModel
    }
    }).catch(sdkError) {// SDKError
    console.log(sdkError.message);
    };

    See @xeokit/scene for more usage info.

    Returns Promise<SceneModel>

    Throws

    SDKError

    • If SceneModel has already been built or destroyed.
    • If no SceneObjects were created in this SceneModel.
  • Forces this component to action any deferred state updates.

    Returns void

  • Gives this component an opportunity to action any defered state updates.

    Returns void

  • Creates a new @xeokit/scene!SceneGeometry within this SceneModel, from non-compressed geometry parameters.

    Usage

    const boxGeometry = sceneModel.createGeometry({
    id: "boxGeometry",
    primitive: TrianglesPrimitive, // @xeokit/constants
    positions: [
    1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, // v0-v1-v2-v3 front
    1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, // v0-v3-v4-v1 right
    1, 1, 1, 1, 1, -1, -1, 1, -1, -1, 1, 1, // v0-v1-v6-v1 top
    -1, 1, 1, -1, 1, -1, -1, -1, -1, -1, -1, 1, // v1-v6-v7-v2 left
    -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1,// v7-v4-v3-v2 bottom
    1, -1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1 // v4-v7-v6-v1 back
    ],
    indices: [
    0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7, 8, 9, 10, 8, 10, 11, 12, 13, 14, 12, 14, 15,
    16, 17, 18, 16, 18, 19, 20, 21, 22, 20, 22, 23
    ]
    });

    if (boxGeometry instanceof SDKError) {
    console.log(boxGeometry.message);
    } else {
    const boxGeometryAgain = sceneModel.geometries["boxGeometry"];
    }

    See @xeokit/scene for more usage info.

    Parameters

    Returns SDKError | SceneGeometry

    @xeokit/scene!SceneGeometry

    • On success.
  • Parameters

    • quantizationRangeParams: SceneQuantizationRangeParams

    Returns SDKError | SceneQuantizationRange

  • Protected

    Logs an error for this component to the JavaScript console.

    The console message will have this format: [ERROR] [<component type> =<component id>: <message>

    Parameters

    • message: string

      The error message to log

    Returns void

  • Protected

    Logs a message for this component.

    The message will have this format: [LOG] [<component type> <component id>: <message>

    Parameters

    • message: string

      The message to log

    Returns void

  • Flags this component as having a defered state updates it needs to perform.

    Returns void

  • Protected

    Logs a warning for this component to the JavaScript console.

    The console message will have this format: [WARN] [<component type> =<component id>: <message>

    Parameters

    • message: string

      The warning message to log

    Returns void

Events

onBuilt: EventEmitter<SceneModel, null>

Emits an event when this SceneModel has been built.

onBuilt

onDestroyed: EventEmitter<SceneModel, null>

Emits an event when this SceneModel has been destroyed.

onDestroyed