magic-pixels
    Preparing search index...

    Type Alias GltfLoaderOptions

    Options of loadGltf and parseGltf. Everything is optional; the defaults load a file from the network in a browser.

    type GltfLoaderOptions = {
        baseUrl?: string;
        draco?: DracoDecoderModule | DracoWorkerOptions;
        fetch?: typeof globalThis.fetch;
        loadImage?: (source: Blob | string) => Promise<TextureData>;
        meshopt?: MeshoptDecoder | MeshoptWorkerOptions;
    }
    Index
    baseUrl?: string

    URL that relative uris of buffers and images are resolved against. loadGltf defaults it to the file's own URL; parseGltf has no default, so relative URIs are passed to fetch as they are.

    Decoder for KHR_draco_mesh_compression, required only if the file uses the extension; magic-pixels never bundles a decoder. Either an already-initialized DracoDecoderModule - the result of createDecoderModule() from draco3d, or the DracoDecoderModule global of the CDN build - decoded synchronously on the main thread, or DracoWorkerOptions to decode in a pool of Web Workers instead.

    fetch?: typeof globalThis.fetch

    fetch implementation for buffers and images; the global one by default

    loadImage?: (source: Blob | string) => Promise<TextureData>

    Decode an image into something a Texture accepts. Called with a Blob for images embedded in a buffer or a data URI, and with the resolved URL otherwise. The default fetches URLs and decodes with createImageBitmap; tests inject a stub so Node needs no DOM.

    Decoder for EXT_meshopt_compression, required only if the file uses the extension; magic-pixels never bundles a decoder. Either an already-initialized MeshoptDecoder - exactly the shape of the meshoptimizer package's export - decoded on the main thread, or MeshoptWorkerOptions to decode in a pool of Web Workers instead.