@onerjs/core 8.46.1 → 8.46.3
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/Collisions/gpuPicker.js +9 -1
- package/Collisions/gpuPicker.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipeline.d.ts +20 -0
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js +58 -13
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
- package/Engines/WebGPU/webgpuConstants.d.ts +5 -2
- package/Engines/WebGPU/webgpuConstants.js +3 -0
- package/Engines/WebGPU/webgpuConstants.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/engine.d.ts +45 -41
- package/Engines/shaderStore.js +2 -2
- package/Engines/shaderStore.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +84 -0
- package/Engines/webgpuEngine.js +80 -1
- package/Engines/webgpuEngine.js.map +1 -1
- package/Layers/thinHighlightLayer.js.map +1 -1
- package/Layers/thinSelectionOutlineLayer.js +20 -5
- package/Layers/thinSelectionOutlineLayer.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.d.ts +7 -0
- package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.js +22 -0
- package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +2 -28
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
- package/Materials/Textures/baseTexture.js +3 -0
- package/Materials/Textures/baseTexture.js.map +1 -1
- package/Materials/Textures/texture.js +1 -0
- package/Materials/Textures/texture.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.d.ts +46 -0
- package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.js +56 -0
- package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.js.map +1 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +104 -463
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +553 -2018
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.d.ts +554 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.js +2017 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.js.map +1 -0
- package/Meshes/index.d.ts +2 -0
- package/Meshes/index.js +2 -0
- package/Meshes/index.js.map +1 -1
- package/Misc/tools.js +1 -1
- package/Misc/tools.js.map +1 -1
- package/Rendering/depthRenderer.js +2 -1
- package/Rendering/depthRenderer.js.map +1 -1
- package/node.d.ts +7 -0
- package/node.js +17 -0
- package/node.js.map +1 -1
- package/package.json +2 -2
- package/Shaders/ShadersInclude/openpbrBlockAmbientOcclusion.d.ts +0 -5
- package/Shaders/ShadersInclude/openpbrBlockAmbientOcclusion.js +0 -35
- package/Shaders/ShadersInclude/openpbrBlockAmbientOcclusion.js.map +0 -1
- package/ShadersWGSL/ShadersInclude/openpbrBlockAmbientOcclusion.d.ts +0 -5
- package/ShadersWGSL/ShadersInclude/openpbrBlockAmbientOcclusion.js +0 -36
- package/ShadersWGSL/ShadersInclude/openpbrBlockAmbientOcclusion.js.map +0 -1
|
@@ -0,0 +1,554 @@
|
|
|
1
|
+
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, Vector2, Vector3 } from "../../Maths/math.vector.js";
|
|
8
|
+
import "../thinInstanceMesh.js";
|
|
9
|
+
import { type Material } from "../../Materials/material.js";
|
|
10
|
+
import { type Effect } from "../../Materials/effect.js";
|
|
11
|
+
import { type Camera } from "../../Cameras/camera.js";
|
|
12
|
+
interface IUpdateOptions {
|
|
13
|
+
flipY?: boolean;
|
|
14
|
+
/** @internal When set, skips reprocessing splats [0, previousVertexCount) and copies from cached arrays instead. */
|
|
15
|
+
previousVertexCount?: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Representation of the types
|
|
19
|
+
*/
|
|
20
|
+
declare enum PLYType {
|
|
21
|
+
FLOAT = 0,
|
|
22
|
+
INT = 1,
|
|
23
|
+
UINT = 2,
|
|
24
|
+
DOUBLE = 3,
|
|
25
|
+
UCHAR = 4,
|
|
26
|
+
UNDEFINED = 5
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Usage types of the PLY values
|
|
30
|
+
*/
|
|
31
|
+
declare enum PLYValue {
|
|
32
|
+
MIN_X = 0,
|
|
33
|
+
MIN_Y = 1,
|
|
34
|
+
MIN_Z = 2,
|
|
35
|
+
MAX_X = 3,
|
|
36
|
+
MAX_Y = 4,
|
|
37
|
+
MAX_Z = 5,
|
|
38
|
+
MIN_SCALE_X = 6,
|
|
39
|
+
MIN_SCALE_Y = 7,
|
|
40
|
+
MIN_SCALE_Z = 8,
|
|
41
|
+
MAX_SCALE_X = 9,
|
|
42
|
+
MAX_SCALE_Y = 10,
|
|
43
|
+
MAX_SCALE_Z = 11,
|
|
44
|
+
PACKED_POSITION = 12,
|
|
45
|
+
PACKED_ROTATION = 13,
|
|
46
|
+
PACKED_SCALE = 14,
|
|
47
|
+
PACKED_COLOR = 15,
|
|
48
|
+
X = 16,
|
|
49
|
+
Y = 17,
|
|
50
|
+
Z = 18,
|
|
51
|
+
SCALE_0 = 19,
|
|
52
|
+
SCALE_1 = 20,
|
|
53
|
+
SCALE_2 = 21,
|
|
54
|
+
DIFFUSE_RED = 22,
|
|
55
|
+
DIFFUSE_GREEN = 23,
|
|
56
|
+
DIFFUSE_BLUE = 24,
|
|
57
|
+
OPACITY = 25,
|
|
58
|
+
F_DC_0 = 26,
|
|
59
|
+
F_DC_1 = 27,
|
|
60
|
+
F_DC_2 = 28,
|
|
61
|
+
F_DC_3 = 29,
|
|
62
|
+
ROT_0 = 30,
|
|
63
|
+
ROT_1 = 31,
|
|
64
|
+
ROT_2 = 32,
|
|
65
|
+
ROT_3 = 33,
|
|
66
|
+
MIN_COLOR_R = 34,
|
|
67
|
+
MIN_COLOR_G = 35,
|
|
68
|
+
MIN_COLOR_B = 36,
|
|
69
|
+
MAX_COLOR_R = 37,
|
|
70
|
+
MAX_COLOR_G = 38,
|
|
71
|
+
MAX_COLOR_B = 39,
|
|
72
|
+
SH_0 = 40,
|
|
73
|
+
SH_1 = 41,
|
|
74
|
+
SH_2 = 42,
|
|
75
|
+
SH_3 = 43,
|
|
76
|
+
SH_4 = 44,
|
|
77
|
+
SH_5 = 45,
|
|
78
|
+
SH_6 = 46,
|
|
79
|
+
SH_7 = 47,
|
|
80
|
+
SH_8 = 48,
|
|
81
|
+
SH_9 = 49,
|
|
82
|
+
SH_10 = 50,
|
|
83
|
+
SH_11 = 51,
|
|
84
|
+
SH_12 = 52,
|
|
85
|
+
SH_13 = 53,
|
|
86
|
+
SH_14 = 54,
|
|
87
|
+
SH_15 = 55,
|
|
88
|
+
SH_16 = 56,
|
|
89
|
+
SH_17 = 57,
|
|
90
|
+
SH_18 = 58,
|
|
91
|
+
SH_19 = 59,
|
|
92
|
+
SH_20 = 60,
|
|
93
|
+
SH_21 = 61,
|
|
94
|
+
SH_22 = 62,
|
|
95
|
+
SH_23 = 63,
|
|
96
|
+
SH_24 = 64,
|
|
97
|
+
SH_25 = 65,
|
|
98
|
+
SH_26 = 66,
|
|
99
|
+
SH_27 = 67,
|
|
100
|
+
SH_28 = 68,
|
|
101
|
+
SH_29 = 69,
|
|
102
|
+
SH_30 = 70,
|
|
103
|
+
SH_31 = 71,
|
|
104
|
+
SH_32 = 72,
|
|
105
|
+
SH_33 = 73,
|
|
106
|
+
SH_34 = 74,
|
|
107
|
+
SH_35 = 75,
|
|
108
|
+
SH_36 = 76,
|
|
109
|
+
SH_37 = 77,
|
|
110
|
+
SH_38 = 78,
|
|
111
|
+
SH_39 = 79,
|
|
112
|
+
SH_40 = 80,
|
|
113
|
+
SH_41 = 81,
|
|
114
|
+
SH_42 = 82,
|
|
115
|
+
SH_43 = 83,
|
|
116
|
+
SH_44 = 84,
|
|
117
|
+
UNDEFINED = 85
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Property field found in PLY header
|
|
121
|
+
*/
|
|
122
|
+
export type PlyProperty = {
|
|
123
|
+
/**
|
|
124
|
+
* Value usage
|
|
125
|
+
*/
|
|
126
|
+
value: PLYValue;
|
|
127
|
+
/**
|
|
128
|
+
* Value type
|
|
129
|
+
*/
|
|
130
|
+
type: PLYType;
|
|
131
|
+
/**
|
|
132
|
+
* offset in byte from te beginning of the splat
|
|
133
|
+
*/
|
|
134
|
+
offset: number;
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* meta info on Splat file
|
|
138
|
+
*/
|
|
139
|
+
export interface PLYHeader {
|
|
140
|
+
/**
|
|
141
|
+
* number of splats
|
|
142
|
+
*/
|
|
143
|
+
vertexCount: number;
|
|
144
|
+
/**
|
|
145
|
+
* number of spatial chunks for compressed ply
|
|
146
|
+
*/
|
|
147
|
+
chunkCount: number;
|
|
148
|
+
/**
|
|
149
|
+
* length in bytes of the vertex info
|
|
150
|
+
*/
|
|
151
|
+
rowVertexLength: number;
|
|
152
|
+
/**
|
|
153
|
+
* length in bytes of the chunk
|
|
154
|
+
*/
|
|
155
|
+
rowChunkLength: number;
|
|
156
|
+
/**
|
|
157
|
+
* array listing properties per vertex
|
|
158
|
+
*/
|
|
159
|
+
vertexProperties: PlyProperty[];
|
|
160
|
+
/**
|
|
161
|
+
* array listing properties per chunk
|
|
162
|
+
*/
|
|
163
|
+
chunkProperties: PlyProperty[];
|
|
164
|
+
/**
|
|
165
|
+
* data view for parsing chunks and vertices
|
|
166
|
+
*/
|
|
167
|
+
dataView: DataView;
|
|
168
|
+
/**
|
|
169
|
+
* buffer for the data view
|
|
170
|
+
*/
|
|
171
|
+
buffer: ArrayBuffer;
|
|
172
|
+
/**
|
|
173
|
+
* degree of SH coefficients
|
|
174
|
+
*/
|
|
175
|
+
shDegree: number;
|
|
176
|
+
/**
|
|
177
|
+
* number of coefficient per splat
|
|
178
|
+
*/
|
|
179
|
+
shCoefficientCount: number;
|
|
180
|
+
/**
|
|
181
|
+
* buffer for SH coefficients
|
|
182
|
+
*/
|
|
183
|
+
shBuffer: ArrayBuffer | null;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Base class for Gaussian Splatting meshes. Contains all single-cloud rendering logic.
|
|
187
|
+
* @internal Use GaussianSplattingMesh instead; this class is an internal implementation detail.
|
|
188
|
+
*/
|
|
189
|
+
export declare class GaussianSplattingMeshBase extends Mesh {
|
|
190
|
+
/** @internal */
|
|
191
|
+
_vertexCount: number;
|
|
192
|
+
protected _worker: Nullable<Worker>;
|
|
193
|
+
private _modelViewProjectionMatrix;
|
|
194
|
+
private _depthMix;
|
|
195
|
+
protected _canPostToWorker: boolean;
|
|
196
|
+
private _readyToDisplay;
|
|
197
|
+
protected _covariancesATexture: Nullable<BaseTexture>;
|
|
198
|
+
protected _covariancesBTexture: Nullable<BaseTexture>;
|
|
199
|
+
protected _centersTexture: Nullable<BaseTexture>;
|
|
200
|
+
protected _colorsTexture: Nullable<BaseTexture>;
|
|
201
|
+
protected _splatPositions: Nullable<Float32Array>;
|
|
202
|
+
private _splatIndex;
|
|
203
|
+
protected _shTextures: Nullable<BaseTexture[]>;
|
|
204
|
+
/** @internal */
|
|
205
|
+
_splatsData: Nullable<ArrayBuffer>;
|
|
206
|
+
/** @internal */
|
|
207
|
+
_shData: Nullable<Uint8Array[]>;
|
|
208
|
+
private _textureSize;
|
|
209
|
+
protected readonly _keepInRam: boolean;
|
|
210
|
+
protected _alwaysRetainSplatsData: boolean;
|
|
211
|
+
private _delayedTextureUpdate;
|
|
212
|
+
protected _useRGBACovariants: boolean;
|
|
213
|
+
private _material;
|
|
214
|
+
private _tmpCovariances;
|
|
215
|
+
private _sortIsDirty;
|
|
216
|
+
protected _cachedBoundingMin: Nullable<Vector3>;
|
|
217
|
+
protected _cachedBoundingMax: Nullable<Vector3>;
|
|
218
|
+
private static _RowOutputLength;
|
|
219
|
+
private static _SH_C0;
|
|
220
|
+
private static _SplatBatchSize;
|
|
221
|
+
private static _PlyConversionBatchSize;
|
|
222
|
+
/** @internal */
|
|
223
|
+
_shDegree: number;
|
|
224
|
+
private static readonly _BatchSize;
|
|
225
|
+
private _cameraViewInfos;
|
|
226
|
+
private static readonly _DefaultViewUpdateThreshold;
|
|
227
|
+
/**
|
|
228
|
+
* Cosine value of the angle threshold to update view dependent splat sorting. Default is 0.0001.
|
|
229
|
+
*/
|
|
230
|
+
viewUpdateThreshold: number;
|
|
231
|
+
protected _disableDepthSort: boolean;
|
|
232
|
+
/**
|
|
233
|
+
* If true, disables depth sorting of the splats (default: false)
|
|
234
|
+
*/
|
|
235
|
+
get disableDepthSort(): boolean;
|
|
236
|
+
set disableDepthSort(value: boolean);
|
|
237
|
+
/**
|
|
238
|
+
* View direction factor used to compute the SH view direction in the shader.
|
|
239
|
+
* @deprecated Not used anymore for SH rendering
|
|
240
|
+
*/
|
|
241
|
+
get viewDirectionFactor(): import("../../types.js").DeepImmutableObject<Vector3>;
|
|
242
|
+
/**
|
|
243
|
+
* SH degree. 0 = no sh (default). 1 = 3 parameters. 2 = 8 parameters. 3 = 15 parameters.
|
|
244
|
+
* Value is clamped between 0 and the maximum degree available from loaded data.
|
|
245
|
+
*/
|
|
246
|
+
get shDegree(): number;
|
|
247
|
+
set shDegree(value: number);
|
|
248
|
+
/**
|
|
249
|
+
* Maximum SH degree available from the loaded data.
|
|
250
|
+
*/
|
|
251
|
+
get maxShDegree(): number;
|
|
252
|
+
/**
|
|
253
|
+
* Number of splats in the mesh
|
|
254
|
+
*/
|
|
255
|
+
get splatCount(): number | undefined;
|
|
256
|
+
/**
|
|
257
|
+
* returns the splats data array buffer that contains in order : postions (3 floats), size (3 floats), color (4 bytes), orientation quaternion (4 bytes)
|
|
258
|
+
* Only available if the mesh was created with keepInRam: true
|
|
259
|
+
*/
|
|
260
|
+
get splatsData(): Nullable<ArrayBuffer>;
|
|
261
|
+
/**
|
|
262
|
+
* returns the SH data arrays
|
|
263
|
+
* Only available if the mesh was created with keepInRam: true
|
|
264
|
+
*/
|
|
265
|
+
get shData(): Nullable<Uint8Array<ArrayBufferLike>[]>;
|
|
266
|
+
/**
|
|
267
|
+
* Set the number of batch (a batch is 16384 splats) after which a display update is performed
|
|
268
|
+
* A value of 0 (default) means display update will not happens before splat is ready.
|
|
269
|
+
*/
|
|
270
|
+
static ProgressiveUpdateAmount: number;
|
|
271
|
+
/**
|
|
272
|
+
* Gets the covariancesA texture
|
|
273
|
+
*/
|
|
274
|
+
get covariancesATexture(): Nullable<BaseTexture>;
|
|
275
|
+
/**
|
|
276
|
+
* Gets the covariancesB texture
|
|
277
|
+
*/
|
|
278
|
+
get covariancesBTexture(): Nullable<BaseTexture>;
|
|
279
|
+
/**
|
|
280
|
+
* Gets the centers texture
|
|
281
|
+
*/
|
|
282
|
+
get centersTexture(): Nullable<BaseTexture>;
|
|
283
|
+
/**
|
|
284
|
+
* Gets the colors texture
|
|
285
|
+
*/
|
|
286
|
+
get colorsTexture(): Nullable<BaseTexture>;
|
|
287
|
+
/**
|
|
288
|
+
* Gets the SH textures
|
|
289
|
+
*/
|
|
290
|
+
get shTextures(): Nullable<BaseTexture[]>;
|
|
291
|
+
/**
|
|
292
|
+
* Gets the kernel size
|
|
293
|
+
* Documentation and mathematical explanations here:
|
|
294
|
+
* https://github.com/graphdeco-inria/gaussian-splatting/issues/294#issuecomment-1772688093
|
|
295
|
+
* https://github.com/autonomousvision/mip-splatting/issues/18#issuecomment-1929388931
|
|
296
|
+
*/
|
|
297
|
+
get kernelSize(): number;
|
|
298
|
+
/**
|
|
299
|
+
* Get the compensation state
|
|
300
|
+
*/
|
|
301
|
+
get compensation(): boolean;
|
|
302
|
+
private _loadingPromise;
|
|
303
|
+
/**
|
|
304
|
+
* set rendering material
|
|
305
|
+
*/
|
|
306
|
+
set material(value: Material);
|
|
307
|
+
/**
|
|
308
|
+
* get rendering material
|
|
309
|
+
*/
|
|
310
|
+
get material(): Nullable<Material>;
|
|
311
|
+
private static _MakeSplatGeometryForMesh;
|
|
312
|
+
/**
|
|
313
|
+
* Creates a new gaussian splatting mesh
|
|
314
|
+
* @param name defines the name of the mesh
|
|
315
|
+
* @param url defines the url to load from (optional)
|
|
316
|
+
* @param scene defines the hosting scene (optional)
|
|
317
|
+
* @param keepInRam keep datas in ram for editing purpose
|
|
318
|
+
*/
|
|
319
|
+
constructor(name: string, url?: Nullable<string>, scene?: Nullable<Scene>, keepInRam?: boolean);
|
|
320
|
+
/**
|
|
321
|
+
* Get the loading promise when loading the mesh from a URL in the constructor
|
|
322
|
+
* @returns constructor loading promise or null if no URL was provided
|
|
323
|
+
*/
|
|
324
|
+
getLoadingPromise(): Promise<void> | null;
|
|
325
|
+
/**
|
|
326
|
+
* Returns the class name
|
|
327
|
+
* @returns "GaussianSplattingMeshBase"
|
|
328
|
+
*/
|
|
329
|
+
getClassName(): string;
|
|
330
|
+
/**
|
|
331
|
+
* Returns the total number of vertices (splats) within the mesh
|
|
332
|
+
* @returns the total number of vertices
|
|
333
|
+
*/
|
|
334
|
+
getTotalVertices(): number;
|
|
335
|
+
/**
|
|
336
|
+
* Is this node ready to be used/rendered
|
|
337
|
+
* @param completeCheck defines if a complete check (including materials and lights) has to be done (false by default)
|
|
338
|
+
* @returns true when ready
|
|
339
|
+
*/
|
|
340
|
+
isReady(completeCheck?: boolean): boolean;
|
|
341
|
+
_getCameraDirection(camera: Camera): Vector3;
|
|
342
|
+
/** @internal */
|
|
343
|
+
_postToWorker(forced?: boolean): void;
|
|
344
|
+
/**
|
|
345
|
+
* 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
|
|
346
|
+
* @param subMesh defines the subMesh to render
|
|
347
|
+
* @param enableAlphaMode defines if alpha mode can be changed
|
|
348
|
+
* @param effectiveMeshReplacement defines an optional mesh used to provide info for the rendering
|
|
349
|
+
* @returns the current mesh
|
|
350
|
+
*/
|
|
351
|
+
render(subMesh: SubMesh, enableAlphaMode: boolean, effectiveMeshReplacement?: AbstractMesh): Mesh;
|
|
352
|
+
private static _TypeNameToEnum;
|
|
353
|
+
private static _ValueNameToEnum;
|
|
354
|
+
/**
|
|
355
|
+
* Parse a PLY file header and returns metas infos on splats and chunks
|
|
356
|
+
* @param data the loaded buffer
|
|
357
|
+
* @returns a PLYHeader
|
|
358
|
+
*/
|
|
359
|
+
static ParseHeader(data: ArrayBuffer): PLYHeader | null;
|
|
360
|
+
private static _GetCompressedChunks;
|
|
361
|
+
private static _GetSplat;
|
|
362
|
+
/**
|
|
363
|
+
* Converts a .ply data with SH coefficients splat
|
|
364
|
+
* if data array buffer is not ply, returns the original buffer
|
|
365
|
+
* @param data the .ply data to load
|
|
366
|
+
* @param useCoroutine use coroutine and yield
|
|
367
|
+
* @returns the loaded splat buffer and optional array of sh coefficients
|
|
368
|
+
*/
|
|
369
|
+
static ConvertPLYWithSHToSplat(data: ArrayBuffer, useCoroutine?: boolean): Generator<undefined, {
|
|
370
|
+
buffer: ArrayBuffer;
|
|
371
|
+
sh?: undefined;
|
|
372
|
+
} | {
|
|
373
|
+
buffer: ArrayBuffer;
|
|
374
|
+
sh: Uint8Array<ArrayBuffer>[] | null;
|
|
375
|
+
}, unknown>;
|
|
376
|
+
/**
|
|
377
|
+
* Converts a .ply data array buffer to splat
|
|
378
|
+
* if data array buffer is not ply, returns the original buffer
|
|
379
|
+
* @param data the .ply data to load
|
|
380
|
+
* @param useCoroutine use coroutine and yield
|
|
381
|
+
* @returns the loaded splat buffer without SH coefficient, whether ply contains or not SH.
|
|
382
|
+
*/
|
|
383
|
+
static ConvertPLYToSplat(data: ArrayBuffer, useCoroutine?: boolean): Generator<undefined, ArrayBuffer, 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
|
+
* @returns the loaded splat buffer
|
|
389
|
+
*/
|
|
390
|
+
static ConvertPLYToSplatAsync(data: ArrayBuffer): Promise<ArrayBuffer>;
|
|
391
|
+
/**
|
|
392
|
+
* Converts a .ply with SH data array buffer to splat
|
|
393
|
+
* if data array buffer is not ply, returns the original buffer
|
|
394
|
+
* @param data the .ply data to load
|
|
395
|
+
* @returns the loaded splat buffer with SH
|
|
396
|
+
*/
|
|
397
|
+
static ConvertPLYWithSHToSplatAsync(data: ArrayBuffer): Promise<{
|
|
398
|
+
buffer: ArrayBuffer;
|
|
399
|
+
sh?: undefined;
|
|
400
|
+
} | {
|
|
401
|
+
buffer: ArrayBuffer;
|
|
402
|
+
sh: Uint8Array<ArrayBuffer>[] | null;
|
|
403
|
+
}>;
|
|
404
|
+
/**
|
|
405
|
+
* Loads a .splat Gaussian Splatting array buffer asynchronously
|
|
406
|
+
* @param data arraybuffer containing splat file
|
|
407
|
+
* @returns a promise that resolves when the operation is complete
|
|
408
|
+
*/
|
|
409
|
+
loadDataAsync(data: ArrayBuffer): Promise<void>;
|
|
410
|
+
/**
|
|
411
|
+
* Loads a Gaussian or Splatting file asynchronously
|
|
412
|
+
* @param url path to the splat file to load
|
|
413
|
+
* @param scene optional scene it belongs to
|
|
414
|
+
* @returns a promise that resolves when the operation is complete
|
|
415
|
+
* @deprecated Please use SceneLoader.ImportMeshAsync instead
|
|
416
|
+
*/
|
|
417
|
+
loadFileAsync(url: string, scene?: Scene): Promise<void>;
|
|
418
|
+
/**
|
|
419
|
+
* Releases resources associated with this mesh.
|
|
420
|
+
* @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)
|
|
421
|
+
*/
|
|
422
|
+
dispose(doNotRecurse?: boolean): void;
|
|
423
|
+
protected _copyTextures(source: GaussianSplattingMeshBase): void;
|
|
424
|
+
/**
|
|
425
|
+
* Returns a new Mesh object generated from the current mesh properties.
|
|
426
|
+
* @param name is a string, the name given to the new mesh
|
|
427
|
+
* @returns a new Gaussian Splatting Mesh
|
|
428
|
+
*/
|
|
429
|
+
clone(name?: string): GaussianSplattingMeshBase;
|
|
430
|
+
private static _CreateWorker;
|
|
431
|
+
protected _makeEmptySplat(index: number, covA: Uint16Array, covB: Uint16Array, colorArray: Uint8Array): void;
|
|
432
|
+
/**
|
|
433
|
+
* Processes a single splat from the source buffer (at srcIndex) and writes the result into
|
|
434
|
+
* the destination texture arrays at dstIndex. This decoupling allows addPart to feed multiple
|
|
435
|
+
* independent source buffers into a single set of destination arrays without merging them first.
|
|
436
|
+
* @param dstIndex - destination splat index (into _splatPositions, covA, covB, colorArray)
|
|
437
|
+
* @param fBuffer - float32 view of the source .splat buffer
|
|
438
|
+
* @param uBuffer - uint8 view of the source .splat buffer
|
|
439
|
+
* @param covA - destination covariancesA array
|
|
440
|
+
* @param covB - destination covariancesB array
|
|
441
|
+
* @param colorArray - destination color array
|
|
442
|
+
* @param minimum - accumulated bounding minimum (updated in-place)
|
|
443
|
+
* @param maximum - accumulated bounding maximum (updated in-place)
|
|
444
|
+
* @param flipY - whether to negate the Y position
|
|
445
|
+
* @param srcIndex - source splat index (defaults to dstIndex when omitted)
|
|
446
|
+
*/
|
|
447
|
+
protected _makeSplat(dstIndex: number, fBuffer: Float32Array, uBuffer: Uint8Array, covA: Uint16Array, covB: Uint16Array, colorArray: Uint8Array, minimum: Vector3, maximum: Vector3, flipY: boolean, srcIndex?: number): void;
|
|
448
|
+
protected _onUpdateTextures(_textureSize: Vector2): void;
|
|
449
|
+
/**
|
|
450
|
+
* Called when part index data is received during a data load. Override to store and manage
|
|
451
|
+
* part index state (e.g. allocating the padded Uint8Array).
|
|
452
|
+
* No-op in the base class.
|
|
453
|
+
* @param _partIndices - the raw part indices passed in by the caller
|
|
454
|
+
* @param _textureLength - the padded texture length (width × height) to allocate into
|
|
455
|
+
*/
|
|
456
|
+
protected _onIndexDataReceived(_partIndices: Uint8Array, _textureLength: number): void;
|
|
457
|
+
/**
|
|
458
|
+
* Called at the start of an incremental texture update, before any splats are processed.
|
|
459
|
+
* Override to perform incremental-specific setup, such as ensuring the part-index GPU texture
|
|
460
|
+
* exists before the sub-texture upload begins.
|
|
461
|
+
* No-op in the base class.
|
|
462
|
+
* @param _textureSize - current texture dimensions
|
|
463
|
+
*/
|
|
464
|
+
protected _onIncrementalUpdateStart(_textureSize: Vector2): void;
|
|
465
|
+
/**
|
|
466
|
+
* Whether this mesh is in compound mode (has at least one part added via addPart).
|
|
467
|
+
* Returns `false` in the base class; overridden to return `true` in the compound subclass.
|
|
468
|
+
* Consumed by the material and depth renderer to toggle compound-specific shader paths.
|
|
469
|
+
* @internal
|
|
470
|
+
*/
|
|
471
|
+
get isCompound(): boolean;
|
|
472
|
+
protected _setDelayedTextureUpdate(covA: Uint16Array, covB: Uint16Array, colorArray: Uint8Array, sh?: Uint8Array[]): void;
|
|
473
|
+
protected _updateTextures(covA: Uint16Array, covB: Uint16Array, colorArray: Uint8Array, sh?: Uint8Array[]): void;
|
|
474
|
+
/**
|
|
475
|
+
* Checks whether the GPU textures can be incrementally updated for a new addPart operation,
|
|
476
|
+
* avoiding a full texture re-upload for existing splats.
|
|
477
|
+
* Requires that the GPU textures already exist and the texture height won't change.
|
|
478
|
+
* @param previousVertexCount - The number of splats previously committed to GPU
|
|
479
|
+
* @param vertexCount - The new total number of splats
|
|
480
|
+
* @returns true when only the new splat region needs to be uploaded
|
|
481
|
+
*/
|
|
482
|
+
protected _canReuseCachedData(previousVertexCount: number, vertexCount: number): boolean;
|
|
483
|
+
/**
|
|
484
|
+
* Posts updated positions to the sort worker and marks the sort as dirty.
|
|
485
|
+
* Called after processing new splats so the worker can re-sort with the complete position set.
|
|
486
|
+
* Subclasses (e.g. compound) may override to additionally post part-index data.
|
|
487
|
+
*/
|
|
488
|
+
protected _notifyWorkerNewData(): void;
|
|
489
|
+
private _updateData;
|
|
490
|
+
/**
|
|
491
|
+
* Update asynchronously the buffer
|
|
492
|
+
* @param data array buffer containing center, color, orientation and scale of splats
|
|
493
|
+
* @param sh optional array of uint8 array for SH data
|
|
494
|
+
* @param partIndices optional array of uint8 for rig node indices
|
|
495
|
+
* @returns a promise
|
|
496
|
+
*/
|
|
497
|
+
updateDataAsync(data: ArrayBuffer, sh?: Uint8Array[], partIndices?: Uint8Array): Promise<void>;
|
|
498
|
+
/**
|
|
499
|
+
* @experimental
|
|
500
|
+
* Update data from GS (position, orientation, color, scaling)
|
|
501
|
+
* @param data array that contain all the datas
|
|
502
|
+
* @param sh optional array of uint8 array for SH data
|
|
503
|
+
* @param options optional informations on how to treat data (needs to be 3rd for backward compatibility)
|
|
504
|
+
* @param partIndices optional array of uint8 for rig node indices
|
|
505
|
+
*/
|
|
506
|
+
updateData(data: ArrayBuffer, sh?: Uint8Array[], options?: IUpdateOptions, partIndices?: Uint8Array): void;
|
|
507
|
+
/**
|
|
508
|
+
* Refreshes the bounding info, taking into account all the thin instances defined
|
|
509
|
+
* @returns the current Gaussian Splatting
|
|
510
|
+
*/
|
|
511
|
+
refreshBoundingInfo(): Mesh;
|
|
512
|
+
protected _updateSplatIndexBuffer(vertexCount: number): void;
|
|
513
|
+
protected _updateTextureFromData: (texture: BaseTexture, data: ArrayBufferView, width: number, lineStart: number, lineCount: number) => void;
|
|
514
|
+
protected _updateSubTextures(centers: Float32Array, covA: Uint16Array, covB: Uint16Array, colors: Uint8Array, lineStart: number, lineCount: number, sh?: Uint8Array[]): void;
|
|
515
|
+
protected _instantiateWorker(): void;
|
|
516
|
+
protected _getTextureSize(length: number): Vector2;
|
|
517
|
+
/**
|
|
518
|
+
* Called after the sort worker has been created and the initial positions message has been sent.
|
|
519
|
+
* Override in subclasses to post any additional setup messages the worker needs (e.g. group
|
|
520
|
+
* indices, per-part matrices, etc.).
|
|
521
|
+
* @param _worker the newly created worker
|
|
522
|
+
*/
|
|
523
|
+
protected _onWorkerCreated(_worker: Worker): void;
|
|
524
|
+
/**
|
|
525
|
+
* Called by the material to bind any extra shader uniforms that are specific to this mesh type.
|
|
526
|
+
* The base implementation is a no-op; override in subclasses to bind additional data.
|
|
527
|
+
* @param _effect the shader effect that is being bound
|
|
528
|
+
* @internal
|
|
529
|
+
*/
|
|
530
|
+
bindExtraEffectUniforms(_effect: Effect): void;
|
|
531
|
+
/**
|
|
532
|
+
* Processes all splats from a source GaussianSplattingMesh directly into the destination
|
|
533
|
+
* texture arrays starting at dstOffset. This is the core of the texture-direct compound API:
|
|
534
|
+
* no merged CPU buffer is ever created; each source mesh is written straight into its region.
|
|
535
|
+
*
|
|
536
|
+
* @param source - The source mesh whose splats are appended
|
|
537
|
+
* @param dstOffset - The destination splat index at which writing starts
|
|
538
|
+
* @param covA - Destination covA array (full texture size)
|
|
539
|
+
* @param covB - Destination covB array (full texture size)
|
|
540
|
+
* @param colorArray - Destination color array (full texture size)
|
|
541
|
+
* @param sh - Destination SH arrays (full texture size), or undefined
|
|
542
|
+
* @param minimum - Accumulated bounding min (updated in-place)
|
|
543
|
+
* @param maximum - Accumulated bounding max (updated in-place)
|
|
544
|
+
* @internal Use GaussianSplattingMesh.addPart instead
|
|
545
|
+
*/
|
|
546
|
+
protected _appendSourceToArrays(source: GaussianSplattingMeshBase, dstOffset: number, covA: Uint16Array, covB: Uint16Array, colorArray: Uint8Array, sh: Uint8Array[] | undefined, minimum: Vector3, maximum: Vector3): void;
|
|
547
|
+
/**
|
|
548
|
+
* Modifies the splats according to the passed transformation matrix.
|
|
549
|
+
* @param transform defines the transform matrix to use
|
|
550
|
+
* @returns the current mesh
|
|
551
|
+
*/
|
|
552
|
+
bakeTransformIntoVertices(transform: DeepImmutable<Matrix>): Mesh;
|
|
553
|
+
}
|
|
554
|
+
export {};
|