@onerjs/core 8.44.9 → 8.45.1

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 (77) hide show
  1. package/Engines/engine.d.ts +25 -0
  2. package/Engines/thinEngine.js +2 -0
  3. package/Engines/thinEngine.js.map +1 -1
  4. package/Gizmos/boundingBoxGizmo.d.ts +2 -0
  5. package/Gizmos/boundingBoxGizmo.js +56 -7
  6. package/Gizmos/boundingBoxGizmo.js.map +1 -1
  7. package/Layers/thinEffectLayer.js +1 -2
  8. package/Layers/thinEffectLayer.js.map +1 -1
  9. package/Materials/Textures/renderTargetTexture.d.ts +2 -2
  10. package/Materials/Textures/renderTargetTexture.js +2 -2
  11. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  12. package/Misc/stringTools.js +20 -14
  13. package/Misc/stringTools.js.map +1 -1
  14. package/Misc/thinMinMaxReducer.js +4 -3
  15. package/Misc/thinMinMaxReducer.js.map +1 -1
  16. package/PostProcesses/thinAnaglyphPostProcess.js +2 -2
  17. package/PostProcesses/thinAnaglyphPostProcess.js.map +1 -1
  18. package/PostProcesses/thinBlackAndWhitePostProcess.js +2 -2
  19. package/PostProcesses/thinBlackAndWhitePostProcess.js.map +1 -1
  20. package/PostProcesses/thinBloomMergePostProcess.js +2 -2
  21. package/PostProcesses/thinBloomMergePostProcess.js.map +1 -1
  22. package/PostProcesses/thinBlurPostProcess.js +2 -2
  23. package/PostProcesses/thinBlurPostProcess.js.map +1 -1
  24. package/PostProcesses/thinChromaticAberrationPostProcess.js +2 -2
  25. package/PostProcesses/thinChromaticAberrationPostProcess.js.map +1 -1
  26. package/PostProcesses/thinCircleOfConfusionPostProcess.js +2 -2
  27. package/PostProcesses/thinCircleOfConfusionPostProcess.js.map +1 -1
  28. package/PostProcesses/thinConvolutionPostProcess.js +2 -2
  29. package/PostProcesses/thinConvolutionPostProcess.js.map +1 -1
  30. package/PostProcesses/thinCustomPostProcess.js +2 -2
  31. package/PostProcesses/thinCustomPostProcess.js.map +1 -1
  32. package/PostProcesses/thinDepthOfFieldMergePostProcess.js +2 -2
  33. package/PostProcesses/thinDepthOfFieldMergePostProcess.js.map +1 -1
  34. package/PostProcesses/thinExtractHighlightsPostProcess.js +2 -2
  35. package/PostProcesses/thinExtractHighlightsPostProcess.js.map +1 -1
  36. package/PostProcesses/thinFXAAPostProcess.js +2 -2
  37. package/PostProcesses/thinFXAAPostProcess.js.map +1 -1
  38. package/PostProcesses/thinFilterPostProcess.js +2 -2
  39. package/PostProcesses/thinFilterPostProcess.js.map +1 -1
  40. package/PostProcesses/thinGrainPostProcess.js +2 -2
  41. package/PostProcesses/thinGrainPostProcess.js.map +1 -1
  42. package/PostProcesses/thinImageProcessingPostProcess.js +1 -2
  43. package/PostProcesses/thinImageProcessingPostProcess.js.map +1 -1
  44. package/PostProcesses/thinPassPostProcess.js +4 -4
  45. package/PostProcesses/thinPassPostProcess.js.map +1 -1
  46. package/PostProcesses/thinSSAO2BlurPostProcess.js +2 -2
  47. package/PostProcesses/thinSSAO2BlurPostProcess.js.map +1 -1
  48. package/PostProcesses/thinSSAO2CombinePostProcess.js +2 -2
  49. package/PostProcesses/thinSSAO2CombinePostProcess.js.map +1 -1
  50. package/PostProcesses/thinSSRBlurCombinerPostProcess.js +2 -2
  51. package/PostProcesses/thinSSRBlurCombinerPostProcess.js.map +1 -1
  52. package/PostProcesses/thinSSRBlurPostProcess.js +2 -2
  53. package/PostProcesses/thinSSRBlurPostProcess.js.map +1 -1
  54. package/PostProcesses/thinScreenSpaceCurvaturePostProcess.js +2 -2
  55. package/PostProcesses/thinScreenSpaceCurvaturePostProcess.js.map +1 -1
  56. package/PostProcesses/thinSharpenPostProcess.js +2 -2
  57. package/PostProcesses/thinSharpenPostProcess.js.map +1 -1
  58. package/PostProcesses/thinTonemapPostProcess.js +2 -2
  59. package/PostProcesses/thinTonemapPostProcess.js.map +1 -1
  60. package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +2 -3
  61. package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
  62. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js +1 -2
  63. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js.map +1 -1
  64. package/Rendering/iblCdfGenerator.js +1 -2
  65. package/Rendering/iblCdfGenerator.js.map +1 -1
  66. package/Rendering/objectRenderer.d.ts +8 -2
  67. package/Rendering/objectRenderer.js +8 -2
  68. package/Rendering/objectRenderer.js.map +1 -1
  69. package/XR/features/WebXRControllerPointerSelection.d.ts +25 -0
  70. package/XR/features/WebXRControllerPointerSelection.js +76 -0
  71. package/XR/features/WebXRControllerPointerSelection.js.map +1 -1
  72. package/XR/features/WebXRControllerTeleportation.d.ts +13 -0
  73. package/XR/features/WebXRControllerTeleportation.js +38 -11
  74. package/XR/features/WebXRControllerTeleportation.js.map +1 -1
  75. package/package.json +1 -1
  76. package/scene.js +6 -0
  77. package/scene.js.map +1 -1
