@onerjs/core 8.52.3 → 8.52.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.
Files changed (50) hide show
  1. package/Cameras/arcRotateCamera.pure.d.ts +6 -0
  2. package/Cameras/arcRotateCamera.pure.js +13 -0
  3. package/Cameras/arcRotateCamera.pure.js.map +1 -1
  4. package/FrameGraph/Node/Blocks/Layers/selectionOutlineLayerBlock.pure.d.ts +3 -0
  5. package/FrameGraph/Node/Blocks/Layers/selectionOutlineLayerBlock.pure.js +16 -1
  6. package/FrameGraph/Node/Blocks/Layers/selectionOutlineLayerBlock.pure.js.map +1 -1
  7. package/FrameGraph/Tasks/Layers/selectionOutlineTask.d.ts +2 -1
  8. package/FrameGraph/Tasks/Layers/selectionOutlineTask.js +5 -2
  9. package/FrameGraph/Tasks/Layers/selectionOutlineTask.js.map +1 -1
  10. package/Layers/selectionOutlineLayer.pure.d.ts +9 -2
  11. package/Layers/selectionOutlineLayer.pure.js +29 -6
  12. package/Layers/selectionOutlineLayer.pure.js.map +1 -1
  13. package/Layers/thinEffectLayer.d.ts +1 -0
  14. package/Layers/thinEffectLayer.js +7 -4
  15. package/Layers/thinEffectLayer.js.map +1 -1
  16. package/Layers/thinSelectionOutlineLayer.d.ts +17 -3
  17. package/Layers/thinSelectionOutlineLayer.js +82 -17
  18. package/Layers/thinSelectionOutlineLayer.js.map +1 -1
  19. package/Materials/PBR/openpbrMaterial.pure.d.ts +13 -0
  20. package/Materials/PBR/openpbrMaterial.pure.js +17 -0
  21. package/Materials/PBR/openpbrMaterial.pure.js.map +1 -1
  22. package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.pure.d.ts +2 -1
  23. package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.pure.js +3 -2
  24. package/Meshes/GaussianSplatting/gaussianSplattingCompoundMesh.pure.js.map +1 -1
  25. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.d.ts +32 -2
  26. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js +180 -22
  27. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js.map +1 -1
  28. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +12 -10
  29. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +37 -13
  30. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
  31. package/Meshes/abstractMesh.pure.d.ts +21 -2
  32. package/Meshes/abstractMesh.pure.js +55 -8
  33. package/Meshes/abstractMesh.pure.js.map +1 -1
  34. package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js +12 -1
  35. package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js.map +1 -1
  36. package/Rendering/geometryBufferRenderer.pure.js +8 -0
  37. package/Rendering/geometryBufferRenderer.pure.js.map +1 -1
  38. package/Rendering/objectRenderer.js +4 -2
  39. package/Rendering/objectRenderer.js.map +1 -1
  40. package/Shaders/gaussianSplattingVoxel.vertex.js +1 -0
  41. package/Shaders/gaussianSplattingVoxel.vertex.js.map +1 -1
  42. package/Shaders/selectionOutline.fragment.js +16 -4
  43. package/Shaders/selectionOutline.fragment.js.map +1 -1
  44. package/ShadersWGSL/ShadersInclude/openpbrBaseLayerData.js +2 -3
  45. package/ShadersWGSL/ShadersInclude/openpbrBaseLayerData.js.map +1 -1
  46. package/ShadersWGSL/gaussianSplattingVoxel.vertex.js +1 -0
  47. package/ShadersWGSL/gaussianSplattingVoxel.vertex.js.map +1 -1
  48. package/ShadersWGSL/selectionOutline.fragment.js +14 -2
  49. package/ShadersWGSL/selectionOutline.fragment.js.map +1 -1
  50. package/package.json +1 -1
@@ -352,7 +352,7 @@ export class GaussianSplattingMeshBase extends Mesh {
352
352
  this._needsRotationScaleTextures = value;
353
353
  if (value && this._covariancesATexture) {
354
354
  if (this._splatsData) {
355
- this.updateData(this._splatsData, this._shData ?? undefined, { flipY: false });
355
+ this.updateData(this._splatsData, this._shData ?? undefined, { flipY: false }, undefined, this._shDegree);
356
356
  }
357
357
  else {
358
358
  Logger.Error("GaussianSplattingMeshBase: needsRotationScaleTextures was enabled after the mesh was already loaded, but the splat data is not kept in RAM. " +
@@ -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) ||
@@ -1570,10 +1574,7 @@ export class GaussianSplattingMeshBase extends Mesh {
1570
1574
  const width = engine.getCaps().maxTextureSize;
1571
1575
  const height = Math.ceil(splatCount / width);
1572
1576
  // create array for the number of textures needed.
1573
- for (let textureIndex = 0; textureIndex < textureCount; textureIndex++) {
1574
- const texture = new Uint8Array(height * width * 4 * 4); // 4 components per texture, 4 sh per component
1575
- sh.push(texture);
1576
- }
1577
+ sh = AllocateShBuffers(textureCount, height * width * 4 * 4);
1577
1578
  for (let i = 0; i < splatCount; i++) {
1578
1579
  for (let shIndexWrite = 0; shIndexWrite < header.shCoefficientCount; shIndexWrite++) {
1579
1580
  const shValue = ubuf[shIndexRead++];
@@ -2294,9 +2295,14 @@ export class GaussianSplattingMeshBase extends Mesh {
2294
2295
  const vertexCountPadded = (this._vertexCount + 15) & ~0xf;
2295
2296
  // If the vertex count changed, we discard this result and trigger a new sort
2296
2297
  if (e.data.depthMix.length != vertexCountPadded) {
2297
- this._canPostToWorker = true;
2298
- this._postToWorker(true);
2299
- this._sortIsDirty = false;
2298
+ // Only re-enable posting and trigger a re-sort if the buffer is available.
2299
+ // If byteLength === 0 the buffer is already in-flight for a newer sort;
2300
+ // that sort's onmessage will handle things when it returns.
2301
+ if (this._depthMix.buffer.byteLength > 0) {
2302
+ this._canPostToWorker = true;
2303
+ this._postToWorker(true);
2304
+ this._sortIsDirty = false;
2305
+ }
2300
2306
  return;
2301
2307
  }
2302
2308
  this._depthMix = e.data.depthMix;
@@ -2571,4 +2577,22 @@ GaussianSplattingMeshBase._CreateWorker = function (self) {
2571
2577
  }
2572
2578
  };
2573
2579
  };
2580
+ /**
2581
+ * Allocates SH texture buffers pre-filled with 128 (the neutral encoding of ~0.0 in the
2582
+ * shader's decompose() function). Padding bytes beyond the actual coefficients in the last
2583
+ * texture are read as higher-order SH bands when the mesh is added to a compound with a
2584
+ * higher degree; zero would decode to -1.0 instead, producing wrong colors.
2585
+ * @param textureCount number of SH textures to allocate
2586
+ * @param bytesEach byte size of each texture buffer
2587
+ * @returns array of initialized Uint8Array buffers
2588
+ */
2589
+ export function AllocateShBuffers(textureCount, bytesEach) {
2590
+ const result = [];
2591
+ for (let i = 0; i < textureCount; i++) {
2592
+ const arr = new Uint8Array(bytesEach);
2593
+ arr.fill(128);
2594
+ result.push(arr);
2595
+ }
2596
+ return result;
2597
+ }
2574
2598
  //# sourceMappingURL=gaussianSplattingMeshBase.pure.js.map