gaussian-splat-lite 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/CONTRIBUTING.md +79 -0
- package/Gaussian-Splat-Lite.svg +104 -0
- package/LICENSE +202 -0
- package/NOTICE +10 -0
- package/README.md +272 -0
- package/THIRD_PARTY_LICENSES.md +53 -0
- package/dist/assets/worker-7HrXsEvI.js.map +1 -0
- package/dist/assets/worker-XHJGFfdJ.js.map +1 -0
- package/dist/gaussian-splat-lite.cjs +3039 -0
- package/dist/gaussian-splat-lite.cjs.map +1 -0
- package/dist/gaussian-splat-lite.min.cjs +886 -0
- package/dist/gaussian-splat-lite.min.cjs.map +1 -0
- package/dist/gaussian-splat-lite.module.js +3023 -0
- package/dist/gaussian-splat-lite.module.js.map +1 -0
- package/dist/gaussian-splat-lite.module.min.js +2840 -0
- package/dist/gaussian-splat-lite.module.min.js.map +1 -0
- package/dist/types/GaussianSplatRenderer.d.cts +385 -0
- package/dist/types/GaussianSplatRenderer.d.ts +385 -0
- package/dist/types/SplatAccumulator.d.cts +72 -0
- package/dist/types/SplatAccumulator.d.ts +72 -0
- package/dist/types/SplatEdit.d.cts +86 -0
- package/dist/types/SplatEdit.d.ts +86 -0
- package/dist/types/SplatGeometry.d.cts +4 -0
- package/dist/types/SplatGeometry.d.ts +4 -0
- package/dist/types/SplatLoader.d.cts +31 -0
- package/dist/types/SplatLoader.d.ts +31 -0
- package/dist/types/SplatMesh.d.cts +74 -0
- package/dist/types/SplatMesh.d.ts +74 -0
- package/dist/types/SplatSource.d.cts +23 -0
- package/dist/types/SplatSource.d.ts +23 -0
- package/dist/types/SplatWorker.d.cts +30 -0
- package/dist/types/SplatWorker.d.ts +30 -0
- package/dist/types/Splats.d.cts +54 -0
- package/dist/types/Splats.d.ts +54 -0
- package/dist/types/cameraRelative.d.cts +22 -0
- package/dist/types/cameraRelative.d.ts +22 -0
- package/dist/types/defines.d.cts +22 -0
- package/dist/types/defines.d.ts +22 -0
- package/dist/types/index.d.cts +12 -0
- package/dist/types/index.d.mts +1 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/shaders.d.cts +1 -0
- package/dist/types/shaders.d.ts +1 -0
- package/dist/types/splatTransform.d.cts +10 -0
- package/dist/types/splatTransform.d.ts +10 -0
- package/dist/types/utils.d.cts +33 -0
- package/dist/types/utils.d.ts +33 -0
- package/dist/types/wasm.d.cts +2 -0
- package/dist/types/wasm.d.ts +2 -0
- package/dist/types/worker.d.cts +42 -0
- package/dist/types/worker.d.ts +42 -0
- package/docs/GaussianSplatRenderer.md +107 -0
- package/docs/SplatAccumulator.md +44 -0
- package/docs/SplatEdit.md +84 -0
- package/docs/SplatFileType.md +30 -0
- package/docs/SplatLoader.md +28 -0
- package/docs/SplatMesh.md +80 -0
- package/docs/SplatSource.md +26 -0
- package/docs/Splats.md +58 -0
- package/package.json +109 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Loader } from 'three';
|
|
2
|
+
import { SplatMesh } from './SplatMesh.cjs';
|
|
3
|
+
import { Splats } from './Splats.cjs';
|
|
4
|
+
import { SplatFileType } from './defines.cjs';
|
|
5
|
+
export declare class SplatLoader extends Loader {
|
|
6
|
+
load(url: string, onLoad?: (decoded: Splats) => void, onProgress?: (event: ProgressEvent) => void, onError?: (error: unknown) => void): void;
|
|
7
|
+
loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<Splats>;
|
|
8
|
+
parse(splats: Splats): SplatMesh;
|
|
9
|
+
loadInternal({ splats, url, fileBytes, fileType, fileName, stream, streamLength, onLoad, onProgress, onError, }: {
|
|
10
|
+
splats?: Splats;
|
|
11
|
+
url?: string;
|
|
12
|
+
fileBytes?: Uint8Array | ArrayBuffer;
|
|
13
|
+
fileType?: SplatFileType;
|
|
14
|
+
fileName?: string;
|
|
15
|
+
stream?: ReadableStream;
|
|
16
|
+
streamLength?: number;
|
|
17
|
+
onLoad?: (decoded: Splats) => void;
|
|
18
|
+
onProgress?: (event: ProgressEvent) => void;
|
|
19
|
+
onError?: (error: unknown) => void;
|
|
20
|
+
}): void;
|
|
21
|
+
loadInternalAsync({ splats, url, fileBytes, fileType, fileName, stream, streamLength, onProgress, }: {
|
|
22
|
+
splats?: Splats;
|
|
23
|
+
url?: string;
|
|
24
|
+
fileBytes?: Uint8Array | ArrayBuffer;
|
|
25
|
+
fileType?: SplatFileType;
|
|
26
|
+
fileName?: string;
|
|
27
|
+
stream?: ReadableStream;
|
|
28
|
+
streamLength?: number;
|
|
29
|
+
onProgress?: (event: ProgressEvent) => void;
|
|
30
|
+
}): Promise<Splats>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Loader } from 'three';
|
|
2
|
+
import { SplatMesh } from './SplatMesh';
|
|
3
|
+
import { Splats } from './Splats';
|
|
4
|
+
import { SplatFileType } from './defines';
|
|
5
|
+
export declare class SplatLoader extends Loader {
|
|
6
|
+
load(url: string, onLoad?: (decoded: Splats) => void, onProgress?: (event: ProgressEvent) => void, onError?: (error: unknown) => void): void;
|
|
7
|
+
loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<Splats>;
|
|
8
|
+
parse(splats: Splats): SplatMesh;
|
|
9
|
+
loadInternal({ splats, url, fileBytes, fileType, fileName, stream, streamLength, onLoad, onProgress, onError, }: {
|
|
10
|
+
splats?: Splats;
|
|
11
|
+
url?: string;
|
|
12
|
+
fileBytes?: Uint8Array | ArrayBuffer;
|
|
13
|
+
fileType?: SplatFileType;
|
|
14
|
+
fileName?: string;
|
|
15
|
+
stream?: ReadableStream;
|
|
16
|
+
streamLength?: number;
|
|
17
|
+
onLoad?: (decoded: Splats) => void;
|
|
18
|
+
onProgress?: (event: ProgressEvent) => void;
|
|
19
|
+
onError?: (error: unknown) => void;
|
|
20
|
+
}): void;
|
|
21
|
+
loadInternalAsync({ splats, url, fileBytes, fileType, fileName, stream, streamLength, onProgress, }: {
|
|
22
|
+
splats?: Splats;
|
|
23
|
+
url?: string;
|
|
24
|
+
fileBytes?: Uint8Array | ArrayBuffer;
|
|
25
|
+
fileType?: SplatFileType;
|
|
26
|
+
fileName?: string;
|
|
27
|
+
stream?: ReadableStream;
|
|
28
|
+
streamLength?: number;
|
|
29
|
+
onProgress?: (event: ProgressEvent) => void;
|
|
30
|
+
}): Promise<Splats>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { SplatEdit, SplatEdits } from './SplatEdit.cjs';
|
|
2
|
+
import { SplatSource } from './SplatSource.cjs';
|
|
3
|
+
import { Splats } from './Splats.cjs';
|
|
4
|
+
import { SplatFileType } from './defines.cjs';
|
|
5
|
+
import * as THREE from "three";
|
|
6
|
+
export type { SplatSource } from './SplatSource.cjs';
|
|
7
|
+
export type SplatMeshOptions = {
|
|
8
|
+
url?: string;
|
|
9
|
+
fileBytes?: Uint8Array | ArrayBuffer;
|
|
10
|
+
fileType?: SplatFileType;
|
|
11
|
+
fileName?: string;
|
|
12
|
+
stream?: ReadableStream;
|
|
13
|
+
streamLength?: number;
|
|
14
|
+
splats?: SplatSource;
|
|
15
|
+
maxSplats?: number;
|
|
16
|
+
constructSplats?: (splats: Splats) => Promise<void> | void;
|
|
17
|
+
onProgress?: (event: ProgressEvent) => void;
|
|
18
|
+
onLoad?: (mesh: SplatMesh) => Promise<void> | void;
|
|
19
|
+
editable?: boolean;
|
|
20
|
+
raycastable?: boolean;
|
|
21
|
+
minRaycastOpacity?: number;
|
|
22
|
+
onFrame?: (context: {
|
|
23
|
+
mesh: SplatMesh;
|
|
24
|
+
time: number;
|
|
25
|
+
deltaTime: number;
|
|
26
|
+
}) => void;
|
|
27
|
+
};
|
|
28
|
+
export type SplatMeshFrameContext = {
|
|
29
|
+
time: number;
|
|
30
|
+
deltaTime: number;
|
|
31
|
+
camera: THREE.Camera;
|
|
32
|
+
globalEdits: SplatEdit[];
|
|
33
|
+
};
|
|
34
|
+
/** A scene object backed by a fixed encoded splat source and RGBA SDF edits. */
|
|
35
|
+
export declare class SplatMesh extends THREE.Object3D {
|
|
36
|
+
initialized: Promise<SplatMesh>;
|
|
37
|
+
isInitialized: boolean;
|
|
38
|
+
splats?: SplatSource;
|
|
39
|
+
numSplats: number;
|
|
40
|
+
recolor: THREE.Color;
|
|
41
|
+
opacity: number;
|
|
42
|
+
maxSh: number;
|
|
43
|
+
edits: SplatEdit[] | null;
|
|
44
|
+
editable: boolean;
|
|
45
|
+
raycastable: boolean;
|
|
46
|
+
minRaycastOpacity: number;
|
|
47
|
+
sdfEdits: SplatEdits | null;
|
|
48
|
+
onFrame?: SplatMeshOptions["onFrame"];
|
|
49
|
+
version: number;
|
|
50
|
+
sortVersion: number;
|
|
51
|
+
mappingVersion: number;
|
|
52
|
+
private lastSource?;
|
|
53
|
+
private lastNumSplats;
|
|
54
|
+
private lastMaxSh;
|
|
55
|
+
private lastMatrixWorld;
|
|
56
|
+
private hasLastMatrixWorld;
|
|
57
|
+
private lastRecolor;
|
|
58
|
+
private viewOrigin;
|
|
59
|
+
private lastViewOrigin;
|
|
60
|
+
private sdfCoordinateOrigin;
|
|
61
|
+
constructor(options?: SplatMeshOptions);
|
|
62
|
+
private asyncInitialize;
|
|
63
|
+
pushSplat(center: THREE.Vector3, scales: THREE.Vector3, quaternion: THREE.Quaternion, opacity: number, color: THREE.Color): void;
|
|
64
|
+
forEachSplat(callback: (index: number, center: THREE.Vector3, scales: THREE.Vector3, quaternion: THREE.Quaternion, opacity: number, color: THREE.Color) => void): void;
|
|
65
|
+
dispose(): void;
|
|
66
|
+
getBoundingBox(centersOnly?: boolean): THREE.Box3;
|
|
67
|
+
frameUpdate({ time, deltaTime, camera, globalEdits }: SplatMeshFrameContext): void;
|
|
68
|
+
updateVersion({ sort }?: {
|
|
69
|
+
sort?: boolean;
|
|
70
|
+
}): void;
|
|
71
|
+
updateMappingVersion(): void;
|
|
72
|
+
set needsUpdate(value: boolean);
|
|
73
|
+
raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection[]): void;
|
|
74
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { SplatEdit, SplatEdits } from './SplatEdit';
|
|
2
|
+
import { SplatSource } from './SplatSource';
|
|
3
|
+
import { Splats } from './Splats';
|
|
4
|
+
import { SplatFileType } from './defines';
|
|
5
|
+
import * as THREE from "three";
|
|
6
|
+
export type { SplatSource } from './SplatSource';
|
|
7
|
+
export type SplatMeshOptions = {
|
|
8
|
+
url?: string;
|
|
9
|
+
fileBytes?: Uint8Array | ArrayBuffer;
|
|
10
|
+
fileType?: SplatFileType;
|
|
11
|
+
fileName?: string;
|
|
12
|
+
stream?: ReadableStream;
|
|
13
|
+
streamLength?: number;
|
|
14
|
+
splats?: SplatSource;
|
|
15
|
+
maxSplats?: number;
|
|
16
|
+
constructSplats?: (splats: Splats) => Promise<void> | void;
|
|
17
|
+
onProgress?: (event: ProgressEvent) => void;
|
|
18
|
+
onLoad?: (mesh: SplatMesh) => Promise<void> | void;
|
|
19
|
+
editable?: boolean;
|
|
20
|
+
raycastable?: boolean;
|
|
21
|
+
minRaycastOpacity?: number;
|
|
22
|
+
onFrame?: (context: {
|
|
23
|
+
mesh: SplatMesh;
|
|
24
|
+
time: number;
|
|
25
|
+
deltaTime: number;
|
|
26
|
+
}) => void;
|
|
27
|
+
};
|
|
28
|
+
export type SplatMeshFrameContext = {
|
|
29
|
+
time: number;
|
|
30
|
+
deltaTime: number;
|
|
31
|
+
camera: THREE.Camera;
|
|
32
|
+
globalEdits: SplatEdit[];
|
|
33
|
+
};
|
|
34
|
+
/** A scene object backed by a fixed encoded splat source and RGBA SDF edits. */
|
|
35
|
+
export declare class SplatMesh extends THREE.Object3D {
|
|
36
|
+
initialized: Promise<SplatMesh>;
|
|
37
|
+
isInitialized: boolean;
|
|
38
|
+
splats?: SplatSource;
|
|
39
|
+
numSplats: number;
|
|
40
|
+
recolor: THREE.Color;
|
|
41
|
+
opacity: number;
|
|
42
|
+
maxSh: number;
|
|
43
|
+
edits: SplatEdit[] | null;
|
|
44
|
+
editable: boolean;
|
|
45
|
+
raycastable: boolean;
|
|
46
|
+
minRaycastOpacity: number;
|
|
47
|
+
sdfEdits: SplatEdits | null;
|
|
48
|
+
onFrame?: SplatMeshOptions["onFrame"];
|
|
49
|
+
version: number;
|
|
50
|
+
sortVersion: number;
|
|
51
|
+
mappingVersion: number;
|
|
52
|
+
private lastSource?;
|
|
53
|
+
private lastNumSplats;
|
|
54
|
+
private lastMaxSh;
|
|
55
|
+
private lastMatrixWorld;
|
|
56
|
+
private hasLastMatrixWorld;
|
|
57
|
+
private lastRecolor;
|
|
58
|
+
private viewOrigin;
|
|
59
|
+
private lastViewOrigin;
|
|
60
|
+
private sdfCoordinateOrigin;
|
|
61
|
+
constructor(options?: SplatMeshOptions);
|
|
62
|
+
private asyncInitialize;
|
|
63
|
+
pushSplat(center: THREE.Vector3, scales: THREE.Vector3, quaternion: THREE.Quaternion, opacity: number, color: THREE.Color): void;
|
|
64
|
+
forEachSplat(callback: (index: number, center: THREE.Vector3, scales: THREE.Vector3, quaternion: THREE.Quaternion, opacity: number, color: THREE.Color) => void): void;
|
|
65
|
+
dispose(): void;
|
|
66
|
+
getBoundingBox(centersOnly?: boolean): THREE.Box3;
|
|
67
|
+
frameUpdate({ time, deltaTime, camera, globalEdits }: SplatMeshFrameContext): void;
|
|
68
|
+
updateVersion({ sort }?: {
|
|
69
|
+
sort?: boolean;
|
|
70
|
+
}): void;
|
|
71
|
+
updateMappingVersion(): void;
|
|
72
|
+
set needsUpdate(value: boolean);
|
|
73
|
+
raycast(raycaster: THREE.Raycaster, intersects: THREE.Intersection[]): void;
|
|
74
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type * as THREE from "three";
|
|
2
|
+
export type SplatShTextures = {
|
|
3
|
+
sh1?: THREE.DataArrayTexture;
|
|
4
|
+
sh2?: THREE.DataArrayTexture;
|
|
5
|
+
sh3a?: THREE.DataArrayTexture;
|
|
6
|
+
sh3b?: THREE.DataArrayTexture;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* GPU and CPU access required by the fixed splat generation pipeline.
|
|
10
|
+
*
|
|
11
|
+
* Sources provide encoded texture data; shader construction and arbitrary
|
|
12
|
+
* per-splat modifiers are deliberately not part of this interface.
|
|
13
|
+
*/
|
|
14
|
+
export interface SplatSource {
|
|
15
|
+
needsUpdate: boolean;
|
|
16
|
+
dispose(): void;
|
|
17
|
+
getNumSplats(): number;
|
|
18
|
+
getNumSh(): number;
|
|
19
|
+
getSplatTextures(): readonly [THREE.DataArrayTexture, THREE.DataArrayTexture];
|
|
20
|
+
getShTextures(): SplatShTextures;
|
|
21
|
+
forEachCenter(callback: (index: number, x: number, y: number, z: number) => void): void;
|
|
22
|
+
forEachSplat(callback: (index: number, center: THREE.Vector3, scales: THREE.Vector3, quaternion: THREE.Quaternion, opacity: number, color: THREE.Color) => void): void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type * as THREE from "three";
|
|
2
|
+
export type SplatShTextures = {
|
|
3
|
+
sh1?: THREE.DataArrayTexture;
|
|
4
|
+
sh2?: THREE.DataArrayTexture;
|
|
5
|
+
sh3a?: THREE.DataArrayTexture;
|
|
6
|
+
sh3b?: THREE.DataArrayTexture;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* GPU and CPU access required by the fixed splat generation pipeline.
|
|
10
|
+
*
|
|
11
|
+
* Sources provide encoded texture data; shader construction and arbitrary
|
|
12
|
+
* per-splat modifiers are deliberately not part of this interface.
|
|
13
|
+
*/
|
|
14
|
+
export interface SplatSource {
|
|
15
|
+
needsUpdate: boolean;
|
|
16
|
+
dispose(): void;
|
|
17
|
+
getNumSplats(): number;
|
|
18
|
+
getNumSh(): number;
|
|
19
|
+
getSplatTextures(): readonly [THREE.DataArrayTexture, THREE.DataArrayTexture];
|
|
20
|
+
getShTextures(): SplatShTextures;
|
|
21
|
+
forEachCenter(callback: (index: number, x: number, y: number, z: number) => void): void;
|
|
22
|
+
forEachSplat(callback: (index: number, center: THREE.Vector3, scales: THREE.Vector3, quaternion: THREE.Quaternion, opacity: number, color: THREE.Color) => void): void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { RpcHandlers } from './worker.cjs';
|
|
2
|
+
type PromiseRecord = {
|
|
3
|
+
resolve: (value: unknown) => void;
|
|
4
|
+
reject: (reason?: unknown) => void;
|
|
5
|
+
onStatus?: (data: unknown) => void | Promise<void>;
|
|
6
|
+
statusQueue: Promise<void>;
|
|
7
|
+
};
|
|
8
|
+
export declare class SplatWorker {
|
|
9
|
+
worker: Worker;
|
|
10
|
+
messages: Record<number, PromiseRecord>;
|
|
11
|
+
static currentId: number;
|
|
12
|
+
constructor();
|
|
13
|
+
onMessage(event: MessageEvent): void;
|
|
14
|
+
call<Name extends keyof RpcHandlers>(name: Name, args: Parameters<RpcHandlers[Name]>[0], options?: {
|
|
15
|
+
onStatus?: (data: unknown) => void | Promise<void>;
|
|
16
|
+
}): Promise<Awaited<ReturnType<RpcHandlers[Name]>>>;
|
|
17
|
+
dispose(): void;
|
|
18
|
+
}
|
|
19
|
+
declare class SplatWorkerPool {
|
|
20
|
+
maxWorkers: number;
|
|
21
|
+
numWorkers: number;
|
|
22
|
+
freelist: SplatWorker[];
|
|
23
|
+
queue: ((worker: SplatWorker) => void)[];
|
|
24
|
+
constructor(maxWorkers?: number);
|
|
25
|
+
withWorker<T>(callback: (worker: SplatWorker) => Promise<T>): Promise<T>;
|
|
26
|
+
allocWorker(): Promise<SplatWorker>;
|
|
27
|
+
freeWorker(worker: SplatWorker): void;
|
|
28
|
+
}
|
|
29
|
+
export declare const workerPool: SplatWorkerPool;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { RpcHandlers } from './worker';
|
|
2
|
+
type PromiseRecord = {
|
|
3
|
+
resolve: (value: unknown) => void;
|
|
4
|
+
reject: (reason?: unknown) => void;
|
|
5
|
+
onStatus?: (data: unknown) => void | Promise<void>;
|
|
6
|
+
statusQueue: Promise<void>;
|
|
7
|
+
};
|
|
8
|
+
export declare class SplatWorker {
|
|
9
|
+
worker: Worker;
|
|
10
|
+
messages: Record<number, PromiseRecord>;
|
|
11
|
+
static currentId: number;
|
|
12
|
+
constructor();
|
|
13
|
+
onMessage(event: MessageEvent): void;
|
|
14
|
+
call<Name extends keyof RpcHandlers>(name: Name, args: Parameters<RpcHandlers[Name]>[0], options?: {
|
|
15
|
+
onStatus?: (data: unknown) => void | Promise<void>;
|
|
16
|
+
}): Promise<Awaited<ReturnType<RpcHandlers[Name]>>>;
|
|
17
|
+
dispose(): void;
|
|
18
|
+
}
|
|
19
|
+
declare class SplatWorkerPool {
|
|
20
|
+
maxWorkers: number;
|
|
21
|
+
numWorkers: number;
|
|
22
|
+
freelist: SplatWorker[];
|
|
23
|
+
queue: ((worker: SplatWorker) => void)[];
|
|
24
|
+
constructor(maxWorkers?: number);
|
|
25
|
+
withWorker<T>(callback: (worker: SplatWorker) => Promise<T>): Promise<T>;
|
|
26
|
+
allocWorker(): Promise<SplatWorker>;
|
|
27
|
+
freeWorker(worker: SplatWorker): void;
|
|
28
|
+
}
|
|
29
|
+
export declare const workerPool: SplatWorkerPool;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { SplatShTextures, SplatSource } from './SplatSource.cjs';
|
|
2
|
+
import { SplatFileType } from './defines.cjs';
|
|
3
|
+
import * as THREE from "three";
|
|
4
|
+
export type SplatsOptions = {
|
|
5
|
+
url?: string;
|
|
6
|
+
fileBytes?: Uint8Array | ArrayBuffer;
|
|
7
|
+
fileType?: SplatFileType;
|
|
8
|
+
fileName?: string;
|
|
9
|
+
stream?: ReadableStream;
|
|
10
|
+
streamLength?: number;
|
|
11
|
+
maxSplats?: number;
|
|
12
|
+
splatArrays?: [Uint32Array, Uint32Array];
|
|
13
|
+
numSplats?: number;
|
|
14
|
+
construct?: (splats: Splats) => Promise<void> | void;
|
|
15
|
+
onProgress?: (event: ProgressEvent) => void;
|
|
16
|
+
extra?: Record<string, unknown>;
|
|
17
|
+
};
|
|
18
|
+
/** A mutable splat source with two 16-byte texture records per splat. */
|
|
19
|
+
export declare class Splats implements SplatSource {
|
|
20
|
+
maxSplats: number;
|
|
21
|
+
numSplats: number;
|
|
22
|
+
splatArrays: [Uint32Array, Uint32Array];
|
|
23
|
+
extra: Record<string, unknown>;
|
|
24
|
+
initialized: Promise<Splats>;
|
|
25
|
+
isInitialized: boolean;
|
|
26
|
+
needsUpdate: boolean;
|
|
27
|
+
private textures;
|
|
28
|
+
private shTextures;
|
|
29
|
+
constructor(options?: SplatsOptions);
|
|
30
|
+
reinitialize(options: SplatsOptions): void;
|
|
31
|
+
initialize(options: SplatsOptions): void;
|
|
32
|
+
private asyncInitialize;
|
|
33
|
+
dispose(): void;
|
|
34
|
+
private disposeTextures;
|
|
35
|
+
getNumSplats(): number;
|
|
36
|
+
getNumSh(): 0 | 1 | 2 | 3;
|
|
37
|
+
ensureSplats(numSplats: number): [Uint32Array, Uint32Array];
|
|
38
|
+
getSplat(index: number): {
|
|
39
|
+
center: THREE.Vector3;
|
|
40
|
+
scales: THREE.Vector3;
|
|
41
|
+
quaternion: THREE.Quaternion;
|
|
42
|
+
color: THREE.Color;
|
|
43
|
+
opacity: number;
|
|
44
|
+
};
|
|
45
|
+
setSplat(index: number, center: THREE.Vector3, scales: THREE.Vector3, quaternion: THREE.Quaternion, opacity: number, color: THREE.Color): void;
|
|
46
|
+
pushSplat(center: THREE.Vector3, scales: THREE.Vector3, quaternion: THREE.Quaternion, opacity: number, color: THREE.Color): void;
|
|
47
|
+
forEachCenter(callback: (index: number, x: number, y: number, z: number) => void): void;
|
|
48
|
+
forEachSplat(callback: (index: number, center: THREE.Vector3, scales: THREE.Vector3, quaternion: THREE.Quaternion, opacity: number, color: THREE.Color) => void): void;
|
|
49
|
+
getSplatTextures(): readonly [THREE.DataArrayTexture, THREE.DataArrayTexture];
|
|
50
|
+
private disposeMainTextures;
|
|
51
|
+
getShTextures(): SplatShTextures;
|
|
52
|
+
private ensureShTexture;
|
|
53
|
+
static emptyTexture: THREE.DataArrayTexture;
|
|
54
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { SplatShTextures, SplatSource } from './SplatSource';
|
|
2
|
+
import { SplatFileType } from './defines';
|
|
3
|
+
import * as THREE from "three";
|
|
4
|
+
export type SplatsOptions = {
|
|
5
|
+
url?: string;
|
|
6
|
+
fileBytes?: Uint8Array | ArrayBuffer;
|
|
7
|
+
fileType?: SplatFileType;
|
|
8
|
+
fileName?: string;
|
|
9
|
+
stream?: ReadableStream;
|
|
10
|
+
streamLength?: number;
|
|
11
|
+
maxSplats?: number;
|
|
12
|
+
splatArrays?: [Uint32Array, Uint32Array];
|
|
13
|
+
numSplats?: number;
|
|
14
|
+
construct?: (splats: Splats) => Promise<void> | void;
|
|
15
|
+
onProgress?: (event: ProgressEvent) => void;
|
|
16
|
+
extra?: Record<string, unknown>;
|
|
17
|
+
};
|
|
18
|
+
/** A mutable splat source with two 16-byte texture records per splat. */
|
|
19
|
+
export declare class Splats implements SplatSource {
|
|
20
|
+
maxSplats: number;
|
|
21
|
+
numSplats: number;
|
|
22
|
+
splatArrays: [Uint32Array, Uint32Array];
|
|
23
|
+
extra: Record<string, unknown>;
|
|
24
|
+
initialized: Promise<Splats>;
|
|
25
|
+
isInitialized: boolean;
|
|
26
|
+
needsUpdate: boolean;
|
|
27
|
+
private textures;
|
|
28
|
+
private shTextures;
|
|
29
|
+
constructor(options?: SplatsOptions);
|
|
30
|
+
reinitialize(options: SplatsOptions): void;
|
|
31
|
+
initialize(options: SplatsOptions): void;
|
|
32
|
+
private asyncInitialize;
|
|
33
|
+
dispose(): void;
|
|
34
|
+
private disposeTextures;
|
|
35
|
+
getNumSplats(): number;
|
|
36
|
+
getNumSh(): 0 | 1 | 2 | 3;
|
|
37
|
+
ensureSplats(numSplats: number): [Uint32Array, Uint32Array];
|
|
38
|
+
getSplat(index: number): {
|
|
39
|
+
center: THREE.Vector3;
|
|
40
|
+
scales: THREE.Vector3;
|
|
41
|
+
quaternion: THREE.Quaternion;
|
|
42
|
+
color: THREE.Color;
|
|
43
|
+
opacity: number;
|
|
44
|
+
};
|
|
45
|
+
setSplat(index: number, center: THREE.Vector3, scales: THREE.Vector3, quaternion: THREE.Quaternion, opacity: number, color: THREE.Color): void;
|
|
46
|
+
pushSplat(center: THREE.Vector3, scales: THREE.Vector3, quaternion: THREE.Quaternion, opacity: number, color: THREE.Color): void;
|
|
47
|
+
forEachCenter(callback: (index: number, x: number, y: number, z: number) => void): void;
|
|
48
|
+
forEachSplat(callback: (index: number, center: THREE.Vector3, scales: THREE.Vector3, quaternion: THREE.Quaternion, opacity: number, color: THREE.Color) => void): void;
|
|
49
|
+
getSplatTextures(): readonly [THREE.DataArrayTexture, THREE.DataArrayTexture];
|
|
50
|
+
private disposeMainTextures;
|
|
51
|
+
getShTextures(): SplatShTextures;
|
|
52
|
+
private ensureShTexture;
|
|
53
|
+
static emptyTexture: THREE.DataArrayTexture;
|
|
54
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SplatAccumulator } from './SplatAccumulator.cjs';
|
|
2
|
+
import * as THREE from "three";
|
|
3
|
+
/**
|
|
4
|
+
* Re-expresses an affine transform so it consumes positions relative to
|
|
5
|
+
* `origin` instead of absolute world positions.
|
|
6
|
+
*
|
|
7
|
+
* If `matrix` maps p to A * p + t, the rebased matrix maps (p - origin) to
|
|
8
|
+
* A * (p - origin) + (A * origin + t), which is the same result without doing
|
|
9
|
+
* a large-coordinate subtraction in float32 shader code.
|
|
10
|
+
*/
|
|
11
|
+
export declare function rebaseAffineTransform(matrix: THREE.Matrix4, origin: THREE.Vector3): THREE.Matrix4;
|
|
12
|
+
/**
|
|
13
|
+
* Builds persistent sort centers relative to each mesh origin. Keeping the
|
|
14
|
+
* Float64 world origin separate lets the worker form a fresh camera-to-mesh
|
|
15
|
+
* offset for every sort without rebuilding the per-splat Float32 data.
|
|
16
|
+
*/
|
|
17
|
+
export declare function buildSortCenters(current: SplatAccumulator): {
|
|
18
|
+
centers: Float32Array<ArrayBuffer>;
|
|
19
|
+
rangeBases: Uint32Array<ArrayBuffer>;
|
|
20
|
+
rangeCounts: Uint32Array<ArrayBuffer>;
|
|
21
|
+
rangeOrigins: Float64Array<ArrayBuffer>;
|
|
22
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SplatAccumulator } from './SplatAccumulator';
|
|
2
|
+
import * as THREE from "three";
|
|
3
|
+
/**
|
|
4
|
+
* Re-expresses an affine transform so it consumes positions relative to
|
|
5
|
+
* `origin` instead of absolute world positions.
|
|
6
|
+
*
|
|
7
|
+
* If `matrix` maps p to A * p + t, the rebased matrix maps (p - origin) to
|
|
8
|
+
* A * (p - origin) + (A * origin + t), which is the same result without doing
|
|
9
|
+
* a large-coordinate subtraction in float32 shader code.
|
|
10
|
+
*/
|
|
11
|
+
export declare function rebaseAffineTransform(matrix: THREE.Matrix4, origin: THREE.Vector3): THREE.Matrix4;
|
|
12
|
+
/**
|
|
13
|
+
* Builds persistent sort centers relative to each mesh origin. Keeping the
|
|
14
|
+
* Float64 world origin separate lets the worker form a fresh camera-to-mesh
|
|
15
|
+
* offset for every sort without rebuilding the per-splat Float32 data.
|
|
16
|
+
*/
|
|
17
|
+
export declare function buildSortCenters(current: SplatAccumulator): {
|
|
18
|
+
centers: Float32Array<ArrayBuffer>;
|
|
19
|
+
rangeBases: Uint32Array<ArrayBuffer>;
|
|
20
|
+
rangeCounts: Uint32Array<ArrayBuffer>;
|
|
21
|
+
rangeOrigins: Float64Array<ArrayBuffer>;
|
|
22
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const LN_SCALE_MIN = -12;
|
|
2
|
+
export declare const LN_SCALE_MAX = 9;
|
|
3
|
+
export declare const SPLAT_TEX_WIDTH_BITS = 11;
|
|
4
|
+
export declare const SPLAT_TEX_HEIGHT_BITS = 11;
|
|
5
|
+
export declare const SPLAT_TEX_WIDTH: number;
|
|
6
|
+
export declare const SPLAT_TEX_HEIGHT: number;
|
|
7
|
+
export declare const SPLAT_TEX_MIN_HEIGHT = 1;
|
|
8
|
+
export declare enum SplatFileType {
|
|
9
|
+
PLY = "ply",
|
|
10
|
+
SPZ = "spz"
|
|
11
|
+
}
|
|
12
|
+
export type SplatExtra = {
|
|
13
|
+
sh1?: Uint32Array;
|
|
14
|
+
sh2?: Uint32Array;
|
|
15
|
+
sh3a?: Uint32Array;
|
|
16
|
+
sh3b?: Uint32Array;
|
|
17
|
+
};
|
|
18
|
+
export type SplatResult = {
|
|
19
|
+
numSplats: number;
|
|
20
|
+
splatArrays: [Uint32Array, Uint32Array];
|
|
21
|
+
extra: SplatExtra;
|
|
22
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const LN_SCALE_MIN = -12;
|
|
2
|
+
export declare const LN_SCALE_MAX = 9;
|
|
3
|
+
export declare const SPLAT_TEX_WIDTH_BITS = 11;
|
|
4
|
+
export declare const SPLAT_TEX_HEIGHT_BITS = 11;
|
|
5
|
+
export declare const SPLAT_TEX_WIDTH: number;
|
|
6
|
+
export declare const SPLAT_TEX_HEIGHT: number;
|
|
7
|
+
export declare const SPLAT_TEX_MIN_HEIGHT = 1;
|
|
8
|
+
export declare enum SplatFileType {
|
|
9
|
+
PLY = "ply",
|
|
10
|
+
SPZ = "spz"
|
|
11
|
+
}
|
|
12
|
+
export type SplatExtra = {
|
|
13
|
+
sh1?: Uint32Array;
|
|
14
|
+
sh2?: Uint32Array;
|
|
15
|
+
sh3a?: Uint32Array;
|
|
16
|
+
sh3b?: Uint32Array;
|
|
17
|
+
};
|
|
18
|
+
export type SplatResult = {
|
|
19
|
+
numSplats: number;
|
|
20
|
+
splatArrays: [Uint32Array, Uint32Array];
|
|
21
|
+
extra: SplatExtra;
|
|
22
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { GaussianSplatRenderer, type GaussianSplatRendererOptions, } from './GaussianSplatRenderer.cjs';
|
|
2
|
+
export { SplatAccumulator, type SplatMapping, } from './SplatAccumulator.cjs';
|
|
3
|
+
export { SplatLoader } from './SplatLoader.cjs';
|
|
4
|
+
export type { SplatWorker } from './SplatWorker.cjs';
|
|
5
|
+
export { Splats, type SplatsOptions } from './Splats.cjs';
|
|
6
|
+
export { SplatMesh, type SplatMeshFrameContext, type SplatMeshOptions, } from './SplatMesh.cjs';
|
|
7
|
+
export type { SplatSource, SplatShTextures, } from './SplatSource.cjs';
|
|
8
|
+
export { SplatEdit, type SplatEditGroup, type SplatEditOptions, SplatEditSdf, type SplatEditSdfOptions, SplatEditSdfType, SplatEditRgbaBlendMode, SplatEdits, } from './SplatEdit.cjs';
|
|
9
|
+
export { toHalf, fromHalf, } from './utils.cjs';
|
|
10
|
+
export * as utils from './utils.cjs';
|
|
11
|
+
export { LN_SCALE_MIN, LN_SCALE_MAX, SplatFileType } from './defines.cjs';
|
|
12
|
+
export * as defines from './defines.cjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./index.cjs";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { GaussianSplatRenderer, type GaussianSplatRendererOptions, } from './GaussianSplatRenderer';
|
|
2
|
+
export { SplatAccumulator, type SplatMapping, } from './SplatAccumulator';
|
|
3
|
+
export { SplatLoader } from './SplatLoader';
|
|
4
|
+
export type { SplatWorker } from './SplatWorker';
|
|
5
|
+
export { Splats, type SplatsOptions } from './Splats';
|
|
6
|
+
export { SplatMesh, type SplatMeshFrameContext, type SplatMeshOptions, } from './SplatMesh';
|
|
7
|
+
export type { SplatSource, SplatShTextures, } from './SplatSource';
|
|
8
|
+
export { SplatEdit, type SplatEditGroup, type SplatEditOptions, SplatEditSdf, type SplatEditSdfOptions, SplatEditSdfType, SplatEditRgbaBlendMode, SplatEdits, } from './SplatEdit';
|
|
9
|
+
export { toHalf, fromHalf, } from './utils';
|
|
10
|
+
export * as utils from './utils';
|
|
11
|
+
export { LN_SCALE_MIN, LN_SCALE_MAX, SplatFileType } from './defines';
|
|
12
|
+
export * as defines from './defines';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getShaders(): Record<string, string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getShaders(): Record<string, string>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
/**
|
|
3
|
+
* Extracts the positive per-axis scale and approximate rotation used by the
|
|
4
|
+
* PlayCanvas-style splat work-buffer transform.
|
|
5
|
+
*
|
|
6
|
+
* Unlike Matrix4.decompose(), this remains finite when a model scale axis is
|
|
7
|
+
* zero. When possible, the missing basis axis is reconstructed from the other
|
|
8
|
+
* two so a model-level collapse can still produce a correctly oriented 2DGS.
|
|
9
|
+
*/
|
|
10
|
+
export declare function decomposeSplatTransform(matrix: THREE.Matrix4, scale: THREE.Vector3, rotation: THREE.Quaternion): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
/**
|
|
3
|
+
* Extracts the positive per-axis scale and approximate rotation used by the
|
|
4
|
+
* PlayCanvas-style splat work-buffer transform.
|
|
5
|
+
*
|
|
6
|
+
* Unlike Matrix4.decompose(), this remains finite when a model scale axis is
|
|
7
|
+
* zero. When possible, the missing basis axis is reconstructed from the other
|
|
8
|
+
* two so a model-level collapse can still produce a correctly oriented 2DGS.
|
|
9
|
+
*/
|
|
10
|
+
export declare function decomposeSplatTransform(matrix: THREE.Matrix4, scale: THREE.Vector3, rotation: THREE.Quaternion): void;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
export declare const threeRevision: number;
|
|
3
|
+
export declare const threeMrtArray: boolean;
|
|
4
|
+
export declare function floatBitsToUint(f: number): number;
|
|
5
|
+
export declare function uintBitsToFloat(u: number): number;
|
|
6
|
+
export declare const toHalf: typeof toHalfNative;
|
|
7
|
+
export declare const fromHalf: typeof fromHalfNative;
|
|
8
|
+
declare function toHalfNative(f: number): number;
|
|
9
|
+
declare function fromHalfNative(u: number): number;
|
|
10
|
+
export declare function getTransferable(ctx: unknown): Transferable[];
|
|
11
|
+
export declare function encodeSplat(splatArrays: [Uint32Array, Uint32Array], index: number, x: number, y: number, z: number, scaleX: number, scaleY: number, scaleZ: number, quatX: number, quatY: number, quatZ: number, quatW: number, opacity: number, r: number, g: number, b: number): void;
|
|
12
|
+
export declare function decodeSplat(splatArrays: [Uint32Array, Uint32Array], index: number): {
|
|
13
|
+
center: THREE.Vector3;
|
|
14
|
+
scales: THREE.Vector3;
|
|
15
|
+
quaternion: THREE.Quaternion;
|
|
16
|
+
color: THREE.Color;
|
|
17
|
+
opacity: number;
|
|
18
|
+
};
|
|
19
|
+
export declare function getTextureSize(numSplats: number): {
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
depth: number;
|
|
23
|
+
maxSplats: number;
|
|
24
|
+
};
|
|
25
|
+
export declare const IDENT_VERTEX_SHADER = "\nprecision highp float;\n\nin vec3 position;\n\nvoid main() {\n gl_Position = vec4(position.xy, 0.0, 1.0);\n}\n";
|
|
26
|
+
export declare function encodeQuatOctXy1010R12(qx: number, qy: number, qz: number, qw: number): number;
|
|
27
|
+
export declare function decodeQuatOctXy1010R12(encoded: number, out: THREE.Quaternion): THREE.Quaternion;
|
|
28
|
+
export declare function uploadU32DataTextureRows(renderer: THREE.WebGLRenderer, texture: THREE.Texture, width: number, rows: number, data: Uint32Array): void;
|
|
29
|
+
export declare function resolveTimer(timer?: THREE.Timer): {
|
|
30
|
+
timer: THREE.Timer;
|
|
31
|
+
ownsTimer: boolean;
|
|
32
|
+
};
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
export declare const threeRevision: number;
|
|
3
|
+
export declare const threeMrtArray: boolean;
|
|
4
|
+
export declare function floatBitsToUint(f: number): number;
|
|
5
|
+
export declare function uintBitsToFloat(u: number): number;
|
|
6
|
+
export declare const toHalf: typeof toHalfNative;
|
|
7
|
+
export declare const fromHalf: typeof fromHalfNative;
|
|
8
|
+
declare function toHalfNative(f: number): number;
|
|
9
|
+
declare function fromHalfNative(u: number): number;
|
|
10
|
+
export declare function getTransferable(ctx: unknown): Transferable[];
|
|
11
|
+
export declare function encodeSplat(splatArrays: [Uint32Array, Uint32Array], index: number, x: number, y: number, z: number, scaleX: number, scaleY: number, scaleZ: number, quatX: number, quatY: number, quatZ: number, quatW: number, opacity: number, r: number, g: number, b: number): void;
|
|
12
|
+
export declare function decodeSplat(splatArrays: [Uint32Array, Uint32Array], index: number): {
|
|
13
|
+
center: THREE.Vector3;
|
|
14
|
+
scales: THREE.Vector3;
|
|
15
|
+
quaternion: THREE.Quaternion;
|
|
16
|
+
color: THREE.Color;
|
|
17
|
+
opacity: number;
|
|
18
|
+
};
|
|
19
|
+
export declare function getTextureSize(numSplats: number): {
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
depth: number;
|
|
23
|
+
maxSplats: number;
|
|
24
|
+
};
|
|
25
|
+
export declare const IDENT_VERTEX_SHADER = "\nprecision highp float;\n\nin vec3 position;\n\nvoid main() {\n gl_Position = vec4(position.xy, 0.0, 1.0);\n}\n";
|
|
26
|
+
export declare function encodeQuatOctXy1010R12(qx: number, qy: number, qz: number, qw: number): number;
|
|
27
|
+
export declare function decodeQuatOctXy1010R12(encoded: number, out: THREE.Quaternion): THREE.Quaternion;
|
|
28
|
+
export declare function uploadU32DataTextureRows(renderer: THREE.WebGLRenderer, texture: THREE.Texture, width: number, rows: number, data: Uint32Array): void;
|
|
29
|
+
export declare function resolveTimer(timer?: THREE.Timer): {
|
|
30
|
+
timer: THREE.Timer;
|
|
31
|
+
ownsTimer: boolean;
|
|
32
|
+
};
|
|
33
|
+
export {};
|