Helper class to set up a basic 3D demo with a Scene, Data, Viewer, WebGLRenderer, and View.

See @xeokit/sdk/demo for usage.

Constructors

Properties

data: Data

The Data created by the DemoHelper. Holds all data models.

maxViews: number

The maximum number of views to create.

renderer: WebGLRenderer

The WebGLRenderer created by the DemoHelper.

scene: Scene

The Scene created by the DemoHelper. Holds all 3D objects.

stats: {
    aabb: number[];
    data: DataModelStats;
    elapsedTime: number;
    endTime: number;
    memory: MemoryUsage;
    renderer: RenderStats;
    scene: SceneModelStats;
    startTime: number;
}

Statistics about the demo, available after calling finished().

viewer: Viewer

The Viewer created by the DemoHelper.

views: {
    [viewId: string]: {
        cameraFlight: CameraFlightAnimation;
        view: View;
        viewController: ViewController;
    };
}

Tracks created Views by their IDs, along with their associated CameraFlightAnimation and ViewController.

Accessors

Methods

  • Creates a new View in the Viewer.

    When viewParams.elementId and viewParams.htmlElement are omitted, this method auto-creates a canvas element, passes it to viewer.createView, and lays it out snugly with other auto-created canvases inside the window.

    Auto-created canvases are given z-index: 100000.

    The first View created becomes the DemoHelper's primary view, and gets a CameraFlightAnimation and ViewController.

    Parameters

    • viewParams: ViewParams = ...

      Parameters for the View.

    Returns View

    The created View.

  • Loads a model into the Scene and Data using the appropriate loader based on the provided type.

    Parameters

    • params: {
          dataModel?: DataModel;
          format: string;
          modelId?: string;
          sceneModel?: SceneModel;
          src?: string;
      }
    • options: any

    Returns Promise<SDKResult<any>>

  • Toggles the visibility of the floating inspector panels.

    Also keeps the Open/Close Inspectors button state synchronized no matter how this method is invoked.

    Returns void