BabylonPress Lite Viewer - v0.1.0
    Preparing search index...

    Class LiteViewer

    Minimal Babylon Lite model viewer for a single canvas.

    The viewer owns a WebGPU engine, an active scene, and an ArcRotate camera. It loads one model scene at a time: loading a new model disposes the previous scene before creating the next one. Loaded models are framed automatically. No environment settings to keep everything minimal as possible. One default light with controlled intensity. ClearColor with alpha channel (use alphaMode: "premultiplied" for transparency).

    Index

    Constructors

    Methods

    • Captures the current viewer canvas.

      The screenshot data is opaque; Babylon Lite forces alpha to 255 when reading back the presented canvas.

      Returns Promise<Screenshot>

    • Stops rendering and disposes the active scene and engine.

      A disposed viewer cannot be initialized again.

      Returns void

    • Returns animation groups loaded with the active model.

      Returns readonly AnimationGroup[]

    • Initializes the WebGPU engine, scene, light, and camera.

      If options.source is provided, the model is loaded before the promise resolves. Rendering starts automatically unless options.autoStart is false.

      Returns Promise<LiteViewerDetails>

      Handles for the initialized viewer, canvas, engine, scene, and camera.

      If WebGPU is unavailable or Babylon Lite initialization fails.

    • Loads a glTF/GLB model from a URL, Blob, or ArrayBuffer.

      When another model is already loaded, the current scene is disposed and a fresh scene is created first. This keeps only one model active at a time. The loaded model is framed automatically before onLoaded runs.

      Parameters

      • source: LiteViewerSource

        Remote URL, application-hosted URL, uploaded file Blob, or model ArrayBuffer.

      Returns Promise<void>

    • Pauses all animation groups loaded with the active model.

      Returns void

    • Stops other loaded animation groups and starts the group with name.

      Parameters

      • name: string

      Returns AnimationGroup

      If no animation group with name exists on the active model.

    • Starts the Babylon Lite render loop.

      This is called automatically by initialize unless autoStart is false.

      Returns void

    • Stops the Babylon Lite render loop.

      Returns void

    • Stops all animation groups loaded with the active model.

      Returns void