@onerjs/core 8.42.2 → 8.42.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"gizmo.js","sourceRoot":"","sources":["../../../../dev/core/src/Gizmos/gizmo.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAE/E,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAI3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAIzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAI5D,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAuBxC;;GAEG;AACH,MAAM,CAAN,IAAkB,gBAKjB;AALD,WAAkB,gBAAgB;IAC9B,sCAAsC;IACtC,2DAAM,CAAA;IACN,0CAA0C;IAC1C,yDAAK,CAAA;AACT,CAAC,EALiB,gBAAgB,KAAhB,gBAAgB,QAKjC;AAED;;GAEG;AACH,MAAM,CAAN,IAAkB,oBAGjB;AAHD,WAAkB,oBAAoB;IAClC,iEAAK,CAAA;IACL,iEAAK,CAAA;AACT,CAAC,EAHiB,oBAAoB,KAApB,oBAAoB,QAGrC;AAiED;;GAEG;AACH,MAAM,OAAO,KAAK;IAgCd;;OAEG;IACH,IAAW,UAAU,CAAC,KAAa;QAC/B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;IAC7B,CAAC;IAED,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAMD;;;OAGG;IACH,IAAW,YAAY;QACnB,OAAO,IAAI,CAAC,aA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AC,IAAI,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC;4BACzH,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC;gCAChC,CAAC,CAAC,QAAQ,GAAG,QAAQ,CAAC;gCACtB,IAAK,CAAe,CAAC,KAAK,EAAE,CAAC;oCACxB,CAAe,CAAC,KAAK,GAAG,QAAQ,CAAC,YAAY,CAAC;gCACnD,CAAC;4BACL,CAAC;wBACL,CAAC,CAAC,CAAC;oBACP,CAAC;gBACL,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,eAAe,CAAC;IAC3B,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,qBAAqB,EAAE,CAAC;YAC7B,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,wBAAwB,CAAC,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QAClG,CAAC;IACL,CAAC;;AA5hBD;;;GAGG;AACW,qBAAe,GAAG,KAAK,AAAR,CAAS;AAEtC;;;;GAIG;AACW,wBAAkB,GAAG,IAAI,AAAP,CAAQ","sourcesContent":["import type { Observer } from \"../Misc/observable\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Scene, IDisposable } from \"../scene\";\r\nimport { Quaternion, Vector3, Matrix, TmpVectors } from \"../Maths/math.vector\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport { Mesh } from \"../Meshes/mesh\";\r\nimport { Camera } from \"../Cameras/camera\";\r\nimport type { TargetCamera } from \"../Cameras/targetCamera\";\r\nimport type { Node } from \"../node\";\r\nimport type { Bone } from \"../Bones/bone\";\r\nimport { UtilityLayerRenderer } from \"../Rendering/utilityLayerRenderer\";\r\nimport type { TransformNode } from \"../Meshes/transformNode\";\r\nimport type { StandardMaterial } from \"../Materials/standardMaterial\";\r\nimport type { PointerInfo } from \"../Events/pointerEvents\";\r\nimport { PointerEventTypes } from \"../Events/pointerEvents\";\r\nimport type { LinesMesh } from \"../Meshes/linesMesh\";\r\nimport type { PointerDragBehavior } from \"../Behaviors/Meshes/pointerDragBehavior\";\r\nimport type { ShadowLight } from \"../Lights/shadowLight\";\r\nimport { Light } from \"../Lights/light\";\r\n\r\n/**\r\n * Cache built by each axis. Used for managing state between all elements of gizmo for enhanced UI\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface GizmoAxisCache {\r\n /** Mesh used to render the Gizmo */\r\n gizmoMeshes: Mesh[];\r\n /** Mesh used to detect user interaction with Gizmo */\r\n colliderMeshes: Mesh[];\r\n /** Material used to indicate color of gizmo mesh */\r\n material: StandardMaterial;\r\n /** Material used to indicate hover state of the Gizmo */\r\n hoverMaterial: StandardMaterial;\r\n /** Material used to indicate disabled state of the Gizmo */\r\n disableMaterial: StandardMaterial;\r\n /** Used to indicate Active state of the Gizmo */\r\n active: boolean;\r\n /** DragBehavior */\r\n dragBehavior: PointerDragBehavior;\r\n}\r\n\r\n/**\r\n * Anchor options where the Gizmo can be positioned in relation to its anchored node\r\n */\r\nexport const enum GizmoAnchorPoint {\r\n /** The origin of the attached node */\r\n Origin,\r\n /** The pivot point of the attached node*/\r\n Pivot,\r\n}\r\n\r\n/**\r\n * Coordinates mode: Local or World. Defines how axis is aligned: either on world axis or transform local axis\r\n */\r\nexport const enum GizmoCoordinatesMode {\r\n World,\r\n Local,\r\n}\r\n\r\n/**\r\n * Interface for basic gizmo\r\n */\r\nexport interface IGizmo extends IDisposable {\r\n /** True when the mouse pointer is hovered a gizmo mesh */\r\n readonly isHovered: boolean;\r\n /** The root mesh of the gizmo */\r\n _rootMesh: Mesh;\r\n /** Ratio for the scale of the gizmo */\r\n scaleRatio: number;\r\n /**\r\n * Mesh that the gizmo will be attached to. (eg. on a drag gizmo the mesh that will be dragged)\r\n * * When set, interactions will be enabled\r\n */\r\n attachedMesh: Nullable<AbstractMesh>;\r\n /**\r\n * Node that the gizmo will be attached to. (eg. on a drag gizmo the mesh, bone or NodeTransform that will be dragged)\r\n * * When set, interactions will be enabled\r\n */\r\n attachedNode: Nullable<Node>;\r\n /**\r\n * If set the gizmo's rotation will be updated to match the attached mesh each frame (Default: true)\r\n */\r\n updateGizmoRotationToMatchAttachedMesh: boolean;\r\n /** The utility layer the gizmo will be added to */\r\n gizmoLayer: UtilityLayerRenderer;\r\n /**\r\n * If set the gizmo's position will be updated to match the attached mesh each frame (Default: true)\r\n */\r\n updateGizmoPositionToMatchAttachedMesh: boolean;\r\n /**\r\n * Defines where the gizmo will be positioned if `updateGizmoPositionToMatchAttachedMesh` is enabled.\r\n * (Default: GizmoAnchorPoint.Origin)\r\n */\r\n anchorPoint: GizmoAnchorPoint;\r\n\r\n /**\r\n * Set the coordinate mode to use. By default it's local.\r\n */\r\n coordinatesMode: GizmoCoordinatesMode;\r\n\r\n /**\r\n * When set, the gizmo will always appear the same size no matter where the camera is (default: true)\r\n */\r\n updateScale: boolean;\r\n /**\r\n * posture that the gizmo will be display\r\n * When set null, default value will be used (Quaternion(0, 0, 0, 1))\r\n */\r\n customRotationQuaternion: Nullable<Quaternion>;\r\n /**\r\n * Disposes and replaces the current meshes in the gizmo with the specified mesh\r\n * @param mesh The mesh to replace the default mesh of the gizmo\r\n */\r\n setCustomMesh(mesh: Mesh): void;\r\n\r\n /**\r\n * Additional transform applied to the gizmo.\r\n * It's useful when the gizmo is attached to a bone: if the bone is part of a skeleton attached to a mesh, you should define the mesh as additionalTransformNode if you want the gizmo to be displayed at the bone's correct location.\r\n * Otherwise, as the gizmo is relative to the skeleton root, the mesh transformation will not be taken into account.\r\n */\r\n additionalTransformNode?: TransformNode | undefined;\r\n}\r\n/**\r\n * Renders gizmos on top of an existing scene which provide controls for position, rotation, etc.\r\n */\r\nexport class Gizmo implements IGizmo {\r\n /**\r\n * The root mesh of the gizmo\r\n */\r\n public _rootMesh: Mesh;\r\n protected _attachedMesh: Nullable<AbstractMesh> = null;\r\n protected _attachedNode: Nullable<Node> = null;\r\n protected _customRotationQuaternion: Nullable<Quaternion> = null;\r\n protected _additionalTransformNode?: TransformNode;\r\n /**\r\n * Ratio for the scale of the gizmo (Default: 1)\r\n */\r\n protected _scaleRatio = 1;\r\n\r\n /**\r\n * boolean updated by pointermove when a gizmo mesh is hovered\r\n */\r\n protected _isHovered = false;\r\n\r\n /**\r\n * When enabled, any gizmo operation will perserve scaling sign. Default is off.\r\n * Only valid for TransformNode derived classes (Mesh, AbstractMesh, ...)\r\n */\r\n public static PreserveScaling = false;\r\n\r\n /**\r\n * There are 2 ways to preserve scaling: using mesh scaling or absolute scaling. Depending of hierarchy, non uniform scaling and LH or RH coordinates. One is preferable than the other.\r\n * If the scaling to be preserved is the local scaling, then set this value to false.\r\n * Default is true which means scaling to be preserved is absolute one (with hierarchy applied)\r\n */\r\n public static UseAbsoluteScaling = true;\r\n\r\n /**\r\n * Ratio for the scale of the gizmo (Default: 1)\r\n */\r\n public set scaleRatio(value: number) {\r\n this._scaleRatio = value;\r\n }\r\n\r\n public get scaleRatio() {\r\n return this._scaleRatio;\r\n }\r\n\r\n /**\r\n * True when the mouse pointer is hovered a gizmo mesh\r\n */\r\n public get isHovered() {\r\n return this._isHovered;\r\n }\r\n\r\n /**\r\n * If a custom mesh has been set (Default: false)\r\n */\r\n protected _customMeshSet = false;\r\n /**\r\n * Mesh that the gizmo will be attached to. (eg. on a drag gizmo the mesh that will be dragged)\r\n * * When set, interactions will be enabled\r\n */\r\n public get attachedMesh() {\r\n return this._attachedMesh;\r\n }\r\n public set attachedMesh(value) {\r\n this._attachedMesh = value;\r\n if (value) {\r\n this._attachedNode = value;\r\n }\r\n this._rootMesh.setEnabled(value ? true : false);\r\n this._attachedNodeChanged(value);\r\n }\r\n /**\r\n * Node that the gizmo will be attached to. (eg. on a drag gizmo the mesh, bone or NodeTransform that will be dragged)\r\n * * When set, interactions will be enabled\r\n */\r\n public get attachedNode() {\r\n return this._attachedNode;\r\n }\r\n public set attachedNode(value) {\r\n this._attachedNode = value;\r\n this._attachedMesh = null;\r\n this._rootMesh.setEnabled(value ? true : false);\r\n this._attachedNodeChanged(value);\r\n }\r\n\r\n /**\r\n * Disposes and replaces the current meshes in the gizmo with the specified mesh\r\n * @param mesh The mesh to replace the default mesh of the gizmo\r\n */\r\n public setCustomMesh(mesh: Mesh) {\r\n if (mesh.getScene() != this.gizmoLayer.utilityLayerScene) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"When setting a custom mesh on a gizmo, the custom meshes scene must be the same as the gizmos (eg. gizmo.gizmoLayer.utilityLayerScene)\";\r\n }\r\n const children = this._rootMesh.getChildMeshes();\r\n for (const c of children) {\r\n c.dispose();\r\n }\r\n mesh.parent = this._rootMesh;\r\n this._customMeshSet = true;\r\n }\r\n\r\n /**\r\n * Additional transform applied to the gizmo.\r\n * It's useful when the gizmo is attached to a bone: if the bone is part of a skeleton attached to a mesh, you should define the mesh as additionalTransformNode if you want the gizmo to be displayed at the bone's correct location.\r\n * Otherwise, as the gizmo is relative to the skeleton root, the mesh transformation will not be taken into account.\r\n */\r\n public get additionalTransformNode() {\r\n return this._additionalTransformNode;\r\n }\r\n\r\n public set additionalTransformNode(value: TransformNode | undefined) {\r\n this._additionalTransformNode = value;\r\n }\r\n\r\n protected _updateGizmoRotationToMatchAttachedMesh = true;\r\n protected _updateGizmoPositionToMatchAttachedMesh = true;\r\n protected _anchorPoint = GizmoAnchorPoint.Origin;\r\n protected _updateScale = true;\r\n protected _coordinatesMode = GizmoCoordinatesMode.Local;\r\n\r\n /**\r\n * If set the gizmo's rotation will be updated to match the attached mesh each frame (Default: true)\r\n * NOTE: This is only possible for meshes with uniform scaling, as otherwise it's not possible to decompose the rotation\r\n */\r\n public set updateGizmoRotationToMatchAttachedMesh(value: boolean) {\r\n this._updateGizmoRotationToMatchAttachedMesh = value;\r\n }\r\n public get updateGizmoRotationToMatchAttachedMesh() {\r\n return this._updateGizmoRotationToMatchAttachedMesh;\r\n }\r\n /**\r\n * If set the gizmo's position will be updated to match the attached mesh each frame (Default: true)\r\n */\r\n public set updateGizmoPositionToMatchAttachedMesh(value: boolean) {\r\n this._updateGizmoPositionToMatchAttachedMesh = value;\r\n }\r\n public get updateGizmoPositionToMatchAttachedMesh() {\r\n return this._updateGizmoPositionToMatchAttachedMesh;\r\n }\r\n\r\n /**\r\n * Defines where the gizmo will be positioned if `updateGizmoPositionToMatchAttachedMesh` is enabled.\r\n * (Default: GizmoAnchorPoint.Origin)\r\n */\r\n public set anchorPoint(value: GizmoAnchorPoint) {\r\n this._anchorPoint = value;\r\n }\r\n public get anchorPoint() {\r\n return this._anchorPoint;\r\n }\r\n\r\n /**\r\n * Set the coordinate system to use. By default it's local.\r\n * But it's possible for a user to tweak so its local for translation and world for rotation.\r\n * In that case, setting the coordinate system will change `updateGizmoRotationToMatchAttachedMesh` and `updateGizmoPositionToMatchAttachedMesh`\r\n */\r\n public set coordinatesMode(coordinatesMode: GizmoCoordinatesMode) {\r\n this._coordinatesMode = coordinatesMode;\r\n const local = coordinatesMode == GizmoCoordinatesMode.Local;\r\n this.updateGizmoRotationToMatchAttachedMesh = local;\r\n this.updateGizmoPositionToMatchAttachedMesh = true;\r\n }\r\n\r\n public get coordinatesMode() {\r\n return this._coordinatesMode;\r\n }\r\n\r\n /**\r\n * When set, the gizmo will always appear the same size no matter where the camera is (default: true)\r\n */\r\n\r\n public set updateScale(value: boolean) {\r\n this._updateScale = value;\r\n }\r\n public get updateScale() {\r\n return this._updateScale;\r\n }\r\n protected _interactionsEnabled = true;\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n protected _attachedNodeChanged(value: Nullable<Node>) {}\r\n\r\n protected _beforeRenderObserver: Nullable<Observer<Scene>>;\r\n private _rightHandtoLeftHandMatrix = Matrix.RotationY(Math.PI);\r\n\r\n /**\r\n * Creates a gizmo\r\n * @param gizmoLayer The utility layer the gizmo will be added to\r\n */\r\n constructor(\r\n /** [Object] The utility layer the gizmo will be added to */\r\n public gizmoLayer: UtilityLayerRenderer = UtilityLayerRenderer.DefaultUtilityLayer\r\n ) {\r\n this._rootMesh = new Mesh(\"gizmoRootNode\", gizmoLayer.utilityLayerScene);\r\n this._rootMesh.rotationQuaternion = Quaternion.Identity();\r\n\r\n this._beforeRenderObserver = this.gizmoLayer.utilityLayerScene.onBeforeRenderObservable.add(() => {\r\n this._update();\r\n });\r\n }\r\n\r\n /**\r\n * posture that the gizmo will be display\r\n * When set null, default value will be used (Quaternion(0, 0, 0, 1))\r\n */\r\n public get customRotationQuaternion(): Nullable<Quaternion> {\r\n return this._customRotationQuaternion;\r\n }\r\n\r\n public set customRotationQuaternion(customRotationQuaternion: Nullable<Quaternion>) {\r\n this._customRotationQuaternion = customRotationQuaternion;\r\n }\r\n\r\n /**\r\n * Updates the gizmo to match the attached mesh's position/rotation\r\n */\r\n protected _update() {\r\n if (this.attachedNode) {\r\n let effectiveNode = this.attachedNode;\r\n if (this.attachedMesh) {\r\n effectiveNode = this.attachedMesh || this.attachedNode;\r\n }\r\n\r\n // Position\r\n if (this.updateGizmoPositionToMatchAttachedMesh) {\r\n if (this.anchorPoint == GizmoAnchorPoint.Pivot && (<TransformNode>effectiveNode).getAbsolutePivotPoint) {\r\n const position = (<TransformNode>effectiveNode).getAbsolutePivotPoint();\r\n this._rootMesh.position.copyFrom(position);\r\n } else {\r\n const row = effectiveNode.getWorldMatrix().getRow(3);\r\n const position = row ? row.toVector3() : new Vector3(0, 0, 0);\r\n this._rootMesh.position.copyFrom(position);\r\n }\r\n }\r\n\r\n // Rotation\r\n if (this.updateGizmoRotationToMatchAttachedMesh) {\r\n const supportedNode =\r\n (<Mesh>effectiveNode)._isMesh ||\r\n effectiveNode.getClassName() === \"AbstractMesh\" ||\r\n effectiveNode.getClassName() === \"TransformNode\" ||\r\n effectiveNode.getClassName() === \"InstancedMesh\";\r\n const transformNode = supportedNode ? (effectiveNode as TransformNode) : undefined;\r\n effectiveNode.getWorldMatrix().decompose(undefined, this._rootMesh.rotationQuaternion!, undefined, Gizmo.PreserveScaling ? transformNode : undefined);\r\n this._rootMesh.rotationQuaternion!.normalize();\r\n } else {\r\n if (this._customRotationQuaternion) {\r\n this._rootMesh.rotationQuaternion!.copyFrom(this._customRotationQuaternion);\r\n } else {\r\n this._rootMesh.rotationQuaternion!.set(0, 0, 0, 1);\r\n }\r\n }\r\n\r\n // Scale\r\n if (this.updateScale) {\r\n const activeCamera = this.gizmoLayer.utilityLayerScene.activeCamera!;\r\n const cameraPosition = activeCamera.globalPosition;\r\n this._rootMesh.position.subtractToRef(cameraPosition, TmpVectors.Vector3[0]);\r\n let scale = this.scaleRatio;\r\n if (activeCamera.mode == Camera.ORTHOGRAPHIC_CAMERA) {\r\n if (activeCamera.orthoTop && activeCamera.orthoBottom) {\r\n const orthoHeight = activeCamera.orthoTop - activeCamera.orthoBottom;\r\n scale *= orthoHeight;\r\n }\r\n } else {\r\n const camForward = activeCamera.getScene().useRightHandedSystem ? Vector3.RightHandedForwardReadOnly : Vector3.LeftHandedForwardReadOnly;\r\n const direction = activeCamera.getDirection(camForward);\r\n scale *= Vector3.Dot(TmpVectors.Vector3[0], direction);\r\n }\r\n this._rootMesh.scaling.setAll(scale);\r\n\r\n // Account for handedness, similar to Matrix.decompose\r\n if (effectiveNode._getWorldMatrixDeterminant() < 0 && !Gizmo.PreserveScaling) {\r\n this._rootMesh.scaling.y *= -1;\r\n }\r\n } else {\r\n this._rootMesh.scaling.setAll(this.scaleRatio);\r\n }\r\n }\r\n\r\n if (this.additionalTransformNode) {\r\n this._rootMesh.computeWorldMatrix(true);\r\n this._rootMesh.getWorldMatrix().multiplyToRef(this.additionalTransformNode.getWorldMatrix(), TmpVectors.Matrix[0]);\r\n TmpVectors.Matrix[0].decompose(this._rootMesh.scaling, this._rootMesh.rotationQuaternion!, this._rootMesh.position);\r\n }\r\n }\r\n\r\n /**\r\n * if transform has a pivot and is not using PostMultiplyPivotMatrix, then the worldMatrix contains the pivot matrix (it's not cancelled at the end)\r\n * so, when extracting the world matrix component, the translation (and other components) is containing the pivot translation.\r\n * And the pivot is applied each frame. Removing it anyway here makes it applied only in computeWorldMatrix.\r\n * @param transform local transform that needs to be transform by the pivot inverse matrix\r\n * @param localMatrix local matrix that needs to be transform by the pivot inverse matrix\r\n * @param result resulting matrix transformed by pivot inverse if the transform node is using pivot without using post Multiply Pivot Matrix\r\n */\r\n protected _handlePivotMatrixInverse(transform: TransformNode, localMatrix: Matrix, result: Matrix): void {\r\n if (transform.isUsingPivotMatrix() && !transform.isUsingPostMultiplyPivotMatrix()) {\r\n transform.getPivotMatrix().invertToRef(TmpVectors.Matrix[5]);\r\n TmpVectors.Matrix[5].multiplyToRef(localMatrix, result);\r\n return;\r\n }\r\n result.copyFrom(localMatrix);\r\n }\r\n /**\r\n * computes the rotation/scaling/position of the transform once the Node world matrix has changed.\r\n */\r\n protected _matrixChanged() {\r\n if (!this._attachedNode) {\r\n return;\r\n }\r\n\r\n if ((<Camera>this._attachedNode)._isCamera) {\r\n const camera = this._attachedNode as Camera;\r\n let worldMatrix;\r\n let worldMatrixUc;\r\n if (camera.parent) {\r\n const parentInv = TmpVectors.Matrix[1];\r\n camera.parent._worldMatrix.invertToRef(parentInv);\r\n this._attachedNode._worldMatrix.multiplyToRef(parentInv, TmpVectors.Matrix[0]);\r\n worldMatrix = TmpVectors.Matrix[0];\r\n } else {\r\n worldMatrix = this._attachedNode._worldMatrix;\r\n }\r\n\r\n if (camera.getScene().useRightHandedSystem) {\r\n // avoid desync with RH matrix computation. Otherwise, rotation of PI around Y axis happens each frame resulting in axis flipped because worldMatrix is computed as inverse of viewMatrix.\r\n this._rightHandtoLeftHandMatrix.multiplyToRef(worldMatrix, TmpVectors.Matrix[1]);\r\n worldMatrixUc = TmpVectors.Matrix[1];\r\n } else {\r\n worldMatrixUc = worldMatrix;\r\n }\r\n\r\n worldMatrixUc.decompose(TmpVectors.Vector3[1], TmpVectors.Quaternion[0], TmpVectors.Vector3[0]);\r\n\r\n const inheritsTargetCamera =\r\n this._attachedNode.getClassName() === \"FreeCamera\" ||\r\n this._attachedNode.getClassName() === \"FlyCamera\" ||\r\n this._attachedNode.getClassName() === \"ArcFollowCamera\" ||\r\n this._attachedNode.getClassName() === \"TargetCamera\" ||\r\n this._attachedNode.getClassName() === \"TouchCamera\" ||\r\n this._attachedNode.getClassName() === \"UniversalCamera\";\r\n\r\n if (inheritsTargetCamera) {\r\n const targetCamera = this._attachedNode as TargetCamera;\r\n targetCamera.rotation = TmpVectors.Quaternion[0].toEulerAngles();\r\n\r\n if (targetCamera.rotationQuaternion) {\r\n targetCamera.rotationQuaternion.copyFrom(TmpVectors.Quaternion[0]);\r\n targetCamera.rotationQuaternion.normalize();\r\n }\r\n }\r\n\r\n camera.position.copyFrom(TmpVectors.Vector3[0]);\r\n } else if (\r\n (<Mesh>this._attachedNode)._isMesh ||\r\n this._attachedNode.getClassName() === \"AbstractMesh\" ||\r\n this._attachedNode.getClassName() === \"TransformNode\" ||\r\n this._attachedNode.getClassName() === \"InstancedMesh\"\r\n ) {\r\n const transform = this._attachedNode as TransformNode;\r\n if (transform.parent) {\r\n const parentInv = TmpVectors.Matrix[0];\r\n const localMat = TmpVectors.Matrix[1];\r\n transform.parent.getWorldMatrix().invertToRef(parentInv);\r\n this._attachedNode.getWorldMatrix().multiplyToRef(parentInv, localMat);\r\n const matrixToDecompose = TmpVectors.Matrix[4];\r\n this._handlePivotMatrixInverse(transform, localMat, matrixToDecompose);\r\n matrixToDecompose.decompose(\r\n TmpVectors.Vector3[0],\r\n TmpVectors.Quaternion[0],\r\n transform.position,\r\n Gizmo.PreserveScaling ? transform : undefined,\r\n Gizmo.UseAbsoluteScaling\r\n );\r\n TmpVectors.Quaternion[0].normalize();\r\n if (transform.isUsingPivotMatrix()) {\r\n // Calculate the local matrix without the translation.\r\n // Copied from TranslateNode.computeWorldMatrix\r\n const r = TmpVectors.Quaternion[1];\r\n Quaternion.RotationYawPitchRollToRef(transform.rotation.y, transform.rotation.x, transform.rotation.z, r);\r\n\r\n const scaleMatrix = TmpVectors.Matrix[2];\r\n Matrix.ScalingToRef(transform.scaling.x, transform.scaling.y, transform.scaling.z, scaleMatrix);\r\n\r\n const rotationMatrix = TmpVectors.Matrix[2];\r\n r.toRotationMatrix(rotationMatrix);\r\n\r\n const pivotMatrix = transform.getPivotMatrix();\r\n const invPivotMatrix = TmpVectors.Matrix[3];\r\n pivotMatrix.invertToRef(invPivotMatrix);\r\n\r\n pivotMatrix.multiplyToRef(scaleMatrix, TmpVectors.Matrix[4]);\r\n TmpVectors.Matrix[4].multiplyToRef(rotationMatrix, TmpVectors.Matrix[5]);\r\n TmpVectors.Matrix[5].multiplyToRef(invPivotMatrix, TmpVectors.Matrix[6]);\r\n\r\n TmpVectors.Matrix[6].getTranslationToRef(TmpVectors.Vector3[1]);\r\n\r\n transform.position.subtractInPlace(TmpVectors.Vector3[1]);\r\n }\r\n } else {\r\n const matrixToDecompose = TmpVectors.Matrix[4];\r\n this._handlePivotMatrixInverse(transform, this._attachedNode._worldMatrix, matrixToDecompose);\r\n matrixToDecompose.decompose(\r\n TmpVectors.Vector3[0],\r\n TmpVectors.Quaternion[0],\r\n transform.position,\r\n Gizmo.PreserveScaling ? transform : undefined,\r\n Gizmo.UseAbsoluteScaling\r\n );\r\n }\r\n TmpVectors.Vector3[0].scaleInPlace(1.0 / transform.scalingDeterminant);\r\n transform.scaling.copyFrom(TmpVectors.Vector3[0]);\r\n if (!transform.billboardMode) {\r\n if (transform.rotationQuaternion) {\r\n transform.rotationQuaternion.copyFrom(TmpVectors.Quaternion[0]);\r\n transform.rotationQuaternion.normalize();\r\n } else {\r\n transform.rotation = TmpVectors.Quaternion[0].toEulerAngles();\r\n }\r\n }\r\n } else if (this._attachedNode.getClassName() === \"Bone\") {\r\n const bone = this._attachedNode as Bone;\r\n const parent = bone.getParent();\r\n\r\n if (parent) {\r\n const invParent = TmpVectors.Matrix[0];\r\n const boneLocalMatrix = TmpVectors.Matrix[1];\r\n parent.getFinalMatrix().invertToRef(invParent);\r\n bone.getFinalMatrix().multiplyToRef(invParent, boneLocalMatrix);\r\n const lmat = bone.getLocalMatrix();\r\n lmat.copyFrom(boneLocalMatrix);\r\n } else {\r\n const lmat = bone.getLocalMatrix();\r\n lmat.copyFrom(bone.getFinalMatrix());\r\n }\r\n bone.markAsDirty();\r\n } else {\r\n const light = this._attachedNode as ShadowLight;\r\n if (light.getTypeID) {\r\n const type = light.getTypeID();\r\n if (type === Light.LIGHTTYPEID_DIRECTIONALLIGHT || type === Light.LIGHTTYPEID_SPOTLIGHT || type === Light.LIGHTTYPEID_POINTLIGHT) {\r\n const parent = light.parent;\r\n\r\n if (parent) {\r\n const invParent = TmpVectors.Matrix[0];\r\n const nodeLocalMatrix = TmpVectors.Matrix[1];\r\n parent.getWorldMatrix().invertToRef(invParent);\r\n light.getWorldMatrix().multiplyToRef(invParent, nodeLocalMatrix);\r\n nodeLocalMatrix.decompose(undefined, TmpVectors.Quaternion[0], TmpVectors.Vector3[0]);\r\n } else {\r\n this._attachedNode._worldMatrix.decompose(undefined, TmpVectors.Quaternion[0], TmpVectors.Vector3[0]);\r\n }\r\n // setter doesn't copy values. Need a new Vector3\r\n light.position = new Vector3(TmpVectors.Vector3[0].x, TmpVectors.Vector3[0].y, TmpVectors.Vector3[0].z);\r\n if (light.direction) {\r\n light.direction = new Vector3(light.direction.x, light.direction.y, light.direction.z);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * refresh gizmo mesh material\r\n * @param gizmoMeshes\r\n * @param material material to apply\r\n */\r\n protected _setGizmoMeshMaterial(gizmoMeshes: Mesh[], material: StandardMaterial) {\r\n if (gizmoMeshes) {\r\n for (const m of gizmoMeshes) {\r\n m.material = material;\r\n if ((<LinesMesh>m).color) {\r\n (<LinesMesh>m).color = material.diffuseColor;\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Subscribes to pointer up, down, and hover events. Used for responsive gizmos.\r\n * @param gizmoLayer The utility layer the gizmo will be added to\r\n * @param gizmoAxisCache Gizmo axis definition used for reactive gizmo UI\r\n * @returns {Observer<PointerInfo>} pointerObserver\r\n */\r\n public static GizmoAxisPointerObserver(gizmoLayer: UtilityLayerRenderer, gizmoAxisCache: Map<Mesh, GizmoAxisCache>): Observer<PointerInfo> {\r\n let dragging = false;\r\n let activeDragButton = -1;\r\n let forcePointerUp = false;\r\n\r\n const pointerObserver = gizmoLayer.utilityLayerScene.onPointerObservable.add((pointerInfo) => {\r\n if (pointerInfo.pickInfo) {\r\n // If we are dragging and the user presses another button, end the drag.\r\n // Otherwise, tracking when the drag should end becomes very complex.\r\n // pointerDragBehavior.ts has similar logic.\r\n forcePointerUp = dragging && pointerInfo.event.button !== -1 && pointerInfo.event.button !== activeDragButton;\r\n\r\n if (forcePointerUp || pointerInfo.type === PointerEventTypes.POINTERUP) {\r\n // On Mouse Up\r\n\r\n gizmoAxisCache.forEach((cache) => {\r\n cache.active = false;\r\n dragging = false;\r\n activeDragButton = -1;\r\n for (const m of cache.gizmoMeshes) {\r\n m.material = cache.dragBehavior.enabled ? cache.material : cache.disableMaterial;\r\n if ((m as LinesMesh).color) {\r\n (m as LinesMesh).color = cache.material.diffuseColor;\r\n }\r\n }\r\n });\r\n } else if (pointerInfo.type === PointerEventTypes.POINTERMOVE) {\r\n // On Hover Logic\r\n if (dragging) {\r\n return;\r\n }\r\n gizmoAxisCache.forEach((cache) => {\r\n if (cache.colliderMeshes && cache.gizmoMeshes) {\r\n const isHovered = cache.colliderMeshes?.indexOf(pointerInfo?.pickInfo?.pickedMesh as Mesh) != -1;\r\n const material = cache.dragBehavior.enabled ? (isHovered || cache.active ? cache.hoverMaterial : cache.material) : cache.disableMaterial;\r\n for (const m of cache.gizmoMeshes) {\r\n m.material = material;\r\n if ((m as LinesMesh).color) {\r\n (m as LinesMesh).color = material.diffuseColor;\r\n }\r\n }\r\n }\r\n });\r\n } else if (pointerInfo.type === PointerEventTypes.POINTERDOWN) {\r\n // On Mouse Down\r\n // If user Clicked Gizmo\r\n if (gizmoAxisCache.has(pointerInfo.pickInfo.pickedMesh?.parent as Mesh)) {\r\n dragging = true;\r\n activeDragButton = pointerInfo.event.button;\r\n const statusMap = gizmoAxisCache.get(pointerInfo.pickInfo.pickedMesh?.parent as Mesh);\r\n statusMap!.active = true;\r\n gizmoAxisCache.forEach((cache) => {\r\n const isHovered = cache.colliderMeshes?.indexOf(pointerInfo?.pickInfo?.pickedMesh as Mesh) != -1;\r\n const material = (isHovered || cache.active) && cache.dragBehavior.enabled ? cache.hoverMaterial : cache.disableMaterial;\r\n for (const m of cache.gizmoMeshes) {\r\n m.material = material;\r\n if ((m as LinesMesh).color) {\r\n (m as LinesMesh).color = material.diffuseColor;\r\n }\r\n }\r\n });\r\n }\r\n }\r\n }\r\n });\r\n\r\n return pointerObserver;\r\n }\r\n\r\n /**\r\n * Disposes of the gizmo\r\n */\r\n public dispose() {\r\n this._rootMesh.dispose();\r\n if (this._beforeRenderObserver) {\r\n this.gizmoLayer.utilityLayerScene.onBeforeRenderObservable.remove(this._beforeRenderObserver);\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"gizmo.js","sourceRoot":"","sources":["../../../../dev/core/src/Gizmos/gizmo.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAE/E,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAI3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAIzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAI5D,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAuBxC;;GAEG;AACH,MAAM,CAAN,IAAkB,gBAKjB;A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AAa,CAAC,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC;4BACzH,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC;gCAChC,CAAC,CAAC,QAAQ,GAAG,QAAQ,CAAC;gCACtB,IAAK,CAAe,CAAC,KAAK,EAAE,CAAC;oCACxB,CAAe,CAAC,KAAK,GAAG,QAAQ,CAAC,YAAY,CAAC;gCACnD,CAAC;4BACL,CAAC;wBACL,CAAC,CAAC,CAAC;oBACP,CAAC;gBACL,CAAC;YACL,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,eAAe,CAAC;IAC3B,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,qBAAqB,EAAE,CAAC;YAC7B,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,wBAAwB,CAAC,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QAClG,CAAC;IACL,CAAC;;AAliBD;;;GAGG;AACW,qBAAe,GAAG,KAAK,AAAR,CAAS;AAEtC;;;;GAIG;AACW,wBAAkB,GAAG,IAAI,AAAP,CAAQ","sourcesContent":["import type { Observer } from \"../Misc/observable\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Scene, IDisposable } from \"../scene\";\r\nimport { Quaternion, Vector3, Matrix, TmpVectors } from \"../Maths/math.vector\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport { Mesh } from \"../Meshes/mesh\";\r\nimport { Camera } from \"../Cameras/camera\";\r\nimport type { TargetCamera } from \"../Cameras/targetCamera\";\r\nimport type { Node } from \"../node\";\r\nimport type { Bone } from \"../Bones/bone\";\r\nimport { UtilityLayerRenderer } from \"../Rendering/utilityLayerRenderer\";\r\nimport type { TransformNode } from \"../Meshes/transformNode\";\r\nimport type { StandardMaterial } from \"../Materials/standardMaterial\";\r\nimport type { PointerInfo } from \"../Events/pointerEvents\";\r\nimport { PointerEventTypes } from \"../Events/pointerEvents\";\r\nimport type { LinesMesh } from \"../Meshes/linesMesh\";\r\nimport type { PointerDragBehavior } from \"../Behaviors/Meshes/pointerDragBehavior\";\r\nimport type { ShadowLight } from \"../Lights/shadowLight\";\r\nimport { Light } from \"../Lights/light\";\r\n\r\n/**\r\n * Cache built by each axis. Used for managing state between all elements of gizmo for enhanced UI\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface GizmoAxisCache {\r\n /** Mesh used to render the Gizmo */\r\n gizmoMeshes: Mesh[];\r\n /** Mesh used to detect user interaction with Gizmo */\r\n colliderMeshes: Mesh[];\r\n /** Material used to indicate color of gizmo mesh */\r\n material: StandardMaterial;\r\n /** Material used to indicate hover state of the Gizmo */\r\n hoverMaterial: StandardMaterial;\r\n /** Material used to indicate disabled state of the Gizmo */\r\n disableMaterial: StandardMaterial;\r\n /** Used to indicate Active state of the Gizmo */\r\n active: boolean;\r\n /** DragBehavior */\r\n dragBehavior: PointerDragBehavior;\r\n}\r\n\r\n/**\r\n * Anchor options where the Gizmo can be positioned in relation to its anchored node\r\n */\r\nexport const enum GizmoAnchorPoint {\r\n /** The origin of the attached node */\r\n Origin,\r\n /** The pivot point of the attached node*/\r\n Pivot,\r\n}\r\n\r\n/**\r\n * Coordinates mode: Local or World. Defines how axis is aligned: either on world axis or transform local axis\r\n */\r\nexport const enum GizmoCoordinatesMode {\r\n World,\r\n Local,\r\n}\r\n\r\n/**\r\n * Interface for basic gizmo\r\n */\r\nexport interface IGizmo extends IDisposable {\r\n /** True when the mouse pointer is hovered a gizmo mesh */\r\n readonly isHovered: boolean;\r\n /** The root mesh of the gizmo */\r\n _rootMesh: Mesh;\r\n /** Ratio for the scale of the gizmo */\r\n scaleRatio: number;\r\n /**\r\n * Mesh that the gizmo will be attached to. (eg. on a drag gizmo the mesh that will be dragged)\r\n * * When set, interactions will be enabled\r\n */\r\n attachedMesh: Nullable<AbstractMesh>;\r\n /**\r\n * Node that the gizmo will be attached to. (eg. on a drag gizmo the mesh, bone or NodeTransform that will be dragged)\r\n * * When set, interactions will be enabled\r\n */\r\n attachedNode: Nullable<Node>;\r\n /**\r\n * If set the gizmo's rotation will be updated to match the attached mesh each frame (Default: true)\r\n */\r\n updateGizmoRotationToMatchAttachedMesh: boolean;\r\n /** The utility layer the gizmo will be added to */\r\n gizmoLayer: UtilityLayerRenderer;\r\n /**\r\n * If set the gizmo's position will be updated to match the attached mesh each frame (Default: true)\r\n */\r\n updateGizmoPositionToMatchAttachedMesh: boolean;\r\n /**\r\n * Defines where the gizmo will be positioned if `updateGizmoPositionToMatchAttachedMesh` is enabled.\r\n * (Default: GizmoAnchorPoint.Origin)\r\n */\r\n anchorPoint: GizmoAnchorPoint;\r\n\r\n /**\r\n * Set the coordinate mode to use. By default it's local.\r\n */\r\n coordinatesMode: GizmoCoordinatesMode;\r\n\r\n /**\r\n * When set, the gizmo will always appear the same size no matter where the camera is (default: true)\r\n */\r\n updateScale: boolean;\r\n /**\r\n * posture that the gizmo will be display\r\n * When set null, default value will be used (Quaternion(0, 0, 0, 1))\r\n */\r\n customRotationQuaternion: Nullable<Quaternion>;\r\n /**\r\n * Disposes and replaces the current meshes in the gizmo with the specified mesh\r\n * @param mesh The mesh to replace the default mesh of the gizmo\r\n */\r\n setCustomMesh(mesh: Mesh): void;\r\n\r\n /**\r\n * Additional transform applied to the gizmo.\r\n * It's useful when the gizmo is attached to a bone: if the bone is part of a skeleton attached to a mesh, you should define the mesh as additionalTransformNode if you want the gizmo to be displayed at the bone's correct location.\r\n * Otherwise, as the gizmo is relative to the skeleton root, the mesh transformation will not be taken into account.\r\n */\r\n additionalTransformNode?: TransformNode | undefined;\r\n}\r\n/**\r\n * Renders gizmos on top of an existing scene which provide controls for position, rotation, etc.\r\n */\r\nexport class Gizmo implements IGizmo {\r\n /**\r\n * The root mesh of the gizmo\r\n */\r\n public _rootMesh: Mesh;\r\n protected _attachedMesh: Nullable<AbstractMesh> = null;\r\n protected _attachedNode: Nullable<Node> = null;\r\n protected _customRotationQuaternion: Nullable<Quaternion> = null;\r\n protected _additionalTransformNode?: TransformNode;\r\n /**\r\n * Ratio for the scale of the gizmo (Default: 1)\r\n */\r\n protected _scaleRatio = 1;\r\n\r\n /**\r\n * boolean updated by pointermove when a gizmo mesh is hovered\r\n */\r\n protected _isHovered = false;\r\n\r\n /**\r\n * When enabled, any gizmo operation will perserve scaling sign. Default is off.\r\n * Only valid for TransformNode derived classes (Mesh, AbstractMesh, ...)\r\n */\r\n public static PreserveScaling = false;\r\n\r\n /**\r\n * There are 2 ways to preserve scaling: using mesh scaling or absolute scaling. Depending of hierarchy, non uniform scaling and LH or RH coordinates. One is preferable than the other.\r\n * If the scaling to be preserved is the local scaling, then set this value to false.\r\n * Default is true which means scaling to be preserved is absolute one (with hierarchy applied)\r\n */\r\n public static UseAbsoluteScaling = true;\r\n\r\n /**\r\n * Ratio for the scale of the gizmo (Default: 1)\r\n */\r\n public set scaleRatio(value: number) {\r\n this._scaleRatio = value;\r\n }\r\n\r\n public get scaleRatio() {\r\n return this._scaleRatio;\r\n }\r\n\r\n /**\r\n * True when the mouse pointer is hovered a gizmo mesh\r\n */\r\n public get isHovered() {\r\n return this._isHovered;\r\n }\r\n\r\n /**\r\n * If a custom mesh has been set (Default: false)\r\n */\r\n protected _customMeshSet = false;\r\n /**\r\n * Mesh that the gizmo will be attached to. (eg. on a drag gizmo the mesh that will be dragged)\r\n * * When set, interactions will be enabled\r\n */\r\n public get attachedMesh() {\r\n return this._attachedMesh;\r\n }\r\n public set attachedMesh(value) {\r\n this._attachedMesh = value;\r\n if (value) {\r\n this._attachedNode = value;\r\n }\r\n this._rootMesh.setEnabled(value ? true : false);\r\n this._attachedNodeChanged(value);\r\n }\r\n /**\r\n * Node that the gizmo will be attached to. (eg. on a drag gizmo the mesh, bone or NodeTransform that will be dragged)\r\n * * When set, interactions will be enabled\r\n */\r\n public get attachedNode() {\r\n return this._attachedNode;\r\n }\r\n public set attachedNode(value) {\r\n this._attachedNode = value;\r\n this._attachedMesh = null;\r\n this._rootMesh.setEnabled(value ? true : false);\r\n this._attachedNodeChanged(value);\r\n }\r\n\r\n /**\r\n * Disposes and replaces the current meshes in the gizmo with the specified mesh\r\n * @param mesh The mesh to replace the default mesh of the gizmo\r\n */\r\n public setCustomMesh(mesh: Mesh) {\r\n if (mesh.getScene() != this.gizmoLayer.utilityLayerScene) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"When setting a custom mesh on a gizmo, the custom meshes scene must be the same as the gizmos (eg. gizmo.gizmoLayer.utilityLayerScene)\";\r\n }\r\n const children = this._rootMesh.getChildMeshes();\r\n for (const c of children) {\r\n c.dispose();\r\n }\r\n mesh.parent = this._rootMesh;\r\n this._customMeshSet = true;\r\n }\r\n\r\n /**\r\n * Additional transform applied to the gizmo.\r\n * It's useful when the gizmo is attached to a bone: if the bone is part of a skeleton attached to a mesh, you should define the mesh as additionalTransformNode if you want the gizmo to be displayed at the bone's correct location.\r\n * Otherwise, as the gizmo is relative to the skeleton root, the mesh transformation will not be taken into account.\r\n */\r\n public get additionalTransformNode() {\r\n return this._additionalTransformNode;\r\n }\r\n\r\n public set additionalTransformNode(value: TransformNode | undefined) {\r\n this._additionalTransformNode = value;\r\n }\r\n\r\n protected _updateGizmoRotationToMatchAttachedMesh = true;\r\n protected _updateGizmoPositionToMatchAttachedMesh = true;\r\n protected _anchorPoint = GizmoAnchorPoint.Origin;\r\n protected _updateScale = true;\r\n protected _coordinatesMode = GizmoCoordinatesMode.Local;\r\n\r\n /**\r\n * If set the gizmo's rotation will be updated to match the attached mesh each frame (Default: true)\r\n * NOTE: This is only possible for meshes with uniform scaling, as otherwise it's not possible to decompose the rotation\r\n */\r\n public set updateGizmoRotationToMatchAttachedMesh(value: boolean) {\r\n this._updateGizmoRotationToMatchAttachedMesh = value;\r\n }\r\n public get updateGizmoRotationToMatchAttachedMesh() {\r\n return this._updateGizmoRotationToMatchAttachedMesh;\r\n }\r\n /**\r\n * If set the gizmo's position will be updated to match the attached mesh each frame (Default: true)\r\n */\r\n public set updateGizmoPositionToMatchAttachedMesh(value: boolean) {\r\n this._updateGizmoPositionToMatchAttachedMesh = value;\r\n }\r\n public get updateGizmoPositionToMatchAttachedMesh() {\r\n return this._updateGizmoPositionToMatchAttachedMesh;\r\n }\r\n\r\n /**\r\n * Defines where the gizmo will be positioned if `updateGizmoPositionToMatchAttachedMesh` is enabled.\r\n * (Default: GizmoAnchorPoint.Origin)\r\n */\r\n public set anchorPoint(value: GizmoAnchorPoint) {\r\n this._anchorPoint = value;\r\n }\r\n public get anchorPoint() {\r\n return this._anchorPoint;\r\n }\r\n\r\n /**\r\n * Set the coordinate system to use. By default it's local.\r\n * But it's possible for a user to tweak so its local for translation and world for rotation.\r\n * In that case, setting the coordinate system will change `updateGizmoRotationToMatchAttachedMesh` and `updateGizmoPositionToMatchAttachedMesh`\r\n */\r\n public set coordinatesMode(coordinatesMode: GizmoCoordinatesMode) {\r\n this._coordinatesMode = coordinatesMode;\r\n const local = coordinatesMode == GizmoCoordinatesMode.Local;\r\n this.updateGizmoRotationToMatchAttachedMesh = local;\r\n this.updateGizmoPositionToMatchAttachedMesh = true;\r\n }\r\n\r\n public get coordinatesMode() {\r\n return this._coordinatesMode;\r\n }\r\n\r\n /**\r\n * When set, the gizmo will always appear the same size no matter where the camera is (default: true)\r\n */\r\n\r\n public set updateScale(value: boolean) {\r\n this._updateScale = value;\r\n }\r\n public get updateScale() {\r\n return this._updateScale;\r\n }\r\n protected _interactionsEnabled = true;\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n protected _attachedNodeChanged(value: Nullable<Node>) {}\r\n\r\n protected _beforeRenderObserver: Nullable<Observer<Scene>>;\r\n private _rightHandtoLeftHandMatrix = Matrix.RotationY(Math.PI);\r\n\r\n /**\r\n * Creates a gizmo\r\n * @param gizmoLayer The utility layer the gizmo will be added to\r\n */\r\n constructor(\r\n /** [Object] The utility layer the gizmo will be added to */\r\n public gizmoLayer: UtilityLayerRenderer = UtilityLayerRenderer.DefaultUtilityLayer\r\n ) {\r\n this._rootMesh = new Mesh(\"gizmoRootNode\", gizmoLayer.utilityLayerScene);\r\n this._rootMesh.rotationQuaternion = Quaternion.Identity();\r\n\r\n this._beforeRenderObserver = this.gizmoLayer.utilityLayerScene.onBeforeRenderObservable.add(() => {\r\n this._update();\r\n });\r\n }\r\n\r\n /**\r\n * posture that the gizmo will be display\r\n * When set null, default value will be used (Quaternion(0, 0, 0, 1))\r\n */\r\n public get customRotationQuaternion(): Nullable<Quaternion> {\r\n return this._customRotationQuaternion;\r\n }\r\n\r\n public set customRotationQuaternion(customRotationQuaternion: Nullable<Quaternion>) {\r\n this._customRotationQuaternion = customRotationQuaternion;\r\n }\r\n\r\n /**\r\n * Updates the gizmo to match the attached mesh's position/rotation\r\n */\r\n protected _update() {\r\n if (this.attachedNode) {\r\n let effectiveNode = this.attachedNode;\r\n if (this.attachedMesh) {\r\n effectiveNode = this.attachedMesh || this.attachedNode;\r\n }\r\n\r\n // Position\r\n if (this.updateGizmoPositionToMatchAttachedMesh) {\r\n if (this.anchorPoint == GizmoAnchorPoint.Pivot && (<TransformNode>effectiveNode).getAbsolutePivotPoint) {\r\n const position = (<TransformNode>effectiveNode).getAbsolutePivotPoint();\r\n this._rootMesh.position.copyFrom(position);\r\n } else {\r\n const row = effectiveNode.getWorldMatrix().getRow(3);\r\n const position = row ? row.toVector3() : new Vector3(0, 0, 0);\r\n this._rootMesh.position.copyFrom(position);\r\n }\r\n }\r\n\r\n // Rotation\r\n if (this.updateGizmoRotationToMatchAttachedMesh) {\r\n const supportedNode =\r\n (<Mesh>effectiveNode)._isMesh ||\r\n effectiveNode.getClassName() === \"AbstractMesh\" ||\r\n effectiveNode.getClassName() === \"TransformNode\" ||\r\n effectiveNode.getClassName() === \"InstancedMesh\";\r\n const transformNode = supportedNode ? (effectiveNode as TransformNode) : undefined;\r\n effectiveNode.getWorldMatrix().decompose(undefined, this._rootMesh.rotationQuaternion!, undefined, Gizmo.PreserveScaling ? transformNode : undefined);\r\n this._rootMesh.rotationQuaternion!.normalize();\r\n } else {\r\n if (this._customRotationQuaternion) {\r\n this._rootMesh.rotationQuaternion!.copyFrom(this._customRotationQuaternion);\r\n } else {\r\n this._rootMesh.rotationQuaternion!.set(0, 0, 0, 1);\r\n }\r\n }\r\n\r\n // Scale\r\n if (this.updateScale) {\r\n const activeCamera = this.gizmoLayer.utilityLayerScene.activeCamera!;\r\n const cameraPosition = activeCamera.globalPosition;\r\n const offsetToCamera = TmpVectors.Vector3[0];\r\n this._rootMesh.absolutePosition.subtractToRef(cameraPosition, offsetToCamera);\r\n let scale = this.scaleRatio;\r\n if (activeCamera.mode == Camera.ORTHOGRAPHIC_CAMERA) {\r\n if (activeCamera.orthoTop && activeCamera.orthoBottom) {\r\n const orthoHeight = activeCamera.orthoTop - activeCamera.orthoBottom;\r\n scale *= orthoHeight;\r\n }\r\n } else {\r\n const camForward = activeCamera.getScene().useRightHandedSystem ? Vector3.RightHandedForwardReadOnly : Vector3.LeftHandedForwardReadOnly;\r\n const direction = activeCamera.getDirection(camForward);\r\n scale *= Vector3.Dot(offsetToCamera, direction);\r\n }\r\n if (this.additionalTransformNode) {\r\n this.additionalTransformNode.getWorldMatrix().decompose(TmpVectors.Vector3[1]);\r\n const maxScale = Math.max(Math.abs(TmpVectors.Vector3[1].x), Math.abs(TmpVectors.Vector3[1].y), Math.abs(TmpVectors.Vector3[1].z));\r\n scale *= 1 / maxScale;\r\n }\r\n this._rootMesh.scaling.setAll(scale);\r\n\r\n // Account for handedness, similar to Matrix.decompose\r\n if (effectiveNode._getWorldMatrixDeterminant() < 0 && !Gizmo.PreserveScaling) {\r\n this._rootMesh.scaling.y *= -1;\r\n }\r\n } else {\r\n this._rootMesh.scaling.setAll(this.scaleRatio);\r\n }\r\n }\r\n\r\n if (this.additionalTransformNode) {\r\n this._rootMesh.computeWorldMatrix(true);\r\n this._rootMesh.getWorldMatrix().multiplyToRef(this.additionalTransformNode.getWorldMatrix(), TmpVectors.Matrix[0]);\r\n TmpVectors.Matrix[0].decompose(this._rootMesh.scaling, this._rootMesh.rotationQuaternion!, this._rootMesh.position);\r\n }\r\n }\r\n\r\n /**\r\n * if transform has a pivot and is not using PostMultiplyPivotMatrix, then the worldMatrix contains the pivot matrix (it's not cancelled at the end)\r\n * so, when extracting the world matrix component, the translation (and other components) is containing the pivot translation.\r\n * And the pivot is applied each frame. Removing it anyway here makes it applied only in computeWorldMatrix.\r\n * @param transform local transform that needs to be transform by the pivot inverse matrix\r\n * @param localMatrix local matrix that needs to be transform by the pivot inverse matrix\r\n * @param result resulting matrix transformed by pivot inverse if the transform node is using pivot without using post Multiply Pivot Matrix\r\n */\r\n protected _handlePivotMatrixInverse(transform: TransformNode, localMatrix: Matrix, result: Matrix): void {\r\n if (transform.isUsingPivotMatrix() && !transform.isUsingPostMultiplyPivotMatrix()) {\r\n transform.getPivotMatrix().invertToRef(TmpVectors.Matrix[5]);\r\n TmpVectors.Matrix[5].multiplyToRef(localMatrix, result);\r\n return;\r\n }\r\n result.copyFrom(localMatrix);\r\n }\r\n /**\r\n * computes the rotation/scaling/position of the transform once the Node world matrix has changed.\r\n */\r\n protected _matrixChanged() {\r\n if (!this._attachedNode) {\r\n return;\r\n }\r\n\r\n if ((<Camera>this._attachedNode)._isCamera) {\r\n const camera = this._attachedNode as Camera;\r\n let worldMatrix;\r\n let worldMatrixUc;\r\n if (camera.parent) {\r\n const parentInv = TmpVectors.Matrix[1];\r\n camera.parent._worldMatrix.invertToRef(parentInv);\r\n this._attachedNode._worldMatrix.multiplyToRef(parentInv, TmpVectors.Matrix[0]);\r\n worldMatrix = TmpVectors.Matrix[0];\r\n } else {\r\n worldMatrix = this._attachedNode._worldMatrix;\r\n }\r\n\r\n if (camera.getScene().useRightHandedSystem) {\r\n // avoid desync with RH matrix computation. Otherwise, rotation of PI around Y axis happens each frame resulting in axis flipped because worldMatrix is computed as inverse of viewMatrix.\r\n this._rightHandtoLeftHandMatrix.multiplyToRef(worldMatrix, TmpVectors.Matrix[1]);\r\n worldMatrixUc = TmpVectors.Matrix[1];\r\n } else {\r\n worldMatrixUc = worldMatrix;\r\n }\r\n\r\n worldMatrixUc.decompose(TmpVectors.Vector3[1], TmpVectors.Quaternion[0], TmpVectors.Vector3[0]);\r\n\r\n const inheritsTargetCamera =\r\n this._attachedNode.getClassName() === \"FreeCamera\" ||\r\n this._attachedNode.getClassName() === \"FlyCamera\" ||\r\n this._attachedNode.getClassName() === \"ArcFollowCamera\" ||\r\n this._attachedNode.getClassName() === \"TargetCamera\" ||\r\n this._attachedNode.getClassName() === \"TouchCamera\" ||\r\n this._attachedNode.getClassName() === \"UniversalCamera\";\r\n\r\n if (inheritsTargetCamera) {\r\n const targetCamera = this._attachedNode as TargetCamera;\r\n targetCamera.rotation = TmpVectors.Quaternion[0].toEulerAngles();\r\n\r\n if (targetCamera.rotationQuaternion) {\r\n targetCamera.rotationQuaternion.copyFrom(TmpVectors.Quaternion[0]);\r\n targetCamera.rotationQuaternion.normalize();\r\n }\r\n }\r\n\r\n camera.position.copyFrom(TmpVectors.Vector3[0]);\r\n } else if (\r\n (<Mesh>this._attachedNode)._isMesh ||\r\n this._attachedNode.getClassName() === \"AbstractMesh\" ||\r\n this._attachedNode.getClassName() === \"TransformNode\" ||\r\n this._attachedNode.getClassName() === \"InstancedMesh\"\r\n ) {\r\n const transform = this._attachedNode as TransformNode;\r\n if (transform.parent) {\r\n const parentInv = TmpVectors.Matrix[0];\r\n const localMat = TmpVectors.Matrix[1];\r\n transform.parent.getWorldMatrix().invertToRef(parentInv);\r\n this._attachedNode.getWorldMatrix().multiplyToRef(parentInv, localMat);\r\n const matrixToDecompose = TmpVectors.Matrix[4];\r\n this._handlePivotMatrixInverse(transform, localMat, matrixToDecompose);\r\n matrixToDecompose.decompose(\r\n TmpVectors.Vector3[0],\r\n TmpVectors.Quaternion[0],\r\n transform.position,\r\n Gizmo.PreserveScaling ? transform : undefined,\r\n Gizmo.UseAbsoluteScaling\r\n );\r\n TmpVectors.Quaternion[0].normalize();\r\n if (transform.isUsingPivotMatrix()) {\r\n // Calculate the local matrix without the translation.\r\n // Copied from TranslateNode.computeWorldMatrix\r\n const r = TmpVectors.Quaternion[1];\r\n Quaternion.RotationYawPitchRollToRef(transform.rotation.y, transform.rotation.x, transform.rotation.z, r);\r\n\r\n const scaleMatrix = TmpVectors.Matrix[2];\r\n Matrix.ScalingToRef(transform.scaling.x, transform.scaling.y, transform.scaling.z, scaleMatrix);\r\n\r\n const rotationMatrix = TmpVectors.Matrix[2];\r\n r.toRotationMatrix(rotationMatrix);\r\n\r\n const pivotMatrix = transform.getPivotMatrix();\r\n const invPivotMatrix = TmpVectors.Matrix[3];\r\n pivotMatrix.invertToRef(invPivotMatrix);\r\n\r\n pivotMatrix.multiplyToRef(scaleMatrix, TmpVectors.Matrix[4]);\r\n TmpVectors.Matrix[4].multiplyToRef(rotationMatrix, TmpVectors.Matrix[5]);\r\n TmpVectors.Matrix[5].multiplyToRef(invPivotMatrix, TmpVectors.Matrix[6]);\r\n\r\n TmpVectors.Matrix[6].getTranslationToRef(TmpVectors.Vector3[1]);\r\n\r\n transform.position.subtractInPlace(TmpVectors.Vector3[1]);\r\n }\r\n } else {\r\n const matrixToDecompose = TmpVectors.Matrix[4];\r\n this._handlePivotMatrixInverse(transform, this._attachedNode._worldMatrix, matrixToDecompose);\r\n matrixToDecompose.decompose(\r\n TmpVectors.Vector3[0],\r\n TmpVectors.Quaternion[0],\r\n transform.position,\r\n Gizmo.PreserveScaling ? transform : undefined,\r\n Gizmo.UseAbsoluteScaling\r\n );\r\n }\r\n TmpVectors.Vector3[0].scaleInPlace(1.0 / transform.scalingDeterminant);\r\n transform.scaling.copyFrom(TmpVectors.Vector3[0]);\r\n if (!transform.billboardMode) {\r\n if (transform.rotationQuaternion) {\r\n transform.rotationQuaternion.copyFrom(TmpVectors.Quaternion[0]);\r\n transform.rotationQuaternion.normalize();\r\n } else {\r\n transform.rotation = TmpVectors.Quaternion[0].toEulerAngles();\r\n }\r\n }\r\n } else if (this._attachedNode.getClassName() === \"Bone\") {\r\n const bone = this._attachedNode as Bone;\r\n const parent = bone.getParent();\r\n\r\n if (parent) {\r\n const invParent = TmpVectors.Matrix[0];\r\n const boneLocalMatrix = TmpVectors.Matrix[1];\r\n parent.getFinalMatrix().invertToRef(invParent);\r\n bone.getFinalMatrix().multiplyToRef(invParent, boneLocalMatrix);\r\n const lmat = bone.getLocalMatrix();\r\n lmat.copyFrom(boneLocalMatrix);\r\n } else {\r\n const lmat = bone.getLocalMatrix();\r\n lmat.copyFrom(bone.getFinalMatrix());\r\n }\r\n bone.markAsDirty();\r\n } else {\r\n const light = this._attachedNode as ShadowLight;\r\n if (light.getTypeID) {\r\n const type = light.getTypeID();\r\n if (type === Light.LIGHTTYPEID_DIRECTIONALLIGHT || type === Light.LIGHTTYPEID_SPOTLIGHT || type === Light.LIGHTTYPEID_POINTLIGHT) {\r\n const parent = light.parent;\r\n\r\n if (parent) {\r\n const invParent = TmpVectors.Matrix[0];\r\n const nodeLocalMatrix = TmpVectors.Matrix[1];\r\n parent.getWorldMatrix().invertToRef(invParent);\r\n light.getWorldMatrix().multiplyToRef(invParent, nodeLocalMatrix);\r\n nodeLocalMatrix.decompose(undefined, TmpVectors.Quaternion[0], TmpVectors.Vector3[0]);\r\n } else {\r\n this._attachedNode._worldMatrix.decompose(undefined, TmpVectors.Quaternion[0], TmpVectors.Vector3[0]);\r\n }\r\n // setter doesn't copy values. Need a new Vector3\r\n light.position = new Vector3(TmpVectors.Vector3[0].x, TmpVectors.Vector3[0].y, TmpVectors.Vector3[0].z);\r\n if (light.direction) {\r\n light.direction = new Vector3(light.direction.x, light.direction.y, light.direction.z);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * refresh gizmo mesh material\r\n * @param gizmoMeshes\r\n * @param material material to apply\r\n */\r\n protected _setGizmoMeshMaterial(gizmoMeshes: Mesh[], material: StandardMaterial) {\r\n if (gizmoMeshes) {\r\n for (const m of gizmoMeshes) {\r\n m.material = material;\r\n if ((<LinesMesh>m).color) {\r\n (<LinesMesh>m).color = material.diffuseColor;\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Subscribes to pointer up, down, and hover events. Used for responsive gizmos.\r\n * @param gizmoLayer The utility layer the gizmo will be added to\r\n * @param gizmoAxisCache Gizmo axis definition used for reactive gizmo UI\r\n * @returns {Observer<PointerInfo>} pointerObserver\r\n */\r\n public static GizmoAxisPointerObserver(gizmoLayer: UtilityLayerRenderer, gizmoAxisCache: Map<Mesh, GizmoAxisCache>): Observer<PointerInfo> {\r\n let dragging = false;\r\n let activeDragButton = -1;\r\n let forcePointerUp = false;\r\n\r\n const pointerObserver = gizmoLayer.utilityLayerScene.onPointerObservable.add((pointerInfo) => {\r\n if (pointerInfo.pickInfo) {\r\n // If we are dragging and the user presses another button, end the drag.\r\n // Otherwise, tracking when the drag should end becomes very complex.\r\n // pointerDragBehavior.ts has similar logic.\r\n forcePointerUp = dragging && pointerInfo.event.button !== -1 && pointerInfo.event.button !== activeDragButton;\r\n\r\n if (forcePointerUp || pointerInfo.type === PointerEventTypes.POINTERUP) {\r\n // On Mouse Up\r\n\r\n gizmoAxisCache.forEach((cache) => {\r\n cache.active = false;\r\n dragging = false;\r\n activeDragButton = -1;\r\n for (const m of cache.gizmoMeshes) {\r\n m.material = cache.dragBehavior.enabled ? cache.material : cache.disableMaterial;\r\n if ((m as LinesMesh).color) {\r\n (m as LinesMesh).color = cache.material.diffuseColor;\r\n }\r\n }\r\n });\r\n } else if (pointerInfo.type === PointerEventTypes.POINTERMOVE) {\r\n // On Hover Logic\r\n if (dragging) {\r\n return;\r\n }\r\n gizmoAxisCache.forEach((cache) => {\r\n if (cache.colliderMeshes && cache.gizmoMeshes) {\r\n const isHovered = cache.colliderMeshes?.indexOf(pointerInfo?.pickInfo?.pickedMesh as Mesh) != -1;\r\n const material = cache.dragBehavior.enabled ? (isHovered || cache.active ? cache.hoverMaterial : cache.material) : cache.disableMaterial;\r\n for (const m of cache.gizmoMeshes) {\r\n m.material = material;\r\n if ((m as LinesMesh).color) {\r\n (m as LinesMesh).color = material.diffuseColor;\r\n }\r\n }\r\n }\r\n });\r\n } else if (pointerInfo.type === PointerEventTypes.POINTERDOWN) {\r\n // On Mouse Down\r\n // If user Clicked Gizmo\r\n if (gizmoAxisCache.has(pointerInfo.pickInfo.pickedMesh?.parent as Mesh)) {\r\n dragging = true;\r\n activeDragButton = pointerInfo.event.button;\r\n const statusMap = gizmoAxisCache.get(pointerInfo.pickInfo.pickedMesh?.parent as Mesh);\r\n statusMap!.active = true;\r\n gizmoAxisCache.forEach((cache) => {\r\n const isHovered = cache.colliderMeshes?.indexOf(pointerInfo?.pickInfo?.pickedMesh as Mesh) != -1;\r\n const material = (isHovered || cache.active) && cache.dragBehavior.enabled ? cache.hoverMaterial : cache.disableMaterial;\r\n for (const m of cache.gizmoMeshes) {\r\n m.material = material;\r\n if ((m as LinesMesh).color) {\r\n (m as LinesMesh).color = material.diffuseColor;\r\n }\r\n }\r\n });\r\n }\r\n }\r\n }\r\n });\r\n\r\n return pointerObserver;\r\n }\r\n\r\n /**\r\n * Disposes of the gizmo\r\n */\r\n public dispose() {\r\n this._rootMesh.dispose();\r\n if (this._beforeRenderObserver) {\r\n this.gizmoLayer.utilityLayerScene.onBeforeRenderObservable.remove(this._beforeRenderObserver);\r\n }\r\n }\r\n}\r\n"]}
@@ -86,16 +86,23 @@ export class PlaneDragGizmo extends Gizmo {
86
86
  // Keep world translation and use it to update world transform
87
87
  // if the node has parent, the local transform properties (position, rotation, scale)
88
88
  // will be recomputed in _matrixChanged function
89
+ // Transform delta by additionalTransformNode inverse world matrix if present
90
+ let delta = event.delta;
91
+ if (this._additionalTransformNode) {
92
+ this._additionalTransformNode.getWorldMatrix().invertToRef(TmpVectors.Matrix[0]);
93
+ Vector3.TransformNormalToRef(event.delta, TmpVectors.Matrix[0], TmpVectors.Vector3[1]);
94
+ delta = TmpVectors.Vector3[1];
95
+ }
89
96
  // Snapping logic
90
97
  if (this.snapDistance == 0) {
91
98
  this.attachedNode.getWorldMatrix().getTranslationToRef(TmpVectors.Vector3[0]);
92
- TmpVectors.Vector3[0].addToRef(event.delta, TmpVectors.Vector3[0]);
99
+ TmpVectors.Vector3[0].addToRef(delta, TmpVectors.Vector3[0]);
93
100
  if (this.dragBehavior.validateDrag(TmpVectors.Vector3[0])) {
94
- this.attachedNode.getWorldMatrix().addTranslationFromFloats(event.delta.x, event.delta.y, event.delta.z);
101
+ this.attachedNode.getWorldMatrix().addTranslationFromFloats(delta.x, delta.y, delta.z);
95
102
  }
96
103
  }
97
104
  else {
98
- currentSnapDragDistance.addInPlace(event.delta);
105
+ currentSnapDragDistance.addInPlace(delta);
99
106
  tmpVector2.set(0, 0, 0);
100
107
  const currentSnapDragDistanceArray = currentSnapDragDistance.asArray();
101
108
  for (let axis = 0; axis < 3; axis++) {
@@ -1 +1 @@
1
- {"version":3,"file":"planeDragGizmo.js","sourceRoot":"","sources":["../../../../dev/core/src/Gizmos/planeDragGizmo.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGxD,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;AA4BjE;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,KAAK;IAyBrC,4EA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AC,CAAC,CAAC,KAAK,CAAC;QACrD,CAAC;IACL,CAAC;IAED;;OAEG;IACH,IAAW,SAAS,CAAC,KAAc;QAC/B,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QACxB,IAAI,CAAC,KAAK,EAAE,CAAC;YACT,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QAC7B,CAAC;aAAM,CAAC;YACJ,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;gBACf,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC;YAClD,CAAC;QACL,CAAC;IACL,CAAC;IAED,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED;;OAEG;IACa,OAAO;QACnB,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;QAC9B,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACpF,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC;QAC3B,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YAClB,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;QAC9B,CAAC;QACD,MAAM,SAAS,GAAG,CAAC,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACtF,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE,CAAC;YAC3B,IAAI,IAAI,EAAE,CAAC;gBACP,IAAI,CAAC,OAAO,EAAE,CAAC;YACnB,CAAC;QACL,CAAC;IACL,CAAC;CACJ","sourcesContent":["import type { Observer } from \"../Misc/observable\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { PointerInfo } from \"../Events/pointerEvents\";\r\nimport { TmpVectors, Vector3 } from \"../Maths/math.vector\";\r\nimport { Color3 } from \"../Maths/math.color\";\r\nimport { TransformNode } from \"../Meshes/transformNode\";\r\nimport type { Node } from \"../node\";\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\nimport { CreatePlane } from \"../Meshes/Builders/planeBuilder\";\r\nimport { PointerDragBehavior } from \"../Behaviors/Meshes/pointerDragBehavior\";\r\nimport type { GizmoAxisCache, IGizmo } from \"./gizmo\";\r\nimport { Gizmo } from \"./gizmo\";\r\nimport { UtilityLayerRenderer } from \"../Rendering/utilityLayerRenderer\";\r\nimport { StandardMaterial } from \"../Materials/standardMaterial\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { PositionGizmo } from \"./positionGizmo\";\r\n\r\n/**\r\n * Interface for plane drag gizmo\r\n */\r\nexport interface IPlaneDragGizmo extends IGizmo {\r\n /** Drag behavior responsible for the gizmos dragging interactions */\r\n dragBehavior: PointerDragBehavior;\r\n /** Drag distance in babylon units that the gizmo will snap to when dragged */\r\n snapDistance: number;\r\n /**\r\n * Event that fires each time the gizmo snaps to a new location.\r\n * * snapDistance is the change in distance\r\n */\r\n onSnapObservable: Observable<{ snapDistance: number }>;\r\n /** If the gizmo is enabled */\r\n isEnabled: boolean;\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 /** Material used to render when gizmo is disabled. typically grey. */\r\n disableMaterial: StandardMaterial;\r\n}\r\n\r\n/**\r\n * Single plane drag gizmo\r\n */\r\nexport class PlaneDragGizmo extends Gizmo implements IPlaneDragGizmo {\r\n /**\r\n * Drag behavior responsible for the gizmos dragging interactions\r\n */\r\n public dragBehavior: PointerDragBehavior;\r\n protected _pointerObserver: Nullable<Observer<PointerInfo>> = null;\r\n /**\r\n * Drag distance in babylon units that the gizmo will snap to when dragged (Default: 0)\r\n */\r\n public snapDistance = 0;\r\n /**\r\n * Event that fires each time the gizmo snaps to a new location.\r\n * * snapDistance is the change in distance\r\n */\r\n public onSnapObservable = new Observable<{ snapDistance: number }>();\r\n\r\n protected _gizmoMesh: TransformNode;\r\n protected _coloredMaterial: StandardMaterial;\r\n protected _hoverMaterial: StandardMaterial;\r\n protected _disableMaterial: StandardMaterial;\r\n\r\n protected _isEnabled: boolean = false;\r\n protected _parent: Nullable<PositionGizmo> = null;\r\n protected _dragging: boolean = false;\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._hoverMaterial;\r\n }\r\n\r\n /** Material used to render when gizmo is disabled. typically grey.*/\r\n public get disableMaterial() {\r\n return this._disableMaterial;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public static _CreatePlane(scene: Scene, material: StandardMaterial): TransformNode {\r\n const plane = new TransformNode(\"plane\", scene);\r\n\r\n //make sure plane is double sided\r\n const dragPlane = CreatePlane(\"dragPlane\", { width: 0.1375, height: 0.1375, sideOrientation: 2 }, scene);\r\n dragPlane.material = material;\r\n dragPlane.parent = plane;\r\n return plane;\r\n }\r\n\r\n /**\r\n * Creates a PlaneDragGizmo\r\n * @param dragPlaneNormal The axis normal to which the gizmo will be able to drag on\r\n * @param color The color of the gizmo\r\n * @param gizmoLayer The utility layer the gizmo will be added to\r\n * @param parent\r\n * @param hoverColor The color of the gizmo when hovering over and dragging\r\n * @param disableColor The Color of the gizmo when its disabled\r\n */\r\n constructor(\r\n dragPlaneNormal: Vector3,\r\n color: Color3 = Color3.Gray(),\r\n gizmoLayer: UtilityLayerRenderer = UtilityLayerRenderer.DefaultUtilityLayer,\r\n parent: Nullable<PositionGizmo> = null,\r\n hoverColor: Color3 = Color3.Yellow(),\r\n disableColor: Color3 = Color3.Gray()\r\n ) {\r\n super(gizmoLayer);\r\n this._parent = parent;\r\n // Create Material\r\n this._coloredMaterial = new StandardMaterial(\"\", gizmoLayer.utilityLayerScene);\r\n this._coloredMaterial.diffuseColor = color;\r\n this._coloredMaterial.specularColor = color.subtract(new Color3(0.1, 0.1, 0.1));\r\n\r\n this._hoverMaterial = new StandardMaterial(\"\", gizmoLayer.utilityLayerScene);\r\n this._hoverMaterial.diffuseColor = hoverColor;\r\n\r\n this._disableMaterial = new StandardMaterial(\"\", gizmoLayer.utilityLayerScene);\r\n this._disableMaterial.diffuseColor = disableColor;\r\n this._disableMaterial.alpha = 0.4;\r\n\r\n // Build plane mesh on root node\r\n this._gizmoMesh = PlaneDragGizmo._CreatePlane(gizmoLayer.utilityLayerScene, this._coloredMaterial);\r\n\r\n this._gizmoMesh.lookAt(this._rootMesh.position.add(dragPlaneNormal));\r\n this._gizmoMesh.scaling.scaleInPlace(1 / 3);\r\n this._gizmoMesh.parent = this._rootMesh;\r\n\r\n const currentSnapDragDistance = new Vector3();\r\n const tmpVector = new Vector3();\r\n const tmpVector2 = new Vector3();\r\n const tmpSnapEvent = { snapDistance: 0 };\r\n // Add dragPlaneNormal drag behavior to handle events when the gizmo is dragged\r\n this.dragBehavior = new PointerDragBehavior({ dragPlaneNormal: dragPlaneNormal });\r\n this.dragBehavior.moveAttached = false;\r\n this._rootMesh.addBehavior(this.dragBehavior);\r\n\r\n this.dragBehavior.onDragObservable.add((event) => {\r\n if (this.attachedNode) {\r\n // Keep world translation and use it to update world transform\r\n // if the node has parent, the local transform properties (position, rotation, scale)\r\n // will be recomputed in _matrixChanged function\r\n\r\n // Snapping logic\r\n if (this.snapDistance == 0) {\r\n this.attachedNode.getWorldMatrix().getTranslationToRef(TmpVectors.Vector3[0]);\r\n TmpVectors.Vector3[0].addToRef(event.delta, TmpVectors.Vector3[0]);\r\n if (this.dragBehavior.validateDrag(TmpVectors.Vector3[0])) {\r\n this.attachedNode.getWorldMatrix().addTranslationFromFloats(event.delta.x, event.delta.y, event.delta.z);\r\n }\r\n } else {\r\n currentSnapDragDistance.addInPlace(event.delta);\r\n tmpVector2.set(0, 0, 0);\r\n const currentSnapDragDistanceArray = currentSnapDragDistance.asArray();\r\n for (let axis = 0; axis < 3; axis++) {\r\n const axisDistance = currentSnapDragDistanceArray[axis];\r\n if (Math.abs(axisDistance) > this.snapDistance) {\r\n const dragSteps = (axisDistance < 0 ? Math.ceil : Math.floor)(axisDistance / this.snapDistance);\r\n currentSnapDragDistanceArray[axis] = currentSnapDragDistanceArray[axis] % this.snapDistance;\r\n tmpVector.set(axis == 0 ? 1 : 0, axis == 1 ? 1 : 0, axis == 2 ? 1 : 0);\r\n tmpVector.scaleInPlace(this.snapDistance * dragSteps);\r\n tmpVector2.addInPlace(tmpVector);\r\n }\r\n }\r\n currentSnapDragDistance.fromArray(currentSnapDragDistanceArray);\r\n this.attachedNode.getWorldMatrix().getTranslationToRef(TmpVectors.Vector3[0]);\r\n TmpVectors.Vector3[0].addToRef(tmpVector2, TmpVectors.Vector3[0]);\r\n if (this.dragBehavior.validateDrag(TmpVectors.Vector3[0])) {\r\n this.attachedNode.getWorldMatrix().addTranslationFromFloats(tmpVector2.x, tmpVector2.y, tmpVector2.z);\r\n tmpSnapEvent.snapDistance = tmpVector2.length();\r\n this.onSnapObservable.notifyObservers(tmpSnapEvent);\r\n }\r\n }\r\n this._matrixChanged();\r\n }\r\n });\r\n this.dragBehavior.onDragStartObservable.add(() => {\r\n this._dragging = true;\r\n });\r\n this.dragBehavior.onDragEndObservable.add(() => {\r\n this._dragging = false;\r\n });\r\n\r\n const light = gizmoLayer._getSharedGizmoLight();\r\n light.includedOnlyMeshes = light.includedOnlyMeshes.concat(this._rootMesh.getChildMeshes(false));\r\n\r\n const cache: GizmoAxisCache = {\r\n gizmoMeshes: this._gizmoMesh.getChildMeshes(),\r\n colliderMeshes: this._gizmoMesh.getChildMeshes(),\r\n material: this._coloredMaterial,\r\n hoverMaterial: this._hoverMaterial,\r\n disableMaterial: this._disableMaterial,\r\n active: false,\r\n dragBehavior: this.dragBehavior,\r\n };\r\n this._parent?.addToAxisCache(this._gizmoMesh as Mesh, cache);\r\n\r\n this._pointerObserver = gizmoLayer.utilityLayerScene.onPointerObservable.add((pointerInfo) => {\r\n if (this._customMeshSet) {\r\n return;\r\n }\r\n this._isHovered = !!(cache.colliderMeshes.indexOf(<Mesh>pointerInfo?.pickInfo?.pickedMesh) != -1);\r\n if (!this._parent) {\r\n const material = cache.dragBehavior.enabled ? (this._isHovered || this._dragging ? this._hoverMaterial : this._coloredMaterial) : this._disableMaterial;\r\n this._setGizmoMeshMaterial(cache.gizmoMeshes, material);\r\n }\r\n });\r\n\r\n this.dragBehavior.onEnabledObservable.add((newState) => {\r\n this._setGizmoMeshMaterial(cache.gizmoMeshes, newState ? this._coloredMaterial : this._disableMaterial);\r\n });\r\n }\r\n\r\n protected override _attachedNodeChanged(value: Nullable<Node>) {\r\n if (this.dragBehavior) {\r\n this.dragBehavior.enabled = value ? true : false;\r\n }\r\n }\r\n\r\n /**\r\n * If the gizmo is enabled\r\n */\r\n public set isEnabled(value: boolean) {\r\n this._isEnabled = value;\r\n if (!value) {\r\n this.attachedNode = null;\r\n } else {\r\n if (this._parent) {\r\n this.attachedNode = this._parent.attachedNode;\r\n }\r\n }\r\n }\r\n\r\n public get isEnabled(): boolean {\r\n return this._isEnabled;\r\n }\r\n\r\n /**\r\n * Disposes of the gizmo\r\n */\r\n public override dispose() {\r\n this.onSnapObservable.clear();\r\n this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver);\r\n this.dragBehavior.detach();\r\n super.dispose();\r\n if (this._gizmoMesh) {\r\n this._gizmoMesh.dispose();\r\n }\r\n const materials = [this._coloredMaterial, this._hoverMaterial, this._disableMaterial];\r\n for (const matl of materials) {\r\n if (matl) {\r\n matl.dispose();\r\n }\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"planeDragGizmo.js","sourceRoot":"","sources":["../../../../dev/core/src/Gizmos/planeDragGizmo.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC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CAAC;QACL,CAAC;IACL,CAAC;IAED,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED;;OAEG;IACa,OAAO;QACnB,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;QAC9B,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACpF,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC;QAC3B,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YAClB,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;QAC9B,CAAC;QACD,MAAM,SAAS,GAAG,CAAC,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACtF,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE,CAAC;YAC3B,IAAI,IAAI,EAAE,CAAC;gBACP,IAAI,CAAC,OAAO,EAAE,CAAC;YACnB,CAAC;QACL,CAAC;IACL,CAAC;CACJ","sourcesContent":["import type { Observer } from \"../Misc/observable\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { PointerInfo } from \"../Events/pointerEvents\";\r\nimport { TmpVectors, Vector3 } from \"../Maths/math.vector\";\r\nimport { Color3 } from \"../Maths/math.color\";\r\nimport { TransformNode } from \"../Meshes/transformNode\";\r\nimport type { Node } from \"../node\";\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\nimport { CreatePlane } from \"../Meshes/Builders/planeBuilder\";\r\nimport { PointerDragBehavior } from \"../Behaviors/Meshes/pointerDragBehavior\";\r\nimport type { GizmoAxisCache, IGizmo } from \"./gizmo\";\r\nimport { Gizmo } from \"./gizmo\";\r\nimport { UtilityLayerRenderer } from \"../Rendering/utilityLayerRenderer\";\r\nimport { StandardMaterial } from \"../Materials/standardMaterial\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { PositionGizmo } from \"./positionGizmo\";\r\n\r\n/**\r\n * Interface for plane drag gizmo\r\n */\r\nexport interface IPlaneDragGizmo extends IGizmo {\r\n /** Drag behavior responsible for the gizmos dragging interactions */\r\n dragBehavior: PointerDragBehavior;\r\n /** Drag distance in babylon units that the gizmo will snap to when dragged */\r\n snapDistance: number;\r\n /**\r\n * Event that fires each time the gizmo snaps to a new location.\r\n * * snapDistance is the change in distance\r\n */\r\n onSnapObservable: Observable<{ snapDistance: number }>;\r\n /** If the gizmo is enabled */\r\n isEnabled: boolean;\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 /** Material used to render when gizmo is disabled. typically grey. */\r\n disableMaterial: StandardMaterial;\r\n}\r\n\r\n/**\r\n * Single plane drag gizmo\r\n */\r\nexport class PlaneDragGizmo extends Gizmo implements IPlaneDragGizmo {\r\n /**\r\n * Drag behavior responsible for the gizmos dragging interactions\r\n */\r\n public dragBehavior: PointerDragBehavior;\r\n protected _pointerObserver: Nullable<Observer<PointerInfo>> = null;\r\n /**\r\n * Drag distance in babylon units that the gizmo will snap to when dragged (Default: 0)\r\n */\r\n public snapDistance = 0;\r\n /**\r\n * Event that fires each time the gizmo snaps to a new location.\r\n * * snapDistance is the change in distance\r\n */\r\n public onSnapObservable = new Observable<{ snapDistance: number }>();\r\n\r\n protected _gizmoMesh: TransformNode;\r\n protected _coloredMaterial: StandardMaterial;\r\n protected _hoverMaterial: StandardMaterial;\r\n protected _disableMaterial: StandardMaterial;\r\n\r\n protected _isEnabled: boolean = false;\r\n protected _parent: Nullable<PositionGizmo> = null;\r\n protected _dragging: boolean = false;\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._hoverMaterial;\r\n }\r\n\r\n /** Material used to render when gizmo is disabled. typically grey.*/\r\n public get disableMaterial() {\r\n return this._disableMaterial;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public static _CreatePlane(scene: Scene, material: StandardMaterial): TransformNode {\r\n const plane = new TransformNode(\"plane\", scene);\r\n\r\n //make sure plane is double sided\r\n const dragPlane = CreatePlane(\"dragPlane\", { width: 0.1375, height: 0.1375, sideOrientation: 2 }, scene);\r\n dragPlane.material = material;\r\n dragPlane.parent = plane;\r\n return plane;\r\n }\r\n\r\n /**\r\n * Creates a PlaneDragGizmo\r\n * @param dragPlaneNormal The axis normal to which the gizmo will be able to drag on\r\n * @param color The color of the gizmo\r\n * @param gizmoLayer The utility layer the gizmo will be added to\r\n * @param parent\r\n * @param hoverColor The color of the gizmo when hovering over and dragging\r\n * @param disableColor The Color of the gizmo when its disabled\r\n */\r\n constructor(\r\n dragPlaneNormal: Vector3,\r\n color: Color3 = Color3.Gray(),\r\n gizmoLayer: UtilityLayerRenderer = UtilityLayerRenderer.DefaultUtilityLayer,\r\n parent: Nullable<PositionGizmo> = null,\r\n hoverColor: Color3 = Color3.Yellow(),\r\n disableColor: Color3 = Color3.Gray()\r\n ) {\r\n super(gizmoLayer);\r\n this._parent = parent;\r\n // Create Material\r\n this._coloredMaterial = new StandardMaterial(\"\", gizmoLayer.utilityLayerScene);\r\n this._coloredMaterial.diffuseColor = color;\r\n this._coloredMaterial.specularColor = color.subtract(new Color3(0.1, 0.1, 0.1));\r\n\r\n this._hoverMaterial = new StandardMaterial(\"\", gizmoLayer.utilityLayerScene);\r\n this._hoverMaterial.diffuseColor = hoverColor;\r\n\r\n this._disableMaterial = new StandardMaterial(\"\", gizmoLayer.utilityLayerScene);\r\n this._disableMaterial.diffuseColor = disableColor;\r\n this._disableMaterial.alpha = 0.4;\r\n\r\n // Build plane mesh on root node\r\n this._gizmoMesh = PlaneDragGizmo._CreatePlane(gizmoLayer.utilityLayerScene, this._coloredMaterial);\r\n\r\n this._gizmoMesh.lookAt(this._rootMesh.position.add(dragPlaneNormal));\r\n this._gizmoMesh.scaling.scaleInPlace(1 / 3);\r\n this._gizmoMesh.parent = this._rootMesh;\r\n\r\n const currentSnapDragDistance = new Vector3();\r\n const tmpVector = new Vector3();\r\n const tmpVector2 = new Vector3();\r\n const tmpSnapEvent = { snapDistance: 0 };\r\n // Add dragPlaneNormal drag behavior to handle events when the gizmo is dragged\r\n this.dragBehavior = new PointerDragBehavior({ dragPlaneNormal: dragPlaneNormal });\r\n this.dragBehavior.moveAttached = false;\r\n this._rootMesh.addBehavior(this.dragBehavior);\r\n\r\n this.dragBehavior.onDragObservable.add((event) => {\r\n if (this.attachedNode) {\r\n // Keep world translation and use it to update world transform\r\n // if the node has parent, the local transform properties (position, rotation, scale)\r\n // will be recomputed in _matrixChanged function\r\n\r\n // Transform delta by additionalTransformNode inverse world matrix if present\r\n let delta = event.delta;\r\n if (this._additionalTransformNode) {\r\n this._additionalTransformNode.getWorldMatrix().invertToRef(TmpVectors.Matrix[0]);\r\n Vector3.TransformNormalToRef(event.delta, TmpVectors.Matrix[0], TmpVectors.Vector3[1]);\r\n delta = TmpVectors.Vector3[1];\r\n }\r\n // Snapping logic\r\n if (this.snapDistance == 0) {\r\n this.attachedNode.getWorldMatrix().getTranslationToRef(TmpVectors.Vector3[0]);\r\n TmpVectors.Vector3[0].addToRef(delta, TmpVectors.Vector3[0]);\r\n if (this.dragBehavior.validateDrag(TmpVectors.Vector3[0])) {\r\n this.attachedNode.getWorldMatrix().addTranslationFromFloats(delta.x, delta.y, delta.z);\r\n }\r\n } else {\r\n currentSnapDragDistance.addInPlace(delta);\r\n tmpVector2.set(0, 0, 0);\r\n const currentSnapDragDistanceArray = currentSnapDragDistance.asArray();\r\n for (let axis = 0; axis < 3; axis++) {\r\n const axisDistance = currentSnapDragDistanceArray[axis];\r\n if (Math.abs(axisDistance) > this.snapDistance) {\r\n const dragSteps = (axisDistance < 0 ? Math.ceil : Math.floor)(axisDistance / this.snapDistance);\r\n currentSnapDragDistanceArray[axis] = currentSnapDragDistanceArray[axis] % this.snapDistance;\r\n tmpVector.set(axis == 0 ? 1 : 0, axis == 1 ? 1 : 0, axis == 2 ? 1 : 0);\r\n tmpVector.scaleInPlace(this.snapDistance * dragSteps);\r\n tmpVector2.addInPlace(tmpVector);\r\n }\r\n }\r\n currentSnapDragDistance.fromArray(currentSnapDragDistanceArray);\r\n this.attachedNode.getWorldMatrix().getTranslationToRef(TmpVectors.Vector3[0]);\r\n TmpVectors.Vector3[0].addToRef(tmpVector2, TmpVectors.Vector3[0]);\r\n if (this.dragBehavior.validateDrag(TmpVectors.Vector3[0])) {\r\n this.attachedNode.getWorldMatrix().addTranslationFromFloats(tmpVector2.x, tmpVector2.y, tmpVector2.z);\r\n tmpSnapEvent.snapDistance = tmpVector2.length();\r\n this.onSnapObservable.notifyObservers(tmpSnapEvent);\r\n }\r\n }\r\n this._matrixChanged();\r\n }\r\n });\r\n this.dragBehavior.onDragStartObservable.add(() => {\r\n this._dragging = true;\r\n });\r\n this.dragBehavior.onDragEndObservable.add(() => {\r\n this._dragging = false;\r\n });\r\n\r\n const light = gizmoLayer._getSharedGizmoLight();\r\n light.includedOnlyMeshes = light.includedOnlyMeshes.concat(this._rootMesh.getChildMeshes(false));\r\n\r\n const cache: GizmoAxisCache = {\r\n gizmoMeshes: this._gizmoMesh.getChildMeshes(),\r\n colliderMeshes: this._gizmoMesh.getChildMeshes(),\r\n material: this._coloredMaterial,\r\n hoverMaterial: this._hoverMaterial,\r\n disableMaterial: this._disableMaterial,\r\n active: false,\r\n dragBehavior: this.dragBehavior,\r\n };\r\n this._parent?.addToAxisCache(this._gizmoMesh as Mesh, cache);\r\n\r\n this._pointerObserver = gizmoLayer.utilityLayerScene.onPointerObservable.add((pointerInfo) => {\r\n if (this._customMeshSet) {\r\n return;\r\n }\r\n this._isHovered = !!(cache.colliderMeshes.indexOf(<Mesh>pointerInfo?.pickInfo?.pickedMesh) != -1);\r\n if (!this._parent) {\r\n const material = cache.dragBehavior.enabled ? (this._isHovered || this._dragging ? this._hoverMaterial : this._coloredMaterial) : this._disableMaterial;\r\n this._setGizmoMeshMaterial(cache.gizmoMeshes, material);\r\n }\r\n });\r\n\r\n this.dragBehavior.onEnabledObservable.add((newState) => {\r\n this._setGizmoMeshMaterial(cache.gizmoMeshes, newState ? this._coloredMaterial : this._disableMaterial);\r\n });\r\n }\r\n\r\n protected override _attachedNodeChanged(value: Nullable<Node>) {\r\n if (this.dragBehavior) {\r\n this.dragBehavior.enabled = value ? true : false;\r\n }\r\n }\r\n\r\n /**\r\n * If the gizmo is enabled\r\n */\r\n public set isEnabled(value: boolean) {\r\n this._isEnabled = value;\r\n if (!value) {\r\n this.attachedNode = null;\r\n } else {\r\n if (this._parent) {\r\n this.attachedNode = this._parent.attachedNode;\r\n }\r\n }\r\n }\r\n\r\n public get isEnabled(): boolean {\r\n return this._isEnabled;\r\n }\r\n\r\n /**\r\n * Disposes of the gizmo\r\n */\r\n public override dispose() {\r\n this.onSnapObservable.clear();\r\n this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver);\r\n this.dragBehavior.detach();\r\n super.dispose();\r\n if (this._gizmoMesh) {\r\n this._gizmoMesh.dispose();\r\n }\r\n const materials = [this._coloredMaterial, this._hoverMaterial, this._disableMaterial];\r\n for (const matl of materials) {\r\n if (matl) {\r\n matl.dispose();\r\n }\r\n }\r\n }\r\n}\r\n"]}
@@ -122,6 +122,10 @@ export class PlaneRotationGizmo extends Gizmo {
122
122
  let localPlaneNormalTowardsCamera = new Vector3();
123
123
  this.dragBehavior.onDragStartObservable.add((e) => {
124
124
  if (this.attachedNode) {
125
+ if (this._additionalTransformNode) {
126
+ this._additionalTransformNode.getWorldMatrix().invertToRef(TmpVectors.Matrix[0]);
127
+ Vector3.TransformCoordinatesToRef(e.dragPlanePoint, TmpVectors.Matrix[0], e.dragPlanePoint);
128
+ }
125
129
  lastDragPosition.copyFrom(e.dragPlanePoint);
126
130
  this._rotationDisplayPlane.setEnabled(true);
127
131
  this._rotationDisplayPlane.getWorldMatrix().invertToRef(rotationMatrix);
@@ -133,6 +137,8 @@ export class PlaneRotationGizmo extends Gizmo {
133
137
  lastDragPosition.copyFrom(e.dragPlanePoint);
134
138
  this._rotationShaderMaterial.setVector3("angles", this._angles);
135
139
  this.angle = 0;
140
+ // there is an issue with the rotation plane with additionalTransformNode, so we hide it in that case to avoid confusion
141
+ this._rotationDisplayPlane.visibility = this._additionalTransformNode ? 0 : 0.999;
136
142
  }
137
143
  });
138
144
  this.dragBehavior.onDragEndObservable.add(() => {
@@ -169,6 +175,10 @@ export class PlaneRotationGizmo extends Gizmo {
169
175
  }
170
176
  nodeQuaternion.normalize();
171
177
  const nodeTranslationForOperation = this.updateGizmoPositionToMatchAttachedMesh ? nodeTranslation : this._rootMesh.absolutePosition;
178
+ if (this._additionalTransformNode) {
179
+ this._additionalTransformNode.getWorldMatrix().invertToRef(TmpVectors.Matrix[0]);
180
+ Vector3.TransformCoordinatesToRef(event.dragPlanePoint, TmpVectors.Matrix[0], event.dragPlanePoint);
181
+ }
172
182
  const newVector = event.dragPlanePoint.subtract(nodeTranslationForOperation).normalize();
173
183
  const originalVector = lastDragPosition.subtract(nodeTranslationForOperation).normalize();
174
184
  const cross = Vector3.Cross(newVector, originalVector);
@@ -1 +1 @@
1
- {"version":3,"file":"planeRotationGizmo.js","sourceRoot":"","sources":["../../../../dev/core/src/Gizmos/planeRotationGizmo.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,iCAAiC,CAAC;AAEzC,OAAO,EAAE,IAAI,EAAE,MAAM,g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AAY,GAAW,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,AAA7B,CAA8B;AA0CvC,6CAA0B,GAAG;;;;;;;;;;;UAWxC,AAXqC,CAWpC;AAEU,+CAA4B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+B/C,AA/B4C,CA+B3C","sourcesContent":["import type { Observer } from \"../Misc/observable\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { PointerInfo } from \"../Events/pointerEvents\";\r\nimport { Quaternion, Matrix, Vector3, TmpVectors } from \"../Maths/math.vector\";\r\nimport { Color3 } from \"../Maths/math.color\";\r\nimport \"../Meshes/Builders/linesBuilder\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport { Mesh } from \"../Meshes/mesh\";\r\nimport type { Node } from \"../node\";\r\nimport { PointerDragBehavior } from \"../Behaviors/Meshes/pointerDragBehavior\";\r\nimport type { GizmoAxisCache, IGizmo } from \"./gizmo\";\r\nimport { Gizmo } from \"./gizmo\";\r\nimport { UtilityLayerRenderer } from \"../Rendering/utilityLayerRenderer\";\r\nimport { StandardMaterial } from \"../Materials/standardMaterial\";\r\nimport type { RotationGizmo } from \"./rotationGizmo\";\r\nimport { ShaderMaterial } from \"../Materials/shaderMaterial\";\r\nimport { Effect } from \"../Materials/effect\";\r\nimport { CreatePlane } from \"../Meshes/Builders/planeBuilder\";\r\nimport { CreateTorus } from \"../Meshes/Builders/torusBuilder\";\r\nimport { Epsilon } from \"../Maths/math.constants\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport type { TransformNode } from \"../Meshes/transformNode\";\r\n\r\n/**\r\n * Interface for plane rotation gizmo\r\n */\r\nexport interface IPlaneRotationGizmo extends IGizmo {\r\n /** Drag behavior responsible for the gizmos dragging interactions */\r\n dragBehavior: PointerDragBehavior;\r\n /** Drag distance in babylon units that the gizmo will snap to when dragged */\r\n snapDistance: number;\r\n /** Sensitivity factor for dragging */\r\n sensitivity: number;\r\n /**\r\n * Event that fires each time the gizmo snaps to a new location.\r\n * * snapDistance is the change in distance\r\n */\r\n onSnapObservable: Observable<{ snapDistance: number }>;\r\n /** Accumulated relative angle value for rotation on the axis. */\r\n angle: number;\r\n /** If the gizmo is enabled */\r\n isEnabled: boolean;\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 /** Color used to render the drag angle sector when gizmo is rotated with mouse */\r\n rotationColor: Color3;\r\n /** Material used to render when gizmo is disabled. typically grey. */\r\n disableMaterial: StandardMaterial;\r\n}\r\n\r\n/**\r\n * Single plane rotation gizmo\r\n */\r\nexport class PlaneRotationGizmo extends Gizmo implements IPlaneRotationGizmo {\r\n /**\r\n * Drag behavior responsible for the gizmos dragging interactions\r\n */\r\n public dragBehavior: PointerDragBehavior;\r\n protected _pointerObserver: Nullable<Observer<PointerInfo>> = null;\r\n\r\n /**\r\n * Rotation distance in radians that the gizmo will snap to (Default: 0)\r\n */\r\n public snapDistance = 0;\r\n /**\r\n * Event that fires each time the gizmo snaps to a new location.\r\n * * snapDistance is the change in distance\r\n */\r\n public onSnapObservable = new Observable<{ snapDistance: number }>();\r\n\r\n /**\r\n * The maximum angle between the camera and the rotation allowed for interaction\r\n * If a rotation plane appears 'flat', a lower value allows interaction.\r\n */\r\n public static MaxDragAngle: number = (Math.PI * 9) / 20;\r\n\r\n /**\r\n * Accumulated relative angle value for rotation on the axis. Reset to 0 when a dragStart occurs\r\n */\r\n public angle: number = 0;\r\n\r\n /**\r\n * Custom sensitivity value for the drag strength\r\n */\r\n public sensitivity = 1;\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._hoverMaterial;\r\n }\r\n\r\n /** Color used to render the drag angle sector when gizmo is rotated with mouse */\r\n public set rotationColor(color: Color3) {\r\n this._rotationShaderMaterial.setColor3(\"rotationColor\", color);\r\n }\r\n\r\n /** Material used to render when gizmo is disabled. typically grey. */\r\n public get disableMaterial() {\r\n return this._disableMaterial;\r\n }\r\n\r\n protected _isEnabled: boolean = true;\r\n protected _parent: Nullable<RotationGizmo> = null;\r\n protected _coloredMaterial: StandardMaterial;\r\n protected _hoverMaterial: StandardMaterial;\r\n protected _disableMaterial: StandardMaterial;\r\n protected _gizmoMesh: Mesh;\r\n protected _rotationDisplayPlane: Mesh;\r\n protected _dragging: boolean = false;\r\n protected _angles = new Vector3();\r\n\r\n protected static _RotationGizmoVertexShader = `\r\n precision highp float;\r\n attribute vec3 position;\r\n attribute vec2 uv;\r\n uniform mat4 worldViewProjection;\r\n varying vec3 vPosition;\r\n varying vec2 vUV;\r\n\r\n void main(void) {\r\n gl_Position = worldViewProjection * vec4(position, 1.0);\r\n vUV = uv;\r\n }`;\r\n\r\n protected static _RotationGizmoFragmentShader = `\r\n precision highp float;\r\n varying vec2 vUV;\r\n varying vec3 vPosition;\r\n uniform vec3 angles;\r\n uniform vec3 rotationColor;\r\n\r\n #define twopi 6.283185307\r\n\r\n void main(void) {\r\n vec2 uv = vUV - vec2(0.5);\r\n float angle = atan(uv.y, uv.x) + 3.141592;\r\n float delta = gl_FrontFacing ? angles.y : -angles.y;\r\n float begin = angles.x - delta * angles.z;\r\n float start = (begin < (begin + delta)) ? begin : (begin + delta);\r\n float end = (begin > (begin + delta)) ? begin : (begin + delta);\r\n float len = sqrt(dot(uv,uv));\r\n float opacity = 1. - step(0.5, len);\r\n\r\n float base = abs(floor(start / twopi)) * twopi;\r\n start += base;\r\n end += base;\r\n\r\n float intensity = 0.;\r\n for (int i = 0; i < 5; i++)\r\n {\r\n intensity += max(step(start, angle) - step(end, angle), 0.);\r\n angle += twopi;\r\n }\r\n gl_FragColor = vec4(rotationColor, min(intensity * 0.25, 0.8)) * opacity;\r\n }\r\n `;\r\n\r\n protected _rotationShaderMaterial: ShaderMaterial;\r\n\r\n /**\r\n * Creates a PlaneRotationGizmo\r\n * @param planeNormal The normal of the plane which the gizmo will be able to rotate on\r\n * @param color The color of the gizmo\r\n * @param gizmoLayer The utility layer the gizmo will be added to\r\n * @param tessellation Amount of tessellation to be used when creating rotation circles\r\n * @param parent\r\n * @param useEulerRotation Use and update Euler angle instead of quaternion\r\n * @param thickness display gizmo axis thickness\r\n * @param hoverColor The color of the gizmo when hovering over and dragging\r\n * @param disableColor The Color of the gizmo when its disabled\r\n */\r\n constructor(\r\n planeNormal: Vector3,\r\n color: Color3 = Color3.Gray(),\r\n gizmoLayer: UtilityLayerRenderer = UtilityLayerRenderer.DefaultUtilityLayer,\r\n tessellation = 32,\r\n parent: Nullable<RotationGizmo> = null,\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n useEulerRotation = false,\r\n thickness: number = 1,\r\n hoverColor: Color3 = Color3.Yellow(),\r\n disableColor: Color3 = Color3.Gray()\r\n ) {\r\n super(gizmoLayer);\r\n this._parent = parent;\r\n // Create Material\r\n this._coloredMaterial = new StandardMaterial(\"\", gizmoLayer.utilityLayerScene);\r\n this._coloredMaterial.diffuseColor = color;\r\n this._coloredMaterial.specularColor = color.subtract(new Color3(0.1, 0.1, 0.1));\r\n\r\n this._hoverMaterial = new StandardMaterial(\"\", gizmoLayer.utilityLayerScene);\r\n this._hoverMaterial.diffuseColor = hoverColor;\r\n this._hoverMaterial.specularColor = hoverColor;\r\n\r\n this._disableMaterial = new StandardMaterial(\"\", gizmoLayer.utilityLayerScene);\r\n this._disableMaterial.diffuseColor = disableColor;\r\n this._disableMaterial.alpha = 0.4;\r\n\r\n // Build mesh on root node\r\n this._gizmoMesh = new Mesh(\"\", gizmoLayer.utilityLayerScene);\r\n const { rotationMesh, collider } = this._createGizmoMesh(this._gizmoMesh, thickness, tessellation);\r\n\r\n // Setup Rotation Circle\r\n this._rotationDisplayPlane = CreatePlane(\r\n \"rotationDisplay\",\r\n {\r\n size: 0.6,\r\n updatable: false,\r\n },\r\n this.gizmoLayer.utilityLayerScene\r\n );\r\n this._rotationDisplayPlane.rotation.z = Math.PI * 0.5;\r\n this._rotationDisplayPlane.parent = this._gizmoMesh;\r\n this._rotationDisplayPlane.setEnabled(false);\r\n\r\n Effect.ShadersStore[\"rotationGizmoVertexShader\"] = PlaneRotationGizmo._RotationGizmoVertexShader;\r\n Effect.ShadersStore[\"rotationGizmoFragmentShader\"] = PlaneRotationGizmo._RotationGizmoFragmentShader;\r\n this._rotationShaderMaterial = new ShaderMaterial(\r\n \"shader\",\r\n this.gizmoLayer.utilityLayerScene,\r\n {\r\n vertex: \"rotationGizmo\",\r\n fragment: \"rotationGizmo\",\r\n },\r\n {\r\n attributes: [\"position\", \"uv\"],\r\n uniforms: [\"worldViewProjection\", \"angles\", \"rotationColor\"],\r\n }\r\n );\r\n this._rotationShaderMaterial.backFaceCulling = false;\r\n this.rotationColor = hoverColor;\r\n\r\n this._rotationDisplayPlane.material = this._rotationShaderMaterial;\r\n this._rotationDisplayPlane.visibility = 0.999;\r\n\r\n this._gizmoMesh.lookAt(this._rootMesh.position.add(planeNormal));\r\n this._rootMesh.addChild(this._gizmoMesh, Gizmo.PreserveScaling);\r\n this._gizmoMesh.scaling.scaleInPlace(1 / 3);\r\n // Add drag behavior to handle events when the gizmo is dragged\r\n this.dragBehavior = new PointerDragBehavior({ dragPlaneNormal: planeNormal });\r\n this.dragBehavior.moveAttached = false;\r\n this.dragBehavior.maxDragAngle = PlaneRotationGizmo.MaxDragAngle;\r\n this.dragBehavior._useAlternatePickedPointAboveMaxDragAngle = true;\r\n this._rootMesh.addBehavior(this.dragBehavior);\r\n\r\n // Closures for drag logic\r\n const lastDragPosition = new Vector3();\r\n\r\n const rotationMatrix = new Matrix();\r\n const planeNormalTowardsCamera = new Vector3();\r\n let localPlaneNormalTowardsCamera = new Vector3();\r\n\r\n this.dragBehavior.onDragStartObservable.add((e) => {\r\n if (this.attachedNode) {\r\n lastDragPosition.copyFrom(e.dragPlanePoint);\r\n this._rotationDisplayPlane.setEnabled(true);\r\n\r\n this._rotationDisplayPlane.getWorldMatrix().invertToRef(rotationMatrix);\r\n Vector3.TransformCoordinatesToRef(e.dragPlanePoint, rotationMatrix, lastDragPosition);\r\n\r\n this._angles.x = Math.atan2(lastDragPosition.y, lastDragPosition.x) + Math.PI;\r\n this._angles.y = 0;\r\n this._angles.z = this.updateGizmoRotationToMatchAttachedMesh ? 1 : 0;\r\n this._dragging = true;\r\n lastDragPosition.copyFrom(e.dragPlanePoint);\r\n this._rotationShaderMaterial.setVector3(\"angles\", this._angles);\r\n this.angle = 0;\r\n }\r\n });\r\n\r\n this.dragBehavior.onDragEndObservable.add(() => {\r\n this._dragging = false;\r\n this._rotationDisplayPlane.setEnabled(false);\r\n });\r\n\r\n const tmpSnapEvent = { snapDistance: 0 };\r\n let currentSnapDragDistance = 0;\r\n const tmpMatrix = new Matrix();\r\n const amountToRotate = new Quaternion();\r\n this.dragBehavior.onDragObservable.add((event) => {\r\n if (this.attachedNode) {\r\n // Calc angle over full 360 degree (https://stackoverflow.com/questions/43493711/the-angle-between-two-3d-vectors-with-a-result-range-0-360)\r\n const nodeScale = new Vector3(1, 1, 1);\r\n const nodeQuaternion = new Quaternion(0, 0, 0, 1);\r\n const nodeTranslation = new Vector3(0, 0, 0);\r\n const attachedNodeTransform = this._attachedNode as TransformNode;\r\n // check there is an active pivot for the TransformNode attached\r\n if (attachedNodeTransform && attachedNodeTransform.isUsingPivotMatrix && attachedNodeTransform.isUsingPivotMatrix() && attachedNodeTransform.position) {\r\n // When a TransformNode has an active pivot, even without parenting,\r\n // translation from the world matrix is different from TransformNode.position.\r\n // Pivot works like a virtual parent that's using the node orientation.\r\n // As the world matrix is transformed by the gizmo and then decomposed to TRS\r\n // its translation part must be set to the Node's position.\r\n attachedNodeTransform.getWorldMatrix().setTranslation(attachedNodeTransform.position);\r\n }\r\n\r\n this.attachedNode.getWorldMatrix().decompose(nodeScale, nodeQuaternion, nodeTranslation);\r\n // uniform scaling of absolute value of components\r\n // (-1,1,1) is uniform but (1,1.001,1) is not\r\n const uniformScaling = Math.abs(Math.abs(nodeScale.x) - Math.abs(nodeScale.y)) <= Epsilon && Math.abs(Math.abs(nodeScale.x) - Math.abs(nodeScale.z)) <= Epsilon;\r\n if (!uniformScaling && this.updateGizmoRotationToMatchAttachedMesh) {\r\n Logger.Warn(\r\n \"Unable to use a rotation gizmo matching mesh rotation with non uniform scaling. Use uniform scaling or set updateGizmoRotationToMatchAttachedMesh to false.\"\r\n );\r\n return;\r\n }\r\n nodeQuaternion.normalize();\r\n\r\n const nodeTranslationForOperation = this.updateGizmoPositionToMatchAttachedMesh ? nodeTranslation : this._rootMesh.absolutePosition;\r\n const newVector = event.dragPlanePoint.subtract(nodeTranslationForOperation).normalize();\r\n const originalVector = lastDragPosition.subtract(nodeTranslationForOperation).normalize();\r\n const cross = Vector3.Cross(newVector, originalVector);\r\n const dot = Vector3.Dot(newVector, originalVector);\r\n let angle = Math.atan2(cross.length(), dot) * this.sensitivity;\r\n planeNormalTowardsCamera.copyFrom(planeNormal);\r\n localPlaneNormalTowardsCamera.copyFrom(planeNormal);\r\n if (this.updateGizmoRotationToMatchAttachedMesh) {\r\n nodeQuaternion.toRotationMatrix(rotationMatrix);\r\n localPlaneNormalTowardsCamera = Vector3.TransformCoordinates(planeNormalTowardsCamera, rotationMatrix);\r\n }\r\n // Flip up vector depending on which side the camera is on\r\n let cameraFlipped = false;\r\n if (gizmoLayer.utilityLayerScene.activeCamera) {\r\n const camVec = gizmoLayer.utilityLayerScene.activeCamera.position.subtract(nodeTranslationForOperation).normalize();\r\n if (Vector3.Dot(camVec, localPlaneNormalTowardsCamera) > 0) {\r\n planeNormalTowardsCamera.scaleInPlace(-1);\r\n localPlaneNormalTowardsCamera.scaleInPlace(-1);\r\n cameraFlipped = true;\r\n }\r\n }\r\n const halfCircleSide = Vector3.Dot(localPlaneNormalTowardsCamera, cross) > 0.0;\r\n if (halfCircleSide) {\r\n angle = -angle;\r\n }\r\n\r\n TmpVectors.Vector3[0].set(angle, 0, 0);\r\n if (!this.dragBehavior.validateDrag(TmpVectors.Vector3[0])) {\r\n angle = 0;\r\n }\r\n\r\n // Snapping logic\r\n let snapped = false;\r\n if (this.snapDistance != 0) {\r\n currentSnapDragDistance += angle;\r\n if (Math.abs(currentSnapDragDistance) > this.snapDistance) {\r\n let dragSteps = Math.floor(Math.abs(currentSnapDragDistance) / this.snapDistance);\r\n if (currentSnapDragDistance < 0) {\r\n dragSteps *= -1;\r\n }\r\n currentSnapDragDistance = currentSnapDragDistance % this.snapDistance;\r\n angle = this.snapDistance * dragSteps;\r\n snapped = true;\r\n } else {\r\n angle = 0;\r\n }\r\n }\r\n\r\n // Convert angle and axis to quaternion (http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm)\r\n const quaternionCoefficient = Math.sin(angle / 2);\r\n amountToRotate.set(\r\n planeNormalTowardsCamera.x * quaternionCoefficient,\r\n planeNormalTowardsCamera.y * quaternionCoefficient,\r\n planeNormalTowardsCamera.z * quaternionCoefficient,\r\n Math.cos(angle / 2)\r\n );\r\n\r\n // If the meshes local scale is inverted (eg. loaded gltf file parent with z scale of -1) the rotation needs to be inverted on the y axis\r\n if (tmpMatrix.determinant() > 0) {\r\n const tmpVector = new Vector3();\r\n amountToRotate.toEulerAnglesToRef(tmpVector);\r\n Quaternion.RotationYawPitchRollToRef(tmpVector.y, -tmpVector.x, -tmpVector.z, amountToRotate);\r\n }\r\n\r\n if (this.updateGizmoRotationToMatchAttachedMesh) {\r\n // Rotate selected mesh quaternion over fixed axis\r\n nodeQuaternion.multiplyToRef(amountToRotate, nodeQuaternion);\r\n nodeQuaternion.normalize();\r\n // recompose matrix\r\n Matrix.ComposeToRef(nodeScale, nodeQuaternion, nodeTranslation, this.attachedNode.getWorldMatrix());\r\n } else {\r\n // Rotate selected mesh quaternion over rotated axis\r\n amountToRotate.toRotationMatrix(TmpVectors.Matrix[0]);\r\n const translation = this.attachedNode.getWorldMatrix().getTranslation();\r\n this.attachedNode.getWorldMatrix().multiplyToRef(TmpVectors.Matrix[0], this.attachedNode.getWorldMatrix());\r\n this.attachedNode.getWorldMatrix().setTranslation(translation);\r\n }\r\n\r\n lastDragPosition.copyFrom(event.dragPlanePoint);\r\n if (snapped) {\r\n tmpSnapEvent.snapDistance = angle;\r\n this.onSnapObservable.notifyObservers(tmpSnapEvent);\r\n }\r\n this._angles.y += gizmoLayer.utilityLayerScene.useRightHandedSystem ? -angle : angle;\r\n this.angle += cameraFlipped ? -angle : angle;\r\n this._rotationShaderMaterial.setVector3(\"angles\", this._angles);\r\n this._matrixChanged();\r\n }\r\n });\r\n\r\n const light = gizmoLayer._getSharedGizmoLight();\r\n light.includedOnlyMeshes = light.includedOnlyMeshes.concat(this._rootMesh.getChildMeshes(false));\r\n\r\n const cache: GizmoAxisCache = {\r\n colliderMeshes: [collider],\r\n gizmoMeshes: [rotationMesh],\r\n material: this._coloredMaterial,\r\n hoverMaterial: this._hoverMaterial,\r\n disableMaterial: this._disableMaterial,\r\n active: false,\r\n dragBehavior: this.dragBehavior,\r\n };\r\n this._parent?.addToAxisCache(this._gizmoMesh, cache);\r\n\r\n this._pointerObserver = gizmoLayer.utilityLayerScene.onPointerObservable.add((pointerInfo) => {\r\n if (this._customMeshSet) {\r\n return;\r\n }\r\n // updating here the maxangle because ondragstart is too late (value already used) and the updated value is not taken into account\r\n this.dragBehavior.maxDragAngle = PlaneRotationGizmo.MaxDragAngle;\r\n this._isHovered = !!(cache.colliderMeshes.indexOf(<Mesh>pointerInfo?.pickInfo?.pickedMesh) != -1);\r\n if (!this._parent) {\r\n const material = cache.dragBehavior.enabled ? (this._isHovered || this._dragging ? this._hoverMaterial : this._coloredMaterial) : this._disableMaterial;\r\n this._setGizmoMeshMaterial(cache.gizmoMeshes, material);\r\n }\r\n });\r\n\r\n this.dragBehavior.onEnabledObservable.add((newState) => {\r\n this._setGizmoMeshMaterial(cache.gizmoMeshes, newState ? this._coloredMaterial : this._disableMaterial);\r\n });\r\n }\r\n\r\n /**\r\n * @internal\r\n * Create Geometry for Gizmo\r\n * @param parentMesh\r\n * @param thickness\r\n * @param tessellation\r\n * @returns\r\n */\r\n protected _createGizmoMesh(parentMesh: AbstractMesh, thickness: number, tessellation: number) {\r\n const collider = CreateTorus(\r\n \"ignore\",\r\n {\r\n diameter: 0.6,\r\n thickness: 0.03 * thickness,\r\n tessellation,\r\n },\r\n this.gizmoLayer.utilityLayerScene\r\n );\r\n collider.visibility = 0;\r\n const rotationMesh = CreateTorus(\r\n \"\",\r\n {\r\n diameter: 0.6,\r\n thickness: 0.005 * thickness,\r\n tessellation,\r\n },\r\n this.gizmoLayer.utilityLayerScene\r\n );\r\n rotationMesh.material = this._coloredMaterial;\r\n\r\n // Position arrow pointing in its drag axis\r\n rotationMesh.rotation.x = Math.PI / 2;\r\n collider.rotation.x = Math.PI / 2;\r\n\r\n parentMesh.addChild(rotationMesh, Gizmo.PreserveScaling);\r\n parentMesh.addChild(collider, Gizmo.PreserveScaling);\r\n return { rotationMesh, collider };\r\n }\r\n\r\n protected override _attachedNodeChanged(value: Nullable<Node>) {\r\n if (this.dragBehavior) {\r\n this.dragBehavior.enabled = value ? true : false;\r\n }\r\n }\r\n\r\n /**\r\n * If the gizmo is enabled\r\n */\r\n public set isEnabled(value: boolean) {\r\n this._isEnabled = value;\r\n if (!value) {\r\n this.attachedMesh = null;\r\n } else {\r\n if (this._parent) {\r\n this.attachedMesh = this._parent.attachedMesh;\r\n }\r\n }\r\n }\r\n\r\n public get isEnabled(): boolean {\r\n return this._isEnabled;\r\n }\r\n\r\n /**\r\n * Disposes of the gizmo\r\n */\r\n public override dispose() {\r\n this.onSnapObservable.clear();\r\n this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver);\r\n this.dragBehavior.detach();\r\n if (this._gizmoMesh) {\r\n this._gizmoMesh.dispose();\r\n }\r\n if (this._rotationDisplayPlane) {\r\n this._rotationDisplayPlane.dispose();\r\n }\r\n if (this._rotationShaderMaterial) {\r\n this._rotationShaderMaterial.dispose();\r\n }\r\n const materials = [this._coloredMaterial, this._hoverMaterial, this._disableMaterial];\r\n for (const matl of materials) {\r\n if (matl) {\r\n matl.dispose();\r\n }\r\n }\r\n super.dispose();\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"planeRotationGizmo.js","sourceRoot":"","sources":["../../../../dev/core/src/Gizmos/planeRotationGizmo.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,iCAAiC,CAAC;AAEzC,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,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;AAEjE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAiCxC;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAiCzC,4EAA4E;IAC5E,IAAW,eAAe;QACtB,OAAO,IAAI,CAA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nB,CAAC;QACL,CAAC;QACD,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;;AA9cD;;;GAGG;AACW,+BAAY,GAAW,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,EAAE,AAA7B,CAA8B;AA0CvC,6CAA0B,GAAG;;;;;;;;;;;UAWxC,AAXqC,CAWpC;AAEU,+CAA4B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+B/C,AA/B4C,CA+B3C","sourcesContent":["import type { Observer } from \"../Misc/observable\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { PointerInfo } from \"../Events/pointerEvents\";\r\nimport { Quaternion, Matrix, Vector3, TmpVectors } from \"../Maths/math.vector\";\r\nimport { Color3 } from \"../Maths/math.color\";\r\nimport \"../Meshes/Builders/linesBuilder\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport { Mesh } from \"../Meshes/mesh\";\r\nimport type { Node } from \"../node\";\r\nimport { PointerDragBehavior } from \"../Behaviors/Meshes/pointerDragBehavior\";\r\nimport type { GizmoAxisCache, IGizmo } from \"./gizmo\";\r\nimport { Gizmo } from \"./gizmo\";\r\nimport { UtilityLayerRenderer } from \"../Rendering/utilityLayerRenderer\";\r\nimport { StandardMaterial } from \"../Materials/standardMaterial\";\r\nimport type { RotationGizmo } from \"./rotationGizmo\";\r\nimport { ShaderMaterial } from \"../Materials/shaderMaterial\";\r\nimport { Effect } from \"../Materials/effect\";\r\nimport { CreatePlane } from \"../Meshes/Builders/planeBuilder\";\r\nimport { CreateTorus } from \"../Meshes/Builders/torusBuilder\";\r\nimport { Epsilon } from \"../Maths/math.constants\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport type { TransformNode } from \"../Meshes/transformNode\";\r\n\r\n/**\r\n * Interface for plane rotation gizmo\r\n */\r\nexport interface IPlaneRotationGizmo extends IGizmo {\r\n /** Drag behavior responsible for the gizmos dragging interactions */\r\n dragBehavior: PointerDragBehavior;\r\n /** Drag distance in babylon units that the gizmo will snap to when dragged */\r\n snapDistance: number;\r\n /** Sensitivity factor for dragging */\r\n sensitivity: number;\r\n /**\r\n * Event that fires each time the gizmo snaps to a new location.\r\n * * snapDistance is the change in distance\r\n */\r\n onSnapObservable: Observable<{ snapDistance: number }>;\r\n /** Accumulated relative angle value for rotation on the axis. */\r\n angle: number;\r\n /** If the gizmo is enabled */\r\n isEnabled: boolean;\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 /** Color used to render the drag angle sector when gizmo is rotated with mouse */\r\n rotationColor: Color3;\r\n /** Material used to render when gizmo is disabled. typically grey. */\r\n disableMaterial: StandardMaterial;\r\n}\r\n\r\n/**\r\n * Single plane rotation gizmo\r\n */\r\nexport class PlaneRotationGizmo extends Gizmo implements IPlaneRotationGizmo {\r\n /**\r\n * Drag behavior responsible for the gizmos dragging interactions\r\n */\r\n public dragBehavior: PointerDragBehavior;\r\n protected _pointerObserver: Nullable<Observer<PointerInfo>> = null;\r\n\r\n /**\r\n * Rotation distance in radians that the gizmo will snap to (Default: 0)\r\n */\r\n public snapDistance = 0;\r\n /**\r\n * Event that fires each time the gizmo snaps to a new location.\r\n * * snapDistance is the change in distance\r\n */\r\n public onSnapObservable = new Observable<{ snapDistance: number }>();\r\n\r\n /**\r\n * The maximum angle between the camera and the rotation allowed for interaction\r\n * If a rotation plane appears 'flat', a lower value allows interaction.\r\n */\r\n public static MaxDragAngle: number = (Math.PI * 9) / 20;\r\n\r\n /**\r\n * Accumulated relative angle value for rotation on the axis. Reset to 0 when a dragStart occurs\r\n */\r\n public angle: number = 0;\r\n\r\n /**\r\n * Custom sensitivity value for the drag strength\r\n */\r\n public sensitivity = 1;\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._hoverMaterial;\r\n }\r\n\r\n /** Color used to render the drag angle sector when gizmo is rotated with mouse */\r\n public set rotationColor(color: Color3) {\r\n this._rotationShaderMaterial.setColor3(\"rotationColor\", color);\r\n }\r\n\r\n /** Material used to render when gizmo is disabled. typically grey. */\r\n public get disableMaterial() {\r\n return this._disableMaterial;\r\n }\r\n\r\n protected _isEnabled: boolean = true;\r\n protected _parent: Nullable<RotationGizmo> = null;\r\n protected _coloredMaterial: StandardMaterial;\r\n protected _hoverMaterial: StandardMaterial;\r\n protected _disableMaterial: StandardMaterial;\r\n protected _gizmoMesh: Mesh;\r\n protected _rotationDisplayPlane: Mesh;\r\n protected _dragging: boolean = false;\r\n protected _angles = new Vector3();\r\n\r\n protected static _RotationGizmoVertexShader = `\r\n precision highp float;\r\n attribute vec3 position;\r\n attribute vec2 uv;\r\n uniform mat4 worldViewProjection;\r\n varying vec3 vPosition;\r\n varying vec2 vUV;\r\n\r\n void main(void) {\r\n gl_Position = worldViewProjection * vec4(position, 1.0);\r\n vUV = uv;\r\n }`;\r\n\r\n protected static _RotationGizmoFragmentShader = `\r\n precision highp float;\r\n varying vec2 vUV;\r\n varying vec3 vPosition;\r\n uniform vec3 angles;\r\n uniform vec3 rotationColor;\r\n\r\n #define twopi 6.283185307\r\n\r\n void main(void) {\r\n vec2 uv = vUV - vec2(0.5);\r\n float angle = atan(uv.y, uv.x) + 3.141592;\r\n float delta = gl_FrontFacing ? angles.y : -angles.y;\r\n float begin = angles.x - delta * angles.z;\r\n float start = (begin < (begin + delta)) ? begin : (begin + delta);\r\n float end = (begin > (begin + delta)) ? begin : (begin + delta);\r\n float len = sqrt(dot(uv,uv));\r\n float opacity = 1. - step(0.5, len);\r\n\r\n float base = abs(floor(start / twopi)) * twopi;\r\n start += base;\r\n end += base;\r\n\r\n float intensity = 0.;\r\n for (int i = 0; i < 5; i++)\r\n {\r\n intensity += max(step(start, angle) - step(end, angle), 0.);\r\n angle += twopi;\r\n }\r\n gl_FragColor = vec4(rotationColor, min(intensity * 0.25, 0.8)) * opacity;\r\n }\r\n `;\r\n\r\n protected _rotationShaderMaterial: ShaderMaterial;\r\n\r\n /**\r\n * Creates a PlaneRotationGizmo\r\n * @param planeNormal The normal of the plane which the gizmo will be able to rotate on\r\n * @param color The color of the gizmo\r\n * @param gizmoLayer The utility layer the gizmo will be added to\r\n * @param tessellation Amount of tessellation to be used when creating rotation circles\r\n * @param parent\r\n * @param useEulerRotation Use and update Euler angle instead of quaternion\r\n * @param thickness display gizmo axis thickness\r\n * @param hoverColor The color of the gizmo when hovering over and dragging\r\n * @param disableColor The Color of the gizmo when its disabled\r\n */\r\n constructor(\r\n planeNormal: Vector3,\r\n color: Color3 = Color3.Gray(),\r\n gizmoLayer: UtilityLayerRenderer = UtilityLayerRenderer.DefaultUtilityLayer,\r\n tessellation = 32,\r\n parent: Nullable<RotationGizmo> = null,\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n useEulerRotation = false,\r\n thickness: number = 1,\r\n hoverColor: Color3 = Color3.Yellow(),\r\n disableColor: Color3 = Color3.Gray()\r\n ) {\r\n super(gizmoLayer);\r\n this._parent = parent;\r\n // Create Material\r\n this._coloredMaterial = new StandardMaterial(\"\", gizmoLayer.utilityLayerScene);\r\n this._coloredMaterial.diffuseColor = color;\r\n this._coloredMaterial.specularColor = color.subtract(new Color3(0.1, 0.1, 0.1));\r\n\r\n this._hoverMaterial = new StandardMaterial(\"\", gizmoLayer.utilityLayerScene);\r\n this._hoverMaterial.diffuseColor = hoverColor;\r\n this._hoverMaterial.specularColor = hoverColor;\r\n\r\n this._disableMaterial = new StandardMaterial(\"\", gizmoLayer.utilityLayerScene);\r\n this._disableMaterial.diffuseColor = disableColor;\r\n this._disableMaterial.alpha = 0.4;\r\n\r\n // Build mesh on root node\r\n this._gizmoMesh = new Mesh(\"\", gizmoLayer.utilityLayerScene);\r\n const { rotationMesh, collider } = this._createGizmoMesh(this._gizmoMesh, thickness, tessellation);\r\n\r\n // Setup Rotation Circle\r\n this._rotationDisplayPlane = CreatePlane(\r\n \"rotationDisplay\",\r\n {\r\n size: 0.6,\r\n updatable: false,\r\n },\r\n this.gizmoLayer.utilityLayerScene\r\n );\r\n this._rotationDisplayPlane.rotation.z = Math.PI * 0.5;\r\n this._rotationDisplayPlane.parent = this._gizmoMesh;\r\n this._rotationDisplayPlane.setEnabled(false);\r\n\r\n Effect.ShadersStore[\"rotationGizmoVertexShader\"] = PlaneRotationGizmo._RotationGizmoVertexShader;\r\n Effect.ShadersStore[\"rotationGizmoFragmentShader\"] = PlaneRotationGizmo._RotationGizmoFragmentShader;\r\n this._rotationShaderMaterial = new ShaderMaterial(\r\n \"shader\",\r\n this.gizmoLayer.utilityLayerScene,\r\n {\r\n vertex: \"rotationGizmo\",\r\n fragment: \"rotationGizmo\",\r\n },\r\n {\r\n attributes: [\"position\", \"uv\"],\r\n uniforms: [\"worldViewProjection\", \"angles\", \"rotationColor\"],\r\n }\r\n );\r\n this._rotationShaderMaterial.backFaceCulling = false;\r\n this.rotationColor = hoverColor;\r\n\r\n this._rotationDisplayPlane.material = this._rotationShaderMaterial;\r\n this._rotationDisplayPlane.visibility = 0.999;\r\n\r\n this._gizmoMesh.lookAt(this._rootMesh.position.add(planeNormal));\r\n this._rootMesh.addChild(this._gizmoMesh, Gizmo.PreserveScaling);\r\n this._gizmoMesh.scaling.scaleInPlace(1 / 3);\r\n // Add drag behavior to handle events when the gizmo is dragged\r\n this.dragBehavior = new PointerDragBehavior({ dragPlaneNormal: planeNormal });\r\n this.dragBehavior.moveAttached = false;\r\n this.dragBehavior.maxDragAngle = PlaneRotationGizmo.MaxDragAngle;\r\n this.dragBehavior._useAlternatePickedPointAboveMaxDragAngle = true;\r\n this._rootMesh.addBehavior(this.dragBehavior);\r\n\r\n // Closures for drag logic\r\n const lastDragPosition = new Vector3();\r\n\r\n const rotationMatrix = new Matrix();\r\n const planeNormalTowardsCamera = new Vector3();\r\n let localPlaneNormalTowardsCamera = new Vector3();\r\n\r\n this.dragBehavior.onDragStartObservable.add((e) => {\r\n if (this.attachedNode) {\r\n if (this._additionalTransformNode) {\r\n this._additionalTransformNode.getWorldMatrix().invertToRef(TmpVectors.Matrix[0]);\r\n Vector3.TransformCoordinatesToRef(e.dragPlanePoint, TmpVectors.Matrix[0], e.dragPlanePoint);\r\n }\r\n lastDragPosition.copyFrom(e.dragPlanePoint);\r\n this._rotationDisplayPlane.setEnabled(true);\r\n\r\n this._rotationDisplayPlane.getWorldMatrix().invertToRef(rotationMatrix);\r\n Vector3.TransformCoordinatesToRef(e.dragPlanePoint, rotationMatrix, lastDragPosition);\r\n\r\n this._angles.x = Math.atan2(lastDragPosition.y, lastDragPosition.x) + Math.PI;\r\n this._angles.y = 0;\r\n this._angles.z = this.updateGizmoRotationToMatchAttachedMesh ? 1 : 0;\r\n this._dragging = true;\r\n lastDragPosition.copyFrom(e.dragPlanePoint);\r\n this._rotationShaderMaterial.setVector3(\"angles\", this._angles);\r\n this.angle = 0;\r\n // there is an issue with the rotation plane with additionalTransformNode, so we hide it in that case to avoid confusion\r\n this._rotationDisplayPlane.visibility = this._additionalTransformNode ? 0 : 0.999;\r\n }\r\n });\r\n\r\n this.dragBehavior.onDragEndObservable.add(() => {\r\n this._dragging = false;\r\n this._rotationDisplayPlane.setEnabled(false);\r\n });\r\n\r\n const tmpSnapEvent = { snapDistance: 0 };\r\n let currentSnapDragDistance = 0;\r\n const tmpMatrix = new Matrix();\r\n const amountToRotate = new Quaternion();\r\n this.dragBehavior.onDragObservable.add((event) => {\r\n if (this.attachedNode) {\r\n // Calc angle over full 360 degree (https://stackoverflow.com/questions/43493711/the-angle-between-two-3d-vectors-with-a-result-range-0-360)\r\n const nodeScale = new Vector3(1, 1, 1);\r\n const nodeQuaternion = new Quaternion(0, 0, 0, 1);\r\n const nodeTranslation = new Vector3(0, 0, 0);\r\n const attachedNodeTransform = this._attachedNode as TransformNode;\r\n // check there is an active pivot for the TransformNode attached\r\n if (attachedNodeTransform && attachedNodeTransform.isUsingPivotMatrix && attachedNodeTransform.isUsingPivotMatrix() && attachedNodeTransform.position) {\r\n // When a TransformNode has an active pivot, even without parenting,\r\n // translation from the world matrix is different from TransformNode.position.\r\n // Pivot works like a virtual parent that's using the node orientation.\r\n // As the world matrix is transformed by the gizmo and then decomposed to TRS\r\n // its translation part must be set to the Node's position.\r\n attachedNodeTransform.getWorldMatrix().setTranslation(attachedNodeTransform.position);\r\n }\r\n\r\n this.attachedNode.getWorldMatrix().decompose(nodeScale, nodeQuaternion, nodeTranslation);\r\n // uniform scaling of absolute value of components\r\n // (-1,1,1) is uniform but (1,1.001,1) is not\r\n const uniformScaling = Math.abs(Math.abs(nodeScale.x) - Math.abs(nodeScale.y)) <= Epsilon && Math.abs(Math.abs(nodeScale.x) - Math.abs(nodeScale.z)) <= Epsilon;\r\n if (!uniformScaling && this.updateGizmoRotationToMatchAttachedMesh) {\r\n Logger.Warn(\r\n \"Unable to use a rotation gizmo matching mesh rotation with non uniform scaling. Use uniform scaling or set updateGizmoRotationToMatchAttachedMesh to false.\"\r\n );\r\n return;\r\n }\r\n nodeQuaternion.normalize();\r\n\r\n const nodeTranslationForOperation = this.updateGizmoPositionToMatchAttachedMesh ? nodeTranslation : this._rootMesh.absolutePosition;\r\n if (this._additionalTransformNode) {\r\n this._additionalTransformNode.getWorldMatrix().invertToRef(TmpVectors.Matrix[0]);\r\n Vector3.TransformCoordinatesToRef(event.dragPlanePoint, TmpVectors.Matrix[0], event.dragPlanePoint);\r\n }\r\n const newVector = event.dragPlanePoint.subtract(nodeTranslationForOperation).normalize();\r\n const originalVector = lastDragPosition.subtract(nodeTranslationForOperation).normalize();\r\n const cross = Vector3.Cross(newVector, originalVector);\r\n const dot = Vector3.Dot(newVector, originalVector);\r\n let angle = Math.atan2(cross.length(), dot) * this.sensitivity;\r\n planeNormalTowardsCamera.copyFrom(planeNormal);\r\n localPlaneNormalTowardsCamera.copyFrom(planeNormal);\r\n if (this.updateGizmoRotationToMatchAttachedMesh) {\r\n nodeQuaternion.toRotationMatrix(rotationMatrix);\r\n localPlaneNormalTowardsCamera = Vector3.TransformCoordinates(planeNormalTowardsCamera, rotationMatrix);\r\n }\r\n // Flip up vector depending on which side the camera is on\r\n let cameraFlipped = false;\r\n if (gizmoLayer.utilityLayerScene.activeCamera) {\r\n const camVec = gizmoLayer.utilityLayerScene.activeCamera.position.subtract(nodeTranslationForOperation).normalize();\r\n if (Vector3.Dot(camVec, localPlaneNormalTowardsCamera) > 0) {\r\n planeNormalTowardsCamera.scaleInPlace(-1);\r\n localPlaneNormalTowardsCamera.scaleInPlace(-1);\r\n cameraFlipped = true;\r\n }\r\n }\r\n const halfCircleSide = Vector3.Dot(localPlaneNormalTowardsCamera, cross) > 0.0;\r\n if (halfCircleSide) {\r\n angle = -angle;\r\n }\r\n\r\n TmpVectors.Vector3[0].set(angle, 0, 0);\r\n if (!this.dragBehavior.validateDrag(TmpVectors.Vector3[0])) {\r\n angle = 0;\r\n }\r\n\r\n // Snapping logic\r\n let snapped = false;\r\n if (this.snapDistance != 0) {\r\n currentSnapDragDistance += angle;\r\n if (Math.abs(currentSnapDragDistance) > this.snapDistance) {\r\n let dragSteps = Math.floor(Math.abs(currentSnapDragDistance) / this.snapDistance);\r\n if (currentSnapDragDistance < 0) {\r\n dragSteps *= -1;\r\n }\r\n currentSnapDragDistance = currentSnapDragDistance % this.snapDistance;\r\n angle = this.snapDistance * dragSteps;\r\n snapped = true;\r\n } else {\r\n angle = 0;\r\n }\r\n }\r\n\r\n // Convert angle and axis to quaternion (http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm)\r\n const quaternionCoefficient = Math.sin(angle / 2);\r\n amountToRotate.set(\r\n planeNormalTowardsCamera.x * quaternionCoefficient,\r\n planeNormalTowardsCamera.y * quaternionCoefficient,\r\n planeNormalTowardsCamera.z * quaternionCoefficient,\r\n Math.cos(angle / 2)\r\n );\r\n\r\n // If the meshes local scale is inverted (eg. loaded gltf file parent with z scale of -1) the rotation needs to be inverted on the y axis\r\n if (tmpMatrix.determinant() > 0) {\r\n const tmpVector = new Vector3();\r\n amountToRotate.toEulerAnglesToRef(tmpVector);\r\n Quaternion.RotationYawPitchRollToRef(tmpVector.y, -tmpVector.x, -tmpVector.z, amountToRotate);\r\n }\r\n\r\n if (this.updateGizmoRotationToMatchAttachedMesh) {\r\n // Rotate selected mesh quaternion over fixed axis\r\n nodeQuaternion.multiplyToRef(amountToRotate, nodeQuaternion);\r\n nodeQuaternion.normalize();\r\n // recompose matrix\r\n Matrix.ComposeToRef(nodeScale, nodeQuaternion, nodeTranslation, this.attachedNode.getWorldMatrix());\r\n } else {\r\n // Rotate selected mesh quaternion over rotated axis\r\n amountToRotate.toRotationMatrix(TmpVectors.Matrix[0]);\r\n const translation = this.attachedNode.getWorldMatrix().getTranslation();\r\n this.attachedNode.getWorldMatrix().multiplyToRef(TmpVectors.Matrix[0], this.attachedNode.getWorldMatrix());\r\n this.attachedNode.getWorldMatrix().setTranslation(translation);\r\n }\r\n\r\n lastDragPosition.copyFrom(event.dragPlanePoint);\r\n if (snapped) {\r\n tmpSnapEvent.snapDistance = angle;\r\n this.onSnapObservable.notifyObservers(tmpSnapEvent);\r\n }\r\n this._angles.y += gizmoLayer.utilityLayerScene.useRightHandedSystem ? -angle : angle;\r\n this.angle += cameraFlipped ? -angle : angle;\r\n this._rotationShaderMaterial.setVector3(\"angles\", this._angles);\r\n this._matrixChanged();\r\n }\r\n });\r\n\r\n const light = gizmoLayer._getSharedGizmoLight();\r\n light.includedOnlyMeshes = light.includedOnlyMeshes.concat(this._rootMesh.getChildMeshes(false));\r\n\r\n const cache: GizmoAxisCache = {\r\n colliderMeshes: [collider],\r\n gizmoMeshes: [rotationMesh],\r\n material: this._coloredMaterial,\r\n hoverMaterial: this._hoverMaterial,\r\n disableMaterial: this._disableMaterial,\r\n active: false,\r\n dragBehavior: this.dragBehavior,\r\n };\r\n this._parent?.addToAxisCache(this._gizmoMesh, cache);\r\n\r\n this._pointerObserver = gizmoLayer.utilityLayerScene.onPointerObservable.add((pointerInfo) => {\r\n if (this._customMeshSet) {\r\n return;\r\n }\r\n // updating here the maxangle because ondragstart is too late (value already used) and the updated value is not taken into account\r\n this.dragBehavior.maxDragAngle = PlaneRotationGizmo.MaxDragAngle;\r\n this._isHovered = !!(cache.colliderMeshes.indexOf(<Mesh>pointerInfo?.pickInfo?.pickedMesh) != -1);\r\n if (!this._parent) {\r\n const material = cache.dragBehavior.enabled ? (this._isHovered || this._dragging ? this._hoverMaterial : this._coloredMaterial) : this._disableMaterial;\r\n this._setGizmoMeshMaterial(cache.gizmoMeshes, material);\r\n }\r\n });\r\n\r\n this.dragBehavior.onEnabledObservable.add((newState) => {\r\n this._setGizmoMeshMaterial(cache.gizmoMeshes, newState ? this._coloredMaterial : this._disableMaterial);\r\n });\r\n }\r\n\r\n /**\r\n * @internal\r\n * Create Geometry for Gizmo\r\n * @param parentMesh\r\n * @param thickness\r\n * @param tessellation\r\n * @returns\r\n */\r\n protected _createGizmoMesh(parentMesh: AbstractMesh, thickness: number, tessellation: number) {\r\n const collider = CreateTorus(\r\n \"ignore\",\r\n {\r\n diameter: 0.6,\r\n thickness: 0.03 * thickness,\r\n tessellation,\r\n },\r\n this.gizmoLayer.utilityLayerScene\r\n );\r\n collider.visibility = 0;\r\n const rotationMesh = CreateTorus(\r\n \"\",\r\n {\r\n diameter: 0.6,\r\n thickness: 0.005 * thickness,\r\n tessellation,\r\n },\r\n this.gizmoLayer.utilityLayerScene\r\n );\r\n rotationMesh.material = this._coloredMaterial;\r\n\r\n // Position arrow pointing in its drag axis\r\n rotationMesh.rotation.x = Math.PI / 2;\r\n collider.rotation.x = Math.PI / 2;\r\n\r\n parentMesh.addChild(rotationMesh, Gizmo.PreserveScaling);\r\n parentMesh.addChild(collider, Gizmo.PreserveScaling);\r\n return { rotationMesh, collider };\r\n }\r\n\r\n protected override _attachedNodeChanged(value: Nullable<Node>) {\r\n if (this.dragBehavior) {\r\n this.dragBehavior.enabled = value ? true : false;\r\n }\r\n }\r\n\r\n /**\r\n * If the gizmo is enabled\r\n */\r\n public set isEnabled(value: boolean) {\r\n this._isEnabled = value;\r\n if (!value) {\r\n this.attachedMesh = null;\r\n } else {\r\n if (this._parent) {\r\n this.attachedMesh = this._parent.attachedMesh;\r\n }\r\n }\r\n }\r\n\r\n public get isEnabled(): boolean {\r\n return this._isEnabled;\r\n }\r\n\r\n /**\r\n * Disposes of the gizmo\r\n */\r\n public override dispose() {\r\n this.onSnapObservable.clear();\r\n this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver);\r\n this.dragBehavior.detach();\r\n if (this._gizmoMesh) {\r\n this._gizmoMesh.dispose();\r\n }\r\n if (this._rotationDisplayPlane) {\r\n this._rotationDisplayPlane.dispose();\r\n }\r\n if (this._rotationShaderMaterial) {\r\n this._rotationShaderMaterial.dispose();\r\n }\r\n const materials = [this._coloredMaterial, this._hoverMaterial, this._disableMaterial];\r\n for (const matl of materials) {\r\n if (matl) {\r\n matl.dispose();\r\n }\r\n }\r\n super.dispose();\r\n }\r\n}\r\n"]}