import { IDisposable } from "../../Interfaces/IDisposable"; /** * Configuration for Draco compression */ export interface IDracoCompressionConfiguration { /** * Configuration for the decoder. */ decoder: { /** * The url to the WebAssembly module. */ wasmUrl?: string; /** * The url to the WebAssembly binary. */ wasmBinaryUrl?: string; /** * The url to the fallback JavaScript module. */ fallbackUrl?: string; }; } /** * Draco compression (https://google.github.io/draco/) * * This class wraps the Draco module. * * **Encoder** * * The encoder is not currently implemented. * * **Decoder** * * By default, the configuration points to a copy of the Draco decoder files for glTF from the babylon.js preview cdn https://preview.babylonjs.com/draco_wasm_wrapper_gltf.js. * * To update the configuration, use the following code: * ```javascript * DracoCompression.Configuration = { * decoder: { * wasmUrl: "", * wasmBinaryUrl: "", * fallbackUrl: "", * } * }; * ``` * * Draco has two versions, one for WebAssembly and one for JavaScript. The decoder configuration can be set to only support Webssembly or only support the JavaScript version. * Decoding will automatically fallback to the JavaScript version if WebAssembly version is not configured or if WebAssembly is not supported by the browser. * Use `DracoCompression.DecoderAvailable` to determine if the decoder configuration is available for the current context. * * To decode Draco compressed data, get the default DracoCompression object and call decodeMeshAsync: * ```javascript * var vertexData = await DracoCompression.Default.decodeMeshAsync(data); * ``` * * @see https://www.babylonjs-playground.com/#N3EK4B#0 */ export declare class DracoCompression implements IDisposable { private _workerPoolPromise?; private _decoderModulePromise?; /** * The configuration. Defaults to the following urls: * - wasmUrl: "https://cdn.zakeke.com/cdn/Scripts/draco/1.3.4/rev.1/draco_wasm_wrapper.js" * - wasmBinaryUrl: "https://cdn.zakeke.com/cdn/Scripts/draco/1.3.4/rev.1/draco_decoder.wasm" * - fallbackUrl: "https://cdn.zakeke.com/cdn/Scripts/draco/1.3.4/rev.1/draco_decoder.js" */ static Configuration: IDracoCompressionConfiguration; /** * Returns true if the decoder configuration is available. */ static get DecoderAvailable(): boolean; /** * Default number of workers to create when creating the draco compression object. */ static DefaultNumWorkers: number; private static GetDefaultNumWorkers; private static _Default; /** * Default instance for the draco compression object. */ static get Default(): DracoCompression; /** * Constructor * @param numWorkers The number of workers for async operations. Specify `0` to disable web workers and run synchronously in the current context. */ constructor(numWorkers?: number); /** * Stop all async operations and release resources. */ dispose(): void; /** * Returns a promise that resolves when ready. Call this manually to ensure draco compression is ready before use. * @returns a promise that resolves when ready */ whenReadyAsync(): Promise; /** * Decode Draco compressed mesh data to vertex data. * @param data The ArrayBuffer or ArrayBufferView for the Draco compression data * @param attributes A map of attributes from vertex buffer kinds to Draco unique ids * @returns A promise that resolves with the decoded vertex data */ decodeMeshAsync(data: ArrayBuffer | ArrayBufferView, attributes?: { [kind: string]: number; }): Promise; }