@onerjs/core 8.46.1 → 8.46.2

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.
Files changed (38) hide show
  1. package/Collisions/gpuPicker.js +9 -1
  2. package/Collisions/gpuPicker.js.map +1 -1
  3. package/Engines/WebGPU/webgpuCacheRenderPipeline.d.ts +20 -0
  4. package/Engines/WebGPU/webgpuCacheRenderPipeline.js +58 -13
  5. package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
  6. package/Engines/WebGPU/webgpuConstants.d.ts +5 -2
  7. package/Engines/WebGPU/webgpuConstants.js +3 -0
  8. package/Engines/WebGPU/webgpuConstants.js.map +1 -1
  9. package/Engines/engine.d.ts +45 -41
  10. package/Engines/webgpuEngine.d.ts +84 -0
  11. package/Engines/webgpuEngine.js +80 -1
  12. package/Engines/webgpuEngine.js.map +1 -1
  13. package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.d.ts +7 -0
  14. package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.js +22 -0
  15. package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.js.map +1 -1
  16. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +2 -28
  17. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  18. package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.d.ts +46 -0
  19. package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.js +56 -0
  20. package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.js.map +1 -0
  21. package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +104 -463
  22. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +553 -2018
  23. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  24. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.d.ts +554 -0
  25. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.js +2017 -0
  26. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.js.map +1 -0
  27. package/Meshes/index.d.ts +2 -0
  28. package/Meshes/index.js +2 -0
  29. package/Meshes/index.js.map +1 -1
  30. package/Rendering/depthRenderer.js +2 -1
  31. package/Rendering/depthRenderer.js.map +1 -1
  32. package/package.json +1 -1
  33. package/Shaders/ShadersInclude/openpbrBlockAmbientOcclusion.d.ts +0 -5
  34. package/Shaders/ShadersInclude/openpbrBlockAmbientOcclusion.js +0 -35
  35. package/Shaders/ShadersInclude/openpbrBlockAmbientOcclusion.js.map +0 -1
  36. package/ShadersWGSL/ShadersInclude/openpbrBlockAmbientOcclusion.d.ts +0 -5
  37. package/ShadersWGSL/ShadersInclude/openpbrBlockAmbientOcclusion.js +0 -36
  38. package/ShadersWGSL/ShadersInclude/openpbrBlockAmbientOcclusion.js.map +0 -1
@@ -1,533 +1,174 @@
1
+ import { type Nullable } from "../../types.js";
1
2
  import { type Scene } from "../../scene.js";
2
- import { type DeepImmutable, type Nullable } from "../../types.js";
3
- import { type BaseTexture } from "../../Materials/Textures/baseTexture.js";
4
- import { SubMesh } from "../subMesh.js";
5
- import { type AbstractMesh } from "../abstractMesh.js";
6
- import { Mesh } from "../mesh.js";
7
- import { Matrix, Vector3 } from "../../Maths/math.vector.js";
3
+ import { type Matrix, type Vector2 } from "../../Maths/math.vector.js";
4
+ import { type Effect } from "../../Materials/effect.js";
5
+ import { GaussianSplattingMeshBase } from "./gaussianSplattingMeshBase.js";
8
6
  import "../thinInstanceMesh.js";
