Documentation - v20.0.0-dev
    Preparing search index...

    The view on a Viewer's scene: its camera and their controls, the transform gizmo, the operators turning the pointer and keyboard input into selection, transformation and context menus. Made with the viewer and kept by it (Viewer.viewport), it draws once mounted on a canvas, with the engine's Renderer, and listens to that canvas.

    Index

    Constructors

    Properties

    cameraControls: CameraController
    contextMenuController: ContextMenuController
    defaultOperator: RaycastSelectOperator
    interactionController: InteractionController
    renderModeController: RenderModeController
    shortcutController: KeyboardShortcutController
    snapModeController: SnapModeController
    transformController: TransformController
    viewer: Viewer

    Reference to the connected Viewer

    Accessors

    • get camera(): RenderCamera

      The camera drawn from, its controls': perspective or orthographic.

      Returns RenderCamera

    • get canvas(): HTMLCanvasElement | null

      The canvas drawn on and listened to; null until mounted.

      Returns HTMLCanvasElement | null

    • get renderer(): Renderer | null

      The engine's renderer, drawing on canvas; null until mounted.

      Returns Renderer | null

    Methods

    • Returns void

    • Returns void

    • Draws on canvas, in place of the canvas mounted, and listens to its input. Asynchronous: the engine asks for a WebGPU adapter and device; the canvas is listened to once its renderer is made. The canvas stays the caller's: placed and sized by its CSS, focusable for the keyboard (tabIndex). A mount waits for the one before to settle (e.g. React mounting, unmounting and mounting again at once): its renderer freed first, as one backend at a time draws the scene.

      Parameters

      • canvas: HTMLCanvasElement

        Where to draw.

      Returns Promise<Renderer | null>

      The renderer, drawing; null when the viewport was unmounted or mounted elsewhere meanwhile (that renderer freed, or none made).

    • Returns void

    • Draws from camera from now on (the camera controls changed mode).

      Parameters

      Returns void

    • Stops drawing on the canvas and listening to it, its renderer freed; the canvas is kept.

      Returns void