import type { LoadingManager } from 'three'; import { GaussianSplats } from './GaussianSplats.cjs'; import { GaussianSplatsDataParser } from './GaussianSplatsDataParser.cjs'; import type { GaussianSplatsLoadCallback, GaussianSplatsNetworkProgressCallback, GaussianSplatsLoadErrorCallback, GaussianSplatsParseSource, GaussianSplatsLoaderOptions, GaussianSOGImage, GaussianSOGImageCollection, GaussianSOGMetadata, GaussianSOGSource, GaussianSOGPaletteResult, GaussianSOGExpandedSHResult, GaussianExpandedSplatData, GaussianDirectSOGSplatData, GaussianSplatData, GaussianSplatsWorkerResult, PLYProperty, PLYPropertyTable } from './GaussianSplatsDataParser.cjs'; export type { GaussianSplatSourceFormat, GaussianSplatsWorkerMode, GaussianSplatsProcessingStage, GaussianSplatsProcessingProgress, GaussianSplatsProcessProgressCallback, GaussianSplatsLoadCallback, GaussianSplatsNetworkProgressCallback, GaussianSplatsLoadErrorCallback, GaussianSplatsParseSource, GaussianSplatsLoaderOptions, GaussianSplatsLoaderDefaultOptions, GaussianSplatsLoadTimings, GaussianSOGImage, GaussianSOGMetadata, GaussianSOGSource, GaussianSOGSphericalHarmonics, GaussianSOGPaletteResult, GaussianSOGExpandedSHResult, GaussianExpandedSplatData, GaussianDirectSOGSplatData, GaussianPackedExpandedSplatData, GaussianSplatData, GaussianSplatsWorkerOptions, GaussianSplatsWorkerResult, GaussianSplatsWorkerParseRequest, GaussianSplatsWorkerProgressMessage, GaussianSplatsWorkerReadyMessage, GaussianSplatsWorkerResultMessage, GaussianSplatsSerializedError, GaussianSplatsWorkerErrorMessage, GaussianSplatsWorkerResponse, } from './GaussianSplatsDataParser.cjs'; /** * Loader for 3D Gaussian Splatting files (.ply, .splat, .splats, and .sog formats). * * Supports: * - PLY format (standard 3DGS training output with positions, scales, rotations, colors, SH coefficients) * - SPLAT/SPLATS format (web-optimized packed format) * - SOG format (PlayCanvas compressed WebP-based format, ~15-20x smaller than PLY) * * **Usage** * ```js * import { GaussianSplatsLoader } from 'three-blocks/gaussian-splats'; * * const loader = new GaussianSplatsLoader(); * * // Callback style * loader.load('/models/scene.ply', (splats) => { * scene.add(splats); * }); * * // Async style * const splats = await loader.loadAsync('/models/scene.ply'); * scene.add(splats); * * // Load compressed SOG format * const splats = await loader.loadAsync('/models/scene.sog'); * scene.add(splats); * * // With options * const splats = await loader.loadAsync('/models/scene.ply', undefined, { * maxSplats: 2000000, * enableSH: true, * shDegree: 2, * }); * ``` * * @class GaussianSplatsLoader * @extends Loader * @short Loader for PLY, SPLAT, SPLATS, and SOG Gaussian Splatting files, returns a GaussianSplats object. * @category Loaders * @tags WebGPU */ export declare class GaussianSplatsLoader extends GaussianSplatsDataParser { constructor(manager?: LoadingManager); /** * Load a Gaussian Splatting file. * * @param {string} url URL to the .ply or .splat file. * @param {Function} [onLoad] Callback fired with the loaded GaussianSplats. * @param {Function} [onProgress] Progress callback. * @param {Function} [onError] Error callback. * @param {Object} [options] Options for the GaussianSplats instance. */ load(url: string, onLoad?: GaussianSplatsLoadCallback, onProgress?: GaussianSplatsNetworkProgressCallback, onError?: GaussianSplatsLoadErrorCallback, options?: GaussianSplatsLoaderOptions): void; /** * Load a Gaussian Splatting file asynchronously. * * @param {string} url URL to the .ply or .splat file. * @param {Function} [onProgress] Progress callback. * @param {Object} [options] Options for the GaussianSplats instance. * @returns {Promise} Promise resolving to the loaded GaussianSplats. */ loadAsync(url: string, onProgress?: GaussianSplatsNetworkProgressCallback, options?: GaussianSplatsLoaderOptions): Promise; /** * Parse a buffer into a GaussianSplats instance. * For SOG files, use parseAsync() instead as they require async image decoding. * Response and ReadableStream sources always parse asynchronously (and stream standard PLY). * * @param {ArrayBuffer|Response|ReadableStream} buffer File data. * @param {string} url Original URL (for format detection). * @param {Object} [options] Options for the GaussianSplats instance. * @returns {GaussianSplats|Promise} The parsed GaussianSplats instance (Promise for SOG/stream). */ parse(buffer: GaussianSplatsParseSource, url: string, options?: GaussianSplatsLoaderOptions): GaussianSplats | Promise; /** * Parse a buffer into a GaussianSplats instance (async version). * Required for SOG files which need async image decoding. * * Standard binary PLY accepts a Response or ReadableStream source and decodes vertex * records while the bytes arrive, overlapping the network/disk read with parsing. * * @param {ArrayBuffer|Response|ReadableStream} buffer File data or byte source. * @param {string} url Original URL (for format detection). * @param {Object} [options] Options for the GaussianSplats instance. * @returns {Promise} Promise resolving to the parsed GaussianSplats instance. */ parseAsync(buffer: GaussianSplatsParseSource, url: string, options?: GaussianSplatsLoaderOptions): Promise; _shouldUseWorker(buffer: ArrayBuffer | ReadableStream, ext: string, options: GaussianSplatsLoaderOptions): boolean; _parseInWorker(buffer: ArrayBuffer | ReadableStream, url: string, options: GaussianSplatsLoaderOptions): Promise; _parseDataAsync(buffer: ArrayBuffer | ReadableStream, url: string, options?: GaussianSplatsLoaderOptions): Promise; protected _parsePLY(buffer: ArrayBuffer, maxSplats: number, packSHHalf?: boolean): GaussianExpandedSplatData; protected _detectSHDegree(propIndex: PLYPropertyTable): number; protected _parseSPLAT(buffer: ArrayBuffer, maxSplats: number): GaussianExpandedSplatData; protected _parseCompressedPLYWithBounds(buffer: ArrayBuffer, numChunks: number, vertexCount: number, shElementCount: number, _chunkProperties: readonly PLYProperty[], _vertexProperties: readonly PLYProperty[], shProperties: readonly PLYProperty[], dataOffset: number, isLittleEndian: boolean, maxSplats: number): GaussianExpandedSplatData; protected _parseSOG(buffer: ArrayBuffer, maxSplats: number, { direct }?: { direct?: boolean | undefined; }): Promise; _createDirectSOGData(images: GaussianSOGImageCollection, meta: GaussianSOGMetadata, count: number, version: number, sogSource: GaussianSOGSource): GaussianDirectSOGSplatData; _parseSOGSphericalHarmonicsPalette(labelsImg: GaussianSOGImage, centroidsImg: GaussianSOGImage, meta: GaussianSOGMetadata, count: number, imgWidth: number): GaussianSOGPaletteResult; _validateSOGImages(images: GaussianSOGImageCollection, count: number, meta?: GaussianSOGMetadata): void; protected _decodeSOGImages(files: Record, meta: GaussianSOGMetadata): Promise; protected _dequantizeSOGData(images: GaussianSOGImageCollection, meta: GaussianSOGMetadata, count: number, version: number): GaussianExpandedSplatData; protected _parseSOGSphericalHarmonics(labelsImg: GaussianSOGImage, centroidsImg: GaussianSOGImage, meta: GaussianSOGMetadata, count: number, imgWidth: number): GaussianSOGExpandedSHResult; }