@speridlabs/visus 2.3.0 → 2.4.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/dist/main.d.ts +335 -347
- package/dist/main.es.js +1454 -838
- package/dist/main.umd.js +164 -195
- package/dist/react.d.ts +6 -2
- package/dist/react.es.js +1616 -989
- package/package.json +4 -1
package/dist/main.d.ts
CHANGED
|
@@ -1,347 +1,335 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Simplified bounding box class that tracks min/max points
|
|
5
|
-
*/
|
|
6
|
-
export declare class BoundingBox {
|
|
7
|
-
min: THREE.Vector3;
|
|
8
|
-
max: THREE.Vector3;
|
|
9
|
-
center: THREE.Vector3;
|
|
10
|
-
/** Half extents (size/2) */
|
|
11
|
-
halfExtents: THREE.Vector3;
|
|
12
|
-
/**
|
|
13
|
-
* Reset the bounding box to its initial state
|
|
14
|
-
*/
|
|
15
|
-
reset(): void;
|
|
16
|
-
/**
|
|
17
|
-
* Expand the bounding box to include the given point
|
|
18
|
-
* @param point Point to include in the bounding box
|
|
19
|
-
*/
|
|
20
|
-
expandByPoint(point: THREE.Vector3): void;
|
|
21
|
-
/**
|
|
22
|
-
* Expand this bounding box to include another bounding box
|
|
23
|
-
* @param box Bounding box to include
|
|
24
|
-
*/
|
|
25
|
-
expandByBox(box: BoundingBox): void;
|
|
26
|
-
/**
|
|
27
|
-
* Update the center and half extents based on min/max
|
|
28
|
-
*/
|
|
29
|
-
private updateDerived;
|
|
30
|
-
/**
|
|
31
|
-
* Check if this box contains a point
|
|
32
|
-
* @param point Point to check
|
|
33
|
-
* @returns True if the point is inside the box
|
|
34
|
-
*/
|
|
35
|
-
containsPoint(point: THREE.Vector3): boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Create a Three.js Box3 from this bounding box
|
|
38
|
-
* @returns THREE.Box3 representation
|
|
39
|
-
*/
|
|
40
|
-
toBox3(): THREE.Box3;
|
|
41
|
-
/**
|
|
42
|
-
* Create a clone of this bounding box
|
|
43
|
-
* @returns New bounding box with the same values
|
|
44
|
-
*/
|
|
45
|
-
clone(): BoundingBox;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Class for loading PLY files with Gaussian Splat data
|
|
50
|
-
*/
|
|
51
|
-
export declare class PlyLoader extends THREE.Loader {
|
|
52
|
-
private requestId;
|
|
53
|
-
private worker;
|
|
54
|
-
private pendingCallbacks;
|
|
55
|
-
constructor(manager?: THREE.LoadingManager);
|
|
56
|
-
/**
|
|
57
|
-
* Handles messages received from the parsing worker
|
|
58
|
-
* @param event The message event from the worker
|
|
59
|
-
*/
|
|
60
|
-
private onWorkerMessage;
|
|
61
|
-
/**
|
|
62
|
-
* Load a PLY file with Gaussian Splat data
|
|
63
|
-
* @param url URL of the PLY file
|
|
64
|
-
* @param onLoad Optional callback when loading is complete
|
|
65
|
-
* @param onProgress Optional progress callback
|
|
66
|
-
* @param onError Optional error callback
|
|
67
|
-
*/
|
|
68
|
-
load(url: string, onLoad?: (data: SplatData) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void;
|
|
69
|
-
/**
|
|
70
|
-
* Load a PLY file asynchronously and return a Promise
|
|
71
|
-
* @param url URL of the PLY file
|
|
72
|
-
* @param onProgress Optional progress callback
|
|
73
|
-
* @returns A Promise that resolves with the parsed SplatData
|
|
74
|
-
*/
|
|
75
|
-
loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<SplatData>;
|
|
76
|
-
/**
|
|
77
|
-
* Parse PLY buffer data asynchronously using Web Worker
|
|
78
|
-
* @param buffer ArrayBuffer containing PLY data
|
|
79
|
-
* @returns Promise that resolves with parsed SplatData
|
|
80
|
-
*/
|
|
81
|
-
private parseAsync;
|
|
82
|
-
/**
|
|
83
|
-
* Terminate the Web Worker and clean up resources
|
|
84
|
-
*/
|
|
85
|
-
dispose(): void;
|
|
86
|
-
/**
|
|
87
|
-
* Creates the self-contained code for the parsing Web Worker
|
|
88
|
-
* @returns A string containing the JavaScript code for the worker
|
|
89
|
-
*/
|
|
90
|
-
private createWorkerCode;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
*
|
|
105
|
-
* @param
|
|
106
|
-
* @param
|
|
107
|
-
* @param
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
*
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
*
|
|
158
|
-
*/
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Set
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
*
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
*
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
splatData: SplatData | null;
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
private
|
|
190
|
-
private
|
|
191
|
-
private
|
|
192
|
-
private
|
|
193
|
-
private
|
|
194
|
-
private
|
|
195
|
-
private
|
|
196
|
-
private
|
|
197
|
-
private
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
*
|
|
203
|
-
* @param
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
*
|
|
210
|
-
* @param
|
|
211
|
-
* @
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
*
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
*
|
|
222
|
-
* @param
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
*
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
* @param
|
|
235
|
-
* @param
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
*
|
|
280
|
-
* @param
|
|
281
|
-
*/
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
*
|
|
285
|
-
* @param
|
|
286
|
-
* @param
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
*
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
private
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* Create the order texture for sorting
|
|
338
|
-
* @param numSplats Number of splats
|
|
339
|
-
* @returns DataTexture for storing order indices
|
|
340
|
-
*/
|
|
341
|
-
private createOrderTexture;
|
|
342
|
-
dispose(): void;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
export declare const VERSION = "0.3.0";
|
|
346
|
-
|
|
347
|
-
export { }
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Simplified bounding box class that tracks min/max points
|
|
5
|
+
*/
|
|
6
|
+
export declare class BoundingBox {
|
|
7
|
+
min: THREE.Vector3;
|
|
8
|
+
max: THREE.Vector3;
|
|
9
|
+
center: THREE.Vector3;
|
|
10
|
+
/** Half extents (size/2) */
|
|
11
|
+
halfExtents: THREE.Vector3;
|
|
12
|
+
/**
|
|
13
|
+
* Reset the bounding box to its initial state
|
|
14
|
+
*/
|
|
15
|
+
reset(): void;
|
|
16
|
+
/**
|
|
17
|
+
* Expand the bounding box to include the given point
|
|
18
|
+
* @param point Point to include in the bounding box
|
|
19
|
+
*/
|
|
20
|
+
expandByPoint(point: THREE.Vector3): void;
|
|
21
|
+
/**
|
|
22
|
+
* Expand this bounding box to include another bounding box
|
|
23
|
+
* @param box Bounding box to include
|
|
24
|
+
*/
|
|
25
|
+
expandByBox(box: BoundingBox): void;
|
|
26
|
+
/**
|
|
27
|
+
* Update the center and half extents based on min/max
|
|
28
|
+
*/
|
|
29
|
+
private updateDerived;
|
|
30
|
+
/**
|
|
31
|
+
* Check if this box contains a point
|
|
32
|
+
* @param point Point to check
|
|
33
|
+
* @returns True if the point is inside the box
|
|
34
|
+
*/
|
|
35
|
+
containsPoint(point: THREE.Vector3): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Create a Three.js Box3 from this bounding box
|
|
38
|
+
* @returns THREE.Box3 representation
|
|
39
|
+
*/
|
|
40
|
+
toBox3(): THREE.Box3;
|
|
41
|
+
/**
|
|
42
|
+
* Create a clone of this bounding box
|
|
43
|
+
* @returns New bounding box with the same values
|
|
44
|
+
*/
|
|
45
|
+
clone(): BoundingBox;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Class for loading PLY files with Gaussian Splat data
|
|
50
|
+
*/
|
|
51
|
+
export declare class PlyLoader extends THREE.Loader {
|
|
52
|
+
private requestId;
|
|
53
|
+
private worker;
|
|
54
|
+
private pendingCallbacks;
|
|
55
|
+
constructor(manager?: THREE.LoadingManager);
|
|
56
|
+
/**
|
|
57
|
+
* Handles messages received from the parsing worker
|
|
58
|
+
* @param event The message event from the worker
|
|
59
|
+
*/
|
|
60
|
+
private onWorkerMessage;
|
|
61
|
+
/**
|
|
62
|
+
* Load a PLY file with Gaussian Splat data
|
|
63
|
+
* @param url URL of the PLY file
|
|
64
|
+
* @param onLoad Optional callback when loading is complete
|
|
65
|
+
* @param onProgress Optional progress callback
|
|
66
|
+
* @param onError Optional error callback
|
|
67
|
+
*/
|
|
68
|
+
load(url: string, onLoad?: (data: SplatData) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void;
|
|
69
|
+
/**
|
|
70
|
+
* Load a PLY file asynchronously and return a Promise
|
|
71
|
+
* @param url URL of the PLY file
|
|
72
|
+
* @param onProgress Optional progress callback
|
|
73
|
+
* @returns A Promise that resolves with the parsed SplatData
|
|
74
|
+
*/
|
|
75
|
+
loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<SplatData>;
|
|
76
|
+
/**
|
|
77
|
+
* Parse PLY buffer data asynchronously using Web Worker
|
|
78
|
+
* @param buffer ArrayBuffer containing PLY data
|
|
79
|
+
* @returns Promise that resolves with parsed SplatData
|
|
80
|
+
*/
|
|
81
|
+
private parseAsync;
|
|
82
|
+
/**
|
|
83
|
+
* Terminate the Web Worker and clean up resources
|
|
84
|
+
*/
|
|
85
|
+
dispose(): void;
|
|
86
|
+
/**
|
|
87
|
+
* Creates the self-contained code for the parsing Web Worker
|
|
88
|
+
* @returns A string containing the JavaScript code for the worker
|
|
89
|
+
*/
|
|
90
|
+
private createWorkerCode;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Class for loading SOGS (Self Organizing Gaussians) files
|
|
95
|
+
*/
|
|
96
|
+
export declare class SogsLoader extends THREE.Loader {
|
|
97
|
+
/**
|
|
98
|
+
* Detect if a buffer is a ZIP file by checking magic bytes
|
|
99
|
+
* ZIP files start with signature: PK\x03\x04 (0x50 0x4B 0x03 0x04)
|
|
100
|
+
*/
|
|
101
|
+
private isZipBuffer;
|
|
102
|
+
/**
|
|
103
|
+
* Load a SOGS file (meta.json + textures)
|
|
104
|
+
* @param url URL of the meta.json file
|
|
105
|
+
* @param onLoad Optional callback when loading is complete
|
|
106
|
+
* @param onProgress Optional progress callback
|
|
107
|
+
* @param onError Optional error callback
|
|
108
|
+
*/
|
|
109
|
+
load(url: string, onLoad?: (data: SplatData) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void;
|
|
110
|
+
/**
|
|
111
|
+
* Load a SOGS file asynchronously and return a Promise
|
|
112
|
+
* @param url URL of the meta.json file
|
|
113
|
+
* @param onProgress Optional progress callback
|
|
114
|
+
* @returns A Promise that resolves with the parsed SplatData
|
|
115
|
+
*/
|
|
116
|
+
loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise<SplatData>;
|
|
117
|
+
private parseAsync;
|
|
118
|
+
private parseMetaAsync;
|
|
119
|
+
private parseZipAsync;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export declare class SplatData {
|
|
123
|
+
numSplats: number;
|
|
124
|
+
textureWidth: number;
|
|
125
|
+
textureHeight: number;
|
|
126
|
+
ranges: SplatRanges;
|
|
127
|
+
centers: Float32Array;
|
|
128
|
+
boundingBox: BoundingBox;
|
|
129
|
+
packedColor: Uint8Array;
|
|
130
|
+
packedGeometry: Uint32Array;
|
|
131
|
+
constructor(numSplats: number, textureWidth: number, textureHeight: number, centers: Float32Array, packedGeometry: Uint32Array, packedColor: Uint8Array, ranges: SplatRanges, boundingBox: BoundingBox);
|
|
132
|
+
/**
|
|
133
|
+
* Optional: Reconstruct a full JS object for a specific splat.
|
|
134
|
+
* Useful for raycasting or debugging.
|
|
135
|
+
*/
|
|
136
|
+
dispose(): void;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export declare class SplatMaterial extends THREE.ShaderMaterial {
|
|
140
|
+
constructor(options?: SplatMaterialOptions);
|
|
141
|
+
setTexWidth(w: number): void;
|
|
142
|
+
/**
|
|
143
|
+
* Update the viewport size
|
|
144
|
+
* @param width Viewport width
|
|
145
|
+
* @param height Viewport height
|
|
146
|
+
*/
|
|
147
|
+
updateViewport(width: number, height: number): void;
|
|
148
|
+
/**
|
|
149
|
+
* Set the main packed geometry texture (RGBA32UI)
|
|
150
|
+
*/
|
|
151
|
+
setPackedGeometry(texture: THREE.Texture): void;
|
|
152
|
+
/**
|
|
153
|
+
* Set the packed color texture (RGBA8)
|
|
154
|
+
*/
|
|
155
|
+
setPackedColor(texture: THREE.Texture): void;
|
|
156
|
+
/**
|
|
157
|
+
* Set order texture for sorting
|
|
158
|
+
*/
|
|
159
|
+
setOrderTexture(texture: THREE.Texture): void;
|
|
160
|
+
/**
|
|
161
|
+
* Set the ranges needed to decompress the packed floats
|
|
162
|
+
*/
|
|
163
|
+
setRanges(ranges: SplatRanges): void;
|
|
164
|
+
/**
|
|
165
|
+
* Set number of splats to render
|
|
166
|
+
* @param count Number of splats
|
|
167
|
+
*/
|
|
168
|
+
setNumSplats(count: number): void;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export declare interface SplatMaterialOptions {
|
|
172
|
+
alphaTest?: number;
|
|
173
|
+
alphaHash?: boolean;
|
|
174
|
+
toneMapped?: boolean;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* A mesh that renders Gaussian splats
|
|
179
|
+
* Not a real MESH, but a custom geometry with instancing
|
|
180
|
+
*/
|
|
181
|
+
export declare class SplatMesh extends THREE.Mesh {
|
|
182
|
+
sorter: SplatSorter;
|
|
183
|
+
options: SplatMeshOptions;
|
|
184
|
+
splatData: SplatData | null;
|
|
185
|
+
textureManager: TextureManager;
|
|
186
|
+
material: SplatMaterial;
|
|
187
|
+
geometry: THREE.InstancedBufferGeometry;
|
|
188
|
+
private lastCameraPositionLocal;
|
|
189
|
+
private lastCameraDirectionLocal;
|
|
190
|
+
private invModelMatrix;
|
|
191
|
+
private _vpW;
|
|
192
|
+
private _vpH;
|
|
193
|
+
private _size;
|
|
194
|
+
private _camPosW;
|
|
195
|
+
private _camDirW;
|
|
196
|
+
private _camPosL;
|
|
197
|
+
private _camDirL;
|
|
198
|
+
/** Number of splats combined into a single instanced draw call. */
|
|
199
|
+
private static INSTANCE_SIZE;
|
|
200
|
+
/**
|
|
201
|
+
* Create a new SplatMesh for rendering Gaussian splats
|
|
202
|
+
* @param splatData The splat data to render
|
|
203
|
+
* @param options Rendering options
|
|
204
|
+
*/
|
|
205
|
+
constructor(splatData: SplatData, options?: SplatMeshOptions);
|
|
206
|
+
private onSorterUpdated;
|
|
207
|
+
/**
|
|
208
|
+
* Creates the instanced geometry for rendering splats.
|
|
209
|
+
* @param totalSplats Total number of splats in the data.
|
|
210
|
+
* @param instanceSize Number of splats per instance.
|
|
211
|
+
* @returns InstancedBufferGeometry
|
|
212
|
+
*/
|
|
213
|
+
private static createInstancedGeometry;
|
|
214
|
+
/**
|
|
215
|
+
* Create chunks data (bounding box min/max) for the sorter.
|
|
216
|
+
* @returns Float32Array containing chunk data [minX, minY, minZ, maxX, maxY, maxZ] or null.
|
|
217
|
+
*/
|
|
218
|
+
private createChunks;
|
|
219
|
+
/**
|
|
220
|
+
* Update the viewport size
|
|
221
|
+
* @param width Viewport width
|
|
222
|
+
* @param height Viewport height
|
|
223
|
+
*/
|
|
224
|
+
updateViewport(width: number, height: number): void;
|
|
225
|
+
/**
|
|
226
|
+
* Sorts splats based on camera position and direction.
|
|
227
|
+
* @param camera The camera to sort against.
|
|
228
|
+
*/
|
|
229
|
+
sort(camera: THREE.Camera): void;
|
|
230
|
+
/**
|
|
231
|
+
* THREE.js hook called before rendering the object.
|
|
232
|
+
* Used here to trigger sorting and update viewport.
|
|
233
|
+
* @param renderer The renderer
|
|
234
|
+
* @param scene The scene
|
|
235
|
+
* @param camera The camera
|
|
236
|
+
*/
|
|
237
|
+
onBeforeRender(renderer: THREE.WebGLRenderer, scene: THREE.Scene, camera: THREE.Camera): void;
|
|
238
|
+
/**
|
|
239
|
+
* Dispose of resources
|
|
240
|
+
*/
|
|
241
|
+
dispose(): void;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export declare interface SplatMeshOptions extends SplatMaterialOptions {
|
|
245
|
+
autoSort?: boolean;
|
|
246
|
+
keepSplatData?: boolean;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
declare interface SplatRanges {
|
|
250
|
+
sh0: {
|
|
251
|
+
min: THREE.Vector3;
|
|
252
|
+
max: THREE.Vector3;
|
|
253
|
+
};
|
|
254
|
+
means: {
|
|
255
|
+
min: THREE.Vector3;
|
|
256
|
+
max: THREE.Vector3;
|
|
257
|
+
};
|
|
258
|
+
scales: {
|
|
259
|
+
min: THREE.Vector3;
|
|
260
|
+
max: THREE.Vector3;
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Manages sorting of splats based on camera view using a Web Worker.
|
|
266
|
+
*/
|
|
267
|
+
export declare class SplatSorter extends THREE.EventDispatcher<{
|
|
268
|
+
updated: SplatSortUpdateEvent;
|
|
269
|
+
}> {
|
|
270
|
+
private worker;
|
|
271
|
+
private centers;
|
|
272
|
+
private orderTexture;
|
|
273
|
+
/** Bounding box data for optimization */
|
|
274
|
+
private chunks;
|
|
275
|
+
private lastCameraPosition;
|
|
276
|
+
private lastCameraDirection;
|
|
277
|
+
constructor();
|
|
278
|
+
/**
|
|
279
|
+
* Handles messages received from the sorting worker.
|
|
280
|
+
* @param event The message event from the worker.
|
|
281
|
+
*/
|
|
282
|
+
private onWorkerMessage;
|
|
283
|
+
/**
|
|
284
|
+
* Initializes the sorter with necessary data and textures.
|
|
285
|
+
* @param orderTexture The THREE.DataTexture (R32UI) to store the sorted splat indices.
|
|
286
|
+
* @param centers A Float32Array containing the center position (x, y, z) for each splat.
|
|
287
|
+
* @param chunks Optional: A Float32Array containing bounding box chunk data [minX, minY, minZ, maxX, maxY, maxZ, ...] for optimization.
|
|
288
|
+
* @param transferOwnership Optional: If true, transfers ownership of centers buffer to worker (saves memory, main thread loses access). Default: false.
|
|
289
|
+
*/
|
|
290
|
+
init(orderTexture: THREE.DataTexture, centers: Float32Array, chunks?: Float32Array, transferOwnership?: boolean): void;
|
|
291
|
+
/**
|
|
292
|
+
* Applies an optional mapping to filter or reorder splats before sorting.
|
|
293
|
+
* The sorter will only consider splats whose original indices are present in the mapping.
|
|
294
|
+
* @param mapping A Uint32Array where each element is the *original* index of a splat to include, or null to reset mapping.
|
|
295
|
+
*/
|
|
296
|
+
setMapping(mapping: Uint32Array | null): void;
|
|
297
|
+
/**
|
|
298
|
+
* Updates the camera parameters used for sorting.
|
|
299
|
+
* @param position The camera's position in the sorter's local coordinate space.
|
|
300
|
+
* @param direction The camera's forward direction in the sorter's local coordinate space.
|
|
301
|
+
*/
|
|
302
|
+
setCamera(position: THREE.Vector3, direction: THREE.Vector3): void;
|
|
303
|
+
/**
|
|
304
|
+
* Terminates the Web Worker and cleans up resources.
|
|
305
|
+
*/
|
|
306
|
+
dispose(): void;
|
|
307
|
+
/**
|
|
308
|
+
* Creates the self-contained code for the sorting Web Worker.
|
|
309
|
+
* @returns A string containing the JavaScript code for the worker.
|
|
310
|
+
*/
|
|
311
|
+
private createWorkerCode;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/** Event dispatched when the sort is updated */
|
|
315
|
+
declare interface SplatSortUpdateEvent extends THREE.Event {
|
|
316
|
+
type: 'updated';
|
|
317
|
+
count: number;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
export declare class TextureManager {
|
|
321
|
+
packedGeometry: THREE.DataTexture;
|
|
322
|
+
packedColor: THREE.DataTexture;
|
|
323
|
+
orderTexture: THREE.DataTexture;
|
|
324
|
+
width: number;
|
|
325
|
+
height: number;
|
|
326
|
+
constructor(data: SplatData);
|
|
327
|
+
private createGeometryTexture;
|
|
328
|
+
private createColorTexture;
|
|
329
|
+
private createOrderTexture;
|
|
330
|
+
dispose(): void;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
export declare const VERSION = "0.3.0";
|
|
334
|
+
|
|
335
|
+
export { }
|