Luxar Viewer API Documentation - v2026.9.22
    Preparing search index...

    What downstream code needs to know about the underlying graphics stack. All static fields are captured once at construction.

    interface RendererCapabilities {
        apiSurface: "webgl2" | "webgpu";
        framebufferYDown: boolean;
        hdr: HDRCapabilities;
        maxMSAASamples: number;
        maxTextureSize: number;
        maxRenderbufferSize: number;
        pointSizeRange: readonly [number, number];
        readBackbufferPixels(): Promise<
            { pixels: Uint8Array; width: number; height: number },
        >;
    }
    Index
    apiSurface: "webgl2" | "webgpu"

    The renderer API surface in use — discriminator for callers that must branch on method signatures (readback shapes, render target wiring, etc.).

    • 'webgl2' → active renderer is THREE.WebGLRenderer.
    • 'webgpu' → active renderer is WebGPURenderer, even when WebGPURenderer's internal backend has fallen back to WebGL2. The callable surface still follows the WebGPURenderer API (e.g. readRenderTargetPixelsAsync returns its result instead of writing into a destination buffer, padding rules apply).

    Treat this as "which method-signature contract should I follow?", not as "which physical GPU backend is running?". Probing the physical backend requires inspecting renderer.backend and is intentionally not exposed here.

    framebufferYDown: boolean

    True when the effective framebuffer presented by the renderer has row 0 at the top of the viewport (real WebGPU; also WebGPURenderer running on its WebGL2 compat backend, which Three.js normalises to match real WebGPU). False when row 0 is at the bottom (THREE.WebGLRenderer).

    This is the canonical seam for every Y-orientation decision in the viewer:

    • createFullscreenTriangleGeometry emits V-inverted UVs when this is true (so that screen-bottom-left at NDC (-1,-1) samples the bottom row of the source target on top-down framebuffers). The false branch emits the straight-V UVs used by WebGL2's bottom-up framebuffer. Either way the resulting vUv resolves to the canvas-relative UV at every fragment.
    • readPixelsCompactAsync returns rows in canonical top-down order; when this is false, the primitive inverts rows on the way out.

    Disambiguates from apiSurface: in practice both fields move together today (every WebGPURenderer reports framebufferYDown=true), but they answer different questions. apiSurface is the method-signature contract (e.g. readRenderTargetPixelsAsync's shape); this field is the framebuffer memory layout. Future Three.js versions could conceivably introduce a WebGPURenderer configuration whose effective Y differs, which is why we keep this as a separate capability rather than aliasing apiSurface.

    HDR / wide-gamut / float-texture detection.

    maxMSAASamples: number

    Maximum MSAA sample count the GPU supports (0 if unsupported).

    maxTextureSize: number

    Maximum 2D texture dimension (MAX_TEXTURE_SIZE / maxTextureDimension2D). Sizes the gsplat splat-data texture (see rendering/element-texture-layout.ts): width is capped at min(4096, maxTextureSize) and height bounds per-node splat capacity.

    maxRenderbufferSize: number

    Maximum renderbuffer dimension (MAX_RENDERBUFFER_SIZE).

    pointSizeRange: readonly [number, number]

    [min, max] gl_PointSize range — used for debug logging.

    • Read the current canvas backbuffer into a freshly-allocated Uint8Array (RGBA bytes, not vertically flipped).

      Returns a Promise so the WebGPU port (which requires async buffer.mapAsync) replaces only this method's body, not the interface contract. Under WebGL2 the inner work is synchronous and the Promise resolves immediately.

      Implementations are responsible for binding the canvas backbuffer before reading.

      Returns Promise<{ pixels: Uint8Array; width: number; height: number }>