G-code Preview — API Reference
    Preparing search index...
    interface ToolpathRendererOptions {
        buildVolume?: BuildVolumeDef;
        cameraMode?: CameraMode;
        canvas: RenderTargetCanvas;
        chunksPerTick?: number;
        colorMode?: ColorMode;
        coreBudget?: number;
        createGeometryWorker?: () => GeometryWorkerLike;
        createRenderer?: (canvas: RenderTargetCanvas) => GLRendererLike;
        frameContent?: "object" | "all";
        geometryConcurrency?: number | "auto" | "off";
        geometryMemoryBudgetBytes?: number;
        interactionQuality?: "auto" | "off";
        preserveDrawingBuffer?: boolean;
        progressivePreview?: ProgressivePreview;
        quality?: "auto" | QualityMode;
        qualityMode?: QualityPolicy;
        renderDuringBuild?: boolean;
        scheduleFrame?: (cb: () => void) => void;
        theme?: Theme;
        tube?: TubeOptions;
        tubeByteBudget?: number;
        tubeSegmentBudget?: number;
    }
    Index

    Properties

    buildVolume?: BuildVolumeDef
    cameraMode?: CameraMode

    Camera projection (#150, DD-009 D3); default 'perspective'.

    chunksPerTick?: number

    Count-based tick override (tests/deterministic hosts): exactly N chunks per tick. Default (unset): TIME-budgeted ticks — chunks build until ~8 ms of work has elapsed (§8: no main-thread stall > 16 ms during incremental build).

    colorMode?: ColorMode
    coreBudget?: number

    Logical-core budget for pool sizing — navigator.hardwareConcurrency (browser) or the cgroup CPU quota (Node/sidecar). Injected so the renderer stays platform-free; omitted → conservative default.

    createGeometryWorker?: () => GeometryWorkerLike

    Factory for a geometry-build worker (DD-028). A bundler passes the batteries-included geometry-worker.js; tests inject a synchronous fake. Omitted → the pool never engages.

    createRenderer?: (canvas: RenderTargetCanvas) => GLRendererLike

    Injectables for tests / exotic hosts.

    frameContent?: "object" | "all"

    Framing target (#306/#6): 'all' extrusion (default) or the printed 'object' (excludes skirt/prime).

    geometryConcurrency?: number | "auto" | "off"

    Parallel tube-geometry build across a worker pool (DD-028). 'auto' (default) sizes a capability- and memory-aware pool and engages it only for tube builds above a cost threshold (small builds and lines stay on the synchronous main-thread path); 'off' forces the synchronous path; a number pins the worker count (still bounded by the memory budget). Geometry is byte-identical either way. No effect without a createGeometryWorker factory (a bundler supplies one via the batteries-included worker entry; tests inject a stub).

    geometryMemoryBudgetBytes?: number

    Max bytes of tube geometry the parallel build may hold in flight at once (DD-028 memory backpressure). The pool shrinks so workers × maxChunkBytes ≤ this, bounding peak transient working set proactively (a cgroup OOM is uncatchable). Defaults to a fraction of the tube byte budget.

    interactionQuality?: "auto" | "off"

    Interaction-aware quality (#306/2, DD-020): 'auto' reduces detail while the camera moves. Default 'off'.

    preserveDrawingBuffer?: boolean

    Preserve the WebGL drawing buffer so the canvas can be read back after a render returns (toDataURL / convertToBlob / readPixels). Off by default (interactive rendering is faster without it); the headless still-render path (#132) turns it on so a single render is capturable.

    progressivePreview?: ProgressivePreview

    During-parse preview presentation (#60 curtain): 'lines' (default, stream the progressive line preview), 'hold' (keep progress but reveal only the final coloured build — a single clean reveal), or 'off' (no progressive geometry or preview progress; consumer drives its own loading treatment). Does not change the final representation.

    quality?: "auto" | QualityMode

    §4.3 quality tier; 'auto' (default) picks tubes ≤ 1 M segments, else lines.

    qualityMode?: QualityPolicy

    Fidelity POLICY (DD-023 §4 D6), distinct from the geometry quality tier (lines/tubes) — what the user/admin WANTS, not what the client is running on (capabilityHint). Modulates the two large-file ceilings within the chosen geometry mode:

    • 'full': render the COMPLETE representation — no every-Nth decimation, full-radial continuous tubes, no budget-driven tubes→lines fallback (only the per-chunk vertex safety net still applies, as an honest last-resort). The hard job of failing gracefully when a client genuinely can't is a later phase; today 'full' attempts the full build.
    • 'adaptive' (default): the capability-aware auto path — auto decimation + the tubeByteBudget cross-section coarsening, every reduction disclosed. Reproduces today's behaviour.
    • 'fast': explicitly trade fidelity for responsiveness — render as flat lines.
    renderDuringBuild?: boolean

    Render the scene after each incremental build tick (progressive-build feedback). Default true — the interactive viewer wants to watch geometry appear. A headless one-shot still sets this false: it builds geometry to completion and renders once at the end, avoiding the dozens-to-hundreds of discarded full-scene renders a large build would otherwise do (each an MSAA software rasterization of a growing tube mesh — the dominant cost of a big still in software WebGL). No visual difference; buildComplete and all build events still fire.

    scheduleFrame?: (cb: () => void) => void
    theme?: Theme

    Bounded declarative theme (#153, DD-009 D4); omitted fields keep the default look.

    Tube profile parameters (tubes mode only).

    tubeByteBudget?: number

    CPU byte budget bounding tube memory (RR-006): above it the tube cross-section is coarsened (fewer sides) — never dropping segments — and, only if the minimum cross-section still exceeds it, the build degrades to flat lines. Default ~450 MB (safe in a 2 GB render cgroup). Raise on a memory-rich host for higher-poly tubes on huge files.

    tubeSegmentBudget?: number

    (v0.10.0) Superseded — this decimated tube geometry by dropping every-Nth segment, which shredded tubes into disconnected spiky stubs on large files (RR-006 correction). Accepted but ignored; use tubeByteBudget. Tube memory is now bounded by coarsening the cross-section at full continuity.