9
- import { type Material } from "../../Materials/material.js";
10
- import { type Camera } from "../../Cameras/camera.js";
11
- interface IUpdateOptions {
12
- flipY?: boolean;
13
- }
14
- /**
15
- * Representation of the types
16
- */
17
- declare enum PLYType {
18
- FLOAT = 0,
19
- INT = 1,
20
- UINT = 2,
21
- DOUBLE = 3,
22
- UCHAR = 4,
23
- UNDEFINED = 5
24
- }
25
- /**
26
- * Usage types of the PLY values
27
- */
28
- declare enum PLYValue {
29
- MIN_X = 0,
30
- MIN_Y = 1,
31
- MIN_Z = 2,
32
- MAX_X = 3,
33
- MAX_Y = 4,
34
- MAX_Z = 5,
35
- MIN_SCALE_X = 6,
36
- MIN_SCALE_Y = 7,
37
- MIN_SCALE_Z = 8,
38
- MAX_SCALE_X = 9,
39
- MAX_SCALE_Y = 10,
40
- MAX_SCALE_Z = 11,
41
- PACKED_POSITION = 12,
42
- PACKED_ROTATION = 13,
43
- PACKED_SCALE = 14,
44
- PACKED_COLOR = 15,
45
- X = 16,
46
- Y = 17,
47
- Z = 18,
48
- SCALE_0 = 19,
49
- SCALE_1 = 20,
50
- SCALE_2 = 21,
51
- DIFFUSE_RED = 22,
52
- DIFFUSE_GREEN = 23,
53
- DIFFUSE_BLUE = 24,
54
- OPACITY = 25,
55
- F_DC_0 = 26,
56
- F_DC_1 = 27,
57
- F_DC_2 = 28,
58
- F_DC_3 = 29,
59
- ROT_0 = 30,
60
- ROT_1 = 31,
61
- ROT_2 = 32,
62
- ROT_3 = 33,
63
- MIN_COLOR_R = 34,
64
- MIN_COLOR_G = 35,
65
- MIN_COLOR_B = 36,
66
- MAX_COLOR_R = 37,
67
- MAX_COLOR_G = 38,
68
- MAX_COLOR_B = 39,
69
- SH_0 = 40,
70
- SH_1 = 41,
71
- SH_2 = 42,
72
- SH_3 = 43,
73
- SH_4 = 44,
74
- SH_5 = 45,
75
- SH_6 = 46,
76
- SH_7 = 47,
77
- SH_8 = 48,
78
- SH_9 = 49,
79
- SH_10 = 50,
80
- SH_11 = 51,
81
- SH_12 = 52,
82
- SH_13 = 53,
83
- SH_14 = 54,
84
- SH_15 = 55,
85
- SH_16 = 56,
86
- SH_17 = 57,
87
- SH_18 = 58,
88
- SH_19 = 59,
89
- SH_20 = 60,
90
- SH_21 = 61,
91
- SH_22 = 62,
92
- SH_23 = 63,
93
- SH_24 = 64,
94
- SH_25 = 65,
95
- SH_26 = 66,
96
- SH_27 = 67,
97
- SH_28 = 68,
98
- SH_29 = 69,
99
- SH_30 = 70,
100
- SH_31 = 71,
101
- SH_32 = 72,
102
- SH_33 = 73,
103
- SH_34 = 74,
104
- SH_35 = 75,
105
- SH_36 = 76,
106
- SH_37 = 77,
107
- SH_38 = 78,
108
- SH_39 = 79,
109
- SH_40 = 80,
110
- SH_41 = 81,
111
- SH_42 = 82,
112
- SH_43 = 83,
113
- SH_44 = 84,
114
- UNDEFINED = 85
115
- }
116
- /**
117
- * Property field found in PLY header
118
- */
119
- export type PlyProperty = {
120
- /**
121
- * Value usage
122
- */
123
- value: PLYValue;
124
- /**
125
- * Value type
126
- */
127
- type: PLYType;
128
- /**
129
- * offset in byte from te beginning of the splat
130
- */
131
- offset: number;
132
- };
7
+ import { GaussianSplattingPartProxyMesh } from "./gaussianSplattingPartProxyMesh.js";
133
8
  /**
134
- * meta info on Splat file
9
+ * Class used to render a Gaussian Splatting mesh. Supports both single-cloud and compound
10
+ * (multi-part) rendering. In compound mode, multiple Gaussian Splatting source meshes are
11
+ * merged into one draw call while retaining per-part world-matrix control via
12
+ * addPart/addParts and removePart.
135
13
  */