@@ -144,6 +144,8 @@ export declare class BoundingBoxGizmo extends Gizmo implements IBoundingBoxGizmo
144
144
  private _tmpRotationMatrix;
145
145
  private _incrementalStartupValue;
146
146
  private _incrementalAnchorStartupValue;
147
+ private _isCenterScaleModeActive;
148
+ private _centerScaleKeyObserver;
147
149
  /**
148
150
  * If child meshes should be ignored when calculating the bounding box. This should be set to true to avoid perf hits with heavily nested meshes (Default: false)
149
151
  */
@@ -12,6 +12,7 @@ import { PivotTools } from "../Misc/pivotTools.js";
12
12
  import { Color3 } from "../Maths/math.color.js";
13
13
  import { Epsilon } from "../Maths/math.constants.js";
14
14
  import { TransformNode } from "../Meshes/transformNode.js";
15
+ import { KeyboardEventTypes } from "../Events/keyboardEvents.js";
15
16
  /**
16
17
  * Dragging operation in observable
17
18
  */
@@ -125,6 +126,8 @@ export class BoundingBoxGizmo extends Gizmo {
125
126
  this._tmpRotationMatrix = new Matrix();
126
127
  this._incrementalStartupValue = Vector3.Zero();
127
128
  this._incrementalAnchorStartupValue = Vector3.Zero();
129
+ this._isCenterScaleModeActive = false;
130
+ this._centerScaleKeyObserver = null;
128
131
  /**
129
132
  * If child meshes should be ignored when calculating the bounding box. This should be set to true to avoid perf hits with heavily nested meshes (Default: false)
130
133
  */
@@ -388,6 +391,9 @@ export class BoundingBoxGizmo extends Gizmo {
388
391
  scaleBoxesDragBehavior.moveAttached = false;
389
392
  let totalRelativeDragDistance = 0;
390
393
  let previousScale = 0;
394
+ const initialAnchorCenter = new Vector3();
395
+ const initialBoxPosition = new Vector3();
396
+ const initialMeshAbsolutePosition = new Vector3();
391
397
  box.addBehavior(scaleBoxesDragBehavior);
392
398
  scaleBoxesDragBehavior.onDragObservable.add((event) => {
393
399
  this.onScaleBoxDragObservable.notifyObservers({ dragOperation: 1 /* DragOperation.Scaling */, dragAxis: new Vector3(i - 1, j - 1, k - 1) });
@@ -420,7 +426,12 @@ export class BoundingBoxGizmo extends Gizmo {
420
426
  fullScale.multiplyInPlace(this._axisFactor);
421
427
  fullScale.addInPlace(this._incrementalStartupValue);
422
428
  this.updateBoundingBox();
423
- if (this.scalePivot) {
429
+ if (this._isCenterScaleModeActive) {
430
+ // Use the original bounding box center captured at drag start so the pivot
431
+ // stays fixed when the modifier is toggled mid-drag
432
+ this._anchorMesh.position.copyFrom(initialAnchorCenter);
433
+ }
434
+ else if (this.scalePivot) {
424
435
  this.attachedMesh.getWorldMatrix().getRotationMatrixToRef(this._tmpRotationMatrix);
425
436
  // Move anchor to desired pivot point (Bottom left corner + dimension/2)
426
437
  this._boundingDimensions.scaleToRef(0.5, this._tmpVector);
@@ -431,13 +442,20 @@ export class BoundingBoxGizmo extends Gizmo {
431
442
  this._anchorMesh.position.addInPlace(this._tmpVector);
432
443
  }
433
444
  else {
434
- // Scale from the position of the opposite corner
435
- box.absolutePosition.subtractToRef(this._anchorMesh.position, this._tmpVector);
436
- this._anchorMesh.position.subtractInPlace(this._tmpVector);
445
+ // Scale from the original opposite corner (2*initialCenter - initialBoxPos)
446
+ // so toggling modes mid-drag always references the same fixed point
447
+ initialAnchorCenter.scaleToRef(2, this._tmpVector);
448
+ this._tmpVector.subtractInPlace(initialBoxPosition);
449
+ this._anchorMesh.position.copyFrom(this._tmpVector);
437
450
  if (this.attachedMesh.isUsingPivotMatrix()) {
438
451
  this._anchorMesh.position.subtractInPlace(this.attachedMesh.getPivotPoint());
439
452
  }
440
453
  }
454
+ // Reset mesh and anchor to drag-start state each frame so the pivot-scale
455
+ // computation is non-iterative; mid-drag mode toggles won't cause jumps
456
+ this.attachedMesh.setAbsolutePosition(initialMeshAbsolutePosition);
457
+ this.attachedMesh.scaling.copyFrom(this._incrementalStartupValue);
458
+ this._anchorMesh.scaling.copyFrom(this._incrementalAnchorStartupValue);
441
459
  this._anchorMesh.addChild(this.attachedMesh);
442
460
  if (this.incrementalSnap) {
443
461
  fullScale.x /= Math.abs(this._incrementalStartupValue.x) < Epsilon ? 1 : this._incrementalStartupValue.x;
@@ -446,14 +464,32 @@ export class BoundingBoxGizmo extends Gizmo {
446
464
  fullScale.x = Math.max(this._incrementalAnchorStartupValue.x * fullScale.x, this.scalingSnapDistance);
447
465
  fullScale.y = Math.max(this._incrementalAnchorStartupValue.y * fullScale.y, this.scalingSnapDistance);
448
466
  fullScale.z = Math.max(this._incrementalAnchorStartupValue.z * fullScale.z, this.scalingSnapDistance);
467
+ if (this._isCenterScaleModeActive) {
468
+ fullScale.x = this._incrementalAnchorStartupValue.x + (fullScale.x - this._incrementalAnchorStartupValue.x) * 2;
469
+ fullScale.y = this._incrementalAnchorStartupValue.y + (fullScale.y - this._incrementalAnchorStartupValue.y) * 2;
470
+ fullScale.z = this._incrementalAnchorStartupValue.z + (fullScale.z - this._incrementalAnchorStartupValue.z) * 2;
471
+ }
449
472
  this._anchorMesh.scaling.x += (fullScale.x - this._anchorMesh.scaling.x) * Math.abs(dragAxis.x);
450
473
  this._anchorMesh.scaling.y += (fullScale.y - this._anchorMesh.scaling.y) * Math.abs(dragAxis.y);
451
474
  this._anchorMesh.scaling.z += (fullScale.z - this._anchorMesh.scaling.z) * Math.abs(dragAxis.z);
452
475
  }
453
476
  else {
454
- this._anchorMesh.scaling.addInPlace(deltaScale);
455
- if (this._anchorMesh.scaling.x < 0 || this._anchorMesh.scaling.y < 0 || this._anchorMesh.scaling.z < 0) {
456
- this._anchorMesh.scaling.subtractInPlace(deltaScale);
477
+ // Compute absolute scale from total drag distance so modifier toggles mid-drag work retroactively
478
+ const scaleMultiplier = this._isCenterScaleModeActive ? 2 : 1;
479
+ const totalScale = totalRelativeDragDistance * this._scaleDragSpeed * scaleMultiplier;
480
+ const newAnchorScale = this._incrementalAnchorStartupValue.clone();
481
+ if (zeroAxisCount === 2) {
482
+ newAnchorScale.x += totalScale * Math.abs(dragAxis.x) * this._axisFactor.x;
483
+ newAnchorScale.y += totalScale * Math.abs(dragAxis.y) * this._axisFactor.y;
484
+ newAnchorScale.z += totalScale * Math.abs(dragAxis.z) * this._axisFactor.z;
485
+ }
486
+ else {
487
+ newAnchorScale.x += totalScale * this._axisFactor.x;
488
+ newAnchorScale.y += totalScale * this._axisFactor.y;
489
+ newAnchorScale.z += totalScale * this._axisFactor.z;
490
+ }
491
+ if (newAnchorScale.x > 0 && newAnchorScale.y > 0 && newAnchorScale.z > 0) {
492
+ this._anchorMesh.scaling.copyFrom(newAnchorScale);
457
493
  }
458
494
  }
459
495
  this._anchorMesh.removeChild(this.attachedMesh);
@@ -471,6 +507,9 @@ export class BoundingBoxGizmo extends Gizmo {
471
507
  previousScale = 0;
472
508
  this._incrementalStartupValue.copyFrom(this.attachedMesh.scaling);
473
509
  this._incrementalAnchorStartupValue.copyFrom(this._anchorMesh.scaling);
510
+ initialAnchorCenter.copyFrom(this._anchorMesh.position);
511
+ initialBoxPosition.copyFrom(box.absolutePosition);
512
+ initialMeshAbsolutePosition.copyFrom(this.attachedMesh.getAbsolutePosition());
474
513
  });
475
514
  scaleBoxesDragBehavior.onDragEndObservable.add((event) => {
476
515
  this.onScaleBoxDragEndObservable.notifyObservers({ dragOperation: 1 /* DragOperation.Scaling */, dragAxis: new Vector3(i - 1, j - 1, k - 1) });
@@ -485,6 +524,15 @@ export class BoundingBoxGizmo extends Gizmo {
485
524
  }
486
525
  }
487
526
  this._rootMesh.addChild(this._scaleBoxesParent);
527
+ // Keyboard observer for center-scale mode (Ctrl on Windows, Opt/Alt on Mac)
528
+ this._centerScaleKeyObserver = gizmoLayer.originalScene.onKeyboardObservable.add(({ type, event }) => {
529
+ if (type === KeyboardEventTypes.KEYDOWN && (event.ctrlKey || event.altKey)) {
530
+ this._isCenterScaleModeActive = true;
531
+ }
532
+ else if (type === KeyboardEventTypes.KEYUP && !event.ctrlKey && !event.altKey) {
533
+ this._isCenterScaleModeActive = false;
534
+ }
535
+ });
488
536
  // Hover color change
489
537
  const pointerIds = [];
490
538
  this._pointerObserver = gizmoLayer.utilityLayerScene.onPointerObservable.add((pointerInfo) => {
@@ -781,6 +829,7 @@ export class BoundingBoxGizmo extends Gizmo {
781
829
  dispose() {
782
830
  this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver);
783
831
  this.gizmoLayer.originalScene.onBeforeRenderObservable.remove(this._renderObserver);
832
+ this.gizmoLayer.originalScene.onKeyboardObservable.remove(this._centerScaleKeyObserver);
784
833
  this._lineBoundingBox.dispose();
785
834
  this._rotateAnchorsParent.dispose();
786
835
  this._scaleBoxesParent.dispose();