@babylonjs/core 8.49.0 → 8.49.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.
@@ -13,6 +13,8 @@ import { Scalar } from "../../Maths/math.scalar.js";
13
13
  import { runCoroutineSync, runCoroutineAsync, createYieldingScheduler } from "../../Misc/coroutine.js";
14
14
  import { EngineStore } from "../../Engines/engineStore.js";
15
15
  import { ImportMeshAsync } from "../../Loading/sceneLoader.js";
16
+ const IsNative = typeof _native !== "undefined";
17
+ const Native = IsNative ? _native : null;
16
18
  // @internal
17
19
  const UnpackUnorm = (value, bits) => {
18
20
  const t = (1 << bits) - 1;
@@ -472,7 +474,7 @@ export class GaussianSplattingMesh extends Mesh {
472
474
  });
473
475
  // sort view infos by last updated frame id: first item is the least recently updated
474
476
  activeViewInfos.sort((a, b) => a.frameIdLastUpdate - b.frameIdLastUpdate);
475
- const hasSortFunction = this._worker || (_native && _native.sortSplats) || this._disableDepthSort;
477
+ const hasSortFunction = this._worker || Native?.sortSplats || this._disableDepthSort;
476
478
  if ((forced || outdated) && hasSortFunction && (this._scene.activeCameras?.length || this._scene.activeCamera) && this._canPostToWorker) {
477
479
  // view infos sorted by least recent updated frame id
478
480
  activeViewInfos.forEach((cameraViewInfos) => {
@@ -492,8 +494,8 @@ export class GaussianSplattingMesh extends Mesh {
492
494
  cameraId: camera.uniqueId,
493
495
  }, [this._depthMix.buffer]);
494
496
  }
495
- else if (_native && _native.sortSplats) {
496
- _native.sortSplats(this._modelViewProjectionMatrix, this._splatPositions, this._splatIndex, this._scene.useRightHandedSystem);
497
+ else if (Native?.sortSplats) {
498
+ Native.sortSplats(this._modelViewProjectionMatrix, this._splatPositions, this._splatIndex, this._scene.useRightHandedSystem);
497
499
  if (cameraViewInfos.splatIndexBufferSet) {
498
500
  cameraViewInfos.mesh.thinInstanceBufferUpdated("splatIndex");
499
501
  }
@@ -1552,7 +1554,7 @@ export class GaussianSplattingMesh extends Mesh {
1552
1554
  });
1553
1555
  }
1554
1556
  // Update depthMix
1555
- if ((!this._depthMix || vertexCount > this._depthMix.length) && !_native) {
1557
+ if ((!this._depthMix || vertexCount > this._depthMix.length) && !IsNative) {
1556
1558
  this._depthMix = new BigInt64Array(paddedVertexCount);
1557
1559
  }
1558
1560
  this.forcedInstanceCount = paddedVertexCount >> 4;
@@ -1594,7 +1596,7 @@ export class GaussianSplattingMesh extends Mesh {
1594
1596
  }
1595
1597
  this._updateSplatIndexBuffer(this._vertexCount);
1596
1598
  // no worker in native
1597
- if (_native) {
1599
+ if (IsNative) {
1598
1600
  return;
1599
1601
  }
1600
1602
  // Start the worker thread