@onerjs/core 8.52.3 → 8.52.4

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.
@@ -659,10 +659,11 @@ export class GaussianSplattingMeshBase extends Mesh {
659
659
  anyDirty = true;
660
660
  continue;
661
661
  }
662
- // Also detect drift: if the world or camera state has changed since the last post,
663
- // mark dirty so the next render does not silently queue a new sort that completes
664
- // after isReady has reported true.
665
- if (this._isSortStateDirty(cameraViewInfo, worldMatrix, camera)) {
662
+ // If world matrix drifted (user applied transforms after load), re-sort before first render.
663
+ // Camera drift is intentionally excluded here: checking camera movement would cause isReady()
664
+ // to return false indefinitely while the camera is moving. The render loop handles camera
665
+ // re-sorting continuously via _postToWorker() in render().
666
+ if (this._isSortStateDirty(cameraViewInfo, worldMatrix, camera, true)) {
666
667
  anyDirty = true;
667
668
  }
668
669
  }
@@ -735,7 +736,7 @@ export class GaussianSplattingMeshBase extends Mesh {
735
736
  localDirection.normalize();
736
737
  return localDirection;
737
738
  }
738
- _isSortStateDirty(cameraViewInfo, worldMatrix, camera) {
739
+ _isSortStateDirty(cameraViewInfo, worldMatrix, camera, worldMatrixOnly = false) {
739
740
  const world = worldMatrix.m;
740
741
  const previousWorld = cameraViewInfo.sortWorldMatrix.m;
741
742
  for (let i = 0; i < previousWorld.length; i++) {
@@ -743,6 +744,9 @@ export class GaussianSplattingMeshBase extends Mesh {
743
744
  return true;
744
745
  }
745
746
  }
747
+ if (worldMatrixOnly) {
748
+ return false;
749
+ }
746
750
  const cameraViewMatrix = camera.getViewMatrix();
747
751
  if (!Scalar.WithinEpsilon(cameraViewInfo.sortCameraForward.x, cameraViewMatrix.m[2], this.viewUpdateThreshold) ||
748
752
  !Scalar.WithinEpsilon(cameraViewInfo.sortCameraForward.y, cameraViewMatrix.m[6], this.viewUpdateThreshold) ||
@@ -2294,9 +2298,14 @@ export class GaussianSplattingMeshBase extends Mesh {
2294
2298
  const vertexCountPadded = (this._vertexCount + 15) & ~0xf;
2295
2299
  // If the vertex count changed, we discard this result and trigger a new sort
2296
2300
  if (e.data.depthMix.length != vertexCountPadded) {
2297
- this._canPostToWorker = true;
2298
- this._postToWorker(true);
2299
- this._sortIsDirty = false;
2301
+ // Only re-enable posting and trigger a re-sort if the buffer is available.
2302
+ // If byteLength === 0 the buffer is already in-flight for a newer sort;
2303
+ // that sort's onmessage will handle things when it returns.
2304
+ if (this._depthMix.buffer.byteLength > 0) {
2305
+ this._canPostToWorker = true;
2306
+ this._postToWorker(true);
2307
+ this._sortIsDirty = false;
2308
+ }
2300
2309
  return;
2301
2310
  }
2302
2311
  this._depthMix = e.data.depthMix;