Backend-neutral renderer contract.

This is the surface expected by higher-level viewer, Studio, and spatial picking code. Concrete backends such as WebGL or WebGPU can expose richer backend-specific APIs in their own modules while still satisfying this shared contract.

interface Renderer {
    events: RendererEvents<any>;
    logging: boolean;
    rendering: boolean;
    viewer: Viewer;
    attachViewer(viewer: Viewer): SDKResult<void>;
    destroy(): void;
    detachViewer(): void;
    getSnapshot(view: View): SDKResult<string>;
    pick(
        view: View,
        pickParams: viewing.viewer.PickParams,
    ): SDKResult<viewing.viewer.PickResult>;
}

Implemented by

Properties

events: RendererEvents<any>

Lifecycle, context, render, and error events emitted by the renderer.

logging: boolean

Enables backend error logging when supported by the implementation.

rendering: boolean

Whether the renderer currently has active rendering state.

viewer: Viewer

Viewer currently attached to the renderer, or null when detached.

Methods

  • Attaches a Viewer to the renderer.

    Implementations usually subscribe to Viewer and Scene events during this call, allocate backend state, and start rendering when the Viewer has a Scene.

    Parameters

    • viewer: Viewer

      Viewer to render.

    Returns SDKResult<void>

    An SDK result indicating whether attachment succeeded.