@babylonjs/core 7.1.0 → 7.2.0
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/Animations/animationGroup.d.ts +1 -1
- package/Animations/animationGroup.js +1 -1
- package/Animations/animationGroup.js.map +1 -1
- package/Compute/computeEffect.d.ts +0 -1
- package/Compute/computeEffect.js +40 -33
- package/Compute/computeEffect.js.map +1 -1
- package/Engines/Extensions/engine.computeShader.d.ts +25 -1
- package/Engines/Extensions/engine.computeShader.js +1 -1
- package/Engines/Extensions/engine.computeShader.js.map +1 -1
- package/Engines/WebGL/webGLRenderTargetWrapper.d.ts +1 -2
- package/Engines/WebGL/webGLRenderTargetWrapper.js +2 -3
- package/Engines/WebGL/webGLRenderTargetWrapper.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.computeShader.js +22 -0
- package/Engines/WebGPU/Extensions/engine.computeShader.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTarget.js +2 -3
- package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/WebGPU/webgpuComputePipelineContext.js +4 -2
- package/Engines/WebGPU/webgpuComputePipelineContext.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.d.ts +1 -0
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +6 -1
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureManager.js +2 -2
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
- package/Engines/renderTargetWrapper.d.ts +6 -2
- package/Engines/renderTargetWrapper.js +9 -2
- package/Engines/renderTargetWrapper.js.map +1 -1
- package/Engines/thinEngine.js +2 -2
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.js +4 -5
- package/Engines/webgpuEngine.js.map +1 -1
- package/Gizmos/axisScaleGizmo.js +6 -1
- package/Gizmos/axisScaleGizmo.js.map +1 -1
- package/Gizmos/boundingBoxGizmo.d.ts +2 -2
- package/Gizmos/boundingBoxGizmo.js +27 -17
- package/Gizmos/boundingBoxGizmo.js.map +1 -1
- package/Gizmos/scaleGizmo.d.ts +6 -0
- package/Gizmos/scaleGizmo.js +10 -2
- package/Gizmos/scaleGizmo.js.map +1 -1
- package/Lights/Shadows/cascadedShadowGenerator.js +1 -1
- package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.js +17 -2
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.js +1 -5
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/PBR/pbrClearCoatConfiguration.d.ts +0 -1
- package/Materials/PBR/pbrClearCoatConfiguration.js +3 -12
- package/Materials/PBR/pbrClearCoatConfiguration.js.map +1 -1
- package/Materials/PBR/pbrIridescenceConfiguration.d.ts +1 -4
- package/Materials/PBR/pbrIridescenceConfiguration.js +5 -15
- package/Materials/PBR/pbrIridescenceConfiguration.js.map +1 -1
- package/Materials/PBR/pbrSheenConfiguration.d.ts +0 -1
- package/Materials/PBR/pbrSheenConfiguration.js +3 -12
- package/Materials/PBR/pbrSheenConfiguration.js.map +1 -1
- package/Materials/PBR/pbrSubSurfaceConfiguration.js +5 -17
- package/Materials/PBR/pbrSubSurfaceConfiguration.js.map +1 -1
- package/Materials/Textures/baseTexture.d.ts +0 -6
- package/Materials/Textures/baseTexture.js +0 -8
- package/Materials/Textures/baseTexture.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.d.ts +2 -1
- package/Materials/Textures/renderTargetTexture.js +3 -2
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/Textures/texture.d.ts +0 -6
- package/Materials/Textures/texture.js +0 -15
- package/Materials/Textures/texture.js.map +1 -1
- package/Materials/Textures/thinTexture.js +1 -1
- package/Materials/Textures/thinTexture.js.map +1 -1
- package/Maths/math.vector.d.ts +12 -0
- package/Maths/math.vector.js +17 -2
- package/Maths/math.vector.js.map +1 -1
- package/Maths/tensor.d.ts +13 -11
- package/Maths/tensor.js.map +1 -1
- package/Meshes/Builders/greasedLineBuilder.js +14 -0
- package/Meshes/Builders/greasedLineBuilder.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineBaseMesh.d.ts +14 -3
- package/Meshes/GreasedLine/greasedLineBaseMesh.js +18 -2
- package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineMesh.js +3 -4
- package/Meshes/GreasedLine/greasedLineMesh.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineRibbonMesh.js +10 -1
- package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -1
- package/Rendering/depthPeelingRenderer.js +1 -1
- package/Rendering/depthPeelingRenderer.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderer.js +1 -1
- package/Rendering/fluidRenderer/fluidRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockClearcoat.js +0 -4
- package/Shaders/ShadersInclude/pbrBlockClearcoat.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockIridescence.js +0 -3
- package/Shaders/ShadersInclude/pbrBlockIridescence.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockSheen.js +1 -5
- package/Shaders/ShadersInclude/pbrBlockSheen.js.map +1 -1
- package/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js +2 -2
- package/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.js.map +1 -1
- package/Shaders/greasedLine.vertex.js +3 -3
- package/Shaders/greasedLine.vertex.js.map +1 -1
- package/Shaders/pbr.fragment.js +4 -4
- package/Shaders/pbr.fragment.js.map +1 -1
- package/XR/features/WebXRHandTracking.d.ts +5 -0
- package/XR/features/WebXRHandTracking.js +6 -0
- package/XR/features/WebXRHandTracking.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boundingBoxGizmo.js","sourceRoot":"","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,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAE1K,6BAA6B;QAC7B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACnB,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACzC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAE/B,oBAAoB;QACpB,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAEtB,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnB,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC;QACnB,OAAO,GAAG,CAAC;IACf,CAAC;IACD;;OAEG;IACI,aAAa;QAChB,MAAM,CAAC,KAAK,CAAC,+CAA+C,CAAC,CAAC;IAClE,CAAC;CACJ","sourcesContent":["import type { Observer } from \"../Misc/observable\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { PointerInfo } from \"../Events/pointerEvents\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Quaternion, Matrix, Vector3 } from \"../Maths/math.vector\";\r\nimport { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\nimport { CreateSphere } from \"../Meshes/Builders/sphereBuilder\";\r\nimport { CreateBox } from \"../Meshes/Builders/boxBuilder\";\r\nimport { CreateLines } from \"../Meshes/Builders/linesBuilder\";\r\nimport { PointerDragBehavior } from \"../Behaviors/Meshes/pointerDragBehavior\";\r\nimport type { IGizmo } from \"./gizmo\";\r\nimport { Gizmo } from \"./gizmo\";\r\nimport { UtilityLayerRenderer } from \"../Rendering/utilityLayerRenderer\";\r\nimport { StandardMaterial } from \"../Materials/standardMaterial\";\r\nimport { PivotTools } from \"../Misc/pivotTools\";\r\nimport { Color3 } from \"../Maths/math.color\";\r\nimport type { LinesMesh } from \"../Meshes/linesMesh\";\r\nimport { Epsilon } from \"../Maths/math.constants\";\r\nimport type { IPointerEvent } from \"../Events/deviceInputEvents\";\r\n\r\n/**\r\n * Interface for bounding box gizmo\r\n */\r\nexport interface IBoundingBoxGizmo extends IGizmo {\r\n /**\r\n * 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.\r\n */\r\n ignoreChildren: boolean;\r\n /**\r\n * Returns true if a descendant should be included when computing the bounding box. When null, all descendants are included. If ignoreChildren is set this will be ignored.\r\n */\r\n includeChildPredicate: Nullable<(abstractMesh: AbstractMesh) => boolean>;\r\n /** The size of the rotation spheres attached to the bounding box */\r\n rotationSphereSize: number;\r\n /** The size of the scale boxes attached to the bounding box */\r\n scaleBoxSize: number;\r\n /**\r\n * If set, the rotation spheres and scale boxes will increase in size based on the distance away from the camera to have a consistent screen size\r\n * Note : fixedDragMeshScreenSize takes precedence over fixedDragMeshBoundsSize if both are true\r\n */\r\n fixedDragMeshScreenSize: boolean;\r\n /**\r\n * If set, the rotation spheres and scale boxes will increase in size based on the size of the bounding box\r\n * Note : fixedDragMeshScreenSize takes precedence over fixedDragMeshBoundsSize if both are true\r\n */\r\n fixedDragMeshBoundsSize: boolean;\r\n /**\r\n * The distance away from the object which the draggable meshes should appear world sized when fixedDragMeshScreenSize is set to true\r\n */\r\n fixedDragMeshScreenSizeDistanceFactor: number;\r\n /** True when a rotation sphere or scale box or a attached mesh is dragged */\r\n readonly isDragging: boolean;\r\n /** Fired when a rotation sphere or scale box is dragged */\r\n onDragStartObservable: Observable<{}>;\r\n /** Fired when a scale box is dragged */\r\n onScaleBoxDragObservable: Observable<{}>;\r\n /** Fired when a scale box drag is ended */\r\n onScaleBoxDragEndObservable: Observable<{}>;\r\n /** Fired when a rotation sphere is dragged */\r\n onRotationSphereDragObservable: Observable<{}>;\r\n /** Fired when a rotation sphere drag is ended */\r\n onRotationSphereDragEndObservable: Observable<{}>;\r\n /** Relative bounding box pivot used when scaling the attached node. */\r\n scalePivot: Nullable<Vector3>;\r\n /** Scale factor vector used for masking some axis */\r\n axisFactor: Vector3;\r\n /** Scale factor scalar affecting all axes' drag speed */\r\n scaleDragSpeed: number;\r\n /**\r\n * Sets the color of the bounding box gizmo\r\n * @param color the color to set\r\n */\r\n setColor(color: Color3): void;\r\n /** Returns an array containing all boxes used for scaling (in increasing x, y and z orders) */\r\n getScaleBoxes(): AbstractMesh[];\r\n /** Updates the bounding box information for the Gizmo */\r\n updateBoundingBox(): void;\r\n /**\r\n * Enables rotation on the specified axis and disables rotation on the others\r\n * @param axis The list of axis that should be enabled (eg. \"xy\" or \"xyz\")\r\n */\r\n setEnabledRotationAxis(axis: string): void;\r\n /**\r\n * Enables/disables scaling\r\n * @param enable if scaling should be enabled\r\n * @param homogeneousScaling defines if scaling should only be homogeneous\r\n */\r\n setEnabledScaling(enable: boolean, homogeneousScaling?: boolean): void;\r\n /** Enables a pointer drag behavior on the bounding box of the gizmo */\r\n enableDragBehavior(): void;\r\n /**\r\n * Force release the drag action by code\r\n */\r\n releaseDrag(): void;\r\n\r\n /** Default material used to render when gizmo is not disabled or hovered */\r\n coloredMaterial: StandardMaterial;\r\n /** Material used to render when gizmo is hovered with mouse*/\r\n hoverMaterial: StandardMaterial;\r\n\r\n /** Drag distance in babylon units that the gizmo will snap scaling to when dragged */\r\n scalingSnapDistance: number;\r\n /** Drag distance in babylon units that the gizmo will snap rotation to when dragged */\r\n rotationSnapDistance: number;\r\n}\r\n\r\n/**\r\n * Bounding box gizmo\r\n */\r\nexport class BoundingBoxGizmo extends Gizmo implements IBoundingBoxGizmo {\r\n protected _lineBoundingBox: AbstractMesh;\r\n protected _rotateSpheresParent: AbstractMesh;\r\n protected _scaleBoxesParent: AbstractMesh;\r\n protected _boundingDimensions = new Vector3(1, 1, 1);\r\n protected _renderObserver: Nullable<Observer<Scene>> = null;\r\n protected _pointerObserver: Nullable<Observer<PointerInfo>> = null;\r\n protected _scaleDragSpeed = 0.2;\r\n protected _rotateSpheresDragBehavior: PointerDragBehavior;\r\n protected _scaleBoxesDragBehavior: PointerDragBehavior;\r\n /**\r\n * boolean updated when a rotation sphere or scale box is dragged\r\n */\r\n protected _dragging = false;\r\n\r\n private _tmpQuaternion = new Quaternion();\r\n private _tmpVector = new Vector3(0, 0, 0);\r\n private _tmpRotationMatrix = new Matrix();\r\n private _incrementalStartupValue = Vector3.Zero();\r\n private _incrementalAnchorStartupValue = Vector3.Zero();\r\n /**\r\n * 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)\r\n */\r\n public ignoreChildren = false;\r\n /**\r\n * Returns true if a descendant should be included when computing the bounding box. When null, all descendants are included. If ignoreChildren is set this will be ignored. (Default: null)\r\n */\r\n public includeChildPredicate: Nullable<(abstractMesh: AbstractMesh) => boolean> = null;\r\n\r\n /**\r\n * The size of the rotation spheres attached to the bounding box (Default: 0.1)\r\n */\r\n public rotationSphereSize = 0.1;\r\n /**\r\n * The size of the scale boxes attached to the bounding box (Default: 0.1)\r\n */\r\n public scaleBoxSize = 0.1;\r\n /**\r\n * If set, the rotation spheres and scale boxes will increase in size based on the distance away from the camera to have a consistent screen size (Default: false)\r\n * Note : fixedDragMeshScreenSize takes precedence over fixedDragMeshBoundsSize if both are true\r\n */\r\n public fixedDragMeshScreenSize = false;\r\n /**\r\n * If set, the rotation spheres and scale boxes will increase in size based on the size of the bounding box\r\n * Note : fixedDragMeshScreenSize takes precedence over fixedDragMeshBoundsSize if both are true\r\n */\r\n public fixedDragMeshBoundsSize = false;\r\n /**\r\n * The distance away from the object which the draggable meshes should appear world sized when fixedDragMeshScreenSize is set to true (default: 10)\r\n */\r\n public fixedDragMeshScreenSizeDistanceFactor = 10;\r\n /**\r\n * Drag distance in babylon units that the gizmo will snap scaling to when dragged\r\n */\r\n public scalingSnapDistance = 0;\r\n /**\r\n * Drag distance in babylon units that the gizmo will snap rotation to when dragged\r\n */\r\n public rotationSnapDistance = 0;\r\n /**\r\n * Fired when a rotation sphere or scale box is dragged\r\n */\r\n public onDragStartObservable = new Observable<{}>();\r\n /**\r\n * Fired when a scale box is dragged\r\n */\r\n public onScaleBoxDragObservable = new Observable<{}>();\r\n /**\r\n * Fired when a scale box drag is ended\r\n */\r\n public onScaleBoxDragEndObservable = new Observable<{}>();\r\n /**\r\n * Fired when a rotation sphere is dragged\r\n */\r\n public onRotationSphereDragObservable = new Observable<{}>();\r\n /**\r\n * Fired when a rotation sphere drag is ended\r\n */\r\n public onRotationSphereDragEndObservable = new Observable<{}>();\r\n /**\r\n * Relative bounding box pivot used when scaling the attached node. When null object with scale from the opposite corner. 0.5,0.5,0.5 for center and 0.5,0,0.5 for bottom (Default: null)\r\n */\r\n public scalePivot: Nullable<Vector3> = null;\r\n /**\r\n * Scale factor used for masking some axis\r\n */\r\n protected _axisFactor = new Vector3(1, 1, 1);\r\n\r\n /**\r\n * Incremental snap scaling (default is false). When true, with a snapDistance of 0.1, scaling will be 1.1,1.2,1.3 instead of, when false: 1.1,1.21,1.33,...\r\n */\r\n public incrementalSnap = false;\r\n\r\n /**\r\n * Sets the axis factor\r\n * @param factor the Vector3 value\r\n */\r\n public set axisFactor(factor: Vector3) {\r\n this._axisFactor = factor;\r\n // update scale cube visibility\r\n const scaleBoxes = this._scaleBoxesParent.getChildMeshes();\r\n let index = 0;\r\n for (let i = 0; i < 3; i++) {\r\n for (let j = 0; j < 3; j++) {\r\n for (let k = 0; k < 3; k++) {\r\n const zeroAxisCount = (i === 1 ? 1 : 0) + (j === 1 ? 1 : 0) + (k === 1 ? 1 : 0);\r\n if (zeroAxisCount === 1 || zeroAxisCount === 3) {\r\n continue;\r\n }\r\n if (scaleBoxes[index]) {\r\n const dragAxis = new Vector3(i - 1, j - 1, k - 1);\r\n dragAxis.multiplyInPlace(this._axisFactor);\r\n scaleBoxes[index].setEnabled(dragAxis.lengthSquared() > Epsilon);\r\n }\r\n index++;\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets the axis factor\r\n * @returns the Vector3 factor value\r\n */\r\n public get axisFactor(): Vector3 {\r\n return this._axisFactor;\r\n }\r\n\r\n /**\r\n * Sets scale drag speed value\r\n * @param value the new speed value\r\n */\r\n public set scaleDragSpeed(value: number) {\r\n this._scaleDragSpeed = value;\r\n }\r\n\r\n /**\r\n * Gets scale drag speed\r\n * @returns the scale speed number\r\n */\r\n public get scaleDragSpeed(): number {\r\n return this._scaleDragSpeed;\r\n }\r\n\r\n /**\r\n * Mesh used as a pivot to rotate the attached node\r\n */\r\n protected _anchorMesh: AbstractMesh;\r\n\r\n protected _existingMeshScale = new Vector3();\r\n\r\n // Dragging\r\n protected _dragMesh: Nullable<Mesh> = null;\r\n protected _pointerDragBehavior = new PointerDragBehavior();\r\n\r\n protected _coloredMaterial: StandardMaterial;\r\n protected _hoverColoredMaterial: StandardMaterial;\r\n\r\n /** Default material used to render when gizmo is not disabled or hovered */\r\n public get coloredMaterial() {\r\n return this._coloredMaterial;\r\n }\r\n\r\n /** Material used to render when gizmo is hovered with mouse*/\r\n public get hoverMaterial() {\r\n return this._hoverColoredMaterial;\r\n }\r\n /**\r\n * Get the pointerDragBehavior\r\n */\r\n public get pointerDragBehavior(): PointerDragBehavior {\r\n return this._pointerDragBehavior;\r\n }\r\n\r\n /** True when a rotation sphere or scale box or a attached mesh is dragged */\r\n public get isDragging() {\r\n return this._dragging || this._pointerDragBehavior.dragging;\r\n }\r\n\r\n /**\r\n * Sets the color of the bounding box gizmo\r\n * @param color the color to set\r\n */\r\n public setColor(color: Color3) {\r\n this._coloredMaterial.emissiveColor = color;\r\n this._hoverColoredMaterial.emissiveColor = color.clone().add(new Color3(0.3, 0.3, 0.3));\r\n this._lineBoundingBox.getChildren().forEach((l) => {\r\n if ((l as LinesMesh).color) {\r\n (l as LinesMesh).color = color;\r\n }\r\n });\r\n }\r\n /**\r\n * Creates an BoundingBoxGizmo\r\n * @param color The color of the gizmo\r\n * @param gizmoLayer The utility layer the gizmo will be added to\r\n */\r\n constructor(color: Color3 = Color3.Gray(), gizmoLayer: UtilityLayerRenderer = UtilityLayerRenderer.DefaultKeepDepthUtilityLayer) {\r\n super(gizmoLayer);\r\n\r\n // Do not update the gizmo's scale so it has a fixed size to the object its attached to\r\n this.updateScale = false;\r\n\r\n this._anchorMesh = new AbstractMesh(\"anchor\", gizmoLayer.utilityLayerScene);\r\n // Create Materials\r\n this._coloredMaterial = new StandardMaterial(\"\", gizmoLayer.utilityLayerScene);\r\n this._coloredMaterial.disableLighting = true;\r\n this._hoverColoredMaterial = new StandardMaterial(\"\", gizmoLayer.utilityLayerScene);\r\n this._hoverColoredMaterial.disableLighting = true;\r\n\r\n // Build bounding box out of lines\r\n this._lineBoundingBox = new AbstractMesh(\"\", gizmoLayer.utilityLayerScene);\r\n this._lineBoundingBox.rotationQuaternion = new Quaternion();\r\n const lines = [];\r\n lines.push(CreateLines(\"lines\", { points: [new Vector3(0, 0, 0), new Vector3(this._boundingDimensions.x, 0, 0)] }, gizmoLayer.utilityLayerScene));\r\n lines.push(CreateLines(\"lines\", { points: [new Vector3(0, 0, 0), new Vector3(0, this._boundingDimensions.y, 0)] }, gizmoLayer.utilityLayerScene));\r\n lines.push(CreateLines(\"lines\", { points: [new Vector3(0, 0, 0), new Vector3(0, 0, this._boundingDimensions.z)] }, gizmoLayer.utilityLayerScene));\r\n lines.push(\r\n CreateLines(\r\n \"lines\",\r\n { points: [new Vector3(this._boundingDimensions.x, 0, 0), new Vector3(this._boundingDimensions.x, this._boundingDimensions.y, 0)] },\r\n gizmoLayer.utilityLayerScene\r\n )\r\n );\r\n lines.push(\r\n CreateLines(\r\n \"lines\",\r\n { points: [new Vector3(this._boundingDimensions.x, 0, 0), new Vector3(this._boundingDimensions.x, 0, this._boundingDimensions.z)] },\r\n gizmoLayer.utilityLayerScene\r\n )\r\n );\r\n lines.push(\r\n CreateLines(\r\n \"lines\",\r\n { points: [new Vector3(0, this._boundingDimensions.y, 0), new Vector3(this._boundingDimensions.x, this._boundingDimensions.y, 0)] },\r\n gizmoLayer.utilityLayerScene\r\n )\r\n );\r\n lines.push(\r\n CreateLines(\r\n \"lines\",\r\n { points: [new Vector3(0, this._boundingDimensions.y, 0), new Vector3(0, this._boundingDimensions.y, this._boundingDimensions.z)] },\r\n gizmoLayer.utilityLayerScene\r\n )\r\n );\r\n lines.push(\r\n CreateLines(\r\n \"lines\",\r\n { points: [new Vector3(0, 0, this._boundingDimensions.z), new Vector3(this._boundingDimensions.x, 0, this._boundingDimensions.z)] },\r\n gizmoLayer.utilityLayerScene\r\n )\r\n );\r\n lines.push(\r\n CreateLines(\r\n \"lines\",\r\n { points: [new Vector3(0, 0, this._boundingDimensions.z), new Vector3(0, this._boundingDimensions.y, this._boundingDimensions.z)] },\r\n gizmoLayer.utilityLayerScene\r\n )\r\n );\r\n lines.push(\r\n CreateLines(\r\n \"lines\",\r\n {\r\n points: [\r\n new Vector3(this._boundingDimensions.x, this._boundingDimensions.y, this._boundingDimensions.z),\r\n new Vector3(0, this._boundingDimensions.y, this._boundingDimensions.z),\r\n ],\r\n },\r\n gizmoLayer.utilityLayerScene\r\n )\r\n );\r\n lines.push(\r\n CreateLines(\r\n \"lines\",\r\n {\r\n points: [\r\n new Vector3(this._boundingDimensions.x, this._boundingDimensions.y, this._boundingDimensions.z),\r\n new Vector3(this._boundingDimensions.x, 0, this._boundingDimensions.z),\r\n ],\r\n },\r\n gizmoLayer.utilityLayerScene\r\n )\r\n );\r\n lines.push(\r\n CreateLines(\r\n \"lines\",\r\n {\r\n points: [\r\n new Vector3(this._boundingDimensions.x, this._boundingDimensions.y, this._boundingDimensions.z),\r\n new Vector3(this._boundingDimensions.x, this._boundingDimensions.y, 0),\r\n ],\r\n },\r\n gizmoLayer.utilityLayerScene\r\n )\r\n );\r\n lines.forEach((l) => {\r\n l.color = color;\r\n l.position.addInPlace(new Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));\r\n l.isPickable = false;\r\n this._lineBoundingBox.addChild(l);\r\n });\r\n this._rootMesh.addChild(this._lineBoundingBox);\r\n\r\n this.setColor(color);\r\n\r\n // Create rotation spheres\r\n this._rotateSpheresParent = new AbstractMesh(\"\", gizmoLayer.utilityLayerScene);\r\n this._rotateSpheresParent.rotationQuaternion = new Quaternion();\r\n for (let i = 0; i < 12; i++) {\r\n const sphere = CreateSphere(\"\", { diameter: 1 }, gizmoLayer.utilityLayerScene);\r\n sphere.rotationQuaternion = new Quaternion();\r\n sphere.material = this._coloredMaterial;\r\n sphere.isNearGrabbable = true;\r\n\r\n // Drag behavior\r\n this._rotateSpheresDragBehavior = new PointerDragBehavior({});\r\n this._rotateSpheresDragBehavior.moveAttached = false;\r\n this._rotateSpheresDragBehavior.updateDragPlane = false;\r\n sphere.addBehavior(this._rotateSpheresDragBehavior);\r\n const startingTurnDirection = new Vector3(1, 0, 0);\r\n let totalTurnAmountOfDrag = 0;\r\n let previousProjectDist = 0;\r\n this._rotateSpheresDragBehavior.onDragStartObservable.add(() => {\r\n startingTurnDirection.copyFrom(sphere.forward);\r\n totalTurnAmountOfDrag = 0;\r\n previousProjectDist = 0;\r\n });\r\n this._rotateSpheresDragBehavior.onDragObservable.add((event) => {\r\n this.onRotationSphereDragObservable.notifyObservers({});\r\n if (this.attachedMesh) {\r\n const originalParent = this.attachedMesh.parent;\r\n if (originalParent && (originalParent as Mesh).scaling && (originalParent as Mesh).scaling.isNonUniformWithinEpsilon(0.001)) {\r\n Logger.Warn(\"BoundingBoxGizmo controls are not supported on child meshes with non-uniform parent scaling\");\r\n return;\r\n }\r\n PivotTools._RemoveAndStorePivotPoint(this.attachedMesh);\r\n\r\n const worldDragDirection = startingTurnDirection;\r\n\r\n // Project the world right on to the drag plane\r\n const toSub = event.dragPlaneNormal.scale(Vector3.Dot(event.dragPlaneNormal, worldDragDirection));\r\n const dragAxis = worldDragDirection.subtract(toSub).normalizeToNew();\r\n\r\n // project drag delta on to the resulting drag axis and rotate based on that\r\n let projectDist = Vector3.Dot(dragAxis, event.delta) < 0 ? Math.abs(event.delta.length()) : -Math.abs(event.delta.length());\r\n\r\n // Make rotation relative to size of mesh.\r\n projectDist = (projectDist / this._boundingDimensions.length()) * this._anchorMesh.scaling.length();\r\n\r\n // Rotate based on axis\r\n if (!this.attachedMesh.rotationQuaternion) {\r\n this.attachedMesh.rotationQuaternion = Quaternion.RotationYawPitchRoll(\r\n this.attachedMesh.rotation.y,\r\n this.attachedMesh.rotation.x,\r\n this.attachedMesh.rotation.z\r\n );\r\n }\r\n if (!this._anchorMesh.rotationQuaternion) {\r\n this._anchorMesh.rotationQuaternion = Quaternion.RotationYawPitchRoll(\r\n this._anchorMesh.rotation.y,\r\n this._anchorMesh.rotation.x,\r\n this._anchorMesh.rotation.z\r\n );\r\n }\r\n\r\n // Do not allow the object to turn more than a full circle\r\n totalTurnAmountOfDrag += projectDist;\r\n if (Math.abs(totalTurnAmountOfDrag) <= 2 * Math.PI) {\r\n if (this.rotationSnapDistance > 0) {\r\n const dragSteps = Math.floor(Math.abs(totalTurnAmountOfDrag) / this.rotationSnapDistance) * (totalTurnAmountOfDrag < 0 ? -1 : 1);\r\n const angle = this.rotationSnapDistance * dragSteps;\r\n projectDist = angle - previousProjectDist;\r\n previousProjectDist = angle;\r\n }\r\n if (i >= 8) {\r\n Quaternion.RotationYawPitchRollToRef(0, 0, projectDist, this._tmpQuaternion);\r\n } else if (i >= 4) {\r\n Quaternion.RotationYawPitchRollToRef(projectDist, 0, 0, this._tmpQuaternion);\r\n } else {\r\n Quaternion.RotationYawPitchRollToRef(0, projectDist, 0, this._tmpQuaternion);\r\n }\r\n\r\n // if using pivot, move anchor so mesh will be at relative (0,0,0) when parented\r\n if (this.attachedMesh.isUsingPivotMatrix()) {\r\n this._anchorMesh.position.copyFrom(this.attachedMesh.position);\r\n }\r\n // Rotate around center of bounding box\r\n this._anchorMesh.addChild(this.attachedMesh);\r\n if (this._anchorMesh.getScene().useRightHandedSystem) {\r\n this._tmpQuaternion.conjugateInPlace();\r\n }\r\n this._tmpQuaternion.normalize();\r\n this._anchorMesh.rotationQuaternion!.multiplyToRef(this._tmpQuaternion, this._anchorMesh.rotationQuaternion!);\r\n this._anchorMesh.rotationQuaternion.normalize();\r\n this._anchorMesh.removeChild(this.attachedMesh);\r\n this.attachedMesh.setParent(originalParent);\r\n }\r\n this.updateBoundingBox();\r\n\r\n PivotTools._RestorePivotPoint(this.attachedMesh);\r\n }\r\n this._updateDummy();\r\n });\r\n\r\n // Selection/deselection\r\n this._rotateSpheresDragBehavior.onDragStartObservable.add(() => {\r\n this.onDragStartObservable.notifyObservers({});\r\n this._dragging = true;\r\n this._selectNode(sphere);\r\n });\r\n this._rotateSpheresDragBehavior.onDragEndObservable.add((event) => {\r\n this.onRotationSphereDragEndObservable.notifyObservers({});\r\n this._dragging = false;\r\n this._selectNode(null);\r\n this._updateDummy();\r\n this._unhoverMeshOnTouchUp(event.pointerInfo, sphere);\r\n });\r\n\r\n this._rotateSpheresParent.addChild(sphere);\r\n }\r\n this._rootMesh.addChild(this._rotateSpheresParent);\r\n\r\n // Create scale cubes\r\n this._scaleBoxesParent = new AbstractMesh(\"\", gizmoLayer.utilityLayerScene);\r\n this._scaleBoxesParent.rotationQuaternion = new Quaternion();\r\n for (let i = 0; i < 3; i++) {\r\n for (let j = 0; j < 3; j++) {\r\n for (let k = 0; k < 3; k++) {\r\n // create box for relevant axis\r\n const zeroAxisCount = (i === 1 ? 1 : 0) + (j === 1 ? 1 : 0) + (k === 1 ? 1 : 0);\r\n if (zeroAxisCount === 1 || zeroAxisCount === 3) {\r\n continue;\r\n }\r\n\r\n const box = CreateBox(\"\", { size: 1 }, gizmoLayer.utilityLayerScene);\r\n box.material = this._coloredMaterial;\r\n box._internalMetadata = zeroAxisCount === 2; // None homogenous scale handle\r\n box.isNearGrabbable = true;\r\n\r\n // Dragging logic\r\n const dragAxis = new Vector3(i - 1, j - 1, k - 1).normalize();\r\n this._scaleBoxesDragBehavior = new PointerDragBehavior({ dragAxis: dragAxis });\r\n this._scaleBoxesDragBehavior.updateDragPlane = false;\r\n this._scaleBoxesDragBehavior.moveAttached = false;\r\n let totalRelativeDragDistance = 0;\r\n let previousScale = 0;\r\n box.addBehavior(this._scaleBoxesDragBehavior);\r\n this._scaleBoxesDragBehavior.onDragObservable.add((event) => {\r\n this.onScaleBoxDragObservable.notifyObservers({});\r\n if (this.attachedMesh) {\r\n const originalParent = this.attachedMesh.parent;\r\n if (originalParent && (originalParent as Mesh).scaling && (originalParent as Mesh).scaling.isNonUniformWithinEpsilon(0.001)) {\r\n Logger.Warn(\"BoundingBoxGizmo controls are not supported on child meshes with non-uniform parent scaling\");\r\n return;\r\n }\r\n PivotTools._RemoveAndStorePivotPoint(this.attachedMesh);\r\n let relativeDragDistance = (event.dragDistance / this._boundingDimensions.length()) * this._anchorMesh.scaling.length();\r\n totalRelativeDragDistance += relativeDragDistance;\r\n if (this.scalingSnapDistance > 0) {\r\n const dragSteps = Math.floor(Math.abs(totalRelativeDragDistance) / this.scalingSnapDistance) * (totalRelativeDragDistance < 0 ? -1 : 1);\r\n const scale = this.scalingSnapDistance * dragSteps;\r\n relativeDragDistance = scale - previousScale;\r\n previousScale = scale;\r\n }\r\n\r\n const deltaScale = new Vector3(relativeDragDistance, relativeDragDistance, relativeDragDistance);\r\n const fullScale = new Vector3(previousScale, previousScale, previousScale);\r\n\r\n if (zeroAxisCount === 2) {\r\n // scale on 1 axis when using the anchor box in the face middle\r\n deltaScale.x *= Math.abs(dragAxis.x);\r\n deltaScale.y *= Math.abs(dragAxis.y);\r\n deltaScale.z *= Math.abs(dragAxis.z);\r\n }\r\n\r\n deltaScale.scaleInPlace(this._scaleDragSpeed);\r\n deltaScale.multiplyInPlace(this._axisFactor);\r\n\r\n fullScale.scaleInPlace(this._scaleDragSpeed);\r\n fullScale.multiplyInPlace(this._axisFactor);\r\n fullScale.addInPlace(this._incrementalStartupValue);\r\n\r\n this.updateBoundingBox();\r\n if (this.scalePivot) {\r\n this.attachedMesh.getWorldMatrix().getRotationMatrixToRef(this._tmpRotationMatrix);\r\n // Move anchor to desired pivot point (Bottom left corner + dimension/2)\r\n this._boundingDimensions.scaleToRef(0.5, this._tmpVector);\r\n Vector3.TransformCoordinatesToRef(this._tmpVector, this._tmpRotationMatrix, this._tmpVector);\r\n this._anchorMesh.position.subtractInPlace(this._tmpVector);\r\n this._boundingDimensions.multiplyToRef(this.scalePivot, this._tmpVector);\r\n Vector3.TransformCoordinatesToRef(this._tmpVector, this._tmpRotationMatrix, this._tmpVector);\r\n this._anchorMesh.position.addInPlace(this._tmpVector);\r\n } else {\r\n // Scale from the position of the opposite corner\r\n box.absolutePosition.subtractToRef(this._anchorMesh.position, this._tmpVector);\r\n this._anchorMesh.position.subtractInPlace(this._tmpVector);\r\n if (this.attachedMesh.isUsingPivotMatrix()) {\r\n this._anchorMesh.position.subtractInPlace(this.attachedMesh.getPivotPoint());\r\n }\r\n }\r\n\r\n this._anchorMesh.addChild(this.attachedMesh);\r\n if (this.incrementalSnap) {\r\n fullScale.x /= Math.abs(this._incrementalStartupValue.x) < Epsilon ? 1 : this._incrementalStartupValue.x;\r\n fullScale.y /= Math.abs(this._incrementalStartupValue.y) < Epsilon ? 1 : this._incrementalStartupValue.y;\r\n fullScale.z /= Math.abs(this._incrementalStartupValue.z) < Epsilon ? 1 : this._incrementalStartupValue.z;\r\n\r\n fullScale.x = Math.max(this._incrementalAnchorStartupValue.x * fullScale.x, this.scalingSnapDistance);\r\n fullScale.y = Math.max(this._incrementalAnchorStartupValue.y * fullScale.y, this.scalingSnapDistance);\r\n fullScale.z = Math.max(this._incrementalAnchorStartupValue.z * fullScale.z, this.scalingSnapDistance);\r\n\r\n this._anchorMesh.scaling.x += (fullScale.x - this._anchorMesh.scaling.x) * Math.abs(dragAxis.x);\r\n this._anchorMesh.scaling.y += (fullScale.y - this._anchorMesh.scaling.y) * Math.abs(dragAxis.y);\r\n this._anchorMesh.scaling.z += (fullScale.z - this._anchorMesh.scaling.z) * Math.abs(dragAxis.z);\r\n } else {\r\n this._anchorMesh.scaling.addInPlace(deltaScale);\r\n if (this._anchorMesh.scaling.x < 0 || this._anchorMesh.scaling.y < 0 || this._anchorMesh.scaling.z < 0) {\r\n this._anchorMesh.scaling.subtractInPlace(deltaScale);\r\n }\r\n }\r\n this._anchorMesh.removeChild(this.attachedMesh);\r\n this.attachedMesh.setParent(originalParent);\r\n PivotTools._RestorePivotPoint(this.attachedMesh);\r\n }\r\n this._updateDummy();\r\n });\r\n\r\n // Selection/deselection\r\n this._scaleBoxesDragBehavior.onDragStartObservable.add(() => {\r\n this.onDragStartObservable.notifyObservers({});\r\n this._dragging = true;\r\n this._selectNode(box);\r\n totalRelativeDragDistance = 0;\r\n previousScale = 0;\r\n this._incrementalStartupValue.copyFrom(this.attachedMesh!.scaling);\r\n this._incrementalAnchorStartupValue.copyFrom(this._anchorMesh!.scaling);\r\n });\r\n this._scaleBoxesDragBehavior.onDragEndObservable.add((event) => {\r\n this.onScaleBoxDragEndObservable.notifyObservers({});\r\n this._dragging = false;\r\n this._selectNode(null);\r\n this._updateDummy();\r\n this._unhoverMeshOnTouchUp(event.pointerInfo, box);\r\n });\r\n\r\n this._scaleBoxesParent.addChild(box);\r\n }\r\n }\r\n }\r\n this._rootMesh.addChild(this._scaleBoxesParent);\r\n\r\n // Hover color change\r\n const pointerIds: AbstractMesh[] = [];\r\n this._pointerObserver = gizmoLayer.utilityLayerScene.onPointerObservable.add((pointerInfo) => {\r\n if (!pointerIds[(<IPointerEvent>pointerInfo.event).pointerId]) {\r\n this._rotateSpheresParent\r\n .getChildMeshes()\r\n .concat(this._scaleBoxesParent.getChildMeshes())\r\n .forEach((mesh) => {\r\n if (pointerInfo.pickInfo && pointerInfo.pickInfo.pickedMesh == mesh) {\r\n pointerIds[(<IPointerEvent>pointerInfo.event).pointerId] = mesh;\r\n mesh.material = this._hoverColoredMaterial;\r\n this._isHovered = true;\r\n }\r\n });\r\n } else {\r\n if (pointerInfo.pickInfo && pointerInfo.pickInfo.pickedMesh != pointerIds[(<IPointerEvent>pointerInfo.event).pointerId]) {\r\n pointerIds[(<IPointerEvent>pointerInfo.event).pointerId].material = this._coloredMaterial;\r\n delete pointerIds[(<IPointerEvent>pointerInfo.event).pointerId];\r\n this._isHovered = false;\r\n }\r\n }\r\n });\r\n\r\n // Update bounding box positions\r\n this._renderObserver = this.gizmoLayer.originalScene.onBeforeRenderObservable.add(() => {\r\n // Only update the bounding box if scaling has changed\r\n if (this.attachedMesh && !this._existingMeshScale.equals(this.attachedMesh.scaling)) {\r\n this.updateBoundingBox();\r\n } else if (this.fixedDragMeshScreenSize || this.fixedDragMeshBoundsSize) {\r\n this._updateRotationSpheres();\r\n this._updateScaleBoxes();\r\n }\r\n\r\n // If drag mesh is enabled and dragging, update the attached mesh pose to match the drag mesh\r\n if (this._dragMesh && this.attachedMesh && this._pointerDragBehavior.dragging) {\r\n this._lineBoundingBox.position.rotateByQuaternionToRef(this._rootMesh.rotationQuaternion!, this._tmpVector);\r\n this.attachedMesh.setAbsolutePosition(this._dragMesh.position.add(this._tmpVector.scale(-1)));\r\n }\r\n });\r\n this.updateBoundingBox();\r\n }\r\n\r\n protected _attachedNodeChanged(value: Nullable<AbstractMesh>) {\r\n if (value) {\r\n // Reset anchor mesh to match attached mesh's scale\r\n // This is needed to avoid invalid box/sphere position on first drag\r\n this._anchorMesh.scaling.setAll(1);\r\n PivotTools._RemoveAndStorePivotPoint(value);\r\n const originalParent = value.parent;\r\n this._anchorMesh.addChild(value);\r\n this._anchorMesh.removeChild(value);\r\n value.setParent(originalParent);\r\n PivotTools._RestorePivotPoint(value);\r\n this.updateBoundingBox();\r\n value.getChildMeshes(false).forEach((m) => {\r\n m.markAsDirty(\"scaling\");\r\n });\r\n\r\n this.gizmoLayer.utilityLayerScene.onAfterRenderObservable.addOnce(() => {\r\n this._updateDummy();\r\n });\r\n }\r\n }\r\n\r\n protected _selectNode(selectedMesh: Nullable<Mesh>) {\r\n this._rotateSpheresParent\r\n .getChildMeshes()\r\n .concat(this._scaleBoxesParent.getChildMeshes())\r\n .forEach((m) => {\r\n m.isVisible = !selectedMesh || m == selectedMesh;\r\n });\r\n }\r\n\r\n protected _unhoverMeshOnTouchUp(pointerInfo: Nullable<PointerInfo>, selectedMesh: AbstractMesh) {\r\n // force unhover mesh if not a mouse event\r\n if (pointerInfo?.event instanceof PointerEvent && pointerInfo?.event.pointerType === \"touch\") {\r\n selectedMesh.material = this._coloredMaterial;\r\n }\r\n }\r\n\r\n /**\r\n * returns an array containing all boxes used for scaling (in increasing x, y and z orders)\r\n * @returns array of scaling boxes\r\n */\r\n public getScaleBoxes() {\r\n return this._scaleBoxesParent.getChildMeshes();\r\n }\r\n\r\n /**\r\n * Updates the bounding box information for the Gizmo\r\n */\r\n public updateBoundingBox() {\r\n if (this.attachedMesh) {\r\n PivotTools._RemoveAndStorePivotPoint(this.attachedMesh);\r\n\r\n // Store original parent\r\n const originalParent = this.attachedMesh.parent;\r\n this.attachedMesh.setParent(null);\r\n\r\n this._update();\r\n\r\n // Rotate based on axis\r\n if (!this.attachedMesh.rotationQuaternion) {\r\n this.attachedMesh.rotationQuaternion = Quaternion.RotationYawPitchRoll(this.attachedMesh.rotation.y, this.attachedMesh.rotation.x, this.attachedMesh.rotation.z);\r\n }\r\n if (!this._anchorMesh.rotationQuaternion) {\r\n this._anchorMesh.rotationQuaternion = Quaternion.RotationYawPitchRoll(this._anchorMesh.rotation.y, this._anchorMesh.rotation.x, this._anchorMesh.rotation.z);\r\n }\r\n this._anchorMesh.rotationQuaternion.copyFrom(this.attachedMesh.rotationQuaternion);\r\n\r\n // Store original position and reset mesh to origin before computing the bounding box\r\n this._tmpQuaternion.copyFrom(this.attachedMesh.rotationQuaternion);\r\n this._tmpVector.copyFrom(this.attachedMesh.position);\r\n this.attachedMesh.rotationQuaternion.set(0, 0, 0, 1);\r\n this.attachedMesh.position.set(0, 0, 0);\r\n\r\n // Update bounding dimensions/positions\r\n const boundingMinMax = this.attachedMesh.getHierarchyBoundingVectors(!this.ignoreChildren, this.includeChildPredicate);\r\n boundingMinMax.max.subtractToRef(boundingMinMax.min, this._boundingDimensions);\r\n\r\n // Update gizmo to match bounding box scaling and rotation\r\n // The position set here is the offset from the origin for the boundingbox when the attached mesh is at the origin\r\n // The position of the gizmo is then set to the attachedMesh in gizmo._update\r\n this._lineBoundingBox.scaling.copyFrom(this._boundingDimensions);\r\n this._lineBoundingBox.position.set(\r\n (boundingMinMax.max.x + boundingMinMax.min.x) / 2,\r\n (boundingMinMax.max.y + boundingMinMax.min.y) / 2,\r\n (boundingMinMax.max.z + boundingMinMax.min.z) / 2\r\n );\r\n this._rotateSpheresParent.position.copyFrom(this._lineBoundingBox.position);\r\n this._scaleBoxesParent.position.copyFrom(this._lineBoundingBox.position);\r\n this._lineBoundingBox.computeWorldMatrix();\r\n this._anchorMesh.position.copyFrom(this._lineBoundingBox.absolutePosition);\r\n\r\n // Restore position/rotation values\r\n this.attachedMesh.rotationQuaternion.copyFrom(this._tmpQuaternion);\r\n this.attachedMesh.position.copyFrom(this._tmpVector);\r\n\r\n // Restore original parent\r\n this.attachedMesh.setParent(originalParent);\r\n }\r\n\r\n this._updateRotationSpheres();\r\n this._updateScaleBoxes();\r\n\r\n if (this.attachedMesh) {\r\n this._existingMeshScale.copyFrom(this.attachedMesh.scaling);\r\n PivotTools._RestorePivotPoint(this.attachedMesh);\r\n }\r\n }\r\n\r\n protected _updateRotationSpheres() {\r\n const rotateSpheres = this._rotateSpheresParent.getChildMeshes();\r\n for (let i = 0; i < 3; i++) {\r\n for (let j = 0; j < 2; j++) {\r\n for (let k = 0; k < 2; k++) {\r\n const index = i * 4 + j * 2 + k;\r\n if (i == 0) {\r\n rotateSpheres[index].position.set(this._boundingDimensions.x / 2, this._boundingDimensions.y * j, this._boundingDimensions.z * k);\r\n rotateSpheres[index].position.addInPlace(new Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));\r\n rotateSpheres[index].lookAt(\r\n Vector3.Cross(rotateSpheres[index].position.normalizeToNew(), Vector3.Right()).normalizeToNew().add(rotateSpheres[index].position)\r\n );\r\n }\r\n if (i == 1) {\r\n rotateSpheres[index].position.set(this._boundingDimensions.x * j, this._boundingDimensions.y / 2, this._boundingDimensions.z * k);\r\n rotateSpheres[index].position.addInPlace(new Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));\r\n rotateSpheres[index].lookAt(\r\n Vector3.Cross(rotateSpheres[index].position.normalizeToNew(), Vector3.Up()).normalizeToNew().add(rotateSpheres[index].position)\r\n );\r\n }\r\n if (i == 2) {\r\n rotateSpheres[index].position.set(this._boundingDimensions.x * j, this._boundingDimensions.y * k, this._boundingDimensions.z / 2);\r\n rotateSpheres[index].position.addInPlace(new Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));\r\n rotateSpheres[index].lookAt(\r\n Vector3.Cross(rotateSpheres[index].position.normalizeToNew(), Vector3.Forward()).normalizeToNew().add(rotateSpheres[index].position)\r\n );\r\n }\r\n if (this.fixedDragMeshScreenSize && this.gizmoLayer.utilityLayerScene.activeCamera) {\r\n rotateSpheres[index].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position, this._tmpVector);\r\n const distanceFromCamera = (this.rotationSphereSize * this._tmpVector.length()) / this.fixedDragMeshScreenSizeDistanceFactor;\r\n rotateSpheres[index].scaling.set(distanceFromCamera, distanceFromCamera, distanceFromCamera);\r\n } else if (this.fixedDragMeshBoundsSize) {\r\n rotateSpheres[index].scaling.set(\r\n this.rotationSphereSize * this._boundingDimensions.x,\r\n this.rotationSphereSize * this._boundingDimensions.y,\r\n this.rotationSphereSize * this._boundingDimensions.z\r\n );\r\n } else {\r\n rotateSpheres[index].scaling.set(this.rotationSphereSize, this.rotationSphereSize, this.rotationSphereSize);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n protected _updateScaleBoxes() {\r\n const scaleBoxes = this._scaleBoxesParent.getChildMeshes();\r\n let index = 0;\r\n for (let i = 0; i < 3; i++) {\r\n for (let j = 0; j < 3; j++) {\r\n for (let k = 0; k < 3; k++) {\r\n const zeroAxisCount = (i === 1 ? 1 : 0) + (j === 1 ? 1 : 0) + (k === 1 ? 1 : 0);\r\n if (zeroAxisCount === 1 || zeroAxisCount === 3) {\r\n continue;\r\n }\r\n if (scaleBoxes[index]) {\r\n scaleBoxes[index].position.set(this._boundingDimensions.x * (i / 2), this._boundingDimensions.y * (j / 2), this._boundingDimensions.z * (k / 2));\r\n scaleBoxes[index].position.addInPlace(new Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));\r\n if (this.fixedDragMeshScreenSize && this.gizmoLayer.utilityLayerScene.activeCamera) {\r\n scaleBoxes[index].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.globalPosition, this._tmpVector);\r\n const distanceFromCamera = (this.scaleBoxSize * this._tmpVector.length()) / this.fixedDragMeshScreenSizeDistanceFactor;\r\n scaleBoxes[index].scaling.set(distanceFromCamera, distanceFromCamera, distanceFromCamera);\r\n } else if (this.fixedDragMeshBoundsSize) {\r\n scaleBoxes[index].scaling.set(\r\n this.scaleBoxSize * this._boundingDimensions.x,\r\n this.scaleBoxSize * this._boundingDimensions.y,\r\n this.scaleBoxSize * this._boundingDimensions.z\r\n );\r\n } else {\r\n scaleBoxes[index].scaling.set(this.scaleBoxSize, this.scaleBoxSize, this.scaleBoxSize);\r\n }\r\n }\r\n index++;\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Enables rotation on the specified axis and disables rotation on the others\r\n * @param axis The list of axis that should be enabled (eg. \"xy\" or \"xyz\")\r\n */\r\n public setEnabledRotationAxis(axis: string) {\r\n this._rotateSpheresParent.getChildMeshes().forEach((m, i) => {\r\n if (i < 4) {\r\n m.setEnabled(axis.indexOf(\"x\") != -1);\r\n } else if (i < 8) {\r\n m.setEnabled(axis.indexOf(\"y\") != -1);\r\n } else {\r\n m.setEnabled(axis.indexOf(\"z\") != -1);\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Enables/disables scaling\r\n * @param enable if scaling should be enabled\r\n * @param homogeneousScaling defines if scaling should only be homogeneous\r\n */\r\n public setEnabledScaling(enable: boolean, homogeneousScaling = false) {\r\n this._scaleBoxesParent.getChildMeshes().forEach((m) => {\r\n let enableMesh = enable;\r\n // Disable heterogeneous scale handles if requested.\r\n if (homogeneousScaling && m._internalMetadata === true) {\r\n enableMesh = false;\r\n }\r\n m.setEnabled(enableMesh);\r\n });\r\n }\r\n\r\n protected _updateDummy() {\r\n if (this._dragMesh) {\r\n this._dragMesh.position.copyFrom(this._lineBoundingBox.getAbsolutePosition());\r\n this._dragMesh.scaling.copyFrom(this._lineBoundingBox.scaling);\r\n this._dragMesh.rotationQuaternion!.copyFrom(this._rootMesh.rotationQuaternion!);\r\n }\r\n }\r\n\r\n /**\r\n * Enables a pointer drag behavior on the bounding box of the gizmo\r\n */\r\n public enableDragBehavior() {\r\n this._dragMesh = CreateBox(\"dummy\", { size: 1 }, this.gizmoLayer.utilityLayerScene);\r\n this._dragMesh.visibility = 0;\r\n this._dragMesh.rotationQuaternion = new Quaternion();\r\n this._pointerDragBehavior.useObjectOrientationForDragging = false;\r\n this._dragMesh.addBehavior(this._pointerDragBehavior);\r\n }\r\n\r\n /**\r\n * Force release the drag action by code\r\n */\r\n public releaseDrag() {\r\n this._scaleBoxesDragBehavior.releaseDrag();\r\n this._rotateSpheresDragBehavior.releaseDrag();\r\n this._pointerDragBehavior.releaseDrag();\r\n }\r\n\r\n /**\r\n * Disposes of the gizmo\r\n */\r\n public dispose() {\r\n this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver);\r\n this.gizmoLayer.originalScene.onBeforeRenderObservable.remove(this._renderObserver);\r\n this._lineBoundingBox.dispose();\r\n this._rotateSpheresParent.dispose();\r\n this._scaleBoxesParent.dispose();\r\n if (this._dragMesh) {\r\n this._dragMesh.dispose();\r\n }\r\n super.dispose();\r\n }\r\n\r\n /**\r\n * Makes a mesh not pickable and wraps the mesh inside of a bounding box mesh that is pickable. (This is useful to avoid picking within complex geometry)\r\n * @param mesh the mesh to wrap in the bounding box mesh and make not pickable\r\n * @returns the bounding box mesh with the passed in mesh as a child\r\n */\r\n public static MakeNotPickableAndWrapInBoundingBox(mesh: Mesh): Mesh {\r\n const makeNotPickable = (root: AbstractMesh) => {\r\n root.isPickable = false;\r\n root.getChildMeshes().forEach((c) => {\r\n makeNotPickable(c);\r\n });\r\n };\r\n makeNotPickable(mesh);\r\n\r\n // Reset position to get bounding box from origin with no rotation\r\n if (!mesh.rotationQuaternion) {\r\n mesh.rotationQuaternion = Quaternion.RotationYawPitchRoll(mesh.rotation.y, mesh.rotation.x, mesh.rotation.z);\r\n }\r\n const oldPos = mesh.position.clone();\r\n const oldRot = mesh.rotationQuaternion.clone();\r\n mesh.rotationQuaternion.set(0, 0, 0, 1);\r\n mesh.position.set(0, 0, 0);\r\n\r\n // Update bounding dimensions/positions\r\n const box = CreateBox(\"box\", { size: 1 }, mesh.getScene());\r\n const boundingMinMax = mesh.getHierarchyBoundingVectors();\r\n boundingMinMax.max.subtractToRef(boundingMinMax.min, box.scaling);\r\n\r\n // Adjust scale to avoid undefined behavior when adding child\r\n if (box.scaling.y === 0) {\r\n box.scaling.y = Epsilon;\r\n }\r\n if (box.scaling.x === 0) {\r\n box.scaling.x = Epsilon;\r\n }\r\n if (box.scaling.z === 0) {\r\n box.scaling.z = Epsilon;\r\n }\r\n\r\n box.position.set((boundingMinMax.max.x + boundingMinMax.min.x) / 2, (boundingMinMax.max.y + boundingMinMax.min.y) / 2, (boundingMinMax.max.z + boundingMinMax.min.z) / 2);\r\n\r\n // Restore original positions\r\n mesh.addChild(box);\r\n mesh.rotationQuaternion.copyFrom(oldRot);\r\n mesh.position.copyFrom(oldPos);\r\n\r\n // Reverse parenting\r\n mesh.removeChild(box);\r\n\r\n box.addChild(mesh);\r\n box.visibility = 0;\r\n return box;\r\n }\r\n /**\r\n * CustomMeshes are not supported by this gizmo\r\n */\r\n public setCustomMesh() {\r\n Logger.Error(\"Custom meshes are not supported on this gizmo\");\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"boundingBoxGizmo.js","sourceRoot":"","sources":["../../../../dev/core/src/Gizmos/boundingBoxGizmo.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAIxC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAE9E,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAyFlD;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IA6FvC;;;OAGG;IACH,IAAW,UAAU,CAAC,MAAe;QACjC,IAA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B,MAAM,CAAC,KAAK,CAAC,+CAA+C,CAAC,CAAC;IAClE,CAAC;CACJ","sourcesContent":["import type { Observer } from \"../Misc/observable\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { PointerInfo } from \"../Events/pointerEvents\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Quaternion, Matrix, Vector3 } from \"../Maths/math.vector\";\r\nimport { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\nimport { CreateSphere } from \"../Meshes/Builders/sphereBuilder\";\r\nimport { CreateBox } from \"../Meshes/Builders/boxBuilder\";\r\nimport { CreateLines } from \"../Meshes/Builders/linesBuilder\";\r\nimport { PointerDragBehavior } from \"../Behaviors/Meshes/pointerDragBehavior\";\r\nimport type { IGizmo } from \"./gizmo\";\r\nimport { Gizmo } from \"./gizmo\";\r\nimport { UtilityLayerRenderer } from \"../Rendering/utilityLayerRenderer\";\r\nimport { StandardMaterial } from \"../Materials/standardMaterial\";\r\nimport { PivotTools } from \"../Misc/pivotTools\";\r\nimport { Color3 } from \"../Maths/math.color\";\r\nimport type { LinesMesh } from \"../Meshes/linesMesh\";\r\nimport { Epsilon } from \"../Maths/math.constants\";\r\nimport type { IPointerEvent } from \"../Events/deviceInputEvents\";\r\n\r\n/**\r\n * Interface for bounding box gizmo\r\n */\r\nexport interface IBoundingBoxGizmo extends IGizmo {\r\n /**\r\n * 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.\r\n */\r\n ignoreChildren: boolean;\r\n /**\r\n * Returns true if a descendant should be included when computing the bounding box. When null, all descendants are included. If ignoreChildren is set this will be ignored.\r\n */\r\n includeChildPredicate: Nullable<(abstractMesh: AbstractMesh) => boolean>;\r\n /** The size of the rotation spheres attached to the bounding box */\r\n rotationSphereSize: number;\r\n /** The size of the scale boxes attached to the bounding box */\r\n scaleBoxSize: number;\r\n /**\r\n * If set, the rotation spheres and scale boxes will increase in size based on the distance away from the camera to have a consistent screen size\r\n * Note : fixedDragMeshScreenSize takes precedence over fixedDragMeshBoundsSize if both are true\r\n */\r\n fixedDragMeshScreenSize: boolean;\r\n /**\r\n * If set, the rotation spheres and scale boxes will increase in size based on the size of the bounding box\r\n * Note : fixedDragMeshScreenSize takes precedence over fixedDragMeshBoundsSize if both are true\r\n */\r\n fixedDragMeshBoundsSize: boolean;\r\n /**\r\n * The distance away from the object which the draggable meshes should appear world sized when fixedDragMeshScreenSize is set to true\r\n */\r\n fixedDragMeshScreenSizeDistanceFactor: number;\r\n /** True when a rotation sphere or scale box or a attached mesh is dragged */\r\n readonly isDragging: boolean;\r\n /** Fired when a rotation sphere or scale box is dragged */\r\n onDragStartObservable: Observable<{}>;\r\n /** Fired when a scale box is dragged */\r\n onScaleBoxDragObservable: Observable<{}>;\r\n /** Fired when a scale box drag is ended */\r\n onScaleBoxDragEndObservable: Observable<{}>;\r\n /** Fired when a rotation sphere is dragged */\r\n onRotationSphereDragObservable: Observable<{}>;\r\n /** Fired when a rotation sphere drag is ended */\r\n onRotationSphereDragEndObservable: Observable<{}>;\r\n /** Relative bounding box pivot used when scaling the attached node. */\r\n scalePivot: Nullable<Vector3>;\r\n /** Scale factor vector used for masking some axis */\r\n axisFactor: Vector3;\r\n /** Scale factor scalar affecting all axes' drag speed */\r\n scaleDragSpeed: number;\r\n /**\r\n * Sets the color of the bounding box gizmo\r\n * @param color the color to set\r\n */\r\n setColor(color: Color3): void;\r\n /** Returns an array containing all boxes used for scaling (in increasing x, y and z orders) */\r\n getScaleBoxes(): AbstractMesh[];\r\n /** Updates the bounding box information for the Gizmo */\r\n updateBoundingBox(): void;\r\n /**\r\n * Enables rotation on the specified axis and disables rotation on the others\r\n * @param axis The list of axis that should be enabled (eg. \"xy\" or \"xyz\")\r\n */\r\n setEnabledRotationAxis(axis: string): void;\r\n /**\r\n * Enables/disables scaling\r\n * @param enable if scaling should be enabled\r\n * @param homogeneousScaling defines if scaling should only be homogeneous\r\n */\r\n setEnabledScaling(enable: boolean, homogeneousScaling?: boolean): void;\r\n /** Enables a pointer drag behavior on the bounding box of the gizmo */\r\n enableDragBehavior(): void;\r\n /**\r\n * Force release the drag action by code\r\n */\r\n releaseDrag(): void;\r\n\r\n /** Default material used to render when gizmo is not disabled or hovered */\r\n coloredMaterial: StandardMaterial;\r\n /** Material used to render when gizmo is hovered with mouse*/\r\n hoverMaterial: StandardMaterial;\r\n\r\n /** Drag distance in babylon units that the gizmo will snap scaling to when dragged */\r\n scalingSnapDistance: number;\r\n /** Drag distance in babylon units that the gizmo will snap rotation to when dragged */\r\n rotationSnapDistance: number;\r\n}\r\n\r\n/**\r\n * Bounding box gizmo\r\n */\r\nexport class BoundingBoxGizmo extends Gizmo implements IBoundingBoxGizmo {\r\n protected _lineBoundingBox: AbstractMesh;\r\n protected _rotateSpheresParent: AbstractMesh;\r\n protected _scaleBoxesParent: AbstractMesh;\r\n protected _boundingDimensions = new Vector3(1, 1, 1);\r\n protected _renderObserver: Nullable<Observer<Scene>> = null;\r\n protected _pointerObserver: Nullable<Observer<PointerInfo>> = null;\r\n protected _scaleDragSpeed = 0.2;\r\n protected _rotateSpheresDragBehaviors: Array<PointerDragBehavior> = [];\r\n protected _scaleBoxesDragBehaviors: Array<PointerDragBehavior> = [];\r\n /**\r\n * boolean updated when a rotation sphere or scale box is dragged\r\n */\r\n protected _dragging = false;\r\n\r\n private _tmpQuaternion = new Quaternion();\r\n private _tmpVector = new Vector3(0, 0, 0);\r\n private _tmpRotationMatrix = new Matrix();\r\n private _incrementalStartupValue = Vector3.Zero();\r\n private _incrementalAnchorStartupValue = Vector3.Zero();\r\n /**\r\n * 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)\r\n */\r\n public ignoreChildren = false;\r\n /**\r\n * Returns true if a descendant should be included when computing the bounding box. When null, all descendants are included. If ignoreChildren is set this will be ignored. (Default: null)\r\n */\r\n public includeChildPredicate: Nullable<(abstractMesh: AbstractMesh) => boolean> = null;\r\n\r\n /**\r\n * The size of the rotation spheres attached to the bounding box (Default: 0.1)\r\n */\r\n public rotationSphereSize = 0.1;\r\n /**\r\n * The size of the scale boxes attached to the bounding box (Default: 0.1)\r\n */\r\n public scaleBoxSize = 0.1;\r\n /**\r\n * If set, the rotation spheres and scale boxes will increase in size based on the distance away from the camera to have a consistent screen size (Default: false)\r\n * Note : fixedDragMeshScreenSize takes precedence over fixedDragMeshBoundsSize if both are true\r\n */\r\n public fixedDragMeshScreenSize = false;\r\n /**\r\n * If set, the rotation spheres and scale boxes will increase in size based on the size of the bounding box\r\n * Note : fixedDragMeshScreenSize takes precedence over fixedDragMeshBoundsSize if both are true\r\n */\r\n public fixedDragMeshBoundsSize = false;\r\n /**\r\n * The distance away from the object which the draggable meshes should appear world sized when fixedDragMeshScreenSize is set to true (default: 10)\r\n */\r\n public fixedDragMeshScreenSizeDistanceFactor = 10;\r\n /**\r\n * Drag distance in babylon units that the gizmo will snap scaling to when dragged\r\n */\r\n public scalingSnapDistance = 0;\r\n /**\r\n * Drag distance in babylon units that the gizmo will snap rotation to when dragged\r\n */\r\n public rotationSnapDistance = 0;\r\n /**\r\n * Fired when a rotation sphere or scale box is dragged\r\n */\r\n public onDragStartObservable = new Observable<{}>();\r\n /**\r\n * Fired when a scale box is dragged\r\n */\r\n public onScaleBoxDragObservable = new Observable<{}>();\r\n /**\r\n * Fired when a scale box drag is ended\r\n */\r\n public onScaleBoxDragEndObservable = new Observable<{}>();\r\n /**\r\n * Fired when a rotation sphere is dragged\r\n */\r\n public onRotationSphereDragObservable = new Observable<{}>();\r\n /**\r\n * Fired when a rotation sphere drag is ended\r\n */\r\n public onRotationSphereDragEndObservable = new Observable<{}>();\r\n /**\r\n * Relative bounding box pivot used when scaling the attached node. When null object with scale from the opposite corner. 0.5,0.5,0.5 for center and 0.5,0,0.5 for bottom (Default: null)\r\n */\r\n public scalePivot: Nullable<Vector3> = null;\r\n /**\r\n * Scale factor used for masking some axis\r\n */\r\n protected _axisFactor = new Vector3(1, 1, 1);\r\n\r\n /**\r\n * Incremental snap scaling (default is false). When true, with a snapDistance of 0.1, scaling will be 1.1,1.2,1.3 instead of, when false: 1.1,1.21,1.33,...\r\n */\r\n public incrementalSnap = false;\r\n\r\n /**\r\n * Sets the axis factor\r\n * @param factor the Vector3 value\r\n */\r\n public set axisFactor(factor: Vector3) {\r\n this._axisFactor = factor;\r\n // update scale cube visibility\r\n const scaleBoxes = this._scaleBoxesParent.getChildMeshes();\r\n let index = 0;\r\n for (let i = 0; i < 3; i++) {\r\n for (let j = 0; j < 3; j++) {\r\n for (let k = 0; k < 3; k++) {\r\n const zeroAxisCount = (i === 1 ? 1 : 0) + (j === 1 ? 1 : 0) + (k === 1 ? 1 : 0);\r\n if (zeroAxisCount === 1 || zeroAxisCount === 3) {\r\n continue;\r\n }\r\n if (scaleBoxes[index]) {\r\n const dragAxis = new Vector3(i - 1, j - 1, k - 1);\r\n dragAxis.multiplyInPlace(this._axisFactor);\r\n scaleBoxes[index].setEnabled(dragAxis.lengthSquared() > Epsilon);\r\n }\r\n index++;\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets the axis factor\r\n * @returns the Vector3 factor value\r\n */\r\n public get axisFactor(): Vector3 {\r\n return this._axisFactor;\r\n }\r\n\r\n /**\r\n * Sets scale drag speed value\r\n * @param value the new speed value\r\n */\r\n public set scaleDragSpeed(value: number) {\r\n this._scaleDragSpeed = value;\r\n }\r\n\r\n /**\r\n * Gets scale drag speed\r\n * @returns the scale speed number\r\n */\r\n public get scaleDragSpeed(): number {\r\n return this._scaleDragSpeed;\r\n }\r\n\r\n /**\r\n * Mesh used as a pivot to rotate the attached node\r\n */\r\n protected _anchorMesh: AbstractMesh;\r\n\r\n protected _existingMeshScale = new Vector3();\r\n\r\n // Dragging\r\n protected _dragMesh: Nullable<Mesh> = null;\r\n protected _pointerDragBehavior = new PointerDragBehavior();\r\n\r\n protected _coloredMaterial: StandardMaterial;\r\n protected _hoverColoredMaterial: StandardMaterial;\r\n\r\n /** Default material used to render when gizmo is not disabled or hovered */\r\n public get coloredMaterial() {\r\n return this._coloredMaterial;\r\n }\r\n\r\n /** Material used to render when gizmo is hovered with mouse*/\r\n public get hoverMaterial() {\r\n return this._hoverColoredMaterial;\r\n }\r\n /**\r\n * Get the pointerDragBehavior\r\n */\r\n public get pointerDragBehavior(): PointerDragBehavior {\r\n return this._pointerDragBehavior;\r\n }\r\n\r\n /** True when a rotation sphere or scale box or a attached mesh is dragged */\r\n public get isDragging() {\r\n return this._dragging || this._pointerDragBehavior.dragging;\r\n }\r\n\r\n /**\r\n * Sets the color of the bounding box gizmo\r\n * @param color the color to set\r\n */\r\n public setColor(color: Color3) {\r\n this._coloredMaterial.emissiveColor = color;\r\n this._hoverColoredMaterial.emissiveColor = color.clone().add(new Color3(0.3, 0.3, 0.3));\r\n this._lineBoundingBox.getChildren().forEach((l) => {\r\n if ((l as LinesMesh).color) {\r\n (l as LinesMesh).color = color;\r\n }\r\n });\r\n }\r\n /**\r\n * Creates an BoundingBoxGizmo\r\n * @param color The color of the gizmo\r\n * @param gizmoLayer The utility layer the gizmo will be added to\r\n */\r\n constructor(color: Color3 = Color3.Gray(), gizmoLayer: UtilityLayerRenderer = UtilityLayerRenderer.DefaultKeepDepthUtilityLayer) {\r\n super(gizmoLayer);\r\n\r\n // Do not update the gizmo's scale so it has a fixed size to the object its attached to\r\n this.updateScale = false;\r\n\r\n this._anchorMesh = new AbstractMesh(\"anchor\", gizmoLayer.utilityLayerScene);\r\n // Create Materials\r\n this._coloredMaterial = new StandardMaterial(\"\", gizmoLayer.utilityLayerScene);\r\n this._coloredMaterial.disableLighting = true;\r\n this._hoverColoredMaterial = new StandardMaterial(\"\", gizmoLayer.utilityLayerScene);\r\n this._hoverColoredMaterial.disableLighting = true;\r\n\r\n // Build bounding box out of lines\r\n this._lineBoundingBox = new AbstractMesh(\"\", gizmoLayer.utilityLayerScene);\r\n this._lineBoundingBox.rotationQuaternion = new Quaternion();\r\n const lines = [];\r\n lines.push(CreateLines(\"lines\", { points: [new Vector3(0, 0, 0), new Vector3(this._boundingDimensions.x, 0, 0)] }, gizmoLayer.utilityLayerScene));\r\n lines.push(CreateLines(\"lines\", { points: [new Vector3(0, 0, 0), new Vector3(0, this._boundingDimensions.y, 0)] }, gizmoLayer.utilityLayerScene));\r\n lines.push(CreateLines(\"lines\", { points: [new Vector3(0, 0, 0), new Vector3(0, 0, this._boundingDimensions.z)] }, gizmoLayer.utilityLayerScene));\r\n lines.push(\r\n CreateLines(\r\n \"lines\",\r\n { points: [new Vector3(this._boundingDimensions.x, 0, 0), new Vector3(this._boundingDimensions.x, this._boundingDimensions.y, 0)] },\r\n gizmoLayer.utilityLayerScene\r\n )\r\n );\r\n lines.push(\r\n CreateLines(\r\n \"lines\",\r\n { points: [new Vector3(this._boundingDimensions.x, 0, 0), new Vector3(this._boundingDimensions.x, 0, this._boundingDimensions.z)] },\r\n gizmoLayer.utilityLayerScene\r\n )\r\n );\r\n lines.push(\r\n CreateLines(\r\n \"lines\",\r\n { points: [new Vector3(0, this._boundingDimensions.y, 0), new Vector3(this._boundingDimensions.x, this._boundingDimensions.y, 0)] },\r\n gizmoLayer.utilityLayerScene\r\n )\r\n );\r\n lines.push(\r\n CreateLines(\r\n \"lines\",\r\n { points: [new Vector3(0, this._boundingDimensions.y, 0), new Vector3(0, this._boundingDimensions.y, this._boundingDimensions.z)] },\r\n gizmoLayer.utilityLayerScene\r\n )\r\n );\r\n lines.push(\r\n CreateLines(\r\n \"lines\",\r\n { points: [new Vector3(0, 0, this._boundingDimensions.z), new Vector3(this._boundingDimensions.x, 0, this._boundingDimensions.z)] },\r\n gizmoLayer.utilityLayerScene\r\n )\r\n );\r\n lines.push(\r\n CreateLines(\r\n \"lines\",\r\n { points: [new Vector3(0, 0, this._boundingDimensions.z), new Vector3(0, this._boundingDimensions.y, this._boundingDimensions.z)] },\r\n gizmoLayer.utilityLayerScene\r\n )\r\n );\r\n lines.push(\r\n CreateLines(\r\n \"lines\",\r\n {\r\n points: [\r\n new Vector3(this._boundingDimensions.x, this._boundingDimensions.y, this._boundingDimensions.z),\r\n new Vector3(0, this._boundingDimensions.y, this._boundingDimensions.z),\r\n ],\r\n },\r\n gizmoLayer.utilityLayerScene\r\n )\r\n );\r\n lines.push(\r\n CreateLines(\r\n \"lines\",\r\n {\r\n points: [\r\n new Vector3(this._boundingDimensions.x, this._boundingDimensions.y, this._boundingDimensions.z),\r\n new Vector3(this._boundingDimensions.x, 0, this._boundingDimensions.z),\r\n ],\r\n },\r\n gizmoLayer.utilityLayerScene\r\n )\r\n );\r\n lines.push(\r\n CreateLines(\r\n \"lines\",\r\n {\r\n points: [\r\n new Vector3(this._boundingDimensions.x, this._boundingDimensions.y, this._boundingDimensions.z),\r\n new Vector3(this._boundingDimensions.x, this._boundingDimensions.y, 0),\r\n ],\r\n },\r\n gizmoLayer.utilityLayerScene\r\n )\r\n );\r\n lines.forEach((l) => {\r\n l.color = color;\r\n l.position.addInPlace(new Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));\r\n l.isPickable = false;\r\n this._lineBoundingBox.addChild(l);\r\n });\r\n this._rootMesh.addChild(this._lineBoundingBox);\r\n\r\n this.setColor(color);\r\n\r\n // Create rotation spheres\r\n this._rotateSpheresParent = new AbstractMesh(\"\", gizmoLayer.utilityLayerScene);\r\n this._rotateSpheresParent.rotationQuaternion = new Quaternion();\r\n for (let i = 0; i < 12; i++) {\r\n const sphere = CreateSphere(\"\", { diameter: 1 }, gizmoLayer.utilityLayerScene);\r\n sphere.rotationQuaternion = new Quaternion();\r\n sphere.material = this._coloredMaterial;\r\n sphere.isNearGrabbable = true;\r\n\r\n // Drag behavior\r\n const rotateSpheresDragBehavior = new PointerDragBehavior({});\r\n rotateSpheresDragBehavior.moveAttached = false;\r\n rotateSpheresDragBehavior.updateDragPlane = false;\r\n sphere.addBehavior(rotateSpheresDragBehavior);\r\n const startingTurnDirection = new Vector3(1, 0, 0);\r\n let totalTurnAmountOfDrag = 0;\r\n let previousProjectDist = 0;\r\n rotateSpheresDragBehavior.onDragStartObservable.add(() => {\r\n startingTurnDirection.copyFrom(sphere.forward);\r\n totalTurnAmountOfDrag = 0;\r\n previousProjectDist = 0;\r\n });\r\n rotateSpheresDragBehavior.onDragObservable.add((event) => {\r\n this.onRotationSphereDragObservable.notifyObservers({});\r\n if (this.attachedMesh) {\r\n const originalParent = this.attachedMesh.parent;\r\n if (originalParent && (originalParent as Mesh).scaling && (originalParent as Mesh).scaling.isNonUniformWithinEpsilon(0.001)) {\r\n Logger.Warn(\"BoundingBoxGizmo controls are not supported on child meshes with non-uniform parent scaling\");\r\n return;\r\n }\r\n PivotTools._RemoveAndStorePivotPoint(this.attachedMesh);\r\n\r\n const worldDragDirection = startingTurnDirection;\r\n\r\n // Project the world right on to the drag plane\r\n const toSub = event.dragPlaneNormal.scale(Vector3.Dot(event.dragPlaneNormal, worldDragDirection));\r\n const dragAxis = worldDragDirection.subtract(toSub).normalizeToNew();\r\n\r\n // project drag delta on to the resulting drag axis and rotate based on that\r\n let projectDist = Vector3.Dot(dragAxis, event.delta) < 0 ? Math.abs(event.delta.length()) : -Math.abs(event.delta.length());\r\n\r\n // Make rotation relative to size of mesh.\r\n projectDist = (projectDist / this._boundingDimensions.length()) * this._anchorMesh.scaling.length();\r\n\r\n // Rotate based on axis\r\n if (!this.attachedMesh.rotationQuaternion) {\r\n this.attachedMesh.rotationQuaternion = Quaternion.RotationYawPitchRoll(\r\n this.attachedMesh.rotation.y,\r\n this.attachedMesh.rotation.x,\r\n this.attachedMesh.rotation.z\r\n );\r\n }\r\n if (!this._anchorMesh.rotationQuaternion) {\r\n this._anchorMesh.rotationQuaternion = Quaternion.RotationYawPitchRoll(\r\n this._anchorMesh.rotation.y,\r\n this._anchorMesh.rotation.x,\r\n this._anchorMesh.rotation.z\r\n );\r\n }\r\n\r\n // Do not allow the object to turn more than a full circle\r\n totalTurnAmountOfDrag += projectDist;\r\n if (Math.abs(totalTurnAmountOfDrag) <= 2 * Math.PI) {\r\n if (this.rotationSnapDistance > 0) {\r\n const dragSteps = Math.floor(Math.abs(totalTurnAmountOfDrag) / this.rotationSnapDistance) * (totalTurnAmountOfDrag < 0 ? -1 : 1);\r\n const angle = this.rotationSnapDistance * dragSteps;\r\n projectDist = angle - previousProjectDist;\r\n previousProjectDist = angle;\r\n }\r\n if (i >= 8) {\r\n Quaternion.RotationYawPitchRollToRef(0, 0, projectDist, this._tmpQuaternion);\r\n } else if (i >= 4) {\r\n Quaternion.RotationYawPitchRollToRef(projectDist, 0, 0, this._tmpQuaternion);\r\n } else {\r\n Quaternion.RotationYawPitchRollToRef(0, projectDist, 0, this._tmpQuaternion);\r\n }\r\n\r\n // if using pivot, move anchor so mesh will be at relative (0,0,0) when parented\r\n if (this.attachedMesh.isUsingPivotMatrix()) {\r\n this._anchorMesh.position.copyFrom(this.attachedMesh.position);\r\n }\r\n // Rotate around center of bounding box\r\n this._anchorMesh.addChild(this.attachedMesh);\r\n if (this._anchorMesh.getScene().useRightHandedSystem) {\r\n this._tmpQuaternion.conjugateInPlace();\r\n }\r\n this._tmpQuaternion.normalize();\r\n this._anchorMesh.rotationQuaternion!.multiplyToRef(this._tmpQuaternion, this._anchorMesh.rotationQuaternion!);\r\n this._anchorMesh.rotationQuaternion.normalize();\r\n this._anchorMesh.removeChild(this.attachedMesh);\r\n this.attachedMesh.setParent(originalParent);\r\n }\r\n this.updateBoundingBox();\r\n\r\n PivotTools._RestorePivotPoint(this.attachedMesh);\r\n }\r\n this._updateDummy();\r\n });\r\n\r\n // Selection/deselection\r\n rotateSpheresDragBehavior.onDragStartObservable.add(() => {\r\n this.onDragStartObservable.notifyObservers({});\r\n this._dragging = true;\r\n this._selectNode(sphere);\r\n });\r\n rotateSpheresDragBehavior.onDragEndObservable.add((event) => {\r\n this.onRotationSphereDragEndObservable.notifyObservers({});\r\n this._dragging = false;\r\n this._selectNode(null);\r\n this._updateDummy();\r\n this._unhoverMeshOnTouchUp(event.pointerInfo, sphere);\r\n });\r\n\r\n this._rotateSpheresDragBehaviors.push(rotateSpheresDragBehavior);\r\n\r\n this._rotateSpheresParent.addChild(sphere);\r\n }\r\n this._rootMesh.addChild(this._rotateSpheresParent);\r\n\r\n // Create scale cubes\r\n this._scaleBoxesParent = new AbstractMesh(\"\", gizmoLayer.utilityLayerScene);\r\n this._scaleBoxesParent.rotationQuaternion = new Quaternion();\r\n for (let i = 0; i < 3; i++) {\r\n for (let j = 0; j < 3; j++) {\r\n for (let k = 0; k < 3; k++) {\r\n // create box for relevant axis\r\n const zeroAxisCount = (i === 1 ? 1 : 0) + (j === 1 ? 1 : 0) + (k === 1 ? 1 : 0);\r\n if (zeroAxisCount === 1 || zeroAxisCount === 3) {\r\n continue;\r\n }\r\n\r\n const box = CreateBox(\"\", { size: 1 }, gizmoLayer.utilityLayerScene);\r\n box.material = this._coloredMaterial;\r\n box._internalMetadata = zeroAxisCount === 2; // None homogenous scale handle\r\n box.isNearGrabbable = true;\r\n\r\n // Dragging logic\r\n const dragAxis = new Vector3(i - 1, j - 1, k - 1).normalize();\r\n const scaleBoxesDragBehavior = new PointerDragBehavior({ dragAxis: dragAxis });\r\n scaleBoxesDragBehavior.updateDragPlane = false;\r\n scaleBoxesDragBehavior.moveAttached = false;\r\n let totalRelativeDragDistance = 0;\r\n let previousScale = 0;\r\n box.addBehavior(scaleBoxesDragBehavior);\r\n scaleBoxesDragBehavior.onDragObservable.add((event) => {\r\n this.onScaleBoxDragObservable.notifyObservers({});\r\n if (this.attachedMesh) {\r\n const originalParent = this.attachedMesh.parent;\r\n if (originalParent && (originalParent as Mesh).scaling && (originalParent as Mesh).scaling.isNonUniformWithinEpsilon(0.001)) {\r\n Logger.Warn(\"BoundingBoxGizmo controls are not supported on child meshes with non-uniform parent scaling\");\r\n return;\r\n }\r\n PivotTools._RemoveAndStorePivotPoint(this.attachedMesh);\r\n let relativeDragDistance = (event.dragDistance / this._boundingDimensions.length()) * this._anchorMesh.scaling.length();\r\n totalRelativeDragDistance += relativeDragDistance;\r\n if (this.scalingSnapDistance > 0) {\r\n const dragSteps = Math.floor(Math.abs(totalRelativeDragDistance) / this.scalingSnapDistance) * (totalRelativeDragDistance < 0 ? -1 : 1);\r\n const scale = this.scalingSnapDistance * dragSteps;\r\n relativeDragDistance = scale - previousScale;\r\n previousScale = scale;\r\n }\r\n\r\n const deltaScale = new Vector3(relativeDragDistance, relativeDragDistance, relativeDragDistance);\r\n const fullScale = new Vector3(previousScale, previousScale, previousScale);\r\n\r\n if (zeroAxisCount === 2) {\r\n // scale on 1 axis when using the anchor box in the face middle\r\n deltaScale.x *= Math.abs(dragAxis.x);\r\n deltaScale.y *= Math.abs(dragAxis.y);\r\n deltaScale.z *= Math.abs(dragAxis.z);\r\n }\r\n\r\n deltaScale.scaleInPlace(this._scaleDragSpeed);\r\n deltaScale.multiplyInPlace(this._axisFactor);\r\n\r\n fullScale.scaleInPlace(this._scaleDragSpeed);\r\n fullScale.multiplyInPlace(this._axisFactor);\r\n fullScale.addInPlace(this._incrementalStartupValue);\r\n\r\n this.updateBoundingBox();\r\n if (this.scalePivot) {\r\n this.attachedMesh.getWorldMatrix().getRotationMatrixToRef(this._tmpRotationMatrix);\r\n // Move anchor to desired pivot point (Bottom left corner + dimension/2)\r\n this._boundingDimensions.scaleToRef(0.5, this._tmpVector);\r\n Vector3.TransformCoordinatesToRef(this._tmpVector, this._tmpRotationMatrix, this._tmpVector);\r\n this._anchorMesh.position.subtractInPlace(this._tmpVector);\r\n this._boundingDimensions.multiplyToRef(this.scalePivot, this._tmpVector);\r\n Vector3.TransformCoordinatesToRef(this._tmpVector, this._tmpRotationMatrix, this._tmpVector);\r\n this._anchorMesh.position.addInPlace(this._tmpVector);\r\n } else {\r\n // Scale from the position of the opposite corner\r\n box.absolutePosition.subtractToRef(this._anchorMesh.position, this._tmpVector);\r\n this._anchorMesh.position.subtractInPlace(this._tmpVector);\r\n if (this.attachedMesh.isUsingPivotMatrix()) {\r\n this._anchorMesh.position.subtractInPlace(this.attachedMesh.getPivotPoint());\r\n }\r\n }\r\n\r\n this._anchorMesh.addChild(this.attachedMesh);\r\n if (this.incrementalSnap) {\r\n fullScale.x /= Math.abs(this._incrementalStartupValue.x) < Epsilon ? 1 : this._incrementalStartupValue.x;\r\n fullScale.y /= Math.abs(this._incrementalStartupValue.y) < Epsilon ? 1 : this._incrementalStartupValue.y;\r\n fullScale.z /= Math.abs(this._incrementalStartupValue.z) < Epsilon ? 1 : this._incrementalStartupValue.z;\r\n\r\n fullScale.x = Math.max(this._incrementalAnchorStartupValue.x * fullScale.x, this.scalingSnapDistance);\r\n fullScale.y = Math.max(this._incrementalAnchorStartupValue.y * fullScale.y, this.scalingSnapDistance);\r\n fullScale.z = Math.max(this._incrementalAnchorStartupValue.z * fullScale.z, this.scalingSnapDistance);\r\n\r\n this._anchorMesh.scaling.x += (fullScale.x - this._anchorMesh.scaling.x) * Math.abs(dragAxis.x);\r\n this._anchorMesh.scaling.y += (fullScale.y - this._anchorMesh.scaling.y) * Math.abs(dragAxis.y);\r\n this._anchorMesh.scaling.z += (fullScale.z - this._anchorMesh.scaling.z) * Math.abs(dragAxis.z);\r\n } else {\r\n this._anchorMesh.scaling.addInPlace(deltaScale);\r\n if (this._anchorMesh.scaling.x < 0 || this._anchorMesh.scaling.y < 0 || this._anchorMesh.scaling.z < 0) {\r\n this._anchorMesh.scaling.subtractInPlace(deltaScale);\r\n }\r\n }\r\n this._anchorMesh.removeChild(this.attachedMesh);\r\n this.attachedMesh.setParent(originalParent);\r\n PivotTools._RestorePivotPoint(this.attachedMesh);\r\n }\r\n this._updateDummy();\r\n });\r\n\r\n // Selection/deselection\r\n scaleBoxesDragBehavior.onDragStartObservable.add(() => {\r\n this.onDragStartObservable.notifyObservers({});\r\n this._dragging = true;\r\n this._selectNode(box);\r\n totalRelativeDragDistance = 0;\r\n previousScale = 0;\r\n this._incrementalStartupValue.copyFrom(this.attachedMesh!.scaling);\r\n this._incrementalAnchorStartupValue.copyFrom(this._anchorMesh!.scaling);\r\n });\r\n scaleBoxesDragBehavior.onDragEndObservable.add((event) => {\r\n this.onScaleBoxDragEndObservable.notifyObservers({});\r\n this._dragging = false;\r\n this._selectNode(null);\r\n this._updateDummy();\r\n this._unhoverMeshOnTouchUp(event.pointerInfo, box);\r\n });\r\n\r\n this._scaleBoxesParent.addChild(box);\r\n this._scaleBoxesDragBehaviors.push(scaleBoxesDragBehavior);\r\n }\r\n }\r\n }\r\n this._rootMesh.addChild(this._scaleBoxesParent);\r\n\r\n // Hover color change\r\n const pointerIds: AbstractMesh[] = [];\r\n this._pointerObserver = gizmoLayer.utilityLayerScene.onPointerObservable.add((pointerInfo) => {\r\n if (!pointerIds[(<IPointerEvent>pointerInfo.event).pointerId]) {\r\n this._rotateSpheresParent\r\n .getChildMeshes()\r\n .concat(this._scaleBoxesParent.getChildMeshes())\r\n .forEach((mesh) => {\r\n if (pointerInfo.pickInfo && pointerInfo.pickInfo.pickedMesh == mesh) {\r\n pointerIds[(<IPointerEvent>pointerInfo.event).pointerId] = mesh;\r\n mesh.material = this._hoverColoredMaterial;\r\n this._isHovered = true;\r\n }\r\n });\r\n } else {\r\n if (pointerInfo.pickInfo && pointerInfo.pickInfo.pickedMesh != pointerIds[(<IPointerEvent>pointerInfo.event).pointerId]) {\r\n pointerIds[(<IPointerEvent>pointerInfo.event).pointerId].material = this._coloredMaterial;\r\n delete pointerIds[(<IPointerEvent>pointerInfo.event).pointerId];\r\n this._isHovered = false;\r\n }\r\n }\r\n });\r\n\r\n // Update bounding box positions\r\n this._renderObserver = this.gizmoLayer.originalScene.onBeforeRenderObservable.add(() => {\r\n // Only update the bounding box if scaling has changed\r\n if (this.attachedMesh && !this._existingMeshScale.equals(this.attachedMesh.scaling)) {\r\n this.updateBoundingBox();\r\n } else if (this.fixedDragMeshScreenSize || this.fixedDragMeshBoundsSize) {\r\n this._updateRotationSpheres();\r\n this._updateScaleBoxes();\r\n }\r\n\r\n // If drag mesh is enabled and dragging, update the attached mesh pose to match the drag mesh\r\n if (this._dragMesh && this.attachedMesh && this._pointerDragBehavior.dragging) {\r\n this._lineBoundingBox.position.rotateByQuaternionToRef(this._rootMesh.rotationQuaternion!, this._tmpVector);\r\n this.attachedMesh.setAbsolutePosition(this._dragMesh.position.add(this._tmpVector.scale(-1)));\r\n }\r\n });\r\n this.updateBoundingBox();\r\n }\r\n\r\n protected _attachedNodeChanged(value: Nullable<AbstractMesh>) {\r\n if (value) {\r\n // Reset anchor mesh to match attached mesh's scale\r\n // This is needed to avoid invalid box/sphere position on first drag\r\n this._anchorMesh.scaling.setAll(1);\r\n PivotTools._RemoveAndStorePivotPoint(value);\r\n const originalParent = value.parent;\r\n this._anchorMesh.addChild(value);\r\n this._anchorMesh.removeChild(value);\r\n value.setParent(originalParent);\r\n PivotTools._RestorePivotPoint(value);\r\n this.updateBoundingBox();\r\n value.getChildMeshes(false).forEach((m) => {\r\n m.markAsDirty(\"scaling\");\r\n });\r\n\r\n this.gizmoLayer.utilityLayerScene.onAfterRenderObservable.addOnce(() => {\r\n this._updateDummy();\r\n });\r\n }\r\n }\r\n\r\n protected _selectNode(selectedMesh: Nullable<Mesh>) {\r\n this._rotateSpheresParent\r\n .getChildMeshes()\r\n .concat(this._scaleBoxesParent.getChildMeshes())\r\n .forEach((m) => {\r\n m.isVisible = !selectedMesh || m == selectedMesh;\r\n });\r\n }\r\n\r\n protected _unhoverMeshOnTouchUp(pointerInfo: Nullable<PointerInfo>, selectedMesh: AbstractMesh) {\r\n // force unhover mesh if not a mouse event\r\n if (pointerInfo?.event instanceof PointerEvent && pointerInfo?.event.pointerType === \"touch\") {\r\n selectedMesh.material = this._coloredMaterial;\r\n }\r\n }\r\n\r\n /**\r\n * returns an array containing all boxes used for scaling (in increasing x, y and z orders)\r\n * @returns array of scaling boxes\r\n */\r\n public getScaleBoxes() {\r\n return this._scaleBoxesParent.getChildMeshes();\r\n }\r\n\r\n /**\r\n * Updates the bounding box information for the Gizmo\r\n */\r\n public updateBoundingBox() {\r\n if (this.attachedMesh) {\r\n PivotTools._RemoveAndStorePivotPoint(this.attachedMesh);\r\n\r\n // Store original parent\r\n const originalParent = this.attachedMesh.parent;\r\n this.attachedMesh.setParent(null);\r\n\r\n this._update();\r\n\r\n // Rotate based on axis\r\n if (!this.attachedMesh.rotationQuaternion) {\r\n this.attachedMesh.rotationQuaternion = Quaternion.RotationYawPitchRoll(this.attachedMesh.rotation.y, this.attachedMesh.rotation.x, this.attachedMesh.rotation.z);\r\n }\r\n if (!this._anchorMesh.rotationQuaternion) {\r\n this._anchorMesh.rotationQuaternion = Quaternion.RotationYawPitchRoll(this._anchorMesh.rotation.y, this._anchorMesh.rotation.x, this._anchorMesh.rotation.z);\r\n }\r\n this._anchorMesh.rotationQuaternion.copyFrom(this.attachedMesh.rotationQuaternion);\r\n\r\n // Store original position and reset mesh to origin before computing the bounding box\r\n this._tmpQuaternion.copyFrom(this.attachedMesh.rotationQuaternion);\r\n this._tmpVector.copyFrom(this.attachedMesh.position);\r\n this.attachedMesh.rotationQuaternion.set(0, 0, 0, 1);\r\n this.attachedMesh.position.set(0, 0, 0);\r\n\r\n // Update bounding dimensions/positions\r\n const boundingMinMax = this.attachedMesh.getHierarchyBoundingVectors(!this.ignoreChildren, this.includeChildPredicate);\r\n boundingMinMax.max.subtractToRef(boundingMinMax.min, this._boundingDimensions);\r\n\r\n // Update gizmo to match bounding box scaling and rotation\r\n // The position set here is the offset from the origin for the boundingbox when the attached mesh is at the origin\r\n // The position of the gizmo is then set to the attachedMesh in gizmo._update\r\n this._lineBoundingBox.scaling.copyFrom(this._boundingDimensions);\r\n this._lineBoundingBox.position.set(\r\n (boundingMinMax.max.x + boundingMinMax.min.x) / 2,\r\n (boundingMinMax.max.y + boundingMinMax.min.y) / 2,\r\n (boundingMinMax.max.z + boundingMinMax.min.z) / 2\r\n );\r\n this._rotateSpheresParent.position.copyFrom(this._lineBoundingBox.position);\r\n this._scaleBoxesParent.position.copyFrom(this._lineBoundingBox.position);\r\n this._lineBoundingBox.computeWorldMatrix();\r\n this._anchorMesh.position.copyFrom(this._lineBoundingBox.absolutePosition);\r\n\r\n // Restore position/rotation values\r\n this.attachedMesh.rotationQuaternion.copyFrom(this._tmpQuaternion);\r\n this.attachedMesh.position.copyFrom(this._tmpVector);\r\n\r\n // Restore original parent\r\n this.attachedMesh.setParent(originalParent);\r\n }\r\n\r\n this._updateRotationSpheres();\r\n this._updateScaleBoxes();\r\n\r\n if (this.attachedMesh) {\r\n this._existingMeshScale.copyFrom(this.attachedMesh.scaling);\r\n PivotTools._RestorePivotPoint(this.attachedMesh);\r\n }\r\n }\r\n\r\n protected _updateRotationSpheres() {\r\n const rotateSpheres = this._rotateSpheresParent.getChildMeshes();\r\n for (let i = 0; i < 3; i++) {\r\n for (let j = 0; j < 2; j++) {\r\n for (let k = 0; k < 2; k++) {\r\n const index = i * 4 + j * 2 + k;\r\n if (i == 0) {\r\n rotateSpheres[index].position.set(this._boundingDimensions.x / 2, this._boundingDimensions.y * j, this._boundingDimensions.z * k);\r\n rotateSpheres[index].position.addInPlace(new Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));\r\n rotateSpheres[index].lookAt(\r\n Vector3.Cross(rotateSpheres[index].position.normalizeToNew(), Vector3.Right()).normalizeToNew().add(rotateSpheres[index].position)\r\n );\r\n }\r\n if (i == 1) {\r\n rotateSpheres[index].position.set(this._boundingDimensions.x * j, this._boundingDimensions.y / 2, this._boundingDimensions.z * k);\r\n rotateSpheres[index].position.addInPlace(new Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));\r\n rotateSpheres[index].lookAt(\r\n Vector3.Cross(rotateSpheres[index].position.normalizeToNew(), Vector3.Up()).normalizeToNew().add(rotateSpheres[index].position)\r\n );\r\n }\r\n if (i == 2) {\r\n rotateSpheres[index].position.set(this._boundingDimensions.x * j, this._boundingDimensions.y * k, this._boundingDimensions.z / 2);\r\n rotateSpheres[index].position.addInPlace(new Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));\r\n rotateSpheres[index].lookAt(\r\n Vector3.Cross(rotateSpheres[index].position.normalizeToNew(), Vector3.Forward()).normalizeToNew().add(rotateSpheres[index].position)\r\n );\r\n }\r\n if (this.fixedDragMeshScreenSize && this.gizmoLayer.utilityLayerScene.activeCamera) {\r\n rotateSpheres[index].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position, this._tmpVector);\r\n const distanceFromCamera = (this.rotationSphereSize * this._tmpVector.length()) / this.fixedDragMeshScreenSizeDistanceFactor;\r\n rotateSpheres[index].scaling.set(distanceFromCamera, distanceFromCamera, distanceFromCamera);\r\n } else if (this.fixedDragMeshBoundsSize) {\r\n rotateSpheres[index].scaling.set(\r\n this.rotationSphereSize * this._boundingDimensions.x,\r\n this.rotationSphereSize * this._boundingDimensions.y,\r\n this.rotationSphereSize * this._boundingDimensions.z\r\n );\r\n } else {\r\n rotateSpheres[index].scaling.set(this.rotationSphereSize, this.rotationSphereSize, this.rotationSphereSize);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n protected _updateScaleBoxes() {\r\n const scaleBoxes = this._scaleBoxesParent.getChildMeshes();\r\n let index = 0;\r\n for (let i = 0; i < 3; i++) {\r\n for (let j = 0; j < 3; j++) {\r\n for (let k = 0; k < 3; k++) {\r\n const zeroAxisCount = (i === 1 ? 1 : 0) + (j === 1 ? 1 : 0) + (k === 1 ? 1 : 0);\r\n if (zeroAxisCount === 1 || zeroAxisCount === 3) {\r\n continue;\r\n }\r\n if (scaleBoxes[index]) {\r\n scaleBoxes[index].position.set(this._boundingDimensions.x * (i / 2), this._boundingDimensions.y * (j / 2), this._boundingDimensions.z * (k / 2));\r\n scaleBoxes[index].position.addInPlace(new Vector3(-this._boundingDimensions.x / 2, -this._boundingDimensions.y / 2, -this._boundingDimensions.z / 2));\r\n if (this.fixedDragMeshScreenSize && this.gizmoLayer.utilityLayerScene.activeCamera) {\r\n scaleBoxes[index].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.globalPosition, this._tmpVector);\r\n const distanceFromCamera = (this.scaleBoxSize * this._tmpVector.length()) / this.fixedDragMeshScreenSizeDistanceFactor;\r\n scaleBoxes[index].scaling.set(distanceFromCamera, distanceFromCamera, distanceFromCamera);\r\n } else if (this.fixedDragMeshBoundsSize) {\r\n scaleBoxes[index].scaling.set(\r\n this.scaleBoxSize * this._boundingDimensions.x,\r\n this.scaleBoxSize * this._boundingDimensions.y,\r\n this.scaleBoxSize * this._boundingDimensions.z\r\n );\r\n } else {\r\n scaleBoxes[index].scaling.set(this.scaleBoxSize, this.scaleBoxSize, this.scaleBoxSize);\r\n }\r\n }\r\n index++;\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Enables rotation on the specified axis and disables rotation on the others\r\n * @param axis The list of axis that should be enabled (eg. \"xy\" or \"xyz\")\r\n */\r\n public setEnabledRotationAxis(axis: string) {\r\n this._rotateSpheresParent.getChildMeshes().forEach((m, i) => {\r\n if (i < 4) {\r\n m.setEnabled(axis.indexOf(\"x\") != -1);\r\n } else if (i < 8) {\r\n m.setEnabled(axis.indexOf(\"y\") != -1);\r\n } else {\r\n m.setEnabled(axis.indexOf(\"z\") != -1);\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Enables/disables scaling\r\n * @param enable if scaling should be enabled\r\n * @param homogeneousScaling defines if scaling should only be homogeneous\r\n */\r\n public setEnabledScaling(enable: boolean, homogeneousScaling = false) {\r\n this._scaleBoxesParent.getChildMeshes().forEach((m) => {\r\n let enableMesh = enable;\r\n // Disable heterogeneous scale handles if requested.\r\n if (homogeneousScaling && m._internalMetadata === true) {\r\n enableMesh = false;\r\n }\r\n m.setEnabled(enableMesh);\r\n });\r\n }\r\n\r\n protected _updateDummy() {\r\n if (this._dragMesh) {\r\n this._dragMesh.position.copyFrom(this._lineBoundingBox.getAbsolutePosition());\r\n this._dragMesh.scaling.copyFrom(this._lineBoundingBox.scaling);\r\n this._dragMesh.rotationQuaternion!.copyFrom(this._rootMesh.rotationQuaternion!);\r\n }\r\n }\r\n\r\n /**\r\n * Enables a pointer drag behavior on the bounding box of the gizmo\r\n */\r\n public enableDragBehavior() {\r\n this._dragMesh = CreateBox(\"dummy\", { size: 1 }, this.gizmoLayer.utilityLayerScene);\r\n this._dragMesh.visibility = 0;\r\n this._dragMesh.rotationQuaternion = new Quaternion();\r\n this._pointerDragBehavior.useObjectOrientationForDragging = false;\r\n this._dragMesh.addBehavior(this._pointerDragBehavior);\r\n }\r\n\r\n /**\r\n * Force release the drag action by code\r\n */\r\n public releaseDrag() {\r\n this._scaleBoxesDragBehaviors.forEach((dragBehavior) => {\r\n dragBehavior.releaseDrag();\r\n });\r\n this._rotateSpheresDragBehaviors.forEach((dragBehavior) => {\r\n dragBehavior.releaseDrag();\r\n });\r\n this._pointerDragBehavior.releaseDrag();\r\n }\r\n\r\n /**\r\n * Disposes of the gizmo\r\n */\r\n public dispose() {\r\n this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver);\r\n this.gizmoLayer.originalScene.onBeforeRenderObservable.remove(this._renderObserver);\r\n this._lineBoundingBox.dispose();\r\n this._rotateSpheresParent.dispose();\r\n this._scaleBoxesParent.dispose();\r\n if (this._dragMesh) {\r\n this._dragMesh.dispose();\r\n }\r\n this._scaleBoxesDragBehaviors.length = 0;\r\n this._rotateSpheresDragBehaviors.length = 0;\r\n super.dispose();\r\n }\r\n\r\n /**\r\n * Makes a mesh not pickable and wraps the mesh inside of a bounding box mesh that is pickable. (This is useful to avoid picking within complex geometry)\r\n * @param mesh the mesh to wrap in the bounding box mesh and make not pickable\r\n * @returns the bounding box mesh with the passed in mesh as a child\r\n */\r\n public static MakeNotPickableAndWrapInBoundingBox(mesh: Mesh): Mesh {\r\n const makeNotPickable = (root: AbstractMesh) => {\r\n root.isPickable = false;\r\n root.getChildMeshes().forEach((c) => {\r\n makeNotPickable(c);\r\n });\r\n };\r\n makeNotPickable(mesh);\r\n\r\n // Reset position to get bounding box from origin with no rotation\r\n if (!mesh.rotationQuaternion) {\r\n mesh.rotationQuaternion = Quaternion.RotationYawPitchRoll(mesh.rotation.y, mesh.rotation.x, mesh.rotation.z);\r\n }\r\n const oldPos = mesh.position.clone();\r\n const oldRot = mesh.rotationQuaternion.clone();\r\n mesh.rotationQuaternion.set(0, 0, 0, 1);\r\n mesh.position.set(0, 0, 0);\r\n\r\n // Update bounding dimensions/positions\r\n const box = CreateBox(\"box\", { size: 1 }, mesh.getScene());\r\n const boundingMinMax = mesh.getHierarchyBoundingVectors();\r\n boundingMinMax.max.subtractToRef(boundingMinMax.min, box.scaling);\r\n\r\n // Adjust scale to avoid undefined behavior when adding child\r\n if (box.scaling.y === 0) {\r\n box.scaling.y = Epsilon;\r\n }\r\n if (box.scaling.x === 0) {\r\n box.scaling.x = Epsilon;\r\n }\r\n if (box.scaling.z === 0) {\r\n box.scaling.z = Epsilon;\r\n }\r\n\r\n box.position.set((boundingMinMax.max.x + boundingMinMax.min.x) / 2, (boundingMinMax.max.y + boundingMinMax.min.y) / 2, (boundingMinMax.max.z + boundingMinMax.min.z) / 2);\r\n\r\n // Restore original positions\r\n mesh.addChild(box);\r\n mesh.rotationQuaternion.copyFrom(oldRot);\r\n mesh.position.copyFrom(oldPos);\r\n\r\n // Reverse parenting\r\n mesh.removeChild(box);\r\n\r\n box.addChild(mesh);\r\n box.visibility = 0;\r\n return box;\r\n }\r\n /**\r\n * CustomMeshes are not supported by this gizmo\r\n */\r\n public setCustomMesh() {\r\n Logger.Error(\"Custom meshes are not supported on this gizmo\");\r\n }\r\n}\r\n"]}
|
package/Gizmos/scaleGizmo.d.ts
CHANGED
|
@@ -183,6 +183,12 @@ export declare class ScaleGizmo extends Gizmo implements IScaleGizmo {
|
|
|
183
183
|
* @param cache Gizmo axis definition used for reactive gizmo UI
|
|
184
184
|
*/
|
|
185
185
|
addToAxisCache(mesh: Mesh, cache: GizmoAxisCache): void;
|
|
186
|
+
/**
|
|
187
|
+
* Get the cache set with addToAxisCache for a specific mesh
|
|
188
|
+
* @param mesh Axis gizmo mesh
|
|
189
|
+
* @returns Gizmo axis definition used for reactive gizmo UI
|
|
190
|
+
*/
|
|
191
|
+
getAxisCache(mesh: Mesh): GizmoAxisCache | undefined;
|
|
186
192
|
/**
|
|
187
193
|
* Force release the drag action by code
|
|
188
194
|
*/
|
package/Gizmos/scaleGizmo.js
CHANGED
|
@@ -67,7 +67,7 @@ export class ScaleGizmo extends Gizmo {
|
|
|
67
67
|
* True when the mouse pointer is hovering a gizmo mesh
|
|
68
68
|
*/
|
|
69
69
|
get isHovered() {
|
|
70
|
-
return this.xGizmo.isHovered || this.yGizmo.isHovered || this.zGizmo.isHovered;
|
|
70
|
+
return this.xGizmo.isHovered || this.yGizmo.isHovered || this.zGizmo.isHovered || this.uniformScaleGizmo.isHovered;
|
|
71
71
|
}
|
|
72
72
|
/**
|
|
73
73
|
* True when the mouse pointer is dragging a gizmo mesh
|
|
@@ -158,7 +158,7 @@ export class ScaleGizmo extends Gizmo {
|
|
|
158
158
|
light.includedOnlyMeshes = light.includedOnlyMeshes.concat(this._octahedron);
|
|
159
159
|
const cache = {
|
|
160
160
|
gizmoMeshes: [this._octahedron, this._uniformScalingMesh],
|
|
161
|
-
colliderMeshes: [this._uniformScalingMesh],
|
|
161
|
+
colliderMeshes: [this._octahedron, this._uniformScalingMesh],
|
|
162
162
|
material: this._coloredMaterial,
|
|
163
163
|
hoverMaterial: this._hoverMaterial,
|
|
164
164
|
disableMaterial: this._disableMaterial,
|
|
@@ -287,6 +287,14 @@ export class ScaleGizmo extends Gizmo {
|
|
|
287
287
|
addToAxisCache(mesh, cache) {
|
|
288
288
|
this._gizmoAxisCache.set(mesh, cache);
|
|
289
289
|
}
|
|
290
|
+
/**
|
|
291
|
+
* Get the cache set with addToAxisCache for a specific mesh
|
|
292
|
+
* @param mesh Axis gizmo mesh
|
|
293
|
+
* @returns Gizmo axis definition used for reactive gizmo UI
|
|
294
|
+
*/
|
|
295
|
+
getAxisCache(mesh) {
|
|
296
|
+
return this._gizmoAxisCache.get(mesh);
|
|
297
|
+
}
|
|
290
298
|
/**
|
|
291
299
|
* Force release the drag action by code
|
|
292
300
|
*/
|