G-code Preview — API Reference
    Preparing search index...

    Interface ModelPreviewControllerOptions

    Controller options — the engine's ModelViewerOptions minus the canvas (bound later). The onProgress callback is still delivered to the consumer AND folded into state.progress.

    interface ModelPreviewControllerOptions {
        autoFrameOnResize?: boolean;
        background?: ModelBackground;
        buildVolume?: BuildVolumeDef | null;
        cameraFov?: number;
        cameraMode?: CameraMode;
        createControls?: (
            camera: PerspectiveCamera | OrthographicCamera,
            domElement: HTMLElement,
        ) => ControlsLike;
        createRenderer?: (canvas: RenderTargetCanvas) => GLRendererLike;
        filamentPalette?: readonly (string | undefined)[];
        interactionQuality?: "off" | "auto";
        limits?: ModelLimits;
        loaders?: readonly ModelLoader[];
        onProgress?: (progress: LoadProgress) => void;
        pixelRatio?: PixelRatioOption;
        renderScope?: RenderScope;
        showVolumeCage?: boolean;
        theme?: Theme;
    }
    Index
    autoFrameOnResize?: boolean

    Re-fit the model on canvas resize until the user moves the camera (default true).

    background?: ModelBackground
    buildVolume?: BuildVolumeDef | null

    Build plate under the model (DD-032 §4.3): the full BuildVolumeDef (shape, min, excluded regions). Omit/null for no plate — the viewer then renders exactly as before. Where the part sits on it is reported honestly as state.placement.

    cameraFov?: number

    Perspective lens in degrees, [10, 120] (default 50). Throws RangeError synchronously outside it.

    cameraMode?: CameraMode
    createControls?: (
        camera: PerspectiveCamera | OrthographicCamera,
        domElement: HTMLElement,
    ) => ControlsLike

    Injected orbit controls (tests).

    createRenderer?: (canvas: RenderTargetCanvas) => GLRendererLike

    Injected GL (tests / exotic hosts).

    filamentPalette?: readonly (string | undefined)[]
    interactionQuality?: "off" | "auto"
    limits?: ModelLimits
    loaders?: readonly ModelLoader[]
    onProgress?: (progress: LoadProgress) => void

    Staged loading-progress (DD-024); also mirrored into state.progress.

    pixelRatio?: PixelRatioOption

    Resting pixel ratio of the canvas: a number in (0, 4], or 'device' (the display's devicePixelRatio capped at 2, followed live as it changes). Unset keeps the renderer's ratio (1). Sharper on HiDPI screens, at a fill cost: a ratio of 2 shades 4× the fragments of 1. Throws RangeError synchronously otherwise. The default capture() size does not change. Remembered across canvas rebinds.

    renderScope?: RenderScope
    showVolumeCage?: boolean

    Draw the build-volume wireframe cage over the plate (default true). false drops only the cage: the plate, grid and shadow stay. Remembered across canvas rebinds.

    theme?: Theme

    Plate/backdrop look, e.g. studioTheme('dark'). Only the plate and backdrop fields apply; lights and materialPreset are deliberately not applicable to the model viewer (its lighting is unchanged). theme.background beats background (the fallback tier). Invalid values throw RangeError synchronously.