@babylonjs/gui 7.3.1 → 7.3.3
Sign up to get free protection for your applications and to get access to all the features.
- package/2D/advancedDynamicTexture.js.map +1 -1
- package/2D/controls/button.js.map +1 -1
- package/2D/controls/checkbox.js.map +1 -1
- package/2D/controls/colorpicker.js.map +1 -1
- package/2D/controls/container.d.ts +2 -1
- package/2D/controls/container.js +4 -3
- package/2D/controls/container.js.map +1 -1
- package/2D/controls/control.d.ts +2 -1
- package/2D/controls/control.js +5 -2
- package/2D/controls/control.js.map +1 -1
- package/2D/controls/displayGrid.js.map +1 -1
- package/2D/controls/ellipse.js.map +1 -1
- package/2D/controls/focusableButton.js.map +1 -1
- package/2D/controls/gradient/LinearGradient.js.map +1 -1
- package/2D/controls/gradient/RadialGradient.js.map +1 -1
- package/2D/controls/grid.js.map +1 -1
- package/2D/controls/image.js.map +1 -1
- package/2D/controls/inputPassword.js.map +1 -1
- package/2D/controls/inputText.js.map +1 -1
- package/2D/controls/inputTextArea.js.map +1 -1
- package/2D/controls/line.js.map +1 -1
- package/2D/controls/multiLine.js.map +1 -1
- package/2D/controls/radioButton.js.map +1 -1
- package/2D/controls/rectangle.js.map +1 -1
- package/2D/controls/scrollViewers/scrollViewer.js.map +1 -1
- package/2D/controls/scrollViewers/scrollViewerWindow.js.map +1 -1
- package/2D/controls/selector.js.map +1 -1
- package/2D/controls/sliders/baseSlider.js.map +1 -1
- package/2D/controls/sliders/imageBasedSlider.js.map +1 -1
- package/2D/controls/sliders/imageScrollBar.js.map +1 -1
- package/2D/controls/sliders/scrollBar.js.map +1 -1
- package/2D/controls/sliders/slider.js.map +1 -1
- package/2D/controls/stackPanel.js.map +1 -1
- package/2D/controls/textBlock.js.map +1 -1
- package/2D/controls/toggleButton.js.map +1 -1
- package/2D/controls/virtualKeyboard.js.map +1 -1
- package/3D/controls/MRTK3/touchHolographicButton.js.map +1 -1
- package/3D/controls/abstractButton3D.js.map +1 -1
- package/3D/controls/button3D.js.map +1 -1
- package/3D/controls/container3D.js.map +1 -1
- package/3D/controls/handMenu.js.map +1 -1
- package/3D/controls/holographicBackplate.js.map +1 -1
- package/3D/controls/holographicButton.js.map +1 -1
- package/3D/controls/holographicSlate.js.map +1 -1
- package/3D/controls/meshButton3D.js.map +1 -1
- package/3D/controls/nearMenu.js.map +1 -1
- package/3D/controls/scatterPanel.js.map +1 -1
- package/3D/controls/slider3D.js.map +1 -1
- package/3D/controls/stackPanel3D.js.map +1 -1
- package/3D/controls/touchButton3D.js.map +1 -1
- package/3D/controls/touchHolographicButton.js.map +1 -1
- package/3D/controls/touchHolographicMenu.js.map +1 -1
- package/3D/controls/touchMeshButton3D.js.map +1 -1
- package/3D/controls/volumeBasedPanel.js.map +1 -1
- package/3D/gizmos/slateGizmo.js.map +1 -1
- package/3D/materials/fluent/fluentMaterial.js.map +1 -1
- package/3D/materials/fluentBackplate/fluentBackplateMaterial.js.map +1 -1
- package/3D/materials/fluentButton/fluentButtonMaterial.js.map +1 -1
- package/3D/materials/handle/handleMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlBackglowMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlBackplateMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlFrontplateMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlInnerquadMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlSliderBarMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlSliderThumbMaterial.js.map +1 -1
- package/package.json +2 -2
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"touchHolographicButton.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/touchHolographicButton.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,6CAA+B;AACjD,OAAO,EAAE,gBAAgB,EAAE,sDAAwC;AACnE,OAAO,EAAE,aAAa,EAAE,gDAAkC;AAC1D,OAAO,EAAE,IAAI,EAAE,uCAAyB;AACxC,OAAO,EAAE,WAAW,EAAE,wDAA0C;AAChE,OAAO,EAAE,SAAS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2C,AAAtD,CAAuD;AACnF;;GAEG;AACW,qCAAc,GAAW,wBAAwB,AAAnC,CAAoC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport { StandardMaterial } from \"core/Materials/standardMaterial\";\r\nimport { TransformNode } from \"core/Meshes/transformNode\";\r\nimport { Mesh } from \"core/Meshes/mesh\";\r\nimport { CreatePlane } from \"core/Meshes/Builders/planeBuilder\";\r\nimport { CreateBox } from \"core/Meshes/Builders/boxBuilder\";\r\nimport { FadeInOutBehavior } from \"core/Behaviors/Meshes/fadeInOutBehavior\";\r\nimport type { Scene } from \"core/scene\";\r\nimport { FluentMaterial } from \"../materials/fluent/fluentMaterial\";\r\nimport { FluentButtonMaterial } from \"../materials/fluentButton/fluentButtonMaterial\";\r\nimport { StackPanel } from \"../../2D/controls/stackPanel\";\r\nimport { Image } from \"../../2D/controls/image\";\r\nimport { TextBlock } from \"../../2D/controls/textBlock\";\r\nimport { AdvancedDynamicTexture } from \"../../2D/advancedDynamicTexture\";\r\nimport type { Control3D } from \"./control3D\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport { TouchButton3D } from \"./touchButton3D\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { SceneLoader } from \"core/Loading/sceneLoader\";\r\nimport { IsDocumentAvailable } from \"core/Misc/domManagement\";\r\nimport { Scalar } from \"core/Maths/math.scalar\";\r\n\r\n/**\r\n * Class used to create a holographic button in 3D\r\n * @since 5.0.0\r\n */\r\nexport class TouchHolographicButton extends TouchButton3D {\r\n /**\r\n * Base Url for the button model.\r\n */\r\n public static MODEL_BASE_URL: string = \"https://assets.babylonjs.com/meshes/MRTK/\";\r\n /**\r\n * File name for the button model.\r\n */\r\n public static MODEL_FILENAME: string = \"mrtk-fluent-button.glb\";\r\n\r\n private _backPlate: Mesh;\r\n private _textPlate: Mesh;\r\n private _frontPlate: AbstractMesh;\r\n private _text: string;\r\n private _imageUrl: string;\r\n private _shareMaterials = true;\r\n private _isBackplateVisible = true;\r\n private _frontMaterial: FluentButtonMaterial;\r\n private _backMaterial: FluentMaterial;\r\n private _plateMaterial: StandardMaterial;\r\n private _pickedPointObserver: Nullable<Observer<Nullable<Vector3>>>;\r\n private _pointerHoverObserver: Nullable<Observer<Vector3>>;\r\n private _frontPlateDepth = 0.5;\r\n private _backPlateDepth = 0.04;\r\n private _backplateColor = new Color3(0.08, 0.15, 0.55);\r\n private _backplateToggledColor = new Color3(0.25, 0.4, 0.95);\r\n\r\n // Tooltip\r\n private _tooltipFade: Nullable<FadeInOutBehavior>;\r\n private _tooltipTextBlock: Nullable<TextBlock>;\r\n private _tooltipTexture: Nullable<AdvancedDynamicTexture>;\r\n private _tooltipMesh: Nullable<Mesh>;\r\n private _tooltipHoverObserver: Nullable<Observer<Control3D>>;\r\n private _tooltipOutObserver: Nullable<Observer<Control3D>>;\r\n\r\n private _disposeTooltip() {\r\n this._tooltipFade = null;\r\n if (this._tooltipTextBlock) {\r\n this._tooltipTextBlock.dispose();\r\n }\r\n if (this._tooltipTexture) {\r\n this._tooltipTexture.dispose();\r\n }\r\n if (this._tooltipMesh) {\r\n this._tooltipMesh.dispose();\r\n }\r\n this.onPointerEnterObservable.remove(this._tooltipHoverObserver);\r\n this.onPointerOutObservable.remove(this._tooltipOutObserver);\r\n }\r\n\r\n /**\r\n * Rendering ground id of all the mesh in the button\r\n */\r\n public set renderingGroupId(id: number) {\r\n this._backPlate.renderingGroupId = id;\r\n this._textPlate.renderingGroupId = id;\r\n this._frontPlate.renderingGroupId = id;\r\n\r\n if (this._tooltipMesh) {\r\n this._tooltipMesh.renderingGroupId = id;\r\n }\r\n }\r\n public get renderingGroupId(): number {\r\n return this._backPlate.renderingGroupId;\r\n }\r\n\r\n /**\r\n * Gets the mesh used to render this control\r\n */\r\n public get mesh(): Nullable<AbstractMesh> {\r\n return this._backPlate as AbstractMesh;\r\n }\r\n\r\n /**\r\n * Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)\r\n */\r\n public set tooltipText(text: Nullable<string>) {\r\n if (!text) {\r\n this._disposeTooltip();\r\n return;\r\n }\r\n if (!this._tooltipFade) {\r\n const rightHandedScene = this._backPlate._scene.useRightHandedSystem;\r\n // Create tooltip with mesh and text\r\n this._tooltipMesh = CreatePlane(\"\", { size: 1 }, this._backPlate._scene);\r\n const tooltipBackground = CreatePlane(\"\", { size: 1, sideOrientation: Mesh.DOUBLESIDE }, this._backPlate._scene);\r\n const mat = new StandardMaterial(\"\", this._backPlate._scene);\r\n mat.diffuseColor = Color3.FromHexString(\"#212121\");\r\n tooltipBackground.material = mat;\r\n tooltipBackground.isPickable = false;\r\n this._tooltipMesh.addChild(tooltipBackground);\r\n tooltipBackground.position = Vector3.Forward(rightHandedScene).scale(0.05);\r\n this._tooltipMesh.scaling.y = 1 / 3;\r\n this._tooltipMesh.position = Vector3.Up().scale(0.7).add(Vector3.Forward(rightHandedScene).scale(-0.15));\r\n this._tooltipMesh.isPickable = false;\r\n this._tooltipMesh.parent = this._backPlate;\r\n\r\n // Create text texture for the tooltip\r\n this._tooltipTexture = AdvancedDynamicTexture.CreateForMesh(this._tooltipMesh);\r\n this._tooltipTextBlock = new TextBlock();\r\n this._tooltipTextBlock.scaleY = 3;\r\n this._tooltipTextBlock.color = \"white\";\r\n this._tooltipTextBlock.fontSize = 130;\r\n this._tooltipTexture.addControl(this._tooltipTextBlock);\r\n\r\n // Add hover action to tooltip\r\n this._tooltipFade = new FadeInOutBehavior();\r\n this._tooltipFade.delay = 500;\r\n this._tooltipMesh.addBehavior(this._tooltipFade);\r\n this._tooltipHoverObserver = this.onPointerEnterObservable.add(() => {\r\n if (this._tooltipFade) {\r\n this._tooltipFade.fadeIn(true);\r\n }\r\n });\r\n this._tooltipOutObserver = this.onPointerOutObservable.add(() => {\r\n if (this._tooltipFade) {\r\n this._tooltipFade.fadeIn(false);\r\n }\r\n });\r\n }\r\n if (this._tooltipTextBlock) {\r\n this._tooltipTextBlock.text = text;\r\n }\r\n }\r\n\r\n public get tooltipText() {\r\n if (this._tooltipTextBlock) {\r\n return this._tooltipTextBlock.text;\r\n }\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets or sets text for the button\r\n */\r\n public get text(): string {\r\n return this._text;\r\n }\r\n\r\n public set text(value: string) {\r\n if (this._text === value) {\r\n return;\r\n }\r\n\r\n this._text = value;\r\n this._rebuildContent();\r\n }\r\n\r\n /**\r\n * Gets or sets the image url for the button\r\n */\r\n public get imageUrl(): string {\r\n return this._imageUrl;\r\n }\r\n\r\n public set imageUrl(value: string) {\r\n if (this._imageUrl === value) {\r\n return;\r\n }\r\n\r\n this._imageUrl = value;\r\n this._rebuildContent();\r\n }\r\n\r\n /**\r\n * Gets the back material used by this button\r\n */\r\n public get backMaterial(): FluentMaterial {\r\n return this._backMaterial;\r\n }\r\n\r\n /**\r\n * Gets the front material used by this button\r\n */\r\n public get frontMaterial(): FluentButtonMaterial {\r\n return this._frontMaterial;\r\n }\r\n\r\n /**\r\n * Gets the plate material used by this button\r\n */\r\n public get plateMaterial(): StandardMaterial {\r\n return this._plateMaterial;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this button shares its material with other HolographicButtons\r\n */\r\n public get shareMaterials(): boolean {\r\n return this._shareMaterials;\r\n }\r\n\r\n /**\r\n * Sets whether the backplate is visible or hidden. Hiding the backplate is not recommended without some sort of replacement\r\n */\r\n public set isBackplateVisible(isVisible: boolean) {\r\n if (this.mesh && !!this._backMaterial) {\r\n if (isVisible && !this._isBackplateVisible) {\r\n this._backPlate.visibility = 1;\r\n } else if (!isVisible && this._isBackplateVisible) {\r\n this._backPlate.visibility = 0;\r\n }\r\n }\r\n\r\n this._isBackplateVisible = isVisible;\r\n }\r\n\r\n /**\r\n * Creates a new button\r\n * @param name defines the control name\r\n * @param shareMaterials\r\n */\r\n constructor(name?: string, shareMaterials = true) {\r\n super(name);\r\n\r\n this._shareMaterials = shareMaterials;\r\n\r\n this.pointerEnterAnimation = () => {\r\n this._frontMaterial.leftBlobEnable = true;\r\n this._frontMaterial.rightBlobEnable = true;\r\n };\r\n\r\n this.pointerOutAnimation = () => {\r\n this._frontMaterial.leftBlobEnable = false;\r\n this._frontMaterial.rightBlobEnable = false;\r\n };\r\n\r\n this.pointerDownAnimation = () => {\r\n if (this._frontPlate && !this.isActiveNearInteraction) {\r\n this._frontPlate.scaling.z = this._frontPlateDepth * 0.2;\r\n this._frontPlate.position = Vector3.Forward(this._frontPlate._scene.useRightHandedSystem).scale((this._frontPlateDepth - 0.2 * this._frontPlateDepth) / 2);\r\n this._textPlate.position = Vector3.Forward(this._textPlate._scene.useRightHandedSystem).scale(-(this._backPlateDepth + 0.2 * this._frontPlateDepth) / 2);\r\n }\r\n };\r\n this.pointerUpAnimation = () => {\r\n if (this._frontPlate) {\r\n this._frontPlate.scaling.z = this._frontPlateDepth;\r\n this._frontPlate.position = Vector3.Forward(this._frontPlate._scene.useRightHandedSystem).scale((this._frontPlateDepth - this._frontPlateDepth) / 2);\r\n this._textPlate.position = Vector3.Forward(this._textPlate._scene.useRightHandedSystem).scale(-(this._backPlateDepth + this._frontPlateDepth) / 2);\r\n }\r\n };\r\n\r\n this.onPointerMoveObservable.add((position) => {\r\n if (this._frontPlate && this.isActiveNearInteraction) {\r\n const scale = Vector3.Zero();\r\n if (this._backPlate.getWorldMatrix().decompose(scale, undefined, undefined)) {\r\n let interactionHeight = this._getInteractionHeight(position, this._backPlate.getAbsolutePosition()) / scale.z;\r\n interactionHeight = Scalar.Clamp(interactionHeight - this._backPlateDepth / 2, 0.2 * this._frontPlateDepth, this._frontPlateDepth);\r\n\r\n this._frontPlate.scaling.z = interactionHeight;\r\n this._frontPlate.position = Vector3.Forward(this._frontPlate._scene.useRightHandedSystem).scale((this._frontPlateDepth - interactionHeight) / 2);\r\n this._textPlate.position = Vector3.Forward(this._textPlate._scene.useRightHandedSystem).scale(-(this._backPlateDepth + interactionHeight) / 2);\r\n }\r\n }\r\n });\r\n\r\n this._pointerHoverObserver = this.onPointerMoveObservable.add((hoverPosition: Vector3) => {\r\n this._frontMaterial.globalLeftIndexTipPosition = hoverPosition;\r\n });\r\n }\r\n\r\n protected _getTypeName(): string {\r\n return \"TouchHolographicButton\";\r\n }\r\n\r\n private _rebuildContent(): void {\r\n this._disposeFacadeTexture();\r\n\r\n const panel = new StackPanel();\r\n panel.isVertical = true;\r\n\r\n if (IsDocumentAvailable() && !!document.createElement) {\r\n if (this._imageUrl) {\r\n const image = new Image();\r\n image.source = this._imageUrl;\r\n image.paddingTop = \"40px\";\r\n image.height = \"180px\";\r\n image.width = \"100px\";\r\n image.paddingBottom = \"40px\";\r\n panel.addControl(image);\r\n }\r\n }\r\n\r\n if (this._text) {\r\n const text = new TextBlock();\r\n text.text = this._text;\r\n text.color = \"white\";\r\n text.height = \"30px\";\r\n text.fontSize = 24;\r\n panel.addControl(text);\r\n }\r\n\r\n this.content = panel;\r\n }\r\n\r\n // Mesh association\r\n protected _createNode(scene: Scene): TransformNode {\r\n this.name = this.name ?? \"TouchHolographicButton\";\r\n const collisionMesh = CreateBox(\r\n `${this.name}_collisionMesh`,\r\n {\r\n width: 1.0,\r\n height: 1.0,\r\n depth: this._frontPlateDepth,\r\n },\r\n scene\r\n );\r\n collisionMesh.isPickable = true;\r\n collisionMesh.isNearPickable = true;\r\n collisionMesh.visibility = 0;\r\n collisionMesh.position = Vector3.Forward(scene.useRightHandedSystem).scale(-this._frontPlateDepth / 2);\r\n\r\n SceneLoader.ImportMeshAsync(undefined, TouchHolographicButton.MODEL_BASE_URL, TouchHolographicButton.MODEL_FILENAME, scene).then((result) => {\r\n const alphaMesh = CreateBox(\r\n \"${this.name}_alphaMesh\",\r\n {\r\n width: 1.0,\r\n height: 1.0,\r\n depth: 1.0,\r\n },\r\n scene\r\n );\r\n alphaMesh.isPickable = false;\r\n alphaMesh.material = new StandardMaterial(\"${this.name}_alphaMesh_material\", scene);\r\n alphaMesh.material.alpha = 0.15;\r\n\r\n const importedFrontPlate = result.meshes[1];\r\n importedFrontPlate.name = `${this.name}_frontPlate`;\r\n importedFrontPlate.isPickable = false;\r\n importedFrontPlate.scaling.z = this._frontPlateDepth;\r\n alphaMesh.parent = importedFrontPlate;\r\n importedFrontPlate.parent = collisionMesh;\r\n if (this._frontMaterial) {\r\n importedFrontPlate.material = this._frontMaterial;\r\n }\r\n this._frontPlate = importedFrontPlate;\r\n });\r\n\r\n this._backPlate = CreateBox(\r\n `${this.name}_backPlate`,\r\n {\r\n width: 1.0,\r\n height: 1.0,\r\n depth: this._backPlateDepth,\r\n },\r\n scene\r\n );\r\n\r\n this._backPlate.position = Vector3.Forward(scene.useRightHandedSystem).scale(this._backPlateDepth / 2);\r\n this._backPlate.isPickable = false;\r\n\r\n this._textPlate = <Mesh>super._createNode(scene);\r\n this._textPlate.name = `${this.name}_textPlate`;\r\n this._textPlate.isPickable = false;\r\n this._textPlate.position = Vector3.Forward(scene.useRightHandedSystem).scale(-this._frontPlateDepth / 2);\r\n\r\n this._backPlate.addChild(collisionMesh);\r\n this._backPlate.addChild(this._textPlate);\r\n\r\n const tn = new TransformNode(`{this.name}_root`, scene);\r\n this._backPlate.setParent(tn);\r\n\r\n this.collisionMesh = collisionMesh;\r\n this.collidableFrontDirection = this._backPlate.forward.negate(); // Mesh is facing the wrong way\r\n\r\n return tn;\r\n }\r\n\r\n protected _applyFacade(facadeTexture: AdvancedDynamicTexture) {\r\n this._plateMaterial.emissiveTexture = facadeTexture;\r\n this._plateMaterial.opacityTexture = facadeTexture;\r\n this._plateMaterial.diffuseColor = new Color3(0.4, 0.4, 0.4);\r\n }\r\n\r\n private _createBackMaterial(mesh: Mesh) {\r\n this._backMaterial = new FluentMaterial(this.name + \"backPlateMaterial\", mesh.getScene());\r\n this._backMaterial.albedoColor = this._backplateColor;\r\n this._backMaterial.renderBorders = true;\r\n this._backMaterial.renderHoverLight = false;\r\n }\r\n\r\n private _createFrontMaterial(mesh: Mesh) {\r\n this._frontMaterial = new FluentButtonMaterial(this.name + \"Front Material\", mesh.getScene());\r\n }\r\n\r\n private _createPlateMaterial(mesh: Mesh) {\r\n this._plateMaterial = new StandardMaterial(this.name + \"Plate Material\", mesh.getScene());\r\n this._plateMaterial.specularColor = Color3.Black();\r\n }\r\n\r\n protected _onToggle(newState: boolean) {\r\n if (this._backMaterial) {\r\n if (newState) {\r\n this._backMaterial.albedoColor = this._backplateToggledColor;\r\n } else {\r\n this._backMaterial.albedoColor = this._backplateColor;\r\n }\r\n }\r\n\r\n super._onToggle(newState);\r\n }\r\n\r\n protected _affectMaterial(mesh: Mesh) {\r\n if (this._shareMaterials) {\r\n // Back\r\n if (!this._host._touchSharedMaterials[\"backFluentMaterial\"]) {\r\n this._createBackMaterial(mesh);\r\n this._host._touchSharedMaterials[\"backFluentMaterial\"] = this._backMaterial;\r\n } else {\r\n this._backMaterial = this._host._touchSharedMaterials[\"backFluentMaterial\"] as FluentMaterial;\r\n }\r\n\r\n // Front\r\n if (!this._host._touchSharedMaterials[\"frontFluentMaterial\"]) {\r\n this._createFrontMaterial(mesh);\r\n this._host._touchSharedMaterials[\"frontFluentMaterial\"] = this._frontMaterial;\r\n } else {\r\n this._frontMaterial = this._host._touchSharedMaterials[\"frontFluentMaterial\"] as FluentButtonMaterial;\r\n }\r\n } else {\r\n this._createBackMaterial(mesh);\r\n this._createFrontMaterial(mesh);\r\n }\r\n\r\n this._createPlateMaterial(mesh);\r\n this._backPlate.material = this._backMaterial;\r\n this._textPlate.material = this._plateMaterial;\r\n\r\n if (!this._isBackplateVisible) {\r\n this._backPlate.visibility = 0;\r\n }\r\n if (this._frontPlate) {\r\n this._frontPlate.material = this._frontMaterial;\r\n }\r\n\r\n this._rebuildContent();\r\n }\r\n\r\n /**\r\n * Releases all associated resources\r\n */\r\n public dispose() {\r\n super.dispose(); // will dispose main mesh ie. back plate\r\n\r\n this._disposeTooltip();\r\n this.onPointerMoveObservable.remove(this._pointerHoverObserver);\r\n\r\n if (!this.shareMaterials) {\r\n this._backMaterial.dispose();\r\n this._frontMaterial.dispose();\r\n this._plateMaterial.dispose();\r\n\r\n if (this._pickedPointObserver) {\r\n this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver);\r\n this._pickedPointObserver = null;\r\n }\r\n }\r\n }\r\n}\r\n"]}
|
1
|
+
{"version":3,"file":"touchHolographicButton.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/touchHolographicButton.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,6CAA+B;AACjD,OAAO,EAAE,gBAAgB,EAAE,sDAAwC;AACnE,OAAO,EAAE,aAAa,EAAE,gDAAkC;AAC1D,OAAO,EAAE,IAAI,EAAE,uCAAyB;AACxC,OAAO,EAAE,WAAW,EAAE,wDAA0C;AAChE,OAAO,EAAE,SAAS,EAAE,sDAAwC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,8DAAgD;AAE5E,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC;AACtF,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAEzE,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,+CAAiC;AACvD,OAAO,EAAE,mBAAmB,EAAE,8CAAgC;AAC9D,OAAO,EAAE,MAAM,EAAE,6CAA+B;AAEhD;;;GAGG;AACH,MAAM,OAAO,sBAAuB,SAAQ,aAAa;IAmC7C,eAAe;QACnB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QACzB,IAAI,IAAI,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,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,IAAI,CAAC,uBAAuB,CAAC,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QAEhE,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;YACtB,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC;YAC7B,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;YAC9B,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;YAE9B,IAAI,IAAI,CAAC,oBAAoB,EAAE;gBAC3B,IAAI,CAAC,KAAK,CAAC,8BAA8B,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;gBAC5E,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;aACpC;SACJ;IACL,CAAC;;AAxcD;;GAEG;AACW,qCAAc,GAAW,2CAA2C,AAAtD,CAAuD;AACnF;;GAEG;AACW,qCAAc,GAAW,wBAAwB,AAAnC,CAAoC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport { StandardMaterial } from \"core/Materials/standardMaterial\";\r\nimport { TransformNode } from \"core/Meshes/transformNode\";\r\nimport { Mesh } from \"core/Meshes/mesh\";\r\nimport { CreatePlane } from \"core/Meshes/Builders/planeBuilder\";\r\nimport { CreateBox } from \"core/Meshes/Builders/boxBuilder\";\r\nimport { FadeInOutBehavior } from \"core/Behaviors/Meshes/fadeInOutBehavior\";\r\nimport type { Scene } from \"core/scene\";\r\nimport { FluentMaterial } from \"../materials/fluent/fluentMaterial\";\r\nimport { FluentButtonMaterial } from \"../materials/fluentButton/fluentButtonMaterial\";\r\nimport { StackPanel } from \"../../2D/controls/stackPanel\";\r\nimport { Image } from \"../../2D/controls/image\";\r\nimport { TextBlock } from \"../../2D/controls/textBlock\";\r\nimport { AdvancedDynamicTexture } from \"../../2D/advancedDynamicTexture\";\r\nimport type { Control3D } from \"./control3D\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport { TouchButton3D } from \"./touchButton3D\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { SceneLoader } from \"core/Loading/sceneLoader\";\r\nimport { IsDocumentAvailable } from \"core/Misc/domManagement\";\r\nimport { Scalar } from \"core/Maths/math.scalar\";\r\n\r\n/**\r\n * Class used to create a holographic button in 3D\r\n * @since 5.0.0\r\n */\r\nexport class TouchHolographicButton extends TouchButton3D {\r\n /**\r\n * Base Url for the button model.\r\n */\r\n public static MODEL_BASE_URL: string = \"https://assets.babylonjs.com/meshes/MRTK/\";\r\n /**\r\n * File name for the button model.\r\n */\r\n public static MODEL_FILENAME: string = \"mrtk-fluent-button.glb\";\r\n\r\n private _backPlate: Mesh;\r\n private _textPlate: Mesh;\r\n private _frontPlate: AbstractMesh;\r\n private _text: string;\r\n private _imageUrl: string;\r\n private _shareMaterials = true;\r\n private _isBackplateVisible = true;\r\n private _frontMaterial: FluentButtonMaterial;\r\n private _backMaterial: FluentMaterial;\r\n private _plateMaterial: StandardMaterial;\r\n private _pickedPointObserver: Nullable<Observer<Nullable<Vector3>>>;\r\n private _pointerHoverObserver: Nullable<Observer<Vector3>>;\r\n private _frontPlateDepth = 0.5;\r\n private _backPlateDepth = 0.04;\r\n private _backplateColor = new Color3(0.08, 0.15, 0.55);\r\n private _backplateToggledColor = new Color3(0.25, 0.4, 0.95);\r\n\r\n // Tooltip\r\n private _tooltipFade: Nullable<FadeInOutBehavior>;\r\n private _tooltipTextBlock: Nullable<TextBlock>;\r\n private _tooltipTexture: Nullable<AdvancedDynamicTexture>;\r\n private _tooltipMesh: Nullable<Mesh>;\r\n private _tooltipHoverObserver: Nullable<Observer<Control3D>>;\r\n private _tooltipOutObserver: Nullable<Observer<Control3D>>;\r\n\r\n private _disposeTooltip() {\r\n this._tooltipFade = null;\r\n if (this._tooltipTextBlock) {\r\n this._tooltipTextBlock.dispose();\r\n }\r\n if (this._tooltipTexture) {\r\n this._tooltipTexture.dispose();\r\n }\r\n if (this._tooltipMesh) {\r\n this._tooltipMesh.dispose();\r\n }\r\n this.onPointerEnterObservable.remove(this._tooltipHoverObserver);\r\n this.onPointerOutObservable.remove(this._tooltipOutObserver);\r\n }\r\n\r\n /**\r\n * Rendering ground id of all the mesh in the button\r\n */\r\n public set renderingGroupId(id: number) {\r\n this._backPlate.renderingGroupId = id;\r\n this._textPlate.renderingGroupId = id;\r\n this._frontPlate.renderingGroupId = id;\r\n\r\n if (this._tooltipMesh) {\r\n this._tooltipMesh.renderingGroupId = id;\r\n }\r\n }\r\n public get renderingGroupId(): number {\r\n return this._backPlate.renderingGroupId;\r\n }\r\n\r\n /**\r\n * Gets the mesh used to render this control\r\n */\r\n public override get mesh(): Nullable<AbstractMesh> {\r\n return this._backPlate as AbstractMesh;\r\n }\r\n\r\n /**\r\n * Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)\r\n */\r\n public set tooltipText(text: Nullable<string>) {\r\n if (!text) {\r\n this._disposeTooltip();\r\n return;\r\n }\r\n if (!this._tooltipFade) {\r\n const rightHandedScene = this._backPlate._scene.useRightHandedSystem;\r\n // Create tooltip with mesh and text\r\n this._tooltipMesh = CreatePlane(\"\", { size: 1 }, this._backPlate._scene);\r\n const tooltipBackground = CreatePlane(\"\", { size: 1, sideOrientation: Mesh.DOUBLESIDE }, this._backPlate._scene);\r\n const mat = new StandardMaterial(\"\", this._backPlate._scene);\r\n mat.diffuseColor = Color3.FromHexString(\"#212121\");\r\n tooltipBackground.material = mat;\r\n tooltipBackground.isPickable = false;\r\n this._tooltipMesh.addChild(tooltipBackground);\r\n tooltipBackground.position = Vector3.Forward(rightHandedScene).scale(0.05);\r\n this._tooltipMesh.scaling.y = 1 / 3;\r\n this._tooltipMesh.position = Vector3.Up().scale(0.7).add(Vector3.Forward(rightHandedScene).scale(-0.15));\r\n this._tooltipMesh.isPickable = false;\r\n this._tooltipMesh.parent = this._backPlate;\r\n\r\n // Create text texture for the tooltip\r\n this._tooltipTexture = AdvancedDynamicTexture.CreateForMesh(this._tooltipMesh);\r\n this._tooltipTextBlock = new TextBlock();\r\n this._tooltipTextBlock.scaleY = 3;\r\n this._tooltipTextBlock.color = \"white\";\r\n this._tooltipTextBlock.fontSize = 130;\r\n this._tooltipTexture.addControl(this._tooltipTextBlock);\r\n\r\n // Add hover action to tooltip\r\n this._tooltipFade = new FadeInOutBehavior();\r\n this._tooltipFade.delay = 500;\r\n this._tooltipMesh.addBehavior(this._tooltipFade);\r\n this._tooltipHoverObserver = this.onPointerEnterObservable.add(() => {\r\n if (this._tooltipFade) {\r\n this._tooltipFade.fadeIn(true);\r\n }\r\n });\r\n this._tooltipOutObserver = this.onPointerOutObservable.add(() => {\r\n if (this._tooltipFade) {\r\n this._tooltipFade.fadeIn(false);\r\n }\r\n });\r\n }\r\n if (this._tooltipTextBlock) {\r\n this._tooltipTextBlock.text = text;\r\n }\r\n }\r\n\r\n public get tooltipText() {\r\n if (this._tooltipTextBlock) {\r\n return this._tooltipTextBlock.text;\r\n }\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets or sets text for the button\r\n */\r\n public get text(): string {\r\n return this._text;\r\n }\r\n\r\n public set text(value: string) {\r\n if (this._text === value) {\r\n return;\r\n }\r\n\r\n this._text = value;\r\n this._rebuildContent();\r\n }\r\n\r\n /**\r\n * Gets or sets the image url for the button\r\n */\r\n public get imageUrl(): string {\r\n return this._imageUrl;\r\n }\r\n\r\n public set imageUrl(value: string) {\r\n if (this._imageUrl === value) {\r\n return;\r\n }\r\n\r\n this._imageUrl = value;\r\n this._rebuildContent();\r\n }\r\n\r\n /**\r\n * Gets the back material used by this button\r\n */\r\n public get backMaterial(): FluentMaterial {\r\n return this._backMaterial;\r\n }\r\n\r\n /**\r\n * Gets the front material used by this button\r\n */\r\n public get frontMaterial(): FluentButtonMaterial {\r\n return this._frontMaterial;\r\n }\r\n\r\n /**\r\n * Gets the plate material used by this button\r\n */\r\n public get plateMaterial(): StandardMaterial {\r\n return this._plateMaterial;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this button shares its material with other HolographicButtons\r\n */\r\n public get shareMaterials(): boolean {\r\n return this._shareMaterials;\r\n }\r\n\r\n /**\r\n * Sets whether the backplate is visible or hidden. Hiding the backplate is not recommended without some sort of replacement\r\n */\r\n public set isBackplateVisible(isVisible: boolean) {\r\n if (this.mesh && !!this._backMaterial) {\r\n if (isVisible && !this._isBackplateVisible) {\r\n this._backPlate.visibility = 1;\r\n } else if (!isVisible && this._isBackplateVisible) {\r\n this._backPlate.visibility = 0;\r\n }\r\n }\r\n\r\n this._isBackplateVisible = isVisible;\r\n }\r\n\r\n /**\r\n * Creates a new button\r\n * @param name defines the control name\r\n * @param shareMaterials\r\n */\r\n constructor(name?: string, shareMaterials = true) {\r\n super(name);\r\n\r\n this._shareMaterials = shareMaterials;\r\n\r\n this.pointerEnterAnimation = () => {\r\n this._frontMaterial.leftBlobEnable = true;\r\n this._frontMaterial.rightBlobEnable = true;\r\n };\r\n\r\n this.pointerOutAnimation = () => {\r\n this._frontMaterial.leftBlobEnable = false;\r\n this._frontMaterial.rightBlobEnable = false;\r\n };\r\n\r\n this.pointerDownAnimation = () => {\r\n if (this._frontPlate && !this.isActiveNearInteraction) {\r\n this._frontPlate.scaling.z = this._frontPlateDepth * 0.2;\r\n this._frontPlate.position = Vector3.Forward(this._frontPlate._scene.useRightHandedSystem).scale((this._frontPlateDepth - 0.2 * this._frontPlateDepth) / 2);\r\n this._textPlate.position = Vector3.Forward(this._textPlate._scene.useRightHandedSystem).scale(-(this._backPlateDepth + 0.2 * this._frontPlateDepth) / 2);\r\n }\r\n };\r\n this.pointerUpAnimation = () => {\r\n if (this._frontPlate) {\r\n this._frontPlate.scaling.z = this._frontPlateDepth;\r\n this._frontPlate.position = Vector3.Forward(this._frontPlate._scene.useRightHandedSystem).scale((this._frontPlateDepth - this._frontPlateDepth) / 2);\r\n this._textPlate.position = Vector3.Forward(this._textPlate._scene.useRightHandedSystem).scale(-(this._backPlateDepth + this._frontPlateDepth) / 2);\r\n }\r\n };\r\n\r\n this.onPointerMoveObservable.add((position) => {\r\n if (this._frontPlate && this.isActiveNearInteraction) {\r\n const scale = Vector3.Zero();\r\n if (this._backPlate.getWorldMatrix().decompose(scale, undefined, undefined)) {\r\n let interactionHeight = this._getInteractionHeight(position, this._backPlate.getAbsolutePosition()) / scale.z;\r\n interactionHeight = Scalar.Clamp(interactionHeight - this._backPlateDepth / 2, 0.2 * this._frontPlateDepth, this._frontPlateDepth);\r\n\r\n this._frontPlate.scaling.z = interactionHeight;\r\n this._frontPlate.position = Vector3.Forward(this._frontPlate._scene.useRightHandedSystem).scale((this._frontPlateDepth - interactionHeight) / 2);\r\n this._textPlate.position = Vector3.Forward(this._textPlate._scene.useRightHandedSystem).scale(-(this._backPlateDepth + interactionHeight) / 2);\r\n }\r\n }\r\n });\r\n\r\n this._pointerHoverObserver = this.onPointerMoveObservable.add((hoverPosition: Vector3) => {\r\n this._frontMaterial.globalLeftIndexTipPosition = hoverPosition;\r\n });\r\n }\r\n\r\n protected override _getTypeName(): string {\r\n return \"TouchHolographicButton\";\r\n }\r\n\r\n private _rebuildContent(): void {\r\n this._disposeFacadeTexture();\r\n\r\n const panel = new StackPanel();\r\n panel.isVertical = true;\r\n\r\n if (IsDocumentAvailable() && !!document.createElement) {\r\n if (this._imageUrl) {\r\n const image = new Image();\r\n image.source = this._imageUrl;\r\n image.paddingTop = \"40px\";\r\n image.height = \"180px\";\r\n image.width = \"100px\";\r\n image.paddingBottom = \"40px\";\r\n panel.addControl(image);\r\n }\r\n }\r\n\r\n if (this._text) {\r\n const text = new TextBlock();\r\n text.text = this._text;\r\n text.color = \"white\";\r\n text.height = \"30px\";\r\n text.fontSize = 24;\r\n panel.addControl(text);\r\n }\r\n\r\n this.content = panel;\r\n }\r\n\r\n // Mesh association\r\n protected override _createNode(scene: Scene): TransformNode {\r\n this.name = this.name ?? \"TouchHolographicButton\";\r\n const collisionMesh = CreateBox(\r\n `${this.name}_collisionMesh`,\r\n {\r\n width: 1.0,\r\n height: 1.0,\r\n depth: this._frontPlateDepth,\r\n },\r\n scene\r\n );\r\n collisionMesh.isPickable = true;\r\n collisionMesh.isNearPickable = true;\r\n collisionMesh.visibility = 0;\r\n collisionMesh.position = Vector3.Forward(scene.useRightHandedSystem).scale(-this._frontPlateDepth / 2);\r\n\r\n SceneLoader.ImportMeshAsync(undefined, TouchHolographicButton.MODEL_BASE_URL, TouchHolographicButton.MODEL_FILENAME, scene).then((result) => {\r\n const alphaMesh = CreateBox(\r\n \"${this.name}_alphaMesh\",\r\n {\r\n width: 1.0,\r\n height: 1.0,\r\n depth: 1.0,\r\n },\r\n scene\r\n );\r\n alphaMesh.isPickable = false;\r\n alphaMesh.material = new StandardMaterial(\"${this.name}_alphaMesh_material\", scene);\r\n alphaMesh.material.alpha = 0.15;\r\n\r\n const importedFrontPlate = result.meshes[1];\r\n importedFrontPlate.name = `${this.name}_frontPlate`;\r\n importedFrontPlate.isPickable = false;\r\n importedFrontPlate.scaling.z = this._frontPlateDepth;\r\n alphaMesh.parent = importedFrontPlate;\r\n importedFrontPlate.parent = collisionMesh;\r\n if (this._frontMaterial) {\r\n importedFrontPlate.material = this._frontMaterial;\r\n }\r\n this._frontPlate = importedFrontPlate;\r\n });\r\n\r\n this._backPlate = CreateBox(\r\n `${this.name}_backPlate`,\r\n {\r\n width: 1.0,\r\n height: 1.0,\r\n depth: this._backPlateDepth,\r\n },\r\n scene\r\n );\r\n\r\n this._backPlate.position = Vector3.Forward(scene.useRightHandedSystem).scale(this._backPlateDepth / 2);\r\n this._backPlate.isPickable = false;\r\n\r\n this._textPlate = <Mesh>super._createNode(scene);\r\n this._textPlate.name = `${this.name}_textPlate`;\r\n this._textPlate.isPickable = false;\r\n this._textPlate.position = Vector3.Forward(scene.useRightHandedSystem).scale(-this._frontPlateDepth / 2);\r\n\r\n this._backPlate.addChild(collisionMesh);\r\n this._backPlate.addChild(this._textPlate);\r\n\r\n const tn = new TransformNode(`{this.name}_root`, scene);\r\n this._backPlate.setParent(tn);\r\n\r\n this.collisionMesh = collisionMesh;\r\n this.collidableFrontDirection = this._backPlate.forward.negate(); // Mesh is facing the wrong way\r\n\r\n return tn;\r\n }\r\n\r\n protected override _applyFacade(facadeTexture: AdvancedDynamicTexture) {\r\n this._plateMaterial.emissiveTexture = facadeTexture;\r\n this._plateMaterial.opacityTexture = facadeTexture;\r\n this._plateMaterial.diffuseColor = new Color3(0.4, 0.4, 0.4);\r\n }\r\n\r\n private _createBackMaterial(mesh: Mesh) {\r\n this._backMaterial = new FluentMaterial(this.name + \"backPlateMaterial\", mesh.getScene());\r\n this._backMaterial.albedoColor = this._backplateColor;\r\n this._backMaterial.renderBorders = true;\r\n this._backMaterial.renderHoverLight = false;\r\n }\r\n\r\n private _createFrontMaterial(mesh: Mesh) {\r\n this._frontMaterial = new FluentButtonMaterial(this.name + \"Front Material\", mesh.getScene());\r\n }\r\n\r\n private _createPlateMaterial(mesh: Mesh) {\r\n this._plateMaterial = new StandardMaterial(this.name + \"Plate Material\", mesh.getScene());\r\n this._plateMaterial.specularColor = Color3.Black();\r\n }\r\n\r\n protected override _onToggle(newState: boolean) {\r\n if (this._backMaterial) {\r\n if (newState) {\r\n this._backMaterial.albedoColor = this._backplateToggledColor;\r\n } else {\r\n this._backMaterial.albedoColor = this._backplateColor;\r\n }\r\n }\r\n\r\n super._onToggle(newState);\r\n }\r\n\r\n protected override _affectMaterial(mesh: Mesh) {\r\n if (this._shareMaterials) {\r\n // Back\r\n if (!this._host._touchSharedMaterials[\"backFluentMaterial\"]) {\r\n this._createBackMaterial(mesh);\r\n this._host._touchSharedMaterials[\"backFluentMaterial\"] = this._backMaterial;\r\n } else {\r\n this._backMaterial = this._host._touchSharedMaterials[\"backFluentMaterial\"] as FluentMaterial;\r\n }\r\n\r\n // Front\r\n if (!this._host._touchSharedMaterials[\"frontFluentMaterial\"]) {\r\n this._createFrontMaterial(mesh);\r\n this._host._touchSharedMaterials[\"frontFluentMaterial\"] = this._frontMaterial;\r\n } else {\r\n this._frontMaterial = this._host._touchSharedMaterials[\"frontFluentMaterial\"] as FluentButtonMaterial;\r\n }\r\n } else {\r\n this._createBackMaterial(mesh);\r\n this._createFrontMaterial(mesh);\r\n }\r\n\r\n this._createPlateMaterial(mesh);\r\n this._backPlate.material = this._backMaterial;\r\n this._textPlate.material = this._plateMaterial;\r\n\r\n if (!this._isBackplateVisible) {\r\n this._backPlate.visibility = 0;\r\n }\r\n if (this._frontPlate) {\r\n this._frontPlate.material = this._frontMaterial;\r\n }\r\n\r\n this._rebuildContent();\r\n }\r\n\r\n /**\r\n * Releases all associated resources\r\n */\r\n public override dispose() {\r\n super.dispose(); // will dispose main mesh ie. back plate\r\n\r\n this._disposeTooltip();\r\n this.onPointerMoveObservable.remove(this._pointerHoverObserver);\r\n\r\n if (!this.shareMaterials) {\r\n this._backMaterial.dispose();\r\n this._frontMaterial.dispose();\r\n this._plateMaterial.dispose();\r\n\r\n if (this._pickedPointObserver) {\r\n this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver);\r\n this._pickedPointObserver = null;\r\n }\r\n }\r\n }\r\n}\r\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"touchHolographicMenu.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/touchHolographicMenu.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,uCAAyB;AACxC,OAAO,EAAE,SAAS,EAAE,sDAAwC;AAE5D,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAE/C,OAAO,EAAE,MAAM,EAAE,uCAAyB;AAI1C;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,gBAAgB;IAgBtD;;;OAGG;IACH,IAAW,eAAe;QACtB,OAAO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AC1C,IAAI,CAAC,gBAAgB,EAAE;YACnB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;SAC3B;QAED,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAEzB,MAAM,CAAC,kBAAkB,GAAG,KAAK,CAAC;QAClC,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;QAEpE,uIAAuI;QACvI,IAAI,CAAC,gBAAgB,EAAE;YACnB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;SAC5B;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;;OAKG;IACI,UAAU,CAAC,QAAmB;QACjC,MAAM,CAAC,IAAI,CAAC,2FAA2F,CAAC,CAAC;QAEzG,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;OAEG;IACI,OAAO;QACV,KAAK,CAAC,OAAO,EAAE,CAAC;QAEhB,IAAI,CAAC,KAAK,CAAC,8BAA8B,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IAChF,CAAC;;AA1JD;;GAEG;AACH,gEAAgE;AAC/C,sCAAiB,GAAW,CAAC,AAAZ,CAAa","sourcesContent":["import type { Scene } from \"core/scene\";\r\nimport type { Vector3 } from \"core/Maths/math.vector\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { Control3D } from \"./control3D\";\r\nimport { VolumeBasedPanel } from \"./volumeBasedPanel\";\r\nimport { Mesh } from \"core/Meshes/mesh\";\r\nimport { CreateBox } from \"core/Meshes/Builders/boxBuilder\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { FluentMaterial } from \"../materials/fluent/fluentMaterial\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport { Logger } from \"core/Misc/logger\";\r\nimport type { Container3D } from \"./container3D\";\r\nimport type { TouchHolographicButton } from \"./touchHolographicButton\";\r\n\r\n/**\r\n * Simple menu that can contain holographic buttons\r\n */\r\nexport class TouchHolographicMenu extends VolumeBasedPanel {\r\n protected _backPlate: Mesh;\r\n private _backPlateMaterial: FluentMaterial;\r\n private _pickedPointObserver: Nullable<Observer<Nullable<Vector3>>>;\r\n\r\n private _currentMin: Nullable<Vector3>;\r\n private _currentMax: Nullable<Vector3>;\r\n\r\n private _backPlateMargin = 1.25;\r\n\r\n /**\r\n * Scale for the buttons added to the menu\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n protected static MENU_BUTTON_SCALE: number = 1;\r\n\r\n /**\r\n * Gets or sets the margin size of the backplate in button size units.\r\n * Setting this to 1, will make the backPlate margin the size of 1 button\r\n */\r\n public get backPlateMargin(): number {\r\n return this._backPlateMargin;\r\n }\r\n\r\n public set backPlateMargin(value: number) {\r\n this._backPlateMargin = value;\r\n\r\n if (this._children.length >= 1) {\r\n this.children.forEach((control) => {\r\n this._updateCurrentMinMax(control.position);\r\n });\r\n\r\n this._updateMargins();\r\n }\r\n }\r\n\r\n protected _createNode(scene: Scene): Nullable<TransformNode> {\r\n const node = new Mesh(`menu_${this.name}`, scene);\r\n\r\n this._backPlate = CreateBox(\"backPlate\" + this.name, { size: 1 }, scene);\r\n this._backPlate.parent = node;\r\n\r\n return node;\r\n }\r\n\r\n protected _affectMaterial(mesh: AbstractMesh) {\r\n this._backPlateMaterial = new FluentMaterial(this.name + \"backPlateMaterial\", mesh.getScene());\r\n this._backPlateMaterial.albedoColor = new Color3(0.08, 0.15, 0.55);\r\n this._backPlateMaterial.renderBorders = true;\r\n this._backPlateMaterial.renderHoverLight = true;\r\n\r\n this._pickedPointObserver = this._host.onPickedPointChangedObservable.add((pickedPoint) => {\r\n if (pickedPoint) {\r\n this._backPlateMaterial.hoverPosition = pickedPoint;\r\n this._backPlateMaterial.hoverColor.a = 1.0;\r\n } else {\r\n this._backPlateMaterial.hoverColor.a = 0;\r\n }\r\n });\r\n\r\n this._backPlate.material = this._backPlateMaterial;\r\n }\r\n\r\n protected _mapGridNode(control: Control3D, nodePosition: Vector3) {\r\n // Simple plane mapping for the menu\r\n const mesh = control.mesh;\r\n\r\n if (!mesh) {\r\n return;\r\n }\r\n\r\n control.position = nodePosition.clone();\r\n\r\n this._updateCurrentMinMax(nodePosition);\r\n }\r\n\r\n protected _finalProcessing() {\r\n this._updateMargins();\r\n }\r\n\r\n private _updateCurrentMinMax(nodePosition: Vector3) {\r\n if (!this._currentMin) {\r\n this._currentMin = nodePosition.clone();\r\n this._currentMax = nodePosition.clone();\r\n }\r\n\r\n this._currentMin.minimizeInPlace(nodePosition);\r\n this._currentMax!.maximizeInPlace(nodePosition);\r\n }\r\n\r\n private _updateMargins() {\r\n if (this._children.length > 0) {\r\n this._currentMin!.addInPlaceFromFloats(-this._cellWidth / 2, -this._cellHeight / 2, 0);\r\n this._currentMax!.addInPlaceFromFloats(this._cellWidth / 2, this._cellHeight / 2, 0);\r\n const extendSize = this._currentMax!.subtract(this._currentMin!);\r\n\r\n // Also add a % margin\r\n this._backPlate.scaling.x = extendSize.x + this._cellWidth * this.backPlateMargin;\r\n this._backPlate.scaling.y = extendSize.y + this._cellHeight * this.backPlateMargin;\r\n this._backPlate.scaling.z = 0.001;\r\n\r\n for (let i = 0; i < this._children.length; i++) {\r\n this._children[i].position.subtractInPlace(this._currentMin!).subtractInPlace(extendSize.scale(0.5));\r\n this._children[i].position.z -= 0.01;\r\n }\r\n }\r\n\r\n this._currentMin = null;\r\n this._currentMax = null;\r\n }\r\n\r\n /**\r\n * Creates a holographic menu GUI 3D control\r\n * @param name name of the menu\r\n */\r\n constructor(name?: string) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Adds a button to the menu.\r\n * Please note that the back material of the button will be set to transparent as it is attached to the menu.\r\n *\r\n * @param button Button to add\r\n * @returns This menu\r\n */\r\n public addButton(button: TouchHolographicButton): TouchHolographicMenu {\r\n // Block updating the layout until the button is resized (which has to happen after node creation)\r\n const wasLayoutBlocked = this.blockLayout;\r\n if (!wasLayoutBlocked) {\r\n this.blockLayout = true;\r\n }\r\n\r\n super.addControl(button);\r\n\r\n button.isBackplateVisible = false;\r\n button.scaling.scaleInPlace(TouchHolographicMenu.MENU_BUTTON_SCALE);\r\n\r\n // Unblocking the layout triggers the pending layout update that uses the size of the buttons to determine the size of the backing mesh\r\n if (!wasLayoutBlocked) {\r\n this.blockLayout = false;\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * This method should not be used directly. It is inherited from `Container3D`.\r\n * Please use `addButton` instead.\r\n * @param _control the control to add\r\n * @returns the current container\r\n */\r\n public addControl(_control: Control3D): Container3D {\r\n Logger.Warn(\"TouchHolographicMenu can only contain buttons. Please use the method `addButton` instead.\");\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Disposes the menu\r\n */\r\n public dispose() {\r\n super.dispose();\r\n\r\n this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver);\r\n }\r\n}\r\n"]}
|
1
|
+
{"version":3,"file":"touchHolographicMenu.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/touchHolographicMenu.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,uCAAyB;AACxC,OAAO,EAAE,SAAS,EAAE,sDAAwC;AAE5D,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAE/C,OAAO,EAAE,MAAM,EAAE,uCAAyB;AAI1C;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,gBAAgB;IAgBtD;;;OAGG;IACH,IAAW,eAAe;QACtB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IACjC,CAAC;IAED,IAAW,eAAe,CAAC,KAAa;QACpC,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;QAE9B,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,IAAI,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,GAAG,KAAK,CAAC;QAClC,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;QAEpE,uIAAuI;QACvI,IAAI,CAAC,gBAAgB,EAAE;YACnB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;SAC5B;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;;OAKG;IACa,UAAU,CAAC,QAAmB;QAC1C,MAAM,CAAC,IAAI,CAAC,2FAA2F,CAAC,CAAC;QAEzG,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;OAEG;IACa,OAAO;QACnB,KAAK,CAAC,OAAO,EAAE,CAAC;QAEhB,IAAI,CAAC,KAAK,CAAC,8BAA8B,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IAChF,CAAC;;AA1JD;;GAEG;AACH,gEAAgE;AAC/C,sCAAiB,GAAW,CAAC,AAAZ,CAAa","sourcesContent":["import type { Scene } from \"core/scene\";\r\nimport type { Vector3 } from \"core/Maths/math.vector\";\r\nimport type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { Control3D } from \"./control3D\";\r\nimport { VolumeBasedPanel } from \"./volumeBasedPanel\";\r\nimport { Mesh } from \"core/Meshes/mesh\";\r\nimport { CreateBox } from \"core/Meshes/Builders/boxBuilder\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { FluentMaterial } from \"../materials/fluent/fluentMaterial\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport { Logger } from \"core/Misc/logger\";\r\nimport type { Container3D } from \"./container3D\";\r\nimport type { TouchHolographicButton } from \"./touchHolographicButton\";\r\n\r\n/**\r\n * Simple menu that can contain holographic buttons\r\n */\r\nexport class TouchHolographicMenu extends VolumeBasedPanel {\r\n protected _backPlate: Mesh;\r\n private _backPlateMaterial: FluentMaterial;\r\n private _pickedPointObserver: Nullable<Observer<Nullable<Vector3>>>;\r\n\r\n private _currentMin: Nullable<Vector3>;\r\n private _currentMax: Nullable<Vector3>;\r\n\r\n private _backPlateMargin = 1.25;\r\n\r\n /**\r\n * Scale for the buttons added to the menu\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n protected static MENU_BUTTON_SCALE: number = 1;\r\n\r\n /**\r\n * Gets or sets the margin size of the backplate in button size units.\r\n * Setting this to 1, will make the backPlate margin the size of 1 button\r\n */\r\n public get backPlateMargin(): number {\r\n return this._backPlateMargin;\r\n }\r\n\r\n public set backPlateMargin(value: number) {\r\n this._backPlateMargin = value;\r\n\r\n if (this._children.length >= 1) {\r\n this.children.forEach((control) => {\r\n this._updateCurrentMinMax(control.position);\r\n });\r\n\r\n this._updateMargins();\r\n }\r\n }\r\n\r\n protected override _createNode(scene: Scene): Nullable<TransformNode> {\r\n const node = new Mesh(`menu_${this.name}`, scene);\r\n\r\n this._backPlate = CreateBox(\"backPlate\" + this.name, { size: 1 }, scene);\r\n this._backPlate.parent = node;\r\n\r\n return node;\r\n }\r\n\r\n protected override _affectMaterial(mesh: AbstractMesh) {\r\n this._backPlateMaterial = new FluentMaterial(this.name + \"backPlateMaterial\", mesh.getScene());\r\n this._backPlateMaterial.albedoColor = new Color3(0.08, 0.15, 0.55);\r\n this._backPlateMaterial.renderBorders = true;\r\n this._backPlateMaterial.renderHoverLight = true;\r\n\r\n this._pickedPointObserver = this._host.onPickedPointChangedObservable.add((pickedPoint) => {\r\n if (pickedPoint) {\r\n this._backPlateMaterial.hoverPosition = pickedPoint;\r\n this._backPlateMaterial.hoverColor.a = 1.0;\r\n } else {\r\n this._backPlateMaterial.hoverColor.a = 0;\r\n }\r\n });\r\n\r\n this._backPlate.material = this._backPlateMaterial;\r\n }\r\n\r\n protected _mapGridNode(control: Control3D, nodePosition: Vector3) {\r\n // Simple plane mapping for the menu\r\n const mesh = control.mesh;\r\n\r\n if (!mesh) {\r\n return;\r\n }\r\n\r\n control.position = nodePosition.clone();\r\n\r\n this._updateCurrentMinMax(nodePosition);\r\n }\r\n\r\n protected override _finalProcessing() {\r\n this._updateMargins();\r\n }\r\n\r\n private _updateCurrentMinMax(nodePosition: Vector3) {\r\n if (!this._currentMin) {\r\n this._currentMin = nodePosition.clone();\r\n this._currentMax = nodePosition.clone();\r\n }\r\n\r\n this._currentMin.minimizeInPlace(nodePosition);\r\n this._currentMax!.maximizeInPlace(nodePosition);\r\n }\r\n\r\n private _updateMargins() {\r\n if (this._children.length > 0) {\r\n this._currentMin!.addInPlaceFromFloats(-this._cellWidth / 2, -this._cellHeight / 2, 0);\r\n this._currentMax!.addInPlaceFromFloats(this._cellWidth / 2, this._cellHeight / 2, 0);\r\n const extendSize = this._currentMax!.subtract(this._currentMin!);\r\n\r\n // Also add a % margin\r\n this._backPlate.scaling.x = extendSize.x + this._cellWidth * this.backPlateMargin;\r\n this._backPlate.scaling.y = extendSize.y + this._cellHeight * this.backPlateMargin;\r\n this._backPlate.scaling.z = 0.001;\r\n\r\n for (let i = 0; i < this._children.length; i++) {\r\n this._children[i].position.subtractInPlace(this._currentMin!).subtractInPlace(extendSize.scale(0.5));\r\n this._children[i].position.z -= 0.01;\r\n }\r\n }\r\n\r\n this._currentMin = null;\r\n this._currentMax = null;\r\n }\r\n\r\n /**\r\n * Creates a holographic menu GUI 3D control\r\n * @param name name of the menu\r\n */\r\n constructor(name?: string) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Adds a button to the menu.\r\n * Please note that the back material of the button will be set to transparent as it is attached to the menu.\r\n *\r\n * @param button Button to add\r\n * @returns This menu\r\n */\r\n public addButton(button: TouchHolographicButton): TouchHolographicMenu {\r\n // Block updating the layout until the button is resized (which has to happen after node creation)\r\n const wasLayoutBlocked = this.blockLayout;\r\n if (!wasLayoutBlocked) {\r\n this.blockLayout = true;\r\n }\r\n\r\n super.addControl(button);\r\n\r\n button.isBackplateVisible = false;\r\n button.scaling.scaleInPlace(TouchHolographicMenu.MENU_BUTTON_SCALE);\r\n\r\n // Unblocking the layout triggers the pending layout update that uses the size of the buttons to determine the size of the backing mesh\r\n if (!wasLayoutBlocked) {\r\n this.blockLayout = false;\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * This method should not be used directly. It is inherited from `Container3D`.\r\n * Please use `addButton` instead.\r\n * @param _control the control to add\r\n * @returns the current container\r\n */\r\n public override addControl(_control: Control3D): Container3D {\r\n Logger.Warn(\"TouchHolographicMenu can only contain buttons. Please use the method `addButton` instead.\");\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Disposes the menu\r\n */\r\n public override dispose() {\r\n super.dispose();\r\n\r\n this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver);\r\n }\r\n}\r\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"touchMeshButton3D.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/touchMeshButton3D.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;GAGG;AACH,MAAM,OAAO,iBAAkB,SAAQ,aAAa;IAIhD;;;;OAIG;IACH,YAAY,IAAU,EAAE,IAAa;QACjC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAElB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QAEzB;;;WAGG;QACH,IAAI,CAAC,qBAAqB,GAAG,GAAG,EAAE;YAC9B,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;gBACZ,OAAO;aACV;YACD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;QACxC,CAAC,CAAC;QAEF,IAAI,CAAC,mBAAmB,GAAG,GAAG,EAAE;YAC5B,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;gBACZ,OAAO;aACV;YACD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC;QAC9C,CAA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AC7B,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;gBACZ,OAAO;aACV;YACD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QACzC,CAAC,CAAC;QAEF,IAAI,CAAC,kBAAkB,GAAG,GAAG,EAAE;YAC3B,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;gBACZ,OAAO;aACV;YACD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC;QAC/C,CAAC,CAAC;IACN,CAAC;IAEkB,YAAY;QAC3B,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED,mBAAmB;IACA,WAAW;QAC1B,IAAI,CAAC,YAAY,CAAC,cAAc,EAAE,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YAChD,IAAI,CAAC,6BAA6B,CAAC,IAAI,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC;QAC5D,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IAED,6DAA6D;IAC1C,eAAe,CAAC,IAAkB,IAAG,CAAC;CAC5D","sourcesContent":["import type { TransformNode } from \"core/Meshes/transformNode\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\n\r\nimport { TouchButton3D } from \"./touchButton3D\";\r\n\r\n/**\r\n * Class used to create an interactable object. It's a touchable 3D button using a mesh coming from the current scene\r\n * @since 5.0.0\r\n */\r\nexport class TouchMeshButton3D extends TouchButton3D {\r\n /** @internal */\r\n protected _currentMesh: Mesh;\r\n\r\n /**\r\n * Creates a new 3D button based on a mesh\r\n * @param mesh mesh to become a 3D button. By default this is also the mesh for near interaction collision checking\r\n * @param name defines the control name\r\n */\r\n constructor(mesh: Mesh, name?: string) {\r\n super(name, mesh);\r\n\r\n this._currentMesh = mesh;\r\n\r\n /**\r\n * Provides a default behavior on hover/out & up/down\r\n * Override those function to create your own desired behavior specific to your mesh\r\n */\r\n this.pointerEnterAnimation = () => {\r\n if (!this.mesh) {\r\n return;\r\n }\r\n this.mesh.scaling.scaleInPlace(1.1);\r\n };\r\n\r\n this.pointerOutAnimation = () => {\r\n if (!this.mesh) {\r\n return;\r\n }\r\n this.mesh.scaling.scaleInPlace(1.0 / 1.1);\r\n };\r\n\r\n this.pointerDownAnimation = () => {\r\n if (!this.mesh) {\r\n return;\r\n }\r\n this.mesh.scaling.scaleInPlace(0.95);\r\n };\r\n\r\n this.pointerUpAnimation = () => {\r\n if (!this.mesh) {\r\n return;\r\n }\r\n this.mesh.scaling.scaleInPlace(1.0 / 0.95);\r\n };\r\n }\r\n\r\n protected override _getTypeName(): string {\r\n return \"TouchMeshButton3D\";\r\n }\r\n\r\n // Mesh association\r\n protected override _createNode(): TransformNode {\r\n this._currentMesh.getChildMeshes().forEach((mesh) => {\r\n this._injectGUI3DReservedDataStore(mesh).control = this;\r\n });\r\n\r\n return this._currentMesh;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n protected override _affectMaterial(mesh: AbstractMesh) {}\r\n}\r\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"volumeBasedPanel.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/volumeBasedPanel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,sCAAwB;AACxC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,6CAA+B;AAGrE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C;;GAEG;AACH,MAAM,OAAgB,gBAAiB,SAAQ,WAAW;IAetD;;;;;;;;;OASG;IACH,IAAW,WAAW;QAClB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IAED,IAAW,WAAW,CAAC,KAAa;QAChC,IAAI,IAAI,CAAC,YAAY,KAAK,KAAK,EAAE;YA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,EAAE;gBAC9B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE;oBAC3B,QAAQ,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,UAAU,GAAG,YAAY,GAAG,IAAI,CAAC,UAAU,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,WAAW,GAAG,YAAY,GAAG,IAAI,CAAC,WAAW,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;oBACpJ,WAAW,EAAE,CAAC;oBACd,IAAI,WAAW,GAAG,YAAY,EAAE;wBAC5B,MAAM;qBACT;iBACJ;aACJ;SACJ;QAED,WAAW,GAAG,CAAC,CAAC;QAChB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,SAAS,EAAE;YAChC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;gBACb,SAAS;aACZ;YAED,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;YAEhD,WAAW,EAAE,CAAC;SACjB;QAED,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC5B,CAAC;IAKD,iFAAiF;IACvE,gBAAgB,KAAI,CAAC;CAClC","sourcesContent":["import { Tools } from \"core/Misc/tools\";\r\nimport { Matrix, Vector3, TmpVectors } from \"core/Maths/math.vector\";\r\nimport type { int } from \"core/types\";\r\n\r\nimport { Container3D } from \"./container3D\";\r\nimport type { Control3D } from \"./control3D\";\r\n\r\n/**\r\n * Abstract class used to create a container panel deployed on the surface of a volume\r\n */\r\nexport abstract class VolumeBasedPanel extends Container3D {\r\n private _columns = 10;\r\n private _rows = 0;\r\n private _rowThenColum = true;\r\n\r\n private _orientation = Container3D.FACEORIGIN_ORIENTATION;\r\n\r\n protected _cellWidth: number;\r\n protected _cellHeight: number;\r\n\r\n /**\r\n * Gets or sets the distance between elements\r\n */\r\n public margin = 0;\r\n\r\n /**\r\n * Gets or sets the orientation to apply to all controls (BABYLON.Container3D.FaceOriginReversedOrientation by default)\r\n * | Value | Type | Description |\r\n * | ----- | ----------------------------------- | ----------- |\r\n * | 0 | UNSET_ORIENTATION | Control rotation will remain unchanged |\r\n * | 1 | FACEORIGIN_ORIENTATION | Control will rotate to make it look at sphere central axis |\r\n * | 2 | FACEORIGINREVERSED_ORIENTATION | Control will rotate to make it look back at sphere central axis |\r\n * | 3 | FACEFORWARD_ORIENTATION | Control will rotate to look at z axis (0, 0, 1) |\r\n * | 4 | FACEFORWARDREVERSED_ORIENTATION | Control will rotate to look at negative z axis (0, 0, -1) |\r\n */\r\n public get orientation(): number {\r\n return this._orientation;\r\n }\r\n\r\n public set orientation(value: number) {\r\n if (this._orientation === value) {\r\n return;\r\n }\r\n\r\n this._orientation = value;\r\n\r\n Tools.SetImmediate(() => {\r\n this._arrangeChildren();\r\n });\r\n }\r\n\r\n /**\r\n * Gets or sets the number of columns requested (10 by default).\r\n * The panel will automatically compute the number of rows based on number of child controls.\r\n */\r\n public get columns(): int {\r\n return this._columns;\r\n }\r\n\r\n public set columns(value: int) {\r\n if (this._columns === value) {\r\n return;\r\n }\r\n\r\n this._columns = value;\r\n this._rowThenColum = true;\r\n\r\n Tools.SetImmediate(() => {\r\n this._arrangeChildren();\r\n });\r\n }\r\n\r\n /**\r\n * Gets or sets a the number of rows requested.\r\n * The panel will automatically compute the number of columns based on number of child controls.\r\n */\r\n public get rows(): int {\r\n return this._rows;\r\n }\r\n\r\n public set rows(value: int) {\r\n if (this._rows === value) {\r\n return;\r\n }\r\n\r\n this._rows = value;\r\n this._rowThenColum = false;\r\n\r\n Tools.SetImmediate(() => {\r\n this._arrangeChildren();\r\n });\r\n }\r\n\r\n /**\r\n * Creates new VolumeBasedPanel\r\n * @param name\r\n */\r\n public constructor(name?: string) {\r\n super(name);\r\n }\r\n\r\n protected _arrangeChildren() {\r\n this._cellWidth = 0;\r\n this._cellHeight = 0;\r\n let rows = 0;\r\n let columns = 0;\r\n let controlCount = 0;\r\n\r\n const currentInverseWorld = Matrix.Invert(this.node!.computeWorldMatrix(true));\r\n\r\n // Measure\r\n for (const child of this._children) {\r\n if (!child.mesh) {\r\n continue;\r\n }\r\n\r\n controlCount++;\r\n child.mesh.computeWorldMatrix(true);\r\n // child.mesh.getWorldMatrix().multiplyToRef(currentInverseWorld, Tmp.Matrix[0]);\r\n\r\n const boundingBox = child.mesh.getHierarchyBoundingVectors();\r\n const extendSize = TmpVectors.Vector3[0];\r\n const diff = TmpVectors.Vector3[1];\r\n\r\n boundingBox.max.subtractToRef(boundingBox.min, diff);\r\n\r\n diff.scaleInPlace(0.5);\r\n\r\n Vector3.TransformNormalToRef(diff, currentInverseWorld, extendSize);\r\n\r\n this._cellWidth = Math.max(this._cellWidth, extendSize.x * 2);\r\n this._cellHeight = Math.max(this._cellHeight, extendSize.y * 2);\r\n }\r\n\r\n this._cellWidth += this.margin * 2;\r\n this._cellHeight += this.margin * 2;\r\n\r\n // Arrange\r\n if (this._rowThenColum) {\r\n columns = this._columns;\r\n rows = Math.ceil(controlCount / this._columns);\r\n } else {\r\n rows = this._rows;\r\n columns = Math.ceil(controlCount / this._rows);\r\n }\r\n\r\n const startOffsetX = columns * 0.5 * this._cellWidth;\r\n const startOffsetY = rows * 0.5 * this._cellHeight;\r\n const nodeGrid = [];\r\n let cellCounter = 0;\r\n\r\n if (this._rowThenColum) {\r\n for (let r = 0; r < rows; r++) {\r\n for (let c = 0; c < columns; c++) {\r\n nodeGrid.push(new Vector3(c * this._cellWidth - startOffsetX + this._cellWidth / 2, r * this._cellHeight - startOffsetY + this._cellHeight / 2, 0));\r\n cellCounter++;\r\n if (cellCounter > controlCount) {\r\n break;\r\n }\r\n }\r\n }\r\n } else {\r\n for (let c = 0; c < columns; c++) {\r\n for (let r = 0; r < rows; r++) {\r\n nodeGrid.push(new Vector3(c * this._cellWidth - startOffsetX + this._cellWidth / 2, r * this._cellHeight - startOffsetY + this._cellHeight / 2, 0));\r\n cellCounter++;\r\n if (cellCounter > controlCount) {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n cellCounter = 0;\r\n for (const child of this._children) {\r\n if (!child.mesh) {\r\n continue;\r\n }\r\n\r\n this._mapGridNode(child, nodeGrid[cellCounter]);\r\n\r\n cellCounter++;\r\n }\r\n\r\n this._finalProcessing();\r\n }\r\n\r\n /** Child classes must implement this function to provide correct control positioning */\r\n protected abstract _mapGridNode(control: Control3D, nodePosition: Vector3): void;\r\n\r\n /** Child classes can implement this function to provide additional processing */\r\n protected _finalProcessing() {}\r\n}\r\n"]}
|
1
|
+
{"version":3,"file":"volumeBasedPanel.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/controls/volumeBasedPanel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,sCAAwB;AACxC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,6CAA+B;AAGrE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C;;GAEG;AACH,MAAM,OAAgB,gBAAiB,SAAQ,WAAW;IAetD;;;;;;;;;OASG;IACH,IAAW,WAAW;QAClB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IAED,IAAW,WAAW,CAAC,KAAa;QAChC,IAAI,IAAI,CAAC,YAAY,KAAK,KAAK,EAAE;YAC7B,OAAO;SACV;QAED,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAE1B,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE;YACpB,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC5B,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;;OAGG;IACH,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAED,IAAW,OAAO,CAAC,KAAU;QACzB,IAAI,IAAI,CAAC,QAAQ,KAAK,KAAK,EAAE;YACzB,OAAO;SACV;QAED,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB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AY,EAAE;wBAC5B,MAAM;qBACT;iBACJ;aACJ;SACJ;QAED,WAAW,GAAG,CAAC,CAAC;QAChB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,SAAS,EAAE;YAChC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;gBACb,SAAS;aACZ;YAED,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;YAEhD,WAAW,EAAE,CAAC;SACjB;QAED,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC5B,CAAC;IAKD,iFAAiF;IACvE,gBAAgB,KAAI,CAAC;CAClC","sourcesContent":["import { Tools } from \"core/Misc/tools\";\r\nimport { Matrix, Vector3, TmpVectors } from \"core/Maths/math.vector\";\r\nimport type { int } from \"core/types\";\r\n\r\nimport { Container3D } from \"./container3D\";\r\nimport type { Control3D } from \"./control3D\";\r\n\r\n/**\r\n * Abstract class used to create a container panel deployed on the surface of a volume\r\n */\r\nexport abstract class VolumeBasedPanel extends Container3D {\r\n private _columns = 10;\r\n private _rows = 0;\r\n private _rowThenColum = true;\r\n\r\n private _orientation = Container3D.FACEORIGIN_ORIENTATION;\r\n\r\n protected _cellWidth: number;\r\n protected _cellHeight: number;\r\n\r\n /**\r\n * Gets or sets the distance between elements\r\n */\r\n public margin = 0;\r\n\r\n /**\r\n * Gets or sets the orientation to apply to all controls (BABYLON.Container3D.FaceOriginReversedOrientation by default)\r\n * | Value | Type | Description |\r\n * | ----- | ----------------------------------- | ----------- |\r\n * | 0 | UNSET_ORIENTATION | Control rotation will remain unchanged |\r\n * | 1 | FACEORIGIN_ORIENTATION | Control will rotate to make it look at sphere central axis |\r\n * | 2 | FACEORIGINREVERSED_ORIENTATION | Control will rotate to make it look back at sphere central axis |\r\n * | 3 | FACEFORWARD_ORIENTATION | Control will rotate to look at z axis (0, 0, 1) |\r\n * | 4 | FACEFORWARDREVERSED_ORIENTATION | Control will rotate to look at negative z axis (0, 0, -1) |\r\n */\r\n public get orientation(): number {\r\n return this._orientation;\r\n }\r\n\r\n public set orientation(value: number) {\r\n if (this._orientation === value) {\r\n return;\r\n }\r\n\r\n this._orientation = value;\r\n\r\n Tools.SetImmediate(() => {\r\n this._arrangeChildren();\r\n });\r\n }\r\n\r\n /**\r\n * Gets or sets the number of columns requested (10 by default).\r\n * The panel will automatically compute the number of rows based on number of child controls.\r\n */\r\n public get columns(): int {\r\n return this._columns;\r\n }\r\n\r\n public set columns(value: int) {\r\n if (this._columns === value) {\r\n return;\r\n }\r\n\r\n this._columns = value;\r\n this._rowThenColum = true;\r\n\r\n Tools.SetImmediate(() => {\r\n this._arrangeChildren();\r\n });\r\n }\r\n\r\n /**\r\n * Gets or sets a the number of rows requested.\r\n * The panel will automatically compute the number of columns based on number of child controls.\r\n */\r\n public get rows(): int {\r\n return this._rows;\r\n }\r\n\r\n public set rows(value: int) {\r\n if (this._rows === value) {\r\n return;\r\n }\r\n\r\n this._rows = value;\r\n this._rowThenColum = false;\r\n\r\n Tools.SetImmediate(() => {\r\n this._arrangeChildren();\r\n });\r\n }\r\n\r\n /**\r\n * Creates new VolumeBasedPanel\r\n * @param name\r\n */\r\n public constructor(name?: string) {\r\n super(name);\r\n }\r\n\r\n protected override _arrangeChildren() {\r\n this._cellWidth = 0;\r\n this._cellHeight = 0;\r\n let rows = 0;\r\n let columns = 0;\r\n let controlCount = 0;\r\n\r\n const currentInverseWorld = Matrix.Invert(this.node!.computeWorldMatrix(true));\r\n\r\n // Measure\r\n for (const child of this._children) {\r\n if (!child.mesh) {\r\n continue;\r\n }\r\n\r\n controlCount++;\r\n child.mesh.computeWorldMatrix(true);\r\n // child.mesh.getWorldMatrix().multiplyToRef(currentInverseWorld, Tmp.Matrix[0]);\r\n\r\n const boundingBox = child.mesh.getHierarchyBoundingVectors();\r\n const extendSize = TmpVectors.Vector3[0];\r\n const diff = TmpVectors.Vector3[1];\r\n\r\n boundingBox.max.subtractToRef(boundingBox.min, diff);\r\n\r\n diff.scaleInPlace(0.5);\r\n\r\n Vector3.TransformNormalToRef(diff, currentInverseWorld, extendSize);\r\n\r\n this._cellWidth = Math.max(this._cellWidth, extendSize.x * 2);\r\n this._cellHeight = Math.max(this._cellHeight, extendSize.y * 2);\r\n }\r\n\r\n this._cellWidth += this.margin * 2;\r\n this._cellHeight += this.margin * 2;\r\n\r\n // Arrange\r\n if (this._rowThenColum) {\r\n columns = this._columns;\r\n rows = Math.ceil(controlCount / this._columns);\r\n } else {\r\n rows = this._rows;\r\n columns = Math.ceil(controlCount / this._rows);\r\n }\r\n\r\n const startOffsetX = columns * 0.5 * this._cellWidth;\r\n const startOffsetY = rows * 0.5 * this._cellHeight;\r\n const nodeGrid = [];\r\n let cellCounter = 0;\r\n\r\n if (this._rowThenColum) {\r\n for (let r = 0; r < rows; r++) {\r\n for (let c = 0; c < columns; c++) {\r\n nodeGrid.push(new Vector3(c * this._cellWidth - startOffsetX + this._cellWidth / 2, r * this._cellHeight - startOffsetY + this._cellHeight / 2, 0));\r\n cellCounter++;\r\n if (cellCounter > controlCount) {\r\n break;\r\n }\r\n }\r\n }\r\n } else {\r\n for (let c = 0; c < columns; c++) {\r\n for (let r = 0; r < rows; r++) {\r\n nodeGrid.push(new Vector3(c * this._cellWidth - startOffsetX + this._cellWidth / 2, r * this._cellHeight - startOffsetY + this._cellHeight / 2, 0));\r\n cellCounter++;\r\n if (cellCounter > controlCount) {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n cellCounter = 0;\r\n for (const child of this._children) {\r\n if (!child.mesh) {\r\n continue;\r\n }\r\n\r\n this._mapGridNode(child, nodeGrid[cellCounter]);\r\n\r\n cellCounter++;\r\n }\r\n\r\n this._finalProcessing();\r\n }\r\n\r\n /** Child classes must implement this function to provide correct control positioning */\r\n protected abstract _mapGridNode(control: Control3D, nodePosition: Vector3): void;\r\n\r\n /** Child classes can implement this function to provide additional processing */\r\n protected _finalProcessing() {}\r\n}\r\n"]}
|
@@ -1 +1 @@
|
|
1
|
-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AG,CAAC,kBAAkB,EAAE,kBAAkB,EAAE,kBAAkB,CAAC,CAAC;iBACjG;gBACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;oBACzC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,kBAAkB,EAAE,kBAAkB,CAAC,CAAC;iBAC/F;aACJ;YACD,IAAI,CAAC,sBAAsB,EAAE,CAAC;SACjC;IACL,CAAC;IAEM,OAAO;QACV,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,wBAAwB,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAEpF,4CAA4C;QAC5C,KAAK,CAAC,OAAO,EAAE,CAAC;QAEhB,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,QAAQ,EAAE;YAChC,MAAM,CAAC,OAAO,EAAE,CAAC;SACpB;QAED,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM,EAAE;YAC5B,IAAI,CAAC,OAAO,EAAE,CAAC;SAClB;IACL,CAAC;CACJ","sourcesContent":["import { Gizmo } from \"core/Gizmos/gizmo\";\r\nimport { Epsilon } from \"core/Maths/math.constants\";\r\nimport { Matrix, Quaternion, TmpVectors, Vector3 } from \"core/Maths/math.vector\";\r\nimport type { Scene } from \"core/scene\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { TransformNode } from \"core/Meshes/transformNode\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport { PivotTools } from \"core/Misc/pivotTools\";\r\nimport type { UtilityLayerRenderer } from \"core/Rendering/utilityLayerRenderer\";\r\nimport type { Nullable } from \"core/types\";\r\n\r\nimport type { HolographicSlate } from \"../controls/holographicSlate\";\r\nimport type { GizmoHandle } from \"./gizmoHandle\";\r\nimport { CornerHandle, SideHandle } from \"./gizmoHandle\";\r\n\r\n// Mask contains the influence of the drag offset vectors on dimensions or origin of the slate\r\n// Mask vector is multiplied to the offset vector\r\ntype HandleMasks = {\r\n dimensions: Vector3;\r\n origin: Vector3;\r\n};\r\n\r\n/**\r\n * Gizmo to resize 2D slates\r\n */\r\nexport class SlateGizmo extends Gizmo {\r\n private _boundingDimensions = new Vector3(0, 0, 0);\r\n private _pickedPointObserver: Nullable<Observer<Nullable<AbstractMesh>>>;\r\n private _renderObserver: Nullable<Observer<Scene>> = null;\r\n\r\n private _tmpQuaternion = new Quaternion();\r\n private _tmpVector = new Vector3(0, 0, 0);\r\n\r\n // Ordered bl, br, tr, tl\r\n private _corners: CornerHandle[] = [];\r\n // Ordered left, bottom, right, top\r\n private _sides: SideHandle[] = [];\r\n private _handlesParent: TransformNode;\r\n private _handleHovered: Nullable<GizmoHandle>;\r\n private _handleDragged: Nullable<GizmoHandle>;\r\n\r\n private _boundingBoxGizmo = {\r\n min: new Vector3(),\r\n max: new Vector3(),\r\n };\r\n\r\n /**\r\n * Value we use to offset handles from mesh\r\n */\r\n private _margin = 0.35;\r\n private _handleSize = 0.075;\r\n private _attachedSlate: Nullable<HolographicSlate> = null;\r\n private _existingSlateScale = new Vector3();\r\n /**\r\n * If set, the handles will increase in size based on the distance away from the camera to have a consistent screen size (Default: true)\r\n */\r\n public fixedScreenSize = false;\r\n /**\r\n * The distance away from the object which the draggable meshes should appear world sized when fixedScreenSize is set to true (default: 10)\r\n */\r\n public fixedScreenSizeDistanceFactor = 10;\r\n\r\n /**\r\n * The slate attached to this gizmo\r\n */\r\n public set attachedSlate(control: Nullable<HolographicSlate>) {\r\n if (control) {\r\n this.attachedMesh = control.mesh;\r\n this.updateBoundingBox();\r\n\r\n this._pickedPointObserver = control._host.onPickingObservable.add((pickedMesh) => {\r\n if (this._handleHovered && (!pickedMesh || pickedMesh.parent !== this._handleHovered.node)) {\r\n this._handleHovered.hover = false;\r\n this._handleHovered = null;\r\n }\r\n\r\n if (pickedMesh && pickedMesh.parent && pickedMesh.parent.reservedDataStore && pickedMesh.parent.reservedDataStore.handle) {\r\n const handle = pickedMesh.parent.reservedDataStore.handle as GizmoHandle;\r\n if (handle.gizmo === this) {\r\n this._handleHovered = handle;\r\n this._handleHovered.hover = true;\r\n }\r\n }\r\n });\r\n } else if (this._attachedSlate) {\r\n this._attachedSlate._host.onPickingObservable.remove(this._pickedPointObserver);\r\n }\r\n this._attachedSlate = control;\r\n }\r\n\r\n public get attachedSlate(): Nullable<HolographicSlate> {\r\n return this._attachedSlate;\r\n }\r\n\r\n constructor(utilityLayer?: UtilityLayerRenderer) {\r\n super(utilityLayer);\r\n\r\n this._createNode();\r\n this.updateScale = false;\r\n\r\n this._renderObserver = this.gizmoLayer.originalScene.onBeforeRenderObservable.add(() => {\r\n // Only update the bounding box if scaling has changed\r\n if (this.attachedMesh && !this._existingSlateScale.equals(this.attachedMesh.scaling)) {\r\n this.updateBoundingBox();\r\n }\r\n });\r\n }\r\n\r\n private _createNode() {\r\n this._handlesParent = new TransformNode(\"handlesParent\", this.gizmoLayer.utilityLayerScene);\r\n this._handlesParent.rotationQuaternion = Quaternion.Identity();\r\n\r\n const masksCorners = [\r\n {\r\n dimensions: new Vector3(-1, -1, 0),\r\n origin: new Vector3(1, 0, 0),\r\n },\r\n {\r\n dimensions: new Vector3(1, -1, 0),\r\n origin: new Vector3(0, 0, 0),\r\n },\r\n {\r\n dimensions: new Vector3(1, 1, 0),\r\n origin: new Vector3(0, 1, 0),\r\n },\r\n {\r\n dimensions: new Vector3(-1, 1, 0),\r\n origin: new Vector3(1, 1, 0),\r\n },\r\n ];\r\n\r\n for (let i = 0; i < 4; i++) {\r\n const corner = new CornerHandle(this, this.gizmoLayer.utilityLayerScene);\r\n this._corners.push(corner);\r\n corner.node.rotation.z = (Math.PI / 2) * i;\r\n\r\n corner.node.parent = this._handlesParent;\r\n this._assignDragBehaviorCorners(\r\n corner,\r\n (originStart: Vector3, dimensionsStart: Vector3, offset: Vector3, masks: HandleMasks) => this._moveHandle(originStart, dimensionsStart, offset, masks, true),\r\n masksCorners[i]\r\n );\r\n }\r\n\r\n for (let i = 0; i < 4; i++) {\r\n const side = new SideHandle(this, this.gizmoLayer.utilityLayerScene);\r\n this._sides.push(side);\r\n side.node.rotation.z = (Math.PI / 2) * i;\r\n side.node.parent = this._handlesParent;\r\n this._assignDragBehaviorSides(side, i % 2 === 0 ? new Vector3(0, 1, 0) : new Vector3(1, 0, 0));\r\n }\r\n\r\n this._handlesParent.parent = this._rootMesh;\r\n }\r\n\r\n private _keepAspectRatio(vector: Vector3, aspectRatio: number, invertDiagonal: boolean = false) {\r\n const axis = TmpVectors.Vector3[0];\r\n axis.copyFromFloats(aspectRatio, 1, 0).normalize();\r\n if (invertDiagonal) {\r\n axis.y *= -1;\r\n }\r\n const dot = Vector3.Dot(vector, axis);\r\n vector.copyFrom(axis).scaleInPlace(dot);\r\n }\r\n\r\n private _clampDimensions(vector: Vector3, dimensions: Vector3, mask: Vector3, keepAspectRatio: boolean = false) {\r\n const impact = TmpVectors.Vector3[0];\r\n impact.copyFrom(vector).multiplyInPlace(mask);\r\n\r\n const clampedDimensions = TmpVectors.Vector3[1];\r\n clampedDimensions.copyFromFloats(\r\n Math.max(this._attachedSlate!.minDimensions.x, impact.x + dimensions.x),\r\n Math.max(this._attachedSlate!.minDimensions.y, impact.y + dimensions.y),\r\n 0\r\n );\r\n\r\n if (keepAspectRatio) {\r\n // Extra logic to ensure the ratio is maintained when the vector has been clamped\r\n const ratio = dimensions.x / dimensions.y;\r\n clampedDimensions.x = Math.max(clampedDimensions.x, clampedDimensions.y * ratio);\r\n clampedDimensions.y = Math.max(clampedDimensions.y, clampedDimensions.x / ratio);\r\n }\r\n\r\n // Calculating the real impact of vector on clamped dimensions\r\n impact.copyFrom(clampedDimensions).subtractInPlace(dimensions);\r\n\r\n vector.x = Math.sign(vector.x) * Math.abs(impact.x);\r\n vector.y = Math.sign(vector.y) * Math.abs(impact.y);\r\n }\r\n\r\n private _moveHandle(originStart: Vector3, dimensionsStart: Vector3, offset: Vector3, masks: HandleMasks, isCorner: boolean) {\r\n if (!this._attachedSlate) {\r\n return;\r\n }\r\n\r\n if (isCorner) {\r\n const aspectRatio = dimensionsStart.x / dimensionsStart.y;\r\n this._keepAspectRatio(offset, aspectRatio, masks.dimensions.x * masks.dimensions.y < 0);\r\n }\r\n this._clampDimensions(offset, dimensionsStart, masks.dimensions, isCorner);\r\n\r\n const offsetOriginMasked = TmpVectors.Vector3[0];\r\n const offsetDimensionsMasked = TmpVectors.Vector3[1];\r\n offsetOriginMasked.copyFrom(offset).multiplyInPlace(masks.origin);\r\n offsetDimensionsMasked.copyFrom(offset).multiplyInPlace(masks.dimensions);\r\n\r\n this._attachedSlate.origin.copyFrom(originStart).addInPlace(offsetOriginMasked);\r\n this._attachedSlate.dimensions.set(dimensionsStart.x + offsetDimensionsMasked.x, dimensionsStart.y + offsetDimensionsMasked.y);\r\n }\r\n\r\n private _assignDragBehaviorCorners(\r\n handle: GizmoHandle,\r\n moveFn: (originStart: Vector3, dimensionsStart: Vector3, offset: Vector3, masks: HandleMasks) => void,\r\n masks: HandleMasks\r\n ) {\r\n const dimensionsStart = new Vector3();\r\n const originStart = new Vector3();\r\n const dragOrigin = new Vector3();\r\n const toObjectFrame = new Matrix();\r\n const dragPlaneNormal = new Vector3();\r\n\r\n const projectToRef = (position: Vector3, normal: Vector3, origin: Vector3, ref: Vector3) => {\r\n // Projects on the plane with its normal and origin\r\n position.subtractToRef(origin, TmpVectors.Vector3[0]);\r\n const dot = Vector3.Dot(TmpVectors.Vector3[0], normal);\r\n TmpVectors.Vector3[1].copyFrom(normal).scaleInPlace(dot);\r\n TmpVectors.Vector3[0].subtractInPlace(TmpVectors.Vector3[1]);\r\n TmpVectors.Vector3[0].addToRef(origin, ref);\r\n };\r\n\r\n const dragStart = (event: { position: Vector3 }) => {\r\n if (this.attachedSlate && this.attachedMesh) {\r\n dimensionsStart.set(this.attachedSlate.dimensions.x, this.attachedSlate.dimensions.y, Epsilon);\r\n originStart.copyFrom(this.attachedSlate.origin);\r\n dragOrigin.copyFrom(event.position);\r\n toObjectFrame.copyFrom(this.attachedMesh.computeWorldMatrix(true));\r\n toObjectFrame.invert();\r\n this.attachedSlate._followButton.isToggled = false;\r\n Vector3.TransformNormalToRef(Vector3.Forward(), this.attachedMesh.getWorldMatrix(), dragPlaneNormal);\r\n dragPlaneNormal.normalize();\r\n\r\n if (this._handleHovered) {\r\n this._handleDragged = this._handleHovered;\r\n this._handleDragged.drag = true;\r\n }\r\n }\r\n };\r\n\r\n const dragging = (event: { position: Vector3 }) => {\r\n if (this.attachedSlate && this.attachedMesh) {\r\n projectToRef(event.position, dragPlaneNormal, dragOrigin, this._tmpVector);\r\n this._tmpVector.subtractInPlace(dragOrigin);\r\n Vector3.TransformNormalToRef(this._tmpVector, toObjectFrame, this._tmpVector);\r\n\r\n moveFn(originStart, dimensionsStart, this._tmpVector, masks);\r\n this.attachedSlate._positionElements();\r\n this.updateBoundingBox();\r\n }\r\n };\r\n\r\n const dragEnd = () => {\r\n if (this.attachedSlate && this.attachedNode) {\r\n this.attachedSlate._updatePivot();\r\n\r\n if (this._handleDragged) {\r\n this._handleDragged.drag = false;\r\n this._handleDragged = null;\r\n }\r\n }\r\n };\r\n\r\n handle.setDragBehavior(dragStart, dragging, dragEnd);\r\n }\r\n\r\n private _assignDragBehaviorSides(handle: GizmoHandle, dragPlaneNormal: Vector3) {\r\n const quaternionOrigin = new Quaternion();\r\n const dragOrigin = new Vector3();\r\n const directionOrigin = new Vector3();\r\n const worldPivot = new Vector3();\r\n const worldPlaneNormal = new Vector3();\r\n\r\n const dragStart = (event: { position: Vector3 }) => {\r\n if (this.attachedSlate && this.attachedMesh) {\r\n quaternionOrigin.copyFrom(this.attachedMesh.rotationQuaternion!);\r\n dragOrigin.copyFrom(event.position);\r\n worldPivot.copyFrom(this.attachedMesh.getAbsolutePivotPoint());\r\n directionOrigin.copyFrom(dragOrigin).subtractInPlace(worldPivot).normalize();\r\n this.attachedSlate._followButton.isToggled = false;\r\n Vector3.TransformNormalToRef(dragPlaneNormal, this.attachedMesh.getWorldMatrix(), worldPlaneNormal);\r\n worldPlaneNormal.normalize();\r\n\r\n if (this._handleHovered) {\r\n this._handleDragged = this._handleHovered;\r\n this._handleDragged.drag = true;\r\n }\r\n }\r\n };\r\n\r\n const dragging = (event: { position: Vector3 }) => {\r\n if (this.attachedSlate && this.attachedMesh) {\r\n this._tmpVector.copyFrom(event.position);\r\n this._tmpVector.subtractInPlace(worldPivot);\r\n this._tmpVector.normalize();\r\n\r\n const angle = -Vector3.GetAngleBetweenVectorsOnPlane(this._tmpVector, directionOrigin, worldPlaneNormal);\r\n Quaternion.RotationAxisToRef(dragPlaneNormal, angle, this._tmpQuaternion);\r\n quaternionOrigin.multiplyToRef(this._tmpQuaternion, this.attachedMesh.rotationQuaternion!);\r\n }\r\n };\r\n\r\n const dragEnd = () => {\r\n if (this.attachedSlate && this.attachedNode) {\r\n this.attachedSlate._updatePivot();\r\n\r\n if (this._handleDragged) {\r\n this._handleDragged.drag = false;\r\n this._handleDragged = null;\r\n }\r\n }\r\n };\r\n\r\n handle.setDragBehavior(dragStart, dragging, dragEnd);\r\n }\r\n\r\n protected _attachedNodeChanged(value: Nullable<AbstractMesh>) {\r\n if (value) {\r\n this.updateBoundingBox();\r\n }\r\n }\r\n\r\n /**\r\n * Updates the bounding box information for the gizmo\r\n */\r\n public updateBoundingBox() {\r\n if (this.attachedMesh) {\r\n PivotTools._RemoveAndStorePivotPoint(this.attachedMesh);\r\n\r\n // Store original parent\r\n const originalParent = this.attachedMesh.parent;\r\n this.attachedMesh.setParent(null);\r\n\r\n this._update();\r\n\r\n // Rotate based on axis\r\n if (!this.attachedMesh.rotationQuaternion) {\r\n this.attachedMesh.rotationQuaternion = Quaternion.RotationYawPitchRoll(this.attachedMesh.rotation.y, this.attachedMesh.rotation.x, this.attachedMesh.rotation.z);\r\n }\r\n\r\n // Store original position and reset mesh to origin before computing the bounding box\r\n this._tmpQuaternion.copyFrom(this.attachedMesh.rotationQuaternion);\r\n this._tmpVector.copyFrom(this.attachedMesh.position);\r\n this.attachedMesh.rotationQuaternion.set(0, 0, 0, 1);\r\n this.attachedMesh.position.set(0, 0, 0);\r\n\r\n // Update bounding dimensions/positions\r\n const boundingMinMax = this.attachedMesh.getHierarchyBoundingVectors();\r\n boundingMinMax.max.subtractToRef(boundingMinMax.min, this._boundingDimensions);\r\n this._boundingBoxGizmo.min = boundingMinMax.min;\r\n this._boundingBoxGizmo.max = boundingMinMax.max;\r\n\r\n // Update handles of the gizmo\r\n this._updateHandlesPosition();\r\n this._updateHandlesScaling();\r\n\r\n // Restore position/rotation values\r\n this.attachedMesh.rotationQuaternion.copyFrom(this._tmpQuaternion);\r\n this.attachedMesh.position.copyFrom(this._tmpVector);\r\n\r\n PivotTools._RestorePivotPoint(this.attachedMesh);\r\n\r\n // Restore original parent\r\n this.attachedMesh.setParent(originalParent);\r\n this.attachedMesh.computeWorldMatrix(true);\r\n\r\n this._existingSlateScale.copyFrom(this.attachedMesh.scaling);\r\n }\r\n }\r\n\r\n private _updateHandlesPosition() {\r\n const min = this._boundingBoxGizmo.min.clone();\r\n const max = this._boundingBoxGizmo.max.clone();\r\n\r\n const handleScaling = this._corners[0].node.scaling.length();\r\n min.x -= this._margin * handleScaling;\r\n min.y -= this._margin * handleScaling;\r\n max.x += this._margin * handleScaling;\r\n max.y += this._margin * handleScaling;\r\n\r\n const center = min.add(max).scaleInPlace(0.5);\r\n\r\n this._corners[0].node.position.copyFromFloats(min.x, min.y, 0);\r\n this._corners[1].node.position.copyFromFloats(max.x, min.y, 0);\r\n this._corners[2].node.position.copyFromFloats(max.x, max.y, 0);\r\n this._corners[3].node.position.copyFromFloats(min.x, max.y, 0);\r\n\r\n this._sides[0].node.position.copyFromFloats(min.x, center.y, 0);\r\n this._sides[1].node.position.copyFromFloats(center.x, min.y, 0);\r\n this._sides[2].node.position.copyFromFloats(max.x, center.y, 0);\r\n this._sides[3].node.position.copyFromFloats(center.x, max.y, 0);\r\n }\r\n\r\n private _updateHandlesScaling() {\r\n if (this._attachedSlate && this._attachedSlate.mesh) {\r\n const scaledWidth = this._attachedSlate.mesh.scaling.x * this._attachedSlate.dimensions.x;\r\n const scaledHeight = this._attachedSlate.mesh.scaling.y * this._attachedSlate.dimensions.y;\r\n const scale = Math.min(scaledWidth, scaledHeight) * this._handleSize;\r\n for (let index = 0; index < this._corners.length; index++) {\r\n this._corners[index].node.scaling.setAll(scale);\r\n }\r\n for (let index = 0; index < this._sides.length; index++) {\r\n this._sides[index].node.scaling.setAll(scale);\r\n }\r\n }\r\n }\r\n\r\n protected _update() {\r\n super._update();\r\n\r\n if (!this.gizmoLayer.utilityLayerScene.activeCamera) {\r\n return;\r\n }\r\n\r\n if (this._attachedSlate && this._attachedSlate.mesh) {\r\n if (this.fixedScreenSize) {\r\n this._attachedSlate.mesh.absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position, this._tmpVector);\r\n const distanceFromCamera = (this._handleSize * this._tmpVector.length()) / this.fixedScreenSizeDistanceFactor;\r\n for (let i = 0; i < this._corners.length; i++) {\r\n this._corners[i].node.scaling.set(distanceFromCamera, distanceFromCamera, distanceFromCamera);\r\n }\r\n for (let i = 0; i < this._sides.length; i++) {\r\n this._sides[i].node.scaling.set(distanceFromCamera, distanceFromCamera, distanceFromCamera);\r\n }\r\n }\r\n this._updateHandlesPosition();\r\n }\r\n }\r\n\r\n public dispose() {\r\n this.gizmoLayer.originalScene.onBeforeRenderObservable.remove(this._renderObserver);\r\n\r\n // Will dispose rootMesh and all descendants\r\n super.dispose();\r\n\r\n for (const corner of this._corners) {\r\n corner.dispose();\r\n }\r\n\r\n for (const side of this._sides) {\r\n side.dispose();\r\n }\r\n }\r\n}\r\n"]}
|
1
|
+
{"version":3,"file":"slateGizmo.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/gizmos/slateGizmo.ts"],"names":[],"mappings":"AAAA,OA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G,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;oBACzC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,kBAAkB,EAAE,kBAAkB,CAAC,CAAC;iBAC/F;aACJ;YACD,IAAI,CAAC,sBAAsB,EAAE,CAAC;SACjC;IACL,CAAC;IAEe,OAAO;QACnB,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,wBAAwB,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAEpF,4CAA4C;QAC5C,KAAK,CAAC,OAAO,EAAE,CAAC;QAEhB,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,QAAQ,EAAE;YAChC,MAAM,CAAC,OAAO,EAAE,CAAC;SACpB;QAED,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM,EAAE;YAC5B,IAAI,CAAC,OAAO,EAAE,CAAC;SAClB;IACL,CAAC;CACJ","sourcesContent":["import { Gizmo } from \"core/Gizmos/gizmo\";\r\nimport { Epsilon } from \"core/Maths/math.constants\";\r\nimport { Matrix, Quaternion, TmpVectors, Vector3 } from \"core/Maths/math.vector\";\r\nimport type { Scene } from \"core/scene\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { TransformNode } from \"core/Meshes/transformNode\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport { PivotTools } from \"core/Misc/pivotTools\";\r\nimport type { UtilityLayerRenderer } from \"core/Rendering/utilityLayerRenderer\";\r\nimport type { Nullable } from \"core/types\";\r\n\r\nimport type { HolographicSlate } from \"../controls/holographicSlate\";\r\nimport type { GizmoHandle } from \"./gizmoHandle\";\r\nimport { CornerHandle, SideHandle } from \"./gizmoHandle\";\r\n\r\n// Mask contains the influence of the drag offset vectors on dimensions or origin of the slate\r\n// Mask vector is multiplied to the offset vector\r\ntype HandleMasks = {\r\n dimensions: Vector3;\r\n origin: Vector3;\r\n};\r\n\r\n/**\r\n * Gizmo to resize 2D slates\r\n */\r\nexport class SlateGizmo extends Gizmo {\r\n private _boundingDimensions = new Vector3(0, 0, 0);\r\n private _pickedPointObserver: Nullable<Observer<Nullable<AbstractMesh>>>;\r\n private _renderObserver: Nullable<Observer<Scene>> = null;\r\n\r\n private _tmpQuaternion = new Quaternion();\r\n private _tmpVector = new Vector3(0, 0, 0);\r\n\r\n // Ordered bl, br, tr, tl\r\n private _corners: CornerHandle[] = [];\r\n // Ordered left, bottom, right, top\r\n private _sides: SideHandle[] = [];\r\n private _handlesParent: TransformNode;\r\n private _handleHovered: Nullable<GizmoHandle>;\r\n private _handleDragged: Nullable<GizmoHandle>;\r\n\r\n private _boundingBoxGizmo = {\r\n min: new Vector3(),\r\n max: new Vector3(),\r\n };\r\n\r\n /**\r\n * Value we use to offset handles from mesh\r\n */\r\n private _margin = 0.35;\r\n private _handleSize = 0.075;\r\n private _attachedSlate: Nullable<HolographicSlate> = null;\r\n private _existingSlateScale = new Vector3();\r\n /**\r\n * If set, the handles will increase in size based on the distance away from the camera to have a consistent screen size (Default: true)\r\n */\r\n public fixedScreenSize = false;\r\n /**\r\n * The distance away from the object which the draggable meshes should appear world sized when fixedScreenSize is set to true (default: 10)\r\n */\r\n public fixedScreenSizeDistanceFactor = 10;\r\n\r\n /**\r\n * The slate attached to this gizmo\r\n */\r\n public set attachedSlate(control: Nullable<HolographicSlate>) {\r\n if (control) {\r\n this.attachedMesh = control.mesh;\r\n this.updateBoundingBox();\r\n\r\n this._pickedPointObserver = control._host.onPickingObservable.add((pickedMesh) => {\r\n if (this._handleHovered && (!pickedMesh || pickedMesh.parent !== this._handleHovered.node)) {\r\n this._handleHovered.hover = false;\r\n this._handleHovered = null;\r\n }\r\n\r\n if (pickedMesh && pickedMesh.parent && pickedMesh.parent.reservedDataStore && pickedMesh.parent.reservedDataStore.handle) {\r\n const handle = pickedMesh.parent.reservedDataStore.handle as GizmoHandle;\r\n if (handle.gizmo === this) {\r\n this._handleHovered = handle;\r\n this._handleHovered.hover = true;\r\n }\r\n }\r\n });\r\n } else if (this._attachedSlate) {\r\n this._attachedSlate._host.onPickingObservable.remove(this._pickedPointObserver);\r\n }\r\n this._attachedSlate = control;\r\n }\r\n\r\n public get attachedSlate(): Nullable<HolographicSlate> {\r\n return this._attachedSlate;\r\n }\r\n\r\n constructor(utilityLayer?: UtilityLayerRenderer) {\r\n super(utilityLayer);\r\n\r\n this._createNode();\r\n this.updateScale = false;\r\n\r\n this._renderObserver = this.gizmoLayer.originalScene.onBeforeRenderObservable.add(() => {\r\n // Only update the bounding box if scaling has changed\r\n if (this.attachedMesh && !this._existingSlateScale.equals(this.attachedMesh.scaling)) {\r\n this.updateBoundingBox();\r\n }\r\n });\r\n }\r\n\r\n private _createNode() {\r\n this._handlesParent = new TransformNode(\"handlesParent\", this.gizmoLayer.utilityLayerScene);\r\n this._handlesParent.rotationQuaternion = Quaternion.Identity();\r\n\r\n const masksCorners = [\r\n {\r\n dimensions: new Vector3(-1, -1, 0),\r\n origin: new Vector3(1, 0, 0),\r\n },\r\n {\r\n dimensions: new Vector3(1, -1, 0),\r\n origin: new Vector3(0, 0, 0),\r\n },\r\n {\r\n dimensions: new Vector3(1, 1, 0),\r\n origin: new Vector3(0, 1, 0),\r\n },\r\n {\r\n dimensions: new Vector3(-1, 1, 0),\r\n origin: new Vector3(1, 1, 0),\r\n },\r\n ];\r\n\r\n for (let i = 0; i < 4; i++) {\r\n const corner = new CornerHandle(this, this.gizmoLayer.utilityLayerScene);\r\n this._corners.push(corner);\r\n corner.node.rotation.z = (Math.PI / 2) * i;\r\n\r\n corner.node.parent = this._handlesParent;\r\n this._assignDragBehaviorCorners(\r\n corner,\r\n (originStart: Vector3, dimensionsStart: Vector3, offset: Vector3, masks: HandleMasks) => this._moveHandle(originStart, dimensionsStart, offset, masks, true),\r\n masksCorners[i]\r\n );\r\n }\r\n\r\n for (let i = 0; i < 4; i++) {\r\n const side = new SideHandle(this, this.gizmoLayer.utilityLayerScene);\r\n this._sides.push(side);\r\n side.node.rotation.z = (Math.PI / 2) * i;\r\n side.node.parent = this._handlesParent;\r\n this._assignDragBehaviorSides(side, i % 2 === 0 ? new Vector3(0, 1, 0) : new Vector3(1, 0, 0));\r\n }\r\n\r\n this._handlesParent.parent = this._rootMesh;\r\n }\r\n\r\n private _keepAspectRatio(vector: Vector3, aspectRatio: number, invertDiagonal: boolean = false) {\r\n const axis = TmpVectors.Vector3[0];\r\n axis.copyFromFloats(aspectRatio, 1, 0).normalize();\r\n if (invertDiagonal) {\r\n axis.y *= -1;\r\n }\r\n const dot = Vector3.Dot(vector, axis);\r\n vector.copyFrom(axis).scaleInPlace(dot);\r\n }\r\n\r\n private _clampDimensions(vector: Vector3, dimensions: Vector3, mask: Vector3, keepAspectRatio: boolean = false) {\r\n const impact = TmpVectors.Vector3[0];\r\n impact.copyFrom(vector).multiplyInPlace(mask);\r\n\r\n const clampedDimensions = TmpVectors.Vector3[1];\r\n clampedDimensions.copyFromFloats(\r\n Math.max(this._attachedSlate!.minDimensions.x, impact.x + dimensions.x),\r\n Math.max(this._attachedSlate!.minDimensions.y, impact.y + dimensions.y),\r\n 0\r\n );\r\n\r\n if (keepAspectRatio) {\r\n // Extra logic to ensure the ratio is maintained when the vector has been clamped\r\n const ratio = dimensions.x / dimensions.y;\r\n clampedDimensions.x = Math.max(clampedDimensions.x, clampedDimensions.y * ratio);\r\n clampedDimensions.y = Math.max(clampedDimensions.y, clampedDimensions.x / ratio);\r\n }\r\n\r\n // Calculating the real impact of vector on clamped dimensions\r\n impact.copyFrom(clampedDimensions).subtractInPlace(dimensions);\r\n\r\n vector.x = Math.sign(vector.x) * Math.abs(impact.x);\r\n vector.y = Math.sign(vector.y) * Math.abs(impact.y);\r\n }\r\n\r\n private _moveHandle(originStart: Vector3, dimensionsStart: Vector3, offset: Vector3, masks: HandleMasks, isCorner: boolean) {\r\n if (!this._attachedSlate) {\r\n return;\r\n }\r\n\r\n if (isCorner) {\r\n const aspectRatio = dimensionsStart.x / dimensionsStart.y;\r\n this._keepAspectRatio(offset, aspectRatio, masks.dimensions.x * masks.dimensions.y < 0);\r\n }\r\n this._clampDimensions(offset, dimensionsStart, masks.dimensions, isCorner);\r\n\r\n const offsetOriginMasked = TmpVectors.Vector3[0];\r\n const offsetDimensionsMasked = TmpVectors.Vector3[1];\r\n offsetOriginMasked.copyFrom(offset).multiplyInPlace(masks.origin);\r\n offsetDimensionsMasked.copyFrom(offset).multiplyInPlace(masks.dimensions);\r\n\r\n this._attachedSlate.origin.copyFrom(originStart).addInPlace(offsetOriginMasked);\r\n this._attachedSlate.dimensions.set(dimensionsStart.x + offsetDimensionsMasked.x, dimensionsStart.y + offsetDimensionsMasked.y);\r\n }\r\n\r\n private _assignDragBehaviorCorners(\r\n handle: GizmoHandle,\r\n moveFn: (originStart: Vector3, dimensionsStart: Vector3, offset: Vector3, masks: HandleMasks) => void,\r\n masks: HandleMasks\r\n ) {\r\n const dimensionsStart = new Vector3();\r\n const originStart = new Vector3();\r\n const dragOrigin = new Vector3();\r\n const toObjectFrame = new Matrix();\r\n const dragPlaneNormal = new Vector3();\r\n\r\n const projectToRef = (position: Vector3, normal: Vector3, origin: Vector3, ref: Vector3) => {\r\n // Projects on the plane with its normal and origin\r\n position.subtractToRef(origin, TmpVectors.Vector3[0]);\r\n const dot = Vector3.Dot(TmpVectors.Vector3[0], normal);\r\n TmpVectors.Vector3[1].copyFrom(normal).scaleInPlace(dot);\r\n TmpVectors.Vector3[0].subtractInPlace(TmpVectors.Vector3[1]);\r\n TmpVectors.Vector3[0].addToRef(origin, ref);\r\n };\r\n\r\n const dragStart = (event: { position: Vector3 }) => {\r\n if (this.attachedSlate && this.attachedMesh) {\r\n dimensionsStart.set(this.attachedSlate.dimensions.x, this.attachedSlate.dimensions.y, Epsilon);\r\n originStart.copyFrom(this.attachedSlate.origin);\r\n dragOrigin.copyFrom(event.position);\r\n toObjectFrame.copyFrom(this.attachedMesh.computeWorldMatrix(true));\r\n toObjectFrame.invert();\r\n this.attachedSlate._followButton.isToggled = false;\r\n Vector3.TransformNormalToRef(Vector3.Forward(), this.attachedMesh.getWorldMatrix(), dragPlaneNormal);\r\n dragPlaneNormal.normalize();\r\n\r\n if (this._handleHovered) {\r\n this._handleDragged = this._handleHovered;\r\n this._handleDragged.drag = true;\r\n }\r\n }\r\n };\r\n\r\n const dragging = (event: { position: Vector3 }) => {\r\n if (this.attachedSlate && this.attachedMesh) {\r\n projectToRef(event.position, dragPlaneNormal, dragOrigin, this._tmpVector);\r\n this._tmpVector.subtractInPlace(dragOrigin);\r\n Vector3.TransformNormalToRef(this._tmpVector, toObjectFrame, this._tmpVector);\r\n\r\n moveFn(originStart, dimensionsStart, this._tmpVector, masks);\r\n this.attachedSlate._positionElements();\r\n this.updateBoundingBox();\r\n }\r\n };\r\n\r\n const dragEnd = () => {\r\n if (this.attachedSlate && this.attachedNode) {\r\n this.attachedSlate._updatePivot();\r\n\r\n if (this._handleDragged) {\r\n this._handleDragged.drag = false;\r\n this._handleDragged = null;\r\n }\r\n }\r\n };\r\n\r\n handle.setDragBehavior(dragStart, dragging, dragEnd);\r\n }\r\n\r\n private _assignDragBehaviorSides(handle: GizmoHandle, dragPlaneNormal: Vector3) {\r\n const quaternionOrigin = new Quaternion();\r\n const dragOrigin = new Vector3();\r\n const directionOrigin = new Vector3();\r\n const worldPivot = new Vector3();\r\n const worldPlaneNormal = new Vector3();\r\n\r\n const dragStart = (event: { position: Vector3 }) => {\r\n if (this.attachedSlate && this.attachedMesh) {\r\n quaternionOrigin.copyFrom(this.attachedMesh.rotationQuaternion!);\r\n dragOrigin.copyFrom(event.position);\r\n worldPivot.copyFrom(this.attachedMesh.getAbsolutePivotPoint());\r\n directionOrigin.copyFrom(dragOrigin).subtractInPlace(worldPivot).normalize();\r\n this.attachedSlate._followButton.isToggled = false;\r\n Vector3.TransformNormalToRef(dragPlaneNormal, this.attachedMesh.getWorldMatrix(), worldPlaneNormal);\r\n worldPlaneNormal.normalize();\r\n\r\n if (this._handleHovered) {\r\n this._handleDragged = this._handleHovered;\r\n this._handleDragged.drag = true;\r\n }\r\n }\r\n };\r\n\r\n const dragging = (event: { position: Vector3 }) => {\r\n if (this.attachedSlate && this.attachedMesh) {\r\n this._tmpVector.copyFrom(event.position);\r\n this._tmpVector.subtractInPlace(worldPivot);\r\n this._tmpVector.normalize();\r\n\r\n const angle = -Vector3.GetAngleBetweenVectorsOnPlane(this._tmpVector, directionOrigin, worldPlaneNormal);\r\n Quaternion.RotationAxisToRef(dragPlaneNormal, angle, this._tmpQuaternion);\r\n quaternionOrigin.multiplyToRef(this._tmpQuaternion, this.attachedMesh.rotationQuaternion!);\r\n }\r\n };\r\n\r\n const dragEnd = () => {\r\n if (this.attachedSlate && this.attachedNode) {\r\n this.attachedSlate._updatePivot();\r\n\r\n if (this._handleDragged) {\r\n this._handleDragged.drag = false;\r\n this._handleDragged = null;\r\n }\r\n }\r\n };\r\n\r\n handle.setDragBehavior(dragStart, dragging, dragEnd);\r\n }\r\n\r\n protected override _attachedNodeChanged(value: Nullable<AbstractMesh>) {\r\n if (value) {\r\n this.updateBoundingBox();\r\n }\r\n }\r\n\r\n /**\r\n * Updates the bounding box information for the gizmo\r\n */\r\n public updateBoundingBox() {\r\n if (this.attachedMesh) {\r\n PivotTools._RemoveAndStorePivotPoint(this.attachedMesh);\r\n\r\n // Store original parent\r\n const originalParent = this.attachedMesh.parent;\r\n this.attachedMesh.setParent(null);\r\n\r\n this._update();\r\n\r\n // Rotate based on axis\r\n if (!this.attachedMesh.rotationQuaternion) {\r\n this.attachedMesh.rotationQuaternion = Quaternion.RotationYawPitchRoll(this.attachedMesh.rotation.y, this.attachedMesh.rotation.x, this.attachedMesh.rotation.z);\r\n }\r\n\r\n // Store original position and reset mesh to origin before computing the bounding box\r\n this._tmpQuaternion.copyFrom(this.attachedMesh.rotationQuaternion);\r\n this._tmpVector.copyFrom(this.attachedMesh.position);\r\n this.attachedMesh.rotationQuaternion.set(0, 0, 0, 1);\r\n this.attachedMesh.position.set(0, 0, 0);\r\n\r\n // Update bounding dimensions/positions\r\n const boundingMinMax = this.attachedMesh.getHierarchyBoundingVectors();\r\n boundingMinMax.max.subtractToRef(boundingMinMax.min, this._boundingDimensions);\r\n this._boundingBoxGizmo.min = boundingMinMax.min;\r\n this._boundingBoxGizmo.max = boundingMinMax.max;\r\n\r\n // Update handles of the gizmo\r\n this._updateHandlesPosition();\r\n this._updateHandlesScaling();\r\n\r\n // Restore position/rotation values\r\n this.attachedMesh.rotationQuaternion.copyFrom(this._tmpQuaternion);\r\n this.attachedMesh.position.copyFrom(this._tmpVector);\r\n\r\n PivotTools._RestorePivotPoint(this.attachedMesh);\r\n\r\n // Restore original parent\r\n this.attachedMesh.setParent(originalParent);\r\n this.attachedMesh.computeWorldMatrix(true);\r\n\r\n this._existingSlateScale.copyFrom(this.attachedMesh.scaling);\r\n }\r\n }\r\n\r\n private _updateHandlesPosition() {\r\n const min = this._boundingBoxGizmo.min.clone();\r\n const max = this._boundingBoxGizmo.max.clone();\r\n\r\n const handleScaling = this._corners[0].node.scaling.length();\r\n min.x -= this._margin * handleScaling;\r\n min.y -= this._margin * handleScaling;\r\n max.x += this._margin * handleScaling;\r\n max.y += this._margin * handleScaling;\r\n\r\n const center = min.add(max).scaleInPlace(0.5);\r\n\r\n this._corners[0].node.position.copyFromFloats(min.x, min.y, 0);\r\n this._corners[1].node.position.copyFromFloats(max.x, min.y, 0);\r\n this._corners[2].node.position.copyFromFloats(max.x, max.y, 0);\r\n this._corners[3].node.position.copyFromFloats(min.x, max.y, 0);\r\n\r\n this._sides[0].node.position.copyFromFloats(min.x, center.y, 0);\r\n this._sides[1].node.position.copyFromFloats(center.x, min.y, 0);\r\n this._sides[2].node.position.copyFromFloats(max.x, center.y, 0);\r\n this._sides[3].node.position.copyFromFloats(center.x, max.y, 0);\r\n }\r\n\r\n private _updateHandlesScaling() {\r\n if (this._attachedSlate && this._attachedSlate.mesh) {\r\n const scaledWidth = this._attachedSlate.mesh.scaling.x * this._attachedSlate.dimensions.x;\r\n const scaledHeight = this._attachedSlate.mesh.scaling.y * this._attachedSlate.dimensions.y;\r\n const scale = Math.min(scaledWidth, scaledHeight) * this._handleSize;\r\n for (let index = 0; index < this._corners.length; index++) {\r\n this._corners[index].node.scaling.setAll(scale);\r\n }\r\n for (let index = 0; index < this._sides.length; index++) {\r\n this._sides[index].node.scaling.setAll(scale);\r\n }\r\n }\r\n }\r\n\r\n protected override _update() {\r\n super._update();\r\n\r\n if (!this.gizmoLayer.utilityLayerScene.activeCamera) {\r\n return;\r\n }\r\n\r\n if (this._attachedSlate && this._attachedSlate.mesh) {\r\n if (this.fixedScreenSize) {\r\n this._attachedSlate.mesh.absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position, this._tmpVector);\r\n const distanceFromCamera = (this._handleSize * this._tmpVector.length()) / this.fixedScreenSizeDistanceFactor;\r\n for (let i = 0; i < this._corners.length; i++) {\r\n this._corners[i].node.scaling.set(distanceFromCamera, distanceFromCamera, distanceFromCamera);\r\n }\r\n for (let i = 0; i < this._sides.length; i++) {\r\n this._sides[i].node.scaling.set(distanceFromCamera, distanceFromCamera, distanceFromCamera);\r\n }\r\n }\r\n this._updateHandlesPosition();\r\n }\r\n }\r\n\r\n public override dispose() {\r\n this.gizmoLayer.originalScene.onBeforeRenderObservable.remove(this._renderObserver);\r\n\r\n // Will dispose rootMesh and all descendants\r\n super.dispose();\r\n\r\n for (const corner of this._corners) {\r\n corner.dispose();\r\n }\r\n\r\n for (const side of this._sides) {\r\n side.dispose();\r\n }\r\n }\r\n}\r\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"fluentMaterial.js","sourceRoot":"","sources":["../../../../../../dev/gui/src/3D/materials/fluent/fluentMaterial.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,SAAS,EAAE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AAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAC3G,CAAC;CACJ;AA9RU;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,CAAC;+DAChB;AAM9B;IADN,iBAAiB,EAAE;sDAC8B;AAM3C;IADN,iBAAiB,EAAE;mDAC4B;AAOzC;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,CAAC;qDACxB;AAMtB;IADN,SAAS,EAAE;mDACa;AAMlB;IADN,SAAS,EAAE;0DACqB;AAM1B;IADN,SAAS,EAAE;sDACgB;AAOrB;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,CAAC;wDACrB;AAMzB;IADN,SAAS,EAAE;mDACc;AAMnB;IADN,iBAAiB,EAAE;kDAC+B;AAM5C;IADN,kBAAkB,EAAE;qDACiB;AAG9B;IADP,kBAAkB,CAAC,eAAe,CAAC;sDACU;AAIvC;IADN,gBAAgB,CAAC,yCAAyC,CAAC;qDAChB;AA2NhD,aAAa,CAAC,4BAA4B,EAAE,cAAc,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\r\nimport { serializeAsColor4, serializeAsVector3, serializeAsTexture, serialize, expandToProperty, serializeAsColor3 } from \"core/Misc/decorators\";\r\nimport { SerializationHelper } from \"core/Misc/decorators.serialization\";\r\nimport type { Matrix } from \"core/Maths/math.vector\";\r\nimport { Vector3, TmpVectors } from \"core/Maths/math.vector\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { MaterialDefines } from \"core/Materials/materialDefines\";\r\nimport type { IEffectCreationOptions } from \"core/Materials/effect\";\r\nimport { PushMaterial } from \"core/Materials/pushMaterial\";\r\nimport { VertexBuffer } from \"core/Buffers/buffer\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport type { SubMesh } from \"core/Meshes/subMesh\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport type { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { Color3, Color4 } from \"core/Maths/math.color\";\r\n\r\nimport \"./shaders/fluent.vertex\";\r\nimport \"./shaders/fluent.fragment\";\r\nimport { PrepareUniformsAndSamplersList } from \"core/Materials/materialHelper.functions\";\r\n\r\n/** @internal */\r\nexport class FluentMaterialDefines extends MaterialDefines {\r\n public INNERGLOW = false;\r\n public BORDER = false;\r\n public HOVERLIGHT = false;\r\n public TEXTURE = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\n/**\r\n * Class used to render controls with fluent design\r\n */\r\nexport class FluentMaterial extends PushMaterial {\r\n /**\r\n * Gets or sets inner glow intensity. A value of 0 means no glow (default is 0.5)\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public innerGlowColorIntensity = 0.5;\r\n\r\n /**\r\n * Gets or sets the inner glow color (white by default)\r\n */\r\n @serializeAsColor3()\r\n public innerGlowColor = new Color3(1.0, 1.0, 1.0);\r\n\r\n /**\r\n * Gets or sets the albedo color (Default is Color3(0.3, 0.35, 0.4))\r\n */\r\n @serializeAsColor3()\r\n public albedoColor = new Color3(0.3, 0.35, 0.4);\r\n\r\n /**\r\n * Gets or sets a boolean indicating if borders must be rendered (default is false)\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public renderBorders = false;\r\n\r\n /**\r\n * Gets or sets border width (default is 0.5)\r\n */\r\n @serialize()\r\n public borderWidth = 0.5;\r\n\r\n /**\r\n * Gets or sets a value indicating the smoothing value applied to border edges (0.02 by default)\r\n */\r\n @serialize()\r\n public edgeSmoothingValue = 0.02;\r\n\r\n /**\r\n * Gets or sets the minimum value that can be applied to border width (default is 0.1)\r\n */\r\n @serialize()\r\n public borderMinValue = 0.1;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if hover light must be rendered (default is false)\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public renderHoverLight = false;\r\n\r\n /**\r\n * Gets or sets the radius used to render the hover light (default is 0.01)\r\n */\r\n @serialize()\r\n public hoverRadius = 0.01;\r\n\r\n /**\r\n * Gets or sets the color used to render the hover light (default is Color4(0.3, 0.3, 0.3, 1.0))\r\n */\r\n @serializeAsColor4()\r\n public hoverColor = new Color4(0.3, 0.3, 0.3, 1.0);\r\n\r\n /**\r\n * Gets or sets the hover light position in world space (default is Vector3.Zero())\r\n */\r\n @serializeAsVector3()\r\n public hoverPosition = Vector3.Zero();\r\n\r\n @serializeAsTexture(\"albedoTexture\")\r\n private _albedoTexture: Nullable<BaseTexture>;\r\n\r\n /** Gets or sets the texture to use for albedo color */\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n public albedoTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Creates a new Fluent material\r\n * @param name defines the name of the material\r\n * @param scene defines the hosting scene\r\n */\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n public needAlphaBlending(): boolean {\r\n return this.alpha !== 1.0;\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh): boolean {\r\n const drawWrapper = subMesh._drawWrapper;\r\n\r\n if (this.isFrozen) {\r\n if (drawWrapper.effect && drawWrapper._wasPreviouslyReady) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh.materialDefines) {\r\n subMesh.materialDefines = new FluentMaterialDefines();\r\n }\r\n\r\n const scene = this.getScene();\r\n const defines = <FluentMaterialDefines>subMesh.materialDefines;\r\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\r\n if (defines._renderId === scene.getRenderId()) {\r\n return true;\r\n }\r\n }\r\n\r\n if (defines._areTexturesDirty) {\r\n defines.INNERGLOW = this.innerGlowColorIntensity > 0;\r\n defines.BORDER = this.renderBorders;\r\n defines.HOVERLIGHT = this.renderHoverLight;\r\n\r\n if (this._albedoTexture) {\r\n if (!this._albedoTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n } else {\r\n defines.TEXTURE = true;\r\n }\r\n } else {\r\n defines.TEXTURE = false;\r\n }\r\n }\r\n\r\n const engine = scene.getEngine();\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n scene.resetCachedMaterial();\r\n\r\n //Attributes\r\n const attribs = [VertexBuffer.PositionKind];\r\n attribs.push(VertexBuffer.NormalKind);\r\n attribs.push(VertexBuffer.UVKind);\r\n\r\n const shaderName = \"fluent\";\r\n\r\n const uniforms = [\r\n \"world\",\r\n \"viewProjection\",\r\n \"innerGlowColor\",\r\n \"albedoColor\",\r\n \"borderWidth\",\r\n \"edgeSmoothingValue\",\r\n \"scaleFactor\",\r\n \"borderMinValue\",\r\n \"hoverColor\",\r\n \"hoverPosition\",\r\n \"hoverRadius\",\r\n \"textureMatrix\",\r\n ];\r\n\r\n const samplers = [\"albedoSampler\"];\r\n const uniformBuffers: string[] = [];\r\n\r\n PrepareUniformsAndSamplersList(<IEffectCreationOptions>{\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: 4,\r\n });\r\n\r\n const join = defines.toString();\r\n subMesh.setEffect(\r\n scene.getEngine().createEffect(\r\n shaderName,\r\n <IEffectCreationOptions>{\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: null,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: 4 },\r\n },\r\n engine\r\n ),\r\n defines,\r\n this._materialContext\r\n );\r\n }\r\n\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n defines._renderId = scene.getRenderId();\r\n drawWrapper._wasPreviouslyReady = true;\r\n\r\n return true;\r\n }\r\n\r\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const scene = this.getScene();\r\n\r\n const defines = <FluentMaterialDefines>subMesh.materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n const effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n\r\n if (this._mustRebind(scene, effect, subMesh)) {\r\n this._activeEffect.setColor4(\"albedoColor\", this.albedoColor, this.alpha);\r\n\r\n if (defines.INNERGLOW) {\r\n this._activeEffect.setColor4(\"innerGlowColor\", this.innerGlowColor, this.innerGlowColorIntensity);\r\n }\r\n\r\n if (defines.BORDER) {\r\n this._activeEffect.setFloat(\"borderWidth\", this.borderWidth);\r\n this._activeEffect.setFloat(\"edgeSmoothingValue\", this.edgeSmoothingValue);\r\n this._activeEffect.setFloat(\"borderMinValue\", this.borderMinValue);\r\n\r\n mesh.getBoundingInfo().boundingBox.extendSize.multiplyToRef(mesh.scaling, TmpVectors.Vector3[0]);\r\n this._activeEffect.setVector3(\"scaleFactor\", TmpVectors.Vector3[0]);\r\n }\r\n\r\n if (defines.HOVERLIGHT) {\r\n this._activeEffect.setDirectColor4(\"hoverColor\", this.hoverColor);\r\n this._activeEffect.setFloat(\"hoverRadius\", this.hoverRadius);\r\n this._activeEffect.setVector3(\"hoverPosition\", this.hoverPosition);\r\n }\r\n\r\n if (defines.TEXTURE && this._albedoTexture) {\r\n this._activeEffect.setTexture(\"albedoSampler\", this._albedoTexture);\r\n const matrix = this._albedoTexture.getTextureMatrix();\r\n this._activeEffect.setMatrix(\"textureMatrix\", matrix);\r\n }\r\n }\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n public getActiveTextures(): BaseTexture[] {\r\n const activeTextures = super.getActiveTextures();\r\n\r\n return activeTextures;\r\n }\r\n\r\n public hasTexture(texture: BaseTexture): boolean {\r\n if (super.hasTexture(texture)) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public clone(name: string): FluentMaterial {\r\n return SerializationHelper.Clone(() => new FluentMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.GUI.FluentMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public getClassName(): string {\r\n return \"FluentMaterial\";\r\n }\r\n\r\n // Statics\r\n public static Parse(source: any, scene: Scene, rootUrl: string): FluentMaterial {\r\n return SerializationHelper.Parse(() => new FluentMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GUI.FluentMaterial\", FluentMaterial);\r\n"]}
|
1
|
+
{"version":3,"file":"fluentMaterial.js","sourceRoot":"","sources":["../../../../../../dev/gui/src/3D/materials/fluent/fluentMaterial.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,SAAS,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,2CAA6B;AACjJ,OAAO,EAAE,mBAAmB,EAAE,yDAA2C;AAEzE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,6CAA+B;AAE7D,OAAO,EAAE,eAAe,EAAE,qDAAuC;AAEjE,OAAO,EAAE,YAAY,EAAE,kDAAoC;AAC3D,OAAO,EAAE,YAAY,EAAE,0CAA4B;AAKnD,OAAO,EAAE,aAAa,EAAE,0CAA4B;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,4CAA8B;AAE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;AAMlB;IADN,SAAS,EAAE;0DACqB;AAM1B;IADN,SAAS,EAAE;sDACgB;AAOrB;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,CAAC;wDACrB;AAMzB;IADN,SAAS,EAAE;mDACc;AAMnB;IADN,iBAAiB,EAAE;kDAC+B;AAM5C;IADN,kBAAkB,EAAE;qDACiB;AAG9B;IADP,kBAAkB,CAAC,eAAe,CAAC;sDACU;AAIvC;IADN,gBAAgB,CAAC,yCAAyC,CAAC;qDAChB;AA2NhD,aAAa,CAAC,4BAA4B,EAAE,cAAc,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\r\nimport { serializeAsColor4, serializeAsVector3, serializeAsTexture, serialize, expandToProperty, serializeAsColor3 } from \"core/Misc/decorators\";\r\nimport { SerializationHelper } from \"core/Misc/decorators.serialization\";\r\nimport type { Matrix } from \"core/Maths/math.vector\";\r\nimport { Vector3, TmpVectors } from \"core/Maths/math.vector\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { MaterialDefines } from \"core/Materials/materialDefines\";\r\nimport type { IEffectCreationOptions } from \"core/Materials/effect\";\r\nimport { PushMaterial } from \"core/Materials/pushMaterial\";\r\nimport { VertexBuffer } from \"core/Buffers/buffer\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport type { SubMesh } from \"core/Meshes/subMesh\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport type { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { Color3, Color4 } from \"core/Maths/math.color\";\r\n\r\nimport \"./shaders/fluent.vertex\";\r\nimport \"./shaders/fluent.fragment\";\r\nimport { PrepareUniformsAndSamplersList } from \"core/Materials/materialHelper.functions\";\r\n\r\n/** @internal */\r\nexport class FluentMaterialDefines extends MaterialDefines {\r\n public INNERGLOW = false;\r\n public BORDER = false;\r\n public HOVERLIGHT = false;\r\n public TEXTURE = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\n/**\r\n * Class used to render controls with fluent design\r\n */\r\nexport class FluentMaterial extends PushMaterial {\r\n /**\r\n * Gets or sets inner glow intensity. A value of 0 means no glow (default is 0.5)\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public innerGlowColorIntensity = 0.5;\r\n\r\n /**\r\n * Gets or sets the inner glow color (white by default)\r\n */\r\n @serializeAsColor3()\r\n public innerGlowColor = new Color3(1.0, 1.0, 1.0);\r\n\r\n /**\r\n * Gets or sets the albedo color (Default is Color3(0.3, 0.35, 0.4))\r\n */\r\n @serializeAsColor3()\r\n public albedoColor = new Color3(0.3, 0.35, 0.4);\r\n\r\n /**\r\n * Gets or sets a boolean indicating if borders must be rendered (default is false)\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public renderBorders = false;\r\n\r\n /**\r\n * Gets or sets border width (default is 0.5)\r\n */\r\n @serialize()\r\n public borderWidth = 0.5;\r\n\r\n /**\r\n * Gets or sets a value indicating the smoothing value applied to border edges (0.02 by default)\r\n */\r\n @serialize()\r\n public edgeSmoothingValue = 0.02;\r\n\r\n /**\r\n * Gets or sets the minimum value that can be applied to border width (default is 0.1)\r\n */\r\n @serialize()\r\n public borderMinValue = 0.1;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if hover light must be rendered (default is false)\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public renderHoverLight = false;\r\n\r\n /**\r\n * Gets or sets the radius used to render the hover light (default is 0.01)\r\n */\r\n @serialize()\r\n public hoverRadius = 0.01;\r\n\r\n /**\r\n * Gets or sets the color used to render the hover light (default is Color4(0.3, 0.3, 0.3, 1.0))\r\n */\r\n @serializeAsColor4()\r\n public hoverColor = new Color4(0.3, 0.3, 0.3, 1.0);\r\n\r\n /**\r\n * Gets or sets the hover light position in world space (default is Vector3.Zero())\r\n */\r\n @serializeAsVector3()\r\n public hoverPosition = Vector3.Zero();\r\n\r\n @serializeAsTexture(\"albedoTexture\")\r\n private _albedoTexture: Nullable<BaseTexture>;\r\n\r\n /** Gets or sets the texture to use for albedo color */\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n public albedoTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Creates a new Fluent material\r\n * @param name defines the name of the material\r\n * @param scene defines the hosting scene\r\n */\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n public override needAlphaBlending(): boolean {\r\n return this.alpha !== 1.0;\r\n }\r\n\r\n public override needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public override getAlphaTestTexture(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n public override isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh): boolean {\r\n const drawWrapper = subMesh._drawWrapper;\r\n\r\n if (this.isFrozen) {\r\n if (drawWrapper.effect && drawWrapper._wasPreviouslyReady) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh.materialDefines) {\r\n subMesh.materialDefines = new FluentMaterialDefines();\r\n }\r\n\r\n const scene = this.getScene();\r\n const defines = <FluentMaterialDefines>subMesh.materialDefines;\r\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\r\n if (defines._renderId === scene.getRenderId()) {\r\n return true;\r\n }\r\n }\r\n\r\n if (defines._areTexturesDirty) {\r\n defines.INNERGLOW = this.innerGlowColorIntensity > 0;\r\n defines.BORDER = this.renderBorders;\r\n defines.HOVERLIGHT = this.renderHoverLight;\r\n\r\n if (this._albedoTexture) {\r\n if (!this._albedoTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n } else {\r\n defines.TEXTURE = true;\r\n }\r\n } else {\r\n defines.TEXTURE = false;\r\n }\r\n }\r\n\r\n const engine = scene.getEngine();\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n scene.resetCachedMaterial();\r\n\r\n //Attributes\r\n const attribs = [VertexBuffer.PositionKind];\r\n attribs.push(VertexBuffer.NormalKind);\r\n attribs.push(VertexBuffer.UVKind);\r\n\r\n const shaderName = \"fluent\";\r\n\r\n const uniforms = [\r\n \"world\",\r\n \"viewProjection\",\r\n \"innerGlowColor\",\r\n \"albedoColor\",\r\n \"borderWidth\",\r\n \"edgeSmoothingValue\",\r\n \"scaleFactor\",\r\n \"borderMinValue\",\r\n \"hoverColor\",\r\n \"hoverPosition\",\r\n \"hoverRadius\",\r\n \"textureMatrix\",\r\n ];\r\n\r\n const samplers = [\"albedoSampler\"];\r\n const uniformBuffers: string[] = [];\r\n\r\n PrepareUniformsAndSamplersList(<IEffectCreationOptions>{\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: 4,\r\n });\r\n\r\n const join = defines.toString();\r\n subMesh.setEffect(\r\n scene.getEngine().createEffect(\r\n shaderName,\r\n <IEffectCreationOptions>{\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: null,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: 4 },\r\n },\r\n engine\r\n ),\r\n defines,\r\n this._materialContext\r\n );\r\n }\r\n\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n defines._renderId = scene.getRenderId();\r\n drawWrapper._wasPreviouslyReady = true;\r\n\r\n return true;\r\n }\r\n\r\n public override bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const scene = this.getScene();\r\n\r\n const defines = <FluentMaterialDefines>subMesh.materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n const effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n\r\n if (this._mustRebind(scene, effect, subMesh)) {\r\n this._activeEffect.setColor4(\"albedoColor\", this.albedoColor, this.alpha);\r\n\r\n if (defines.INNERGLOW) {\r\n this._activeEffect.setColor4(\"innerGlowColor\", this.innerGlowColor, this.innerGlowColorIntensity);\r\n }\r\n\r\n if (defines.BORDER) {\r\n this._activeEffect.setFloat(\"borderWidth\", this.borderWidth);\r\n this._activeEffect.setFloat(\"edgeSmoothingValue\", this.edgeSmoothingValue);\r\n this._activeEffect.setFloat(\"borderMinValue\", this.borderMinValue);\r\n\r\n mesh.getBoundingInfo().boundingBox.extendSize.multiplyToRef(mesh.scaling, TmpVectors.Vector3[0]);\r\n this._activeEffect.setVector3(\"scaleFactor\", TmpVectors.Vector3[0]);\r\n }\r\n\r\n if (defines.HOVERLIGHT) {\r\n this._activeEffect.setDirectColor4(\"hoverColor\", this.hoverColor);\r\n this._activeEffect.setFloat(\"hoverRadius\", this.hoverRadius);\r\n this._activeEffect.setVector3(\"hoverPosition\", this.hoverPosition);\r\n }\r\n\r\n if (defines.TEXTURE && this._albedoTexture) {\r\n this._activeEffect.setTexture(\"albedoSampler\", this._albedoTexture);\r\n const matrix = this._albedoTexture.getTextureMatrix();\r\n this._activeEffect.setMatrix(\"textureMatrix\", matrix);\r\n }\r\n }\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n public override getActiveTextures(): BaseTexture[] {\r\n const activeTextures = super.getActiveTextures();\r\n\r\n return activeTextures;\r\n }\r\n\r\n public override hasTexture(texture: BaseTexture): boolean {\r\n if (super.hasTexture(texture)) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public override dispose(forceDisposeEffect?: boolean): void {\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public override clone(name: string): FluentMaterial {\r\n return SerializationHelper.Clone(() => new FluentMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.GUI.FluentMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"FluentMaterial\";\r\n }\r\n\r\n // Statics\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): FluentMaterial {\r\n return SerializationHelper.Parse(() => new FluentMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GUI.FluentMaterial\", FluentMaterial);\r\n"]}
|