UNPKG

@needle-tools/gltf-progressive

Version:

three.js support for loading glTF or GLB files that contain progressive loading data

41 lines (40 loc) 2.04 kB
import { WebGLRenderer } from 'three'; import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader.js'; import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js'; import { KTX2Loader } from 'three/examples/jsm/loaders/KTX2Loader.js'; /** * Set the location of the Draco decoder. If a draco loader has already been created, it will be updated. * @default 'https://www.gstatic.com/draco/versioned/decoders/1.5.7/' */ export declare function setDracoDecoderLocation(location: string): void; /** * Set the location of the KTX2 transcoder. If a KTX2 loader has already been created, it will be updated. * @default 'https://www.gstatic.com/basis-universal/versioned/2021-04-15-ba1c3e4/' */ export declare function setKTX2TranscoderLocation(location: string): void; /** * Create loaders/decoders for Draco, KTX2 and Meshopt to be used with GLTFLoader. * @param renderer - Provide a renderer to detect KTX2 support. * @returns The loaders/decoders. */ export declare function createLoaders(renderer: WebGLRenderer | null): { dracoLoader: DRACOLoader; ktx2Loader: KTX2Loader; meshoptDecoder: { supported: boolean; ready: Promise<void>; decodeVertexBuffer: (target: Uint8Array, count: number, size: number, source: Uint8Array, filter?: string) => void; decodeIndexBuffer: (target: Uint8Array, count: number, size: number, source: Uint8Array) => void; decodeIndexSequence: (target: Uint8Array, count: number, size: number, source: Uint8Array) => void; decodeGltfBuffer: (target: Uint8Array, count: number, size: number, source: Uint8Array, mode: string, filter?: string) => void; }; }; export declare function addDracoAndKTX2Loaders(loader: GLTFLoader): void; /** * Smart loading hints can be used by needle infrastructure to deliver assets optimized for a specific usecase. */ export type SmartLoadingHints = { progressive?: boolean; usecase?: "product"; }; export declare function configureLoader(loader: GLTFLoader, opts: SmartLoadingHints): void;