diff --git a/types/three/examples/jsm/exporters/GLTFExporter.d.ts b/types/three/examples/jsm/exporters/GLTFExporter.d.ts index 1c7cbce01..2360c1d00 100644 --- a/types/three/examples/jsm/exporters/GLTFExporter.d.ts +++ b/types/three/examples/jsm/exporters/GLTFExporter.d.ts @@ -47,12 +47,18 @@ export interface GLTFExporterOptions { includeCustomExtensions?: boolean; } -export class GLTFExporter { +type TextureUtils = { decompress: (texture: Texture, maxTextureSize?: number) => Promise | void }; + +declare class GLTFExporter { + textureUtils: TextureUtils | null; + constructor(); register(callback: (writer: GLTFWriter) => GLTFExporterPlugin): this; unregister(callback: (writer: GLTFWriter) => GLTFExporterPlugin): this; + setTextureUtils(utils: TextureUtils | null): this; + /** * Generates a .gltf (JSON) or .glb (binary) output from the input (Scenes or Objects) * @@ -94,11 +100,15 @@ export class GLTFExporter { ): Promise; } -export class GLTFWriter { +declare class GLTFWriter { + textureUtils: TextureUtils | null; + constructor(); setPlugins(plugins: GLTFExporterPlugin[]): void; + setTextureUtils(utils: TextureUtils | null): this; + /** * Parse scenes and generate GLTF output * @@ -106,7 +116,7 @@ export class GLTFWriter { * @param onDone Callback on completed * @param options options */ - write( + writeAsync( input: Object3D | Object3D[], onDone: (gltf: ArrayBuffer | { [key: string]: any }) => void, options?: GLTFExporterOptions, @@ -121,3 +131,6 @@ export interface GLTFExporterPlugin { beforeParse?: (input: Object3D | Object3D[]) => void; afterParse?: (input: Object3D | Object3D[]) => void; } + +export { GLTFExporter }; +export type { GLTFWriter };