Represents the root container for all scene‑level state, including models, objects, meshes, geometries, textures and runtime events.

A Scene serves as the authoritative registry and lifecycle manager of:

It provides:

  • A shared coordinate system
  • A central event hub via SceneEvents
  • Lifecycle management (creation, destruction, registration)
  • Error reporting with optional console logging

See @xeokit/sdk/scene for general usage examples.

Constructors

Properties

coordinateSystem: CoordinateSystem

The coordinate system used throughout this Scene.

This determines how all positions, orientations, and transformations within the Scene are interpreted.

destroyed: boolean = false

Indicates whether this Scene has been destroyed.

When true, new models cannot be created and most operations will return an error result.

events: SceneEvents

Event dispatcher for Scene‑level lifecycle events.

id: string

Unique ID of this Scene. This is generated automatically.

logging: boolean = true

Enables or disables console logging of SDK errors.

Defaults to false. When enabled, any dispatched error will also be logged via console.error.

models: { [key: string]: SceneModel }

All SceneModel instances belonging to this Scene, keyed by their unique model ID.

objects: { [key: string]: SceneObject }

All SceneObject instances currently registered in this Scene.

Objects are stored at the Scene level so tools and utilities can access them without needing to know which model they belong to.

Methods

  • Creates and registers a new SceneModel in this Scene.

    • Fires a SceneEvents.onSceneModelCreated event.
    • Validates that the Scene is not destroyed and the model ID is unique.
    • Instantiates the SceneModel and populates it from the given parameters.
    • Registers the model and dispatches a creation event.
    • If population fails, destroys the model and all its components (objects, meshes, geometries), dispatching destruction events for each component and the model itself.

    Parameters

    Returns SDKResult<SceneModel>

    SDKResult containing the created SceneModel or an error.