@babylonjs/core 8.45.3 → 8.45.5
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/AudioV2/webAudio/components/webAudioParameterComponent.js +5 -1
- package/AudioV2/webAudio/components/webAudioParameterComponent.js.map +1 -1
- package/Cameras/touchCamera.js +1 -1
- package/Cameras/touchCamera.js.map +1 -1
- package/Engines/AbstractEngine/abstractEngine.loadFile.d.ts +11 -0
- package/Engines/AbstractEngine/abstractEngine.loadFile.js +12 -0
- package/Engines/AbstractEngine/abstractEngine.loadFile.js.map +1 -0
- package/Engines/AbstractEngine/abstractEngine.textureLoaders.d.ts +1 -0
- package/Engines/AbstractEngine/abstractEngine.textureLoaders.js +4 -0
- package/Engines/AbstractEngine/abstractEngine.textureLoaders.js.map +1 -0
- package/Engines/AbstractEngine/index.d.ts +2 -0
- package/Engines/AbstractEngine/index.js +2 -0
- package/Engines/AbstractEngine/index.js.map +1 -1
- package/Engines/Native/Extensions/index.d.ts +1 -0
- package/Engines/Native/Extensions/index.js +2 -0
- package/Engines/Native/Extensions/index.js.map +1 -0
- package/Engines/Native/Extensions/nativeEngine.cubeTexture.d.ts +27 -0
- package/Engines/Native/Extensions/nativeEngine.cubeTexture.js +96 -0
- package/Engines/Native/Extensions/nativeEngine.cubeTexture.js.map +1 -0
- package/Engines/Native/nativeHelpers.js +7 -0
- package/Engines/Native/nativeHelpers.js.map +1 -1
- package/Engines/Native/nativeInterfaces.d.ts +2 -0
- package/Engines/Native/nativeInterfaces.js.map +1 -1
- package/Engines/Native/nativePipelineContext.d.ts +2 -2
- package/Engines/Native/nativePipelineContext.js.map +1 -1
- package/Engines/Native/nativeRenderTargetWrapper.d.ts +3 -3
- package/Engines/Native/nativeRenderTargetWrapper.js.map +1 -1
- package/Engines/Native/validatedNativeDataStream.js +2 -2
- package/Engines/Native/validatedNativeDataStream.js.map +1 -1
- package/Engines/abstractEngine.d.ts +9 -0
- package/Engines/abstractEngine.js +13 -4
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/engine.d.ts +2 -6
- package/Engines/engine.js +2 -13
- package/Engines/engine.js.map +1 -1
- package/Engines/index.d.ts +1 -0
- package/Engines/index.js +1 -0
- package/Engines/index.js.map +1 -1
- package/Engines/nativeEngine.d.ts +19 -536
- package/Engines/nativeEngine.js +27 -2127
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/nullEngine.d.ts +2 -0
- package/Engines/nullEngine.js +2 -0
- package/Engines/nullEngine.js.map +1 -1
- package/Engines/thinNativeEngine.d.ts +537 -0
- package/Engines/thinNativeEngine.js +2033 -0
- package/Engines/thinNativeEngine.js.map +1 -0
- package/Engines/webgpuEngine.d.ts +2 -0
- package/Engines/webgpuEngine.js +2 -0
- package/Engines/webgpuEngine.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraph.d.ts +0 -5
- package/FrameGraph/Node/nodeRenderGraph.js +0 -7
- package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
- package/FrameGraph/frameGraph.d.ts +0 -6
- package/FrameGraph/frameGraph.js +0 -23
- package/FrameGraph/frameGraph.js.map +1 -1
- package/FrameGraph/frameGraphObjectList.d.ts +0 -1
- package/FrameGraph/frameGraphObjectList.js +0 -1
- package/FrameGraph/frameGraphObjectList.js.map +1 -1
- package/FrameGraph/frameGraphRenderContext.d.ts +0 -1
- package/FrameGraph/frameGraphRenderContext.js +0 -1
- package/FrameGraph/frameGraphRenderContext.js.map +1 -1
- package/FrameGraph/frameGraphRenderTarget.d.ts +0 -1
- package/FrameGraph/frameGraphRenderTarget.js +0 -1
- package/FrameGraph/frameGraphRenderTarget.js.map +1 -1
- package/FrameGraph/frameGraphTask.d.ts +0 -1
- package/FrameGraph/frameGraphTask.js +0 -1
- package/FrameGraph/frameGraphTask.js.map +1 -1
- package/FrameGraph/frameGraphTextureManager.d.ts +0 -1
- package/FrameGraph/frameGraphTextureManager.js +0 -1
- package/FrameGraph/frameGraphTextureManager.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +6 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +100 -41
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
- package/Misc/tools.d.ts +3 -1
- package/Misc/tools.js +76 -59
- package/Misc/tools.js.map +1 -1
- package/Particles/Node/Blocks/Update/updateFlowMapBlock.d.ts +4 -14
- package/Particles/Node/Blocks/Update/updateFlowMapBlock.js +9 -27
- package/Particles/Node/Blocks/Update/updateFlowMapBlock.js.map +1 -1
- package/Particles/Node/Blocks/index.d.ts +2 -0
- package/Particles/Node/Blocks/index.js +2 -0
- package/Particles/Node/Blocks/index.js.map +1 -1
- package/Particles/Node/Blocks/particleClampBlock.d.ts +42 -0
- package/Particles/Node/Blocks/particleClampBlock.js +114 -0
- package/Particles/Node/Blocks/particleClampBlock.js.map +1 -0
- package/Particles/Node/Blocks/particleVectorMathBlock.d.ts +3 -7
- package/Particles/Node/Blocks/particleVectorMathBlock.js +15 -32
- package/Particles/Node/Blocks/particleVectorMathBlock.js.map +1 -1
- package/Particles/Node/Blocks/systemBlock.d.ts +4 -0
- package/Particles/Node/Blocks/systemBlock.js +9 -1
- package/Particles/Node/Blocks/systemBlock.js.map +1 -1
- package/Particles/Node/nodeParticleSystemSet.helper.js +62 -4
- package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
- package/Particles/baseParticleSystem.d.ts +7 -0
- package/Particles/baseParticleSystem.js +7 -0
- package/Particles/baseParticleSystem.js.map +1 -1
- package/Particles/particleSystem.d.ts +12 -0
- package/Particles/particleSystem.js +12 -0
- package/Particles/particleSystem.js.map +1 -1
- package/Particles/thinParticleSystem.d.ts +10 -0
- package/Particles/thinParticleSystem.js +10 -1
- package/Particles/thinParticleSystem.js.map +1 -1
- package/XR/native/nativeXRFrame.js +1 -1
- package/XR/native/nativeXRFrame.js.map +1 -1
- package/package.json +1 -1
|
@@ -161,6 +161,24 @@ var PLYValue;
|
|
|
161
161
|
* Class used to render a gaussian splatting mesh
|
|
162
162
|
*/
|
|
163
163
|
export class GaussianSplattingMesh extends Mesh {
|
|
164
|
+
/**
|
|
165
|
+
* If true, disables depth sorting of the splats (default: false)
|
|
166
|
+
*/
|
|
167
|
+
get disableDepthSort() {
|
|
168
|
+
return this._disableDepthSort;
|
|
169
|
+
}
|
|
170
|
+
set disableDepthSort(value) {
|
|
171
|
+
if (!this._disableDepthSort && value) {
|
|
172
|
+
this._worker?.terminate();
|
|
173
|
+
this._worker = null;
|
|
174
|
+
this._disableDepthSort = true;
|
|
175
|
+
}
|
|
176
|
+
else if (this._disableDepthSort && !value) {
|
|
177
|
+
this._disableDepthSort = false;
|
|
178
|
+
this._sortIsDirty = true;
|
|
179
|
+
this._instanciateWorker();
|
|
180
|
+
}
|
|
181
|
+
}
|
|
164
182
|
/**
|
|
165
183
|
* View direction factor used to compute the SH view direction in the shader.
|
|
166
184
|
* @deprecated Not used anymore for SH rendering
|
|
@@ -297,6 +315,7 @@ export class GaussianSplattingMesh extends Mesh {
|
|
|
297
315
|
this._sortIsDirty = false;
|
|
298
316
|
this._shDegree = 0;
|
|
299
317
|
this._cameraViewInfos = new Map();
|
|
318
|
+
this._disableDepthSort = false;
|
|
300
319
|
this._loadingPromise = null;
|
|
301
320
|
this.subMeshes = [];
|
|
302
321
|
new SubMesh(0, 0, 4 * GaussianSplattingMesh._BatchSize, 0, 6 * GaussianSplattingMesh._BatchSize, this);
|
|
@@ -378,38 +397,39 @@ export class GaussianSplattingMesh extends Mesh {
|
|
|
378
397
|
outdated = true;
|
|
379
398
|
}
|
|
380
399
|
});
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
400
|
+
// array of cameras used for rendering
|
|
401
|
+
const cameras = this._scene.activeCameras?.length ? this._scene.activeCameras : [this._scene.activeCamera];
|
|
402
|
+
// list view infos for active cameras
|
|
403
|
+
const activeViewInfos = [];
|
|
404
|
+
cameras.forEach((camera) => {
|
|
405
|
+
const cameraId = camera.uniqueId;
|
|
406
|
+
const cameraViewInfos = this._cameraViewInfos.get(cameraId);
|
|
407
|
+
if (cameraViewInfos) {
|
|
408
|
+
activeViewInfos.push(cameraViewInfos);
|
|
409
|
+
}
|
|
410
|
+
else {
|
|
411
|
+
// mesh doesn't exist yet for this camera
|
|
412
|
+
const cameraMesh = new Mesh(this.name + "_cameraMesh_" + cameraId, this._scene);
|
|
413
|
+
// not visible with inspector or the scene graph
|
|
414
|
+
cameraMesh.reservedDataStore = { hidden: true };
|
|
415
|
+
cameraMesh.setEnabled(false);
|
|
416
|
+
cameraMesh.material = this.material;
|
|
417
|
+
GaussianSplattingMesh._MakeSplatGeometryForMesh(cameraMesh);
|
|
418
|
+
const newViewInfos = {
|
|
419
|
+
camera: camera,
|
|
420
|
+
cameraDirection: new Vector3(0, 0, 0),
|
|
421
|
+
mesh: cameraMesh,
|
|
422
|
+
frameIdLastUpdate: frameId,
|
|
423
|
+
splatIndexBufferSet: false,
|
|
424
|
+
};
|
|
425
|
+
activeViewInfos.push(newViewInfos);
|
|
426
|
+
this._cameraViewInfos.set(cameraId, newViewInfos);
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
// sort view infos by last updated frame id: first item is the least recently updated
|
|
430
|
+
activeViewInfos.sort((a, b) => a.frameIdLastUpdate - b.frameIdLastUpdate);
|
|
431
|
+
const hasSortFunction = this._worker || (_native && _native.sortSplats) || this._disableDepthSort;
|
|
432
|
+
if ((forced || outdated) && hasSortFunction && (this._scene.activeCameras?.length || this._scene.activeCamera) && this._canPostToWorker) {
|
|
413
433
|
// view infos sorted by least recent updated frame id
|
|
414
434
|
activeViewInfos.forEach((cameraViewInfos) => {
|
|
415
435
|
const camera = cameraViewInfos.camera;
|
|
@@ -420,14 +440,38 @@ export class GaussianSplattingMesh extends Mesh {
|
|
|
420
440
|
cameraViewInfos.cameraDirection.copyFrom(cameraDirection);
|
|
421
441
|
cameraViewInfos.frameIdLastUpdate = frameId;
|
|
422
442
|
this._canPostToWorker = false;
|
|
423
|
-
this._worker
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
443
|
+
if (this._worker) {
|
|
444
|
+
this._worker.postMessage({
|
|
445
|
+
view: this._modelViewMatrix.m,
|
|
446
|
+
depthMix: this._depthMix,
|
|
447
|
+
useRightHandedSystem: this._scene.useRightHandedSystem,
|
|
448
|
+
cameraId: camera.uniqueId,
|
|
449
|
+
}, [this._depthMix.buffer]);
|
|
450
|
+
}
|
|
451
|
+
else if (_native && _native.sortSplats) {
|
|
452
|
+
_native.sortSplats(this._modelViewMatrix, this._splatPositions, this._splatIndex, this._scene.useRightHandedSystem);
|
|
453
|
+
if (cameraViewInfos.splatIndexBufferSet) {
|
|
454
|
+
cameraViewInfos.mesh.thinInstanceBufferUpdated("splatIndex");
|
|
455
|
+
}
|
|
456
|
+
else {
|
|
457
|
+
cameraViewInfos.mesh.thinInstanceSetBuffer("splatIndex", this._splatIndex, 16, false);
|
|
458
|
+
cameraViewInfos.splatIndexBufferSet = true;
|
|
459
|
+
}
|
|
460
|
+
this._canPostToWorker = true;
|
|
461
|
+
this._readyToDisplay = true;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
else if (this._disableDepthSort) {
|
|
467
|
+
activeViewInfos.forEach((cameraViewInfos) => {
|
|
468
|
+
if (!cameraViewInfos.splatIndexBufferSet) {
|
|
469
|
+
cameraViewInfos.mesh.thinInstanceSetBuffer("splatIndex", this._splatIndex, 16, false);
|
|
470
|
+
cameraViewInfos.splatIndexBufferSet = true;
|
|
429
471
|
}
|
|
430
472
|
});
|
|
473
|
+
this._canPostToWorker = true;
|
|
474
|
+
this._readyToDisplay = true;
|
|
431
475
|
}
|
|
432
476
|
}
|
|
433
477
|
/**
|
|
@@ -1176,6 +1220,7 @@ export class GaussianSplattingMesh extends Mesh {
|
|
|
1176
1220
|
newGS._modelViewMatrix = Matrix.Identity();
|
|
1177
1221
|
newGS._splatPositions = this._splatPositions;
|
|
1178
1222
|
newGS._readyToDisplay = false;
|
|
1223
|
+
newGS._disableDepthSort = this._disableDepthSort;
|
|
1179
1224
|
newGS._instanciateWorker();
|
|
1180
1225
|
const binfo = this.getBoundingInfo();
|
|
1181
1226
|
newGS.getBoundingInfo().reConstruct(binfo.minimum, binfo.maximum, this.getWorldMatrix());
|
|
@@ -1259,7 +1304,9 @@ export class GaussianSplattingMesh extends Mesh {
|
|
|
1259
1304
|
this._delayedTextureUpdate = { covA: covA, covB: covB, colors: colorArray, centers: this._splatPositions, sh: sh };
|
|
1260
1305
|
const positions = Float32Array.from(this._splatPositions);
|
|
1261
1306
|
const vertexCount = this._vertexCount;
|
|
1262
|
-
this._worker
|
|
1307
|
+
if (this._worker) {
|
|
1308
|
+
this._worker.postMessage({ positions, vertexCount }, [positions.buffer]);
|
|
1309
|
+
}
|
|
1263
1310
|
this._postToWorker(true);
|
|
1264
1311
|
}
|
|
1265
1312
|
else {
|
|
@@ -1330,7 +1377,9 @@ export class GaussianSplattingMesh extends Mesh {
|
|
|
1330
1377
|
// sort will be dirty here as just finished filled positions will not be sorted
|
|
1331
1378
|
const positions = Float32Array.from(this._splatPositions);
|
|
1332
1379
|
const vertexCount = this._vertexCount;
|
|
1333
|
-
this._worker
|
|
1380
|
+
if (this._worker) {
|
|
1381
|
+
this._worker.postMessage({ positions, vertexCount }, [positions.buffer]);
|
|
1382
|
+
}
|
|
1334
1383
|
this._sortIsDirty = true;
|
|
1335
1384
|
}
|
|
1336
1385
|
else {
|
|
@@ -1386,6 +1435,9 @@ export class GaussianSplattingMesh extends Mesh {
|
|
|
1386
1435
|
const paddedVertexCount = (vertexCount + 15) & ~0xf;
|
|
1387
1436
|
if (!this._splatIndex || vertexCount > this._splatIndex.length) {
|
|
1388
1437
|
this._splatIndex = new Float32Array(paddedVertexCount);
|
|
1438
|
+
for (let i = 0; i < paddedVertexCount; i++) {
|
|
1439
|
+
this._splatIndex[i] = i;
|
|
1440
|
+
}
|
|
1389
1441
|
// update meshes for knowns cameras
|
|
1390
1442
|
this._cameraViewInfos.forEach((cameraViewInfos) => {
|
|
1391
1443
|
cameraViewInfos.mesh.thinInstanceSetBuffer("splatIndex", this._splatIndex, 16, false);
|
|
@@ -1421,7 +1473,14 @@ export class GaussianSplattingMesh extends Mesh {
|
|
|
1421
1473
|
if (!this._vertexCount) {
|
|
1422
1474
|
return;
|
|
1423
1475
|
}
|
|
1476
|
+
if (this._disableDepthSort) {
|
|
1477
|
+
return;
|
|
1478
|
+
}
|
|
1424
1479
|
this._updateSplatIndexBuffer(this._vertexCount);
|
|
1480
|
+
// no worker in native
|
|
1481
|
+
if (_native) {
|
|
1482
|
+
return;
|
|
1483
|
+
}
|
|
1425
1484
|
// Start the worker thread
|
|
1426
1485
|
this._worker?.terminate();
|
|
1427
1486
|
this._worker = new Worker(URL.createObjectURL(new Blob(["(", GaussianSplattingMesh._CreateWorker.toString(), ")(self)"], {
|
|
@@ -1512,7 +1571,7 @@ GaussianSplattingMesh._CreateWorker = function (self) {
|
|
|
1512
1571
|
else {
|
|
1513
1572
|
const cameraId = e.data.cameraId;
|
|
1514
1573
|
const viewProj = e.data.view;
|
|
1515
|
-
const vertexCountPadded = (positions.length + 15) & ~0xf;
|
|
1574
|
+
const vertexCountPadded = (positions.length / 4 + 15) & ~0xf;
|
|
1516
1575
|
if (!positions || !viewProj) {
|
|
1517
1576
|
// Sanity check, it shouldn't happen!
|
|
1518
1577
|
throw new Error("positions or view is not defined!");
|