@onerjs/core 8.44.9 → 8.45.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.
- package/Engines/engine.d.ts +25 -0
- package/Engines/thinEngine.js +2 -0
- package/Engines/thinEngine.js.map +1 -1
- package/Gizmos/boundingBoxGizmo.d.ts +2 -0
- package/Gizmos/boundingBoxGizmo.js +56 -7
- package/Gizmos/boundingBoxGizmo.js.map +1 -1
- package/Layers/thinEffectLayer.js +1 -2
- package/Layers/thinEffectLayer.js.map +1 -1
- package/Materials/Textures/Filtering/hdrIrradianceFiltering.js +3 -0
- package/Materials/Textures/Filtering/hdrIrradianceFiltering.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.d.ts +2 -2
- package/Materials/Textures/renderTargetTexture.js +2 -2
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Misc/stringTools.js +20 -14
- package/Misc/stringTools.js.map +1 -1
- package/Misc/thinMinMaxReducer.js +4 -3
- package/Misc/thinMinMaxReducer.js.map +1 -1
- package/PostProcesses/thinAnaglyphPostProcess.js +2 -2
- package/PostProcesses/thinAnaglyphPostProcess.js.map +1 -1
- package/PostProcesses/thinBlackAndWhitePostProcess.js +2 -2
- package/PostProcesses/thinBlackAndWhitePostProcess.js.map +1 -1
- package/PostProcesses/thinBloomMergePostProcess.js +2 -2
- package/PostProcesses/thinBloomMergePostProcess.js.map +1 -1
- package/PostProcesses/thinBlurPostProcess.js +2 -2
- package/PostProcesses/thinBlurPostProcess.js.map +1 -1
- package/PostProcesses/thinChromaticAberrationPostProcess.js +2 -2
- package/PostProcesses/thinChromaticAberrationPostProcess.js.map +1 -1
- package/PostProcesses/thinCircleOfConfusionPostProcess.js +2 -2
- package/PostProcesses/thinCircleOfConfusionPostProcess.js.map +1 -1
- package/PostProcesses/thinConvolutionPostProcess.js +2 -2
- package/PostProcesses/thinConvolutionPostProcess.js.map +1 -1
- package/PostProcesses/thinCustomPostProcess.js +2 -2
- package/PostProcesses/thinCustomPostProcess.js.map +1 -1
- package/PostProcesses/thinDepthOfFieldMergePostProcess.js +2 -2
- package/PostProcesses/thinDepthOfFieldMergePostProcess.js.map +1 -1
- package/PostProcesses/thinExtractHighlightsPostProcess.js +2 -2
- package/PostProcesses/thinExtractHighlightsPostProcess.js.map +1 -1
- package/PostProcesses/thinFXAAPostProcess.js +2 -2
- package/PostProcesses/thinFXAAPostProcess.js.map +1 -1
- package/PostProcesses/thinFilterPostProcess.js +2 -2
- package/PostProcesses/thinFilterPostProcess.js.map +1 -1
- package/PostProcesses/thinGrainPostProcess.js +2 -2
- package/PostProcesses/thinGrainPostProcess.js.map +1 -1
- package/PostProcesses/thinImageProcessingPostProcess.js +1 -2
- package/PostProcesses/thinImageProcessingPostProcess.js.map +1 -1
- package/PostProcesses/thinPassPostProcess.js +4 -4
- package/PostProcesses/thinPassPostProcess.js.map +1 -1
- package/PostProcesses/thinSSAO2BlurPostProcess.js +2 -2
- package/PostProcesses/thinSSAO2BlurPostProcess.js.map +1 -1
- package/PostProcesses/thinSSAO2CombinePostProcess.js +2 -2
- package/PostProcesses/thinSSAO2CombinePostProcess.js.map +1 -1
- package/PostProcesses/thinSSRBlurCombinerPostProcess.js +2 -2
- package/PostProcesses/thinSSRBlurCombinerPostProcess.js.map +1 -1
- package/PostProcesses/thinSSRBlurPostProcess.js +2 -2
- package/PostProcesses/thinSSRBlurPostProcess.js.map +1 -1
- package/PostProcesses/thinScreenSpaceCurvaturePostProcess.js +2 -2
- package/PostProcesses/thinScreenSpaceCurvaturePostProcess.js.map +1 -1
- package/PostProcesses/thinSharpenPostProcess.js +2 -2
- package/PostProcesses/thinSharpenPostProcess.js.map +1 -1
- package/PostProcesses/thinTonemapPostProcess.js +2 -2
- package/PostProcesses/thinTonemapPostProcess.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +2 -3
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js +1 -2
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js.map +1 -1
- package/Rendering/iblCdfGenerator.js +1 -2
- package/Rendering/iblCdfGenerator.js.map +1 -1
- package/Rendering/objectRenderer.d.ts +8 -2
- package/Rendering/objectRenderer.js +8 -2
- package/Rendering/objectRenderer.js.map +1 -1
- package/XR/features/WebXRControllerPointerSelection.d.ts +25 -0
- package/XR/features/WebXRControllerPointerSelection.js +76 -0
- package/XR/features/WebXRControllerPointerSelection.js.map +1 -1
- package/XR/features/WebXRControllerTeleportation.d.ts +13 -0
- package/XR/features/WebXRControllerTeleportation.js +38 -11
- package/XR/features/WebXRControllerTeleportation.js.map +1 -1
- package/package.json +1 -1
- package/scene.js +6 -0
- 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.
|
|
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
|
|
435
|
-
|
|
436
|
-
|
|
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
|
-
|
|
455
|
-
|
|
456
|
-
|
|
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();
|