136
- export interface PLYHeader {
137
- /**
138
- * number of splats
139
- */
140
- vertexCount: number;
141
- /**
142
- * number of spatial chunks for compressed ply
143
- */
144
- chunkCount: number;
145
- /**
146
- * length in bytes of the vertex info
147
- */
148
- rowVertexLength: number;
14
+ export declare class GaussianSplattingMesh extends GaussianSplattingMeshBase {
149
15
  /**
150
- * length in bytes of the chunk
16
+ * Proxy meshes indexed by part index. Maintained in sync with _partMatrices.
151
17
  */
152
- rowChunkLength: number;
153
- /**
154
- * array listing properties per vertex
155
- */
156
- vertexProperties: PlyProperty[];
157
- /**
158
- * array listing properties per chunk
159
- */
160
- chunkProperties: PlyProperty[];
161
- /**
162
- * data view for parsing chunks and vertices
163
- */
164
- dataView: DataView;
165
- /**
166
- * buffer for the data view
167
- */
168
- buffer: ArrayBuffer;
169
- /**
170
- * degree of SH coefficients
171
- */
172
- shDegree: number;
18
+ private _partProxies;
173
19
  /**
174
- * number of coefficient per splat
20
+ * World matrices for each part, indexed by part index.
175
21
  */
176
- shCoefficientCount: number;
22
+ protected _partMatrices: Matrix[];
23
+ /** When true, suppresses the sort trigger inside setWorldMatrixForPart during batch rebuilds. */
24
+ private _rebuilding;
177
25
  /**
178
- * buffer for SH coefficients
26
+ * Visibility values for each part (0.0 to 1.0), indexed by part index.
179
27
  */
180
- shBuffer: ArrayBuffer | null;
181
- }
182
- /**
183
- * Class used to render a gaussian splatting mesh
184
- */
185
- export declare class GaussianSplattingMesh extends Mesh {
186
- private _vertexCount;
187
- private _worker;
188
- private _modelViewProjectionMatrix;
189
- private _depthMix;
190
- private _canPostToWorker;
191
- private _readyToDisplay;
192
- private _covariancesATexture;
193
- private _covariancesBTexture;
194
- private _centersTexture;
195
- private _colorsTexture;
196
- private _splatPositions;
197
- private _splatIndex;
198
- private _shTextures;
199
- private _splatsData;
200
- private _shData;
28
+ protected _partVisibility: number[];
201
29
  private _partIndicesTexture;
202
30
  private _partIndices;
203
- private _partMatrices;
204
- private _partVisibility;
205
- private _partProxies;
206
- private _textureSize;
207
- private readonly _keepInRam;
208
- private _delayedTextureUpdate;
209
- private _useRGBACovariants;
210
- private _material;
211
- private _tmpCovariances;
212
- private _sortIsDirty;
213
- private static _RowOutputLength;
214
- private static _SH_C0;
215
- private static _SplatBatchSize;
216
- private static _PlyConversionBatchSize;
217
- private _shDegree;
218
- private static readonly _BatchSize;
219
- private _cameraViewInfos;
220
- private static readonly _DefaultViewUpdateThreshold;
221
- /**
222
- * Cosine value of the angle threshold to update view dependent splat sorting. Default is 0.0001.
223
- */
224
- viewUpdateThreshold: number;
225
- protected _disableDepthSort: boolean;
226
- /**
227
- * If true, disables depth sorting of the splats (default: false)
228
- */
229
- get disableDepthSort(): boolean;
230
- set disableDepthSort(value: boolean);
231
- /**
232
- * View direction factor used to compute the SH view direction in the shader.
233
- * @deprecated Not used anymore for SH rendering
234
- */
235
- get viewDirectionFactor(): import("../../types.js").DeepImmutableObject<Vector3>;
236
- /**
237
- * SH degree. 0 = no sh (default). 1 = 3 parameters. 2 = 8 parameters. 3 = 15 parameters.
238
- * Value is clamped between 0 and the maximum degree available from loaded data.
239
- */
240
- get shDegree(): number;
241
- set shDegree(value: number);
242
- /**
243
- * Maximum SH degree available from the loaded data.
244
- */
245
- get maxShDegree(): number;
246
- /**
247
- * Number of splats in the mesh
248
- */
249
- get splatCount(): number | undefined;
250
- /**
251
- * returns the splats data array buffer that contains in order : postions (3 floats), size (3 floats), color (4 bytes), orientation quaternion (4 bytes)
252
- */
253
- get splatsData(): Nullable<ArrayBuffer>;
254
- /**
255
- * returns the SH data arrays
256
- */
257
- get shData(): Nullable<Uint8Array<ArrayBufferLike>[]>;
258
- /**
259
- * True when this mesh is a compound that regroups multiple Gaussian splatting parts.
260
- */
261
- get isCompound(): boolean;
262
31
  /**
263
- * returns the part indices array
264
- */
265
- get partIndices(): Nullable<Uint8Array<ArrayBufferLike>>;
266
- /**
267
- * Gets the part indices texture, if the mesh is a compound
268
- */
269
- get partIndicesTexture(): Nullable<BaseTexture>;
270
- /**
271
- * Gets the part visibility array, if the mesh is a compound
272
- */
273
- get partVisibility(): number[];
274
- /**
275
- * Set the number of batch (a batch is 16384 splats) after which a display update is performed
276
- * A value of 0 (default) means display update will not happens before splat is ready.
277
- */
278
- static ProgressiveUpdateAmount: number;
279
- /**
280
- * Gets the covariancesA texture
281
- */
282
- get covariancesATexture(): Nullable<BaseTexture>;
283
- /**
284
- * Gets the covariancesB texture
285
- */
286
- get covariancesBTexture(): Nullable<BaseTexture>;
287
- /**
288
- * Gets the centers texture
289
- */
290
- get centersTexture(): Nullable<BaseTexture>;
291
- /**
292
- * Gets the colors texture
293
- */
294
- get colorsTexture(): Nullable<BaseTexture>;
295
- /**
296
- * Gets the SH textures
297
- */
298
- get shTextures(): Nullable<BaseTexture[]>;
299
- /**
300
- * Gets the kernel size
301
- * Documentation and mathematical explanations here:
302
- * https://github.com/graphdeco-inria/gaussian-splatting/issues/294#issuecomment-1772688093
303
- * https://github.com/autonomousvision/mip-splatting/issues/18#issuecomment-1929388931
304
- */
305
- get kernelSize(): number;
306
- /**
307
- * Get the compensation state
308
- */
309
- get compensation(): boolean;
310
- private _loadingPromise;
311
- /**
312
- * set rendering material
313
- */
314
- set material(value: Material);
315
- /**
316
- * get rendering material
317
- */
318
- get material(): Nullable<Material>;
319
- private static _MakeSplatGeometryForMesh;
320
- /**
321
- * Creates a new gaussian splatting mesh
322
- * @param name defines the name of the mesh
323
- * @param url defines the url to load from (optional)
324
- * @param scene defines the hosting scene (optional)
325
- * @param keepInRam keep datas in ram for editing purpose
32
+ * Creates a new GaussianSplattingMesh
33
+ * @param name the name of the mesh
34
+ * @param url optional URL to load a Gaussian Splatting file from
35
+ * @param scene the hosting scene
36
+ * @param keepInRam whether to keep the raw splat data in RAM after uploading to GPU
326
37
  */
327
38
  constructor(name: string, url?: Nullable<string>, scene?: Nullable<Scene>, keepInRam?: boolean);
328
- /**
329
- * Get the loading promise when loading the mesh from a URL in the constructor
330
- * @returns constructor loading promise or null if no URL was provided
331
- */
332
- getLoadingPromise(): Promise<void> | null;
333
39
  /**
334
40
  * Returns the class name
335
41
  * @returns "GaussianSplattingMesh"
336
42
  */
337
43
  getClassName(): string;
338
44
  /**
339
- * Returns the total number of vertices (splats) within the mesh
340
- * @returns the total number of vertices
341
- */
342
- getTotalVertices(): number;
343
- /**
344
- * Is this node ready to be used/rendered
345
- * @param completeCheck defines if a complete check (including materials and lights) has to be done (false by default)
346
- * @returns true when ready
347
- */
348
- isReady(completeCheck?: boolean): boolean;
349
- _getCameraDirection(camera: Camera): Vector3;
350
- /** @internal */
351
- _postToWorker(forced?: boolean): void;
352
- /**
353
- * Triggers the draw call for the mesh. Usually, you don't need to call this method by your own because the mesh rendering is handled by the scene rendering manager
354
- * @param subMesh defines the subMesh to render
355
- * @param enableAlphaMode defines if alpha mode can be changed
356
- * @param effectiveMeshReplacement defines an optional mesh used to provide info for the rendering
357
- * @returns the current mesh
358
- */
359
- render(subMesh: SubMesh, enableAlphaMode: boolean, effectiveMeshReplacement?: AbstractMesh): Mesh;
360
- private static _TypeNameToEnum;
361
- private static _ValueNameToEnum;
362
- /**
363
- * Parse a PLY file header and returns metas infos on splats and chunks
364
- * @param data the loaded buffer
365
- * @returns a PLYHeader
366
- */
367
- static ParseHeader(data: ArrayBuffer): PLYHeader | null;
368
- private static _GetCompressedChunks;
369
- private static _GetSplat;
370
- /**
371
- * Converts a .ply data with SH coefficients splat
372
- * if data array buffer is not ply, returns the original buffer
373
- * @param data the .ply data to load
374
- * @param useCoroutine use coroutine and yield
375
- * @returns the loaded splat buffer and optional array of sh coefficients
376
- */
377
- static ConvertPLYWithSHToSplat(data: ArrayBuffer, useCoroutine?: boolean): Generator<undefined, {
378
- buffer: ArrayBuffer;
379
- sh?: undefined;
380
- } | {
381
- buffer: ArrayBuffer;
382
- sh: Uint8Array<ArrayBuffer>[] | null;
383
- }, unknown>;
384
- /**
385
- * Converts a .ply data array buffer to splat
386
- * if data array buffer is not ply, returns the original buffer
387
- * @param data the .ply data to load
388
- * @param useCoroutine use coroutine and yield
389
- * @returns the loaded splat buffer without SH coefficient, whether ply contains or not SH.
390
- */
391
- static ConvertPLYToSplat(data: ArrayBuffer, useCoroutine?: boolean): Generator<undefined, ArrayBuffer, unknown>;
392
- /**
393
- * Converts a .ply data array buffer to splat
394
- * if data array buffer is not ply, returns the original buffer
395
- * @param data the .ply data to load
396
- * @returns the loaded splat buffer
45
+ * Disposes proxy meshes and clears part data in addition to the base class GPU resources.
46
+ * @param doNotRecurse Set to true to not recurse into each children
397
47
  */
398
- static ConvertPLYToSplatAsync(data: ArrayBuffer): Promise<ArrayBuffer>;
48
+ dispose(doNotRecurse?: boolean): void;
399
49
  /**
400
- * Converts a .ply with SH data array buffer to splat
401
- * if data array buffer is not ply, returns the original buffer
402
- * @param data the .ply data to load
403
- * @returns the loaded splat buffer with SH
50
+ * Posts the initial per-part data to the sort worker after it has been created.
51
+ * Sends the current part matrices and group index array so the worker can correctly
52
+ * weight depth values per part.
53
+ * @param worker the newly created sort worker
404
54
  */
405
- static ConvertPLYWithSHToSplatAsync(data: ArrayBuffer): Promise<{
406
- buffer: ArrayBuffer;
407
- sh?: undefined;
408
- } | {
409
- buffer: ArrayBuffer;
410
- sh: Uint8Array<ArrayBuffer>[] | null;
411
- }>;
55
+ protected _onWorkerCreated(worker: Worker): void;
412
56
  /**
413
- * Loads a .splat Gaussian Splatting array buffer asynchronously
414
- * @param data arraybuffer containing splat file
415
- * @returns a promise that resolves when the operation is complete
57
+ * Stores the raw part index array, padded to texture length, so the worker and GPU texture
58
+ * creation step have access to it.
59
+ * @param partIndices - the raw part indices array received during a data load
60
+ * @param textureLength - the padded texture length to allocate into
416
61
  */
417
- loadDataAsync(data: ArrayBuffer): Promise<void>;
62
+ protected _onIndexDataReceived(partIndices: Uint8Array, textureLength: number): void;
418
63
  /**
419
- * Loads a Gaussian or Splatting file asynchronously
420
- * @param url path to the splat file to load
421
- * @param scene optional scene it belongs to
422
- * @returns a promise that resolves when the operation is complete
423
- * @deprecated Please use SceneLoader.ImportMeshAsync instead
64
+ * Returns `true` when at least one part has been added to this compound mesh.
65
+ * Returns `false` before any parts are added, so the mesh renders in normal
66
+ * (non-compound) mode until the first addPart/addParts call. This matches the
67
+ * old base-class behavior of `this._partMatrices.length > 0` and avoids
68
+ * binding unset partWorld uniforms (which would cause division-by-zero in the
69
+ * Gaussian projection Jacobian and produce huge distorted splats).
70
+ * @internal
424
71
  */
425
- loadFileAsync(url: string, scene?: Scene): Promise<void>;
72
+ get isCompound(): boolean;
426
73
  /**
427
- * Releases resources associated with this mesh.
428
- * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)
74
+ * During a removePart rebuild, keep the existing sort worker alive rather than
75
+ * tearing it down and spinning up a new one. This avoids startup latency and the
76
+ * transient state window where a stale sort could fire against an incomplete
77
+ * partMatrices array.
78
+ * Outside of a rebuild the base-class behaviour is used unchanged.
429
79
  */
430
- dispose(doNotRecurse?: boolean): void;
431
- private _copyTextures;
80
+ protected _instantiateWorker(): void;
432
81
  /**
433
- * Returns a new Mesh object generated from the current mesh properties.
434
- * @param name is a string, the name given to the new mesh
435
- * @returns a new Gaussian Splatting Mesh
82
+ * Ensures the part-index GPU texture exists at the start of an incremental update.
83
+ * Called before the sub-texture upload so the correct texture is available for the first batch.
84
+ * @param textureSize - current texture dimensions
436
85
  */
437
- clone(name?: string): GaussianSplattingMesh;
438
- private static _CreateWorker;
439
- private _makeEmptySplat;
440
- private _makeSplat;
441
- private _updateTextures;
442
- private _updateData;
86
+ protected _onIncrementalUpdateStart(textureSize: Vector2): void;
443
87
  /**
444
- * Update asynchronously the buffer
445
- * @param data array buffer containing center, color, orientation and scale of splats
446
- * @param sh optional array of uint8 array for SH data
447
- * @param partIndices optional array of uint8 for rig node indices
448
- * @returns a promise
88
+ * Posts positions (via super) and then additionally posts the current part-index array
89
+ * to the sort worker so it can associate each splat with its part.
449
90
  */
450
- updateDataAsync(data: ArrayBuffer, sh?: Uint8Array[], partIndices?: Uint8Array): Promise<void>;
91
+ protected _notifyWorkerNewData(): void;
451
92
  /**
452
- * @experimental
453
- * Update data from GS (position, orientation, color, scaling)
454
- * @param data array that contain all the datas
455
- * @param sh optional array of uint8 array for SH data
456
- * @param options optional informations on how to treat data (needs to be 3rd for backward compatibility)
457
- * @param partIndices optional array of uint8 for rig node indices
93
+ * Binds all compound-specific shader uniforms: the group index texture, per-part world
94
+ * matrices, and per-part visibility values.
95
+ * @param effect the shader effect that is being bound
96
+ * @internal
458
97
  */
459
- updateData(data: ArrayBuffer, sh?: Uint8Array[], options?: IUpdateOptions, partIndices?: Uint8Array): void;
98
+ bindExtraEffectUniforms(effect: Effect): void;
460
99
  /**
461
- * Refreshes the bounding info, taking into account all the thin instances defined
462
- * @returns the current Gaussian Splatting
100
+ * Gets the number of parts in the compound.
463
101
  */
464
- refreshBoundingInfo(): Mesh;
465
- private _updateSplatIndexBuffer;
466
- private _updateSubTextures;
467
- private _instanciateWorker;
468
- private _getTextureSize;
102
+ get partCount(): number;
469
103
  /**
470
- * Gets the number of parts in the compound
471
- * @returns the number of parts in the compound, or 0 if the mesh is not a compound
104
+ * Gets the part visibility array.
472
105
  */
473
- get partCount(): number;
106
+ get partVisibility(): number[];
474
107
  /**
475
- * Sets the world matrix for a specific part of the compound (if this mesh is a compound).
108
+ * Sets the world matrix for a specific part of the compound.
476
109
  * This will trigger a re-sort of the mesh.
477
- * @param partIndex index of the part, that must be between 0 and partCount - 1
110
+ * The `_partMatrices` array is automatically extended when `partIndex >= partCount`.
111
+ * @param partIndex index of the part
478
112
  * @param worldMatrix the world matrix to set
479
113
  */
480
114
  setWorldMatrixForPart(partIndex: number, worldMatrix: Matrix): void;
481
115
  /**
482
- * Gets the world matrix for a specific part of the compound (if this mesh is a compound).
116
+ * Gets the world matrix for a specific part of the compound.
483
117
  * @param partIndex index of the part, that must be between 0 and partCount - 1
484
- * @returns the world matrix for the part, or the current world matrix of the mesh if the mesh is not a compound
118
+ * @returns the world matrix for the part, or the current world matrix of the mesh if the part is not found
485
119
  */
486
120
  getWorldMatrixForPart(partIndex: number): Matrix;
487
121
  /**
488
- * Gets the visibility for a specific part of the compound (if this mesh is a compound).
122
+ * Gets the visibility for a specific part of the compound.
489
123
  * @param partIndex index of the part, that must be between 0 and partCount - 1
490
124
  * @returns the visibility value (0.0 to 1.0) for the part
491
125
  */
492
126
  getPartVisibility(partIndex: number): number;
493
127
  /**
494
- * Sets the visibility for a specific part of the compound (if this mesh is a compound).
128
+ * Sets the visibility for a specific part of the compound.
495
129
  * @param partIndex index of the part, that must be between 0 and partCount - 1
496
130
  * @param value the visibility value (0.0 to 1.0) to set
497
131
  */
498
132
  setPartVisibility(partIndex: number, value: number): void;
499
- /**
500
- * Ensure that the part world matrix array is at least the given length.
501
- * NB: This length is used as reference for the number of parts in the compound.
502
- * Newly inserted parts are initialized with the current world matrix of the mesh.
503
- * @param length - The minimum length to ensure
504
- */
505
- private _ensureMinimumPartMatricesLength;
506
- /**
507
- * This sets the number of parts in the compound.
508
- * Warning: This must be consistent with the indices used in the partIndices texture.
509
- * Newly inserted parts are initialized with the current world matrix of the mesh.
510
- * @param length - The length to resize to
511
- */
512
- private _resizePartMatrices;
133
+ protected _copyTextures(source: GaussianSplattingMeshBase): void;
134
+ protected _onUpdateTextures(textureSize: Vector2): void;
135
+ protected _updateSubTextures(splatPositions: Float32Array, covA: Uint16Array, covB: Uint16Array, colorArray: Uint8Array, lineStart: number, lineCount: number, sh?: Uint8Array[], partIndices?: Uint8Array): void;
136
+ /**
137
+ * Creates the part indices GPU texture the first time an incremental addPart introduces
138
+ * compound data. Has no effect if the texture already exists or no partIndices are provided.
139
+ * @param textureSize - Current texture dimensions
140
+ * @param partIndices - Part index data; if undefined the method is a no-op
141
+ */
142
+ protected _ensurePartIndicesTexture(textureSize: Vector2, partIndices: Uint8Array | undefined): void;
143
+ /**
144
+ * Core implementation for adding one or more external GaussianSplattingMesh objects as new
145
+ * parts. Writes directly into texture-sized CPU arrays and uploads in one pass — no merged
146
+ * CPU splat buffer is ever constructed.
147
+ *
148
+ * @param others - Source meshes to append (must each be non-compound and fully loaded)
149
+ * @param disposeOthers - Dispose source meshes after appending
150
+ * @returns Proxy meshes and their assigned part indices
151
+ */
152
+ protected _addPartsInternal(others: GaussianSplattingMesh[], disposeOthers: boolean): {
153
+ proxyMeshes: GaussianSplattingPartProxyMesh[];
154
+ assignedPartIndices: number[];
155
+ };
513
156
  /**
514
157
  * Add another mesh to this mesh, as a new part. This makes the current mesh a compound, if not already.
515
- * NB: The current mesh needs to be loaded with keepInRam: true.
516
- * @param other - The other mesh to add. This must be loaded with keepInRam: true.
158
+ * The source mesh's splat data is read directly no merged CPU buffer is constructed.
159
+ * @param other - The other mesh to add. Must be fully loaded before calling this method.
517
160
  * @param disposeOther - Whether to dispose the other mesh after adding it to the current mesh.
518
161
  * @returns a placeholder mesh that can be used to manipulate the part transform
162
+ * @deprecated Use {@link GaussianSplattingCompoundMesh.addPart} instead.
519
163
  */
520
- addPart(other: GaussianSplattingMesh, disposeOther?: boolean): Mesh;
164
+ addPart(other: GaussianSplattingMesh, disposeOther?: boolean): GaussianSplattingPartProxyMesh;
521
165
  /**
522
166
  * Remove a part from this compound mesh.
167
+ * The remaining parts are rebuilt directly from their stored source mesh references —
168
+ * no merged CPU splat buffer is read back. The current mesh is reset to a plain (single-part)
169
+ * state and then each remaining source is re-added via addParts.
523
170
  * @param index - The index of the part to remove
171
+ * @deprecated Use {@link GaussianSplattingCompoundMesh.removePart} instead.
524
172
  */
525
173
  removePart(index: number): void;
526
- /**
527
- * Modifies the splats according to the passed transformation matrix.
528
- * @param transform defines the transform matrix to use
529
- * @returns the current mesh
530
- */
531
- bakeTransformIntoVertices(transform: DeepImmutable<Matrix>): Mesh;
532
174
  }
533
- export {};