@babylonjs/gui 7.34.4 → 7.35.1
Sign up to get free protection for your applications and to get access to all the features.
- package/2D/FrameGraph/guiTask.js.map +1 -1
- package/2D/FrameGraph/renderGraphGUIBlock.js.map +1 -1
- package/2D/adtInstrumentation.js.map +1 -1
- package/2D/advancedDynamicTexture.d.ts +1 -1
- 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.js.map +1 -1
- 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/BaseGradient.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/statics.js.map +1 -1
- package/2D/controls/textBlock.js.map +1 -1
- package/2D/controls/textWrapper.js.map +1 -1
- package/2D/controls/toggleButton.js.map +1 -1
- package/2D/controls/virtualKeyboard.js.map +1 -1
- package/2D/math2D.js.map +1 -1
- package/2D/measure.js.map +1 -1
- package/2D/multiLinePoint.js.map +1 -1
- package/2D/style.js.map +1 -1
- package/2D/valueAndUnit.js.map +1 -1
- package/2D/xmlLoader.js.map +1 -1
- package/3D/behaviors/defaultBehavior.js.map +1 -1
- package/3D/controls/MRTK3/touchHolographicButton.js.map +1 -1
- package/3D/controls/button3D.js.map +1 -1
- package/3D/controls/container3D.js.map +1 -1
- package/3D/controls/contentDisplay3D.js.map +1 -1
- package/3D/controls/control3D.js.map +1 -1
- package/3D/controls/cylinderPanel.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/planePanel.js.map +1 -1
- package/3D/controls/scatterPanel.js.map +1 -1
- package/3D/controls/slider3D.js.map +1 -1
- package/3D/controls/spherePanel.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/gizmoHandle.js.map +1 -1
- package/3D/gizmos/slateGizmo.js.map +1 -1
- package/3D/gui3DManager.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/legacy/legacy.js.map +1 -1
- package/package.json +2 -2
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"slateGizmo.js","sourceRoot":"","sources":["../../../../../dev/gui/src/3D/gizmos/slateGizmo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,wCAA0B;AAC1C,OAAO,EAAE,OAAO,EAAE,gDAAkC;AACpD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,6CAA+B;AAGjF,OAAO,EAAE,aAAa,EAAE,gDAAkC;AAE1D,OAAO,EAAE,UAAU,EAAE,2CAA6B;AAMlD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AASzD;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,KAAK;IAqCjC;;OAEG;IACH,IAAW,aAAa,CAAC,OAAmC;QACxD,IAAI,OAAO,EAAE;YACT,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;YACjC,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAEzB,IAAI,CAAC,oBAAoB,GAAG,OAAO,CAAC,KAAK,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE;gBAC7E,IAAI,IAAI,CAAC,cAAc,IAAI,CAAC,CAAC,UAAU,IAAI,UAAU,CAAC,MAAM,KAAK,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE;oBACxF,IAAI,CAAC,cAAc,CAAC,KAAK,GAAG,KAAK,CAAC;oBAClC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;iBAC9B;gBAED,IAAI,UAAU,IAAI,UAAU,CAAC,MAAM,IAAI,UAAU,CAAC,MAAM,CAAC,iBAAiB,IAAI,UAAU,CAAC,MAAM,CAAC,iBAAiB,CAAC,MAAM,EAAE;oBACtH,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,iBAAi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AM,EAAE,CAAC,EAAE,EAAE;oBAC3C,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,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;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"]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\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"]}
|
package/3D/gui3DManager.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"gui3DManager.js","sourceRoot":"","sources":["../../../../dev/gui/src/3D/gui3DManager.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,2CAA6B;AAClD,OAAO,EAAE,OAAO,EAAE,6CAA+B;AAEjD,OAAO,EAAE,iBAAiB,EAAE,gDAAkC;AAE9D,OAAO,EAAE,gBAAgB,EAAE,mDAAqC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,0DAA4C;AAC3E,OAAO,EAAE,WAAW,EAAE,+CAAiC;AAGvD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAIrD;;;GAGG;AACH,MAAM,OAAO,YAAY;IAkCrB,6BAA6B;IAC7B,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED,oCAAoC;IACpC,IAAW,YAAY;QACnB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED,iEAAiE;IACjE,IAAW,cAAc;QACrB,OAAO,IAAI,CAAC,qBAAqB,CAAC;IACtC,CAAC;IAED,4EAA4E;IAC5E,IAAW,cAAc,CAAC,QAAgB;QACtC,IAAI,IAAI,CAAC,qBAAqB,KAAK,QAAQ,IAAI,QAAQ,GAAG,CAAC,EAAE;YACzD,MAAM,UAAU,GAAG,QAAQ,GAAG,IAAI,CAAC,qBAAqB,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IAAI,CAAC;aACrC;SACJ;QAED,IAAI,IAAI,CAAC,aAAa,EAAE;YACpB,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC;SAChC;IACL,CAAC;;AArQgB,mCAAsB,GAAW,KAAK,AAAhB,CAAiB","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport type { PointerInfo } from \"core/Events/pointerEvents\";\r\nimport { PointerEventTypes } from \"core/Events/pointerEvents\";\r\nimport type { Material } from \"core/Materials/material\";\r\nimport { HemisphericLight } from \"core/Lights/hemisphericLight\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { UtilityLayerRenderer } from \"core/Rendering/utilityLayerRenderer\";\r\nimport { EngineStore } from \"core/Engines/engineStore\";\r\nimport type { IDisposable, Scene } from \"core/scene\";\r\n\r\nimport { Container3D } from \"./controls/container3D\";\r\nimport type { Control3D } from \"./controls/control3D\";\r\nimport type { IPointerEvent } from \"core/Events/deviceInputEvents\";\r\n\r\n/**\r\n * Class used to manage 3D user interface\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui3D\r\n */\r\nexport class GUI3DManager implements IDisposable {\r\n private _scene: Scene;\r\n private _sceneDisposeObserver: Nullable<Observer<Scene>>;\r\n private _utilityLayer: Nullable<UtilityLayerRenderer>;\r\n private _rootContainer: Container3D;\r\n private _pointerObserver: Nullable<Observer<PointerInfo>>;\r\n private _pointerOutObserver: Nullable<Observer<number>>;\r\n private _customControlScaling = 1.0;\r\n /** @internal */\r\n public _lastPickedControl: Control3D;\r\n /** @internal */\r\n public _lastControlOver: { [pointerId: number]: Control3D } = {};\r\n /** @internal */\r\n public _lastControlDown: { [pointerId: number]: Control3D } = {};\r\n\r\n protected static MRTK_REALISTIC_SCALING: number = 0.032;\r\n\r\n /**\r\n * Observable raised when the point picked by the pointer events changed\r\n */\r\n public onPickedPointChangedObservable = new Observable<Nullable<Vector3>>();\r\n\r\n /**\r\n * Observable raised when a picking happens\r\n */\r\n public onPickingObservable = new Observable<Nullable<AbstractMesh>>();\r\n\r\n // Shared resources\r\n /** @internal */\r\n public _sharedMaterials: { [key: string]: Material } = {};\r\n\r\n /** @internal */\r\n public _touchSharedMaterials: { [key: string]: Material } = {};\r\n\r\n /** Gets the hosting scene */\r\n public get scene(): Scene {\r\n return this._scene;\r\n }\r\n\r\n /** Gets associated utility layer */\r\n public get utilityLayer(): Nullable<UtilityLayerRenderer> {\r\n return this._utilityLayer;\r\n }\r\n\r\n /** Gets the scaling for all UI elements owned by this manager */\r\n public get controlScaling() {\r\n return this._customControlScaling;\r\n }\r\n\r\n /** Sets the scaling adjustment for all UI elements owned by this manager */\r\n public set controlScaling(newScale: number) {\r\n if (this._customControlScaling !== newScale && newScale > 0) {\r\n const scaleRatio = newScale / this._customControlScaling;\r\n this._customControlScaling = newScale;\r\n\r\n this._rootContainer.children.forEach((control: Control3D) => {\r\n control.scaling.scaleInPlace(scaleRatio);\r\n\r\n if (newScale !== 1) {\r\n control._isScaledByManager = true;\r\n }\r\n });\r\n }\r\n }\r\n\r\n /** Gets if controls attached to this manager are realistically sized, based on the fact that 1 unit length is 1 meter */\r\n public get useRealisticScaling() {\r\n return this.controlScaling === GUI3DManager.MRTK_REALISTIC_SCALING;\r\n }\r\n\r\n /** Sets if controls attached to this manager are realistically sized, based on the fact that 1 unit length is 1 meter */\r\n public set useRealisticScaling(newValue: boolean) {\r\n this.controlScaling = newValue ? GUI3DManager.MRTK_REALISTIC_SCALING : 1;\r\n }\r\n\r\n /**\r\n * Creates a new GUI3DManager\r\n * @param scene\r\n */\r\n public constructor(scene?: Scene) {\r\n this._scene = scene || EngineStore.LastCreatedScene!;\r\n this._sceneDisposeObserver = this._scene.onDisposeObservable.add(() => {\r\n this._sceneDisposeObserver = null;\r\n this._utilityLayer = null;\r\n this.dispose();\r\n });\r\n\r\n this._utilityLayer = UtilityLayerRenderer._CreateDefaultUtilityLayerFromScene(this._scene);\r\n this._utilityLayer.onlyCheckPointerDownEvents = false;\r\n this._utilityLayer.pickUtilitySceneFirst = false;\r\n this._utilityLayer.mainSceneTrackerPredicate = (mesh: Nullable<AbstractMesh>) => {\r\n return mesh && mesh.reservedDataStore?.GUI3D?.control?._node;\r\n };\r\n\r\n // Root\r\n this._rootContainer = new Container3D(\"RootContainer\");\r\n this._rootContainer._host = this;\r\n const utilityLayerScene = this._utilityLayer.utilityLayerScene;\r\n\r\n // Events\r\n this._pointerOutObserver = this._utilityLayer.onPointerOutObservable.add((pointerId) => {\r\n this._handlePointerOut(pointerId, true);\r\n });\r\n\r\n this._pointerObserver = utilityLayerScene.onPointerObservable.add((pi) => {\r\n this._doPicking(pi);\r\n });\r\n\r\n // Scene\r\n this._utilityLayer.utilityLayerScene.autoClear = false;\r\n this._utilityLayer.utilityLayerScene.autoClearDepthAndStencil = false;\r\n new HemisphericLight(\"hemi\", Vector3.Up(), this._utilityLayer.utilityLayerScene);\r\n }\r\n\r\n private _handlePointerOut(pointerId: number, isPointerUp: boolean) {\r\n const previousControlOver = this._lastControlOver[pointerId];\r\n if (previousControlOver) {\r\n previousControlOver._onPointerOut(previousControlOver);\r\n delete this._lastControlOver[pointerId];\r\n }\r\n\r\n if (isPointerUp) {\r\n if (this._lastControlDown[pointerId]) {\r\n this._lastControlDown[pointerId].forcePointerUp();\r\n delete this._lastControlDown[pointerId];\r\n }\r\n }\r\n\r\n this.onPickedPointChangedObservable.notifyObservers(null);\r\n }\r\n\r\n private _doPicking(pi: PointerInfo): boolean {\r\n if (!this._utilityLayer || !this._utilityLayer.shouldRender || !this._utilityLayer.utilityLayerScene.activeCamera) {\r\n return false;\r\n }\r\n\r\n const pointerEvent = <IPointerEvent>pi.event;\r\n\r\n const pointerId = pointerEvent.pointerId || 0;\r\n const buttonIndex = pointerEvent.button;\r\n\r\n const pickingInfo = pi.pickInfo;\r\n if (pickingInfo) {\r\n this.onPickingObservable.notifyObservers(pickingInfo.pickedMesh);\r\n }\r\n\r\n if (!pickingInfo || !pickingInfo.hit) {\r\n this._handlePointerOut(pointerId, pi.type === PointerEventTypes.POINTERUP);\r\n return false;\r\n }\r\n\r\n if (pickingInfo.pickedPoint) {\r\n this.onPickedPointChangedObservable.notifyObservers(pickingInfo.pickedPoint);\r\n }\r\n\r\n const control = <Control3D>pickingInfo.pickedMesh!.reservedDataStore?.GUI3D?.control;\r\n if (!!control && !control._processObservables(pi.type, pickingInfo.pickedPoint!, pickingInfo.originMesh?.position || null, pointerId, buttonIndex)) {\r\n if (pi.type === PointerEventTypes.POINTERMOVE) {\r\n if (this._lastControlOver[pointerId]) {\r\n this._lastControlOver[pointerId]._onPointerOut(this._lastControlOver[pointerId]);\r\n }\r\n\r\n delete this._lastControlOver[pointerId];\r\n }\r\n }\r\n\r\n if (pi.type === PointerEventTypes.POINTERUP) {\r\n if (this._lastControlDown[pointerEvent.pointerId]) {\r\n this._lastControlDown[pointerEvent.pointerId].forcePointerUp();\r\n delete this._lastControlDown[pointerEvent.pointerId];\r\n }\r\n\r\n if (pointerEvent.pointerType === \"touch\" || (pointerEvent.pointerType === \"xr\" && this._scene.getEngine().hostInformation.isMobile)) {\r\n this._handlePointerOut(pointerId, false);\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Gets the root container\r\n */\r\n public get rootContainer(): Container3D {\r\n return this._rootContainer;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if the given control is in the root child list\r\n * @param control defines the control to check\r\n * @returns true if the control is in the root child list\r\n */\r\n public containsControl(control: Control3D): boolean {\r\n return this._rootContainer.containsControl(control);\r\n }\r\n\r\n /**\r\n * Adds a control to the root child list\r\n * @param control defines the control to add\r\n * @returns the current manager\r\n */\r\n public addControl(control: Control3D): GUI3DManager {\r\n this._rootContainer.addControl(control);\r\n if (this._customControlScaling !== 1) {\r\n control.scaling.scaleInPlace(this._customControlScaling);\r\n control._isScaledByManager = true;\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * Removes a control from the root child list\r\n * @param control defines the control to remove\r\n * @returns the current container\r\n */\r\n public removeControl(control: Control3D): GUI3DManager {\r\n this._rootContainer.removeControl(control);\r\n if (control._isScaledByManager) {\r\n control.scaling.scaleInPlace(1 / this._customControlScaling);\r\n control._isScaledByManager = false;\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * Releases all associated resources\r\n */\r\n public dispose() {\r\n this._rootContainer.dispose();\r\n\r\n for (const materialName in this._sharedMaterials) {\r\n if (!Object.prototype.hasOwnProperty.call(this._sharedMaterials, materialName)) {\r\n continue;\r\n }\r\n\r\n this._sharedMaterials[materialName].dispose();\r\n }\r\n\r\n this._sharedMaterials = {};\r\n\r\n for (const materialName in this._touchSharedMaterials) {\r\n if (!Object.prototype.hasOwnProperty.call(this._touchSharedMaterials, materialName)) {\r\n continue;\r\n }\r\n\r\n this._touchSharedMaterials[materialName].dispose();\r\n }\r\n\r\n this._touchSharedMaterials = {};\r\n\r\n if (this._pointerOutObserver && this._utilityLayer) {\r\n this._utilityLayer.onPointerOutObservable.remove(this._pointerOutObserver);\r\n this._pointerOutObserver = null;\r\n }\r\n\r\n this.onPickedPointChangedObservable.clear();\r\n this.onPickingObservable.clear();\r\n\r\n const utilityLayerScene = this._utilityLayer ? this._utilityLayer.utilityLayerScene : null;\r\n\r\n if (utilityLayerScene) {\r\n if (this._pointerObserver) {\r\n utilityLayerScene.onPointerObservable.remove(this._pointerObserver);\r\n this._pointerObserver = null;\r\n }\r\n }\r\n if (this._scene) {\r\n if (this._sceneDisposeObserver) {\r\n this._scene.onDisposeObservable.remove(this._sceneDisposeObserver);\r\n this._sceneDisposeObserver = null;\r\n }\r\n }\r\n\r\n if (this._utilityLayer) {\r\n this._utilityLayer.dispose();\r\n }\r\n }\r\n}\r\n"]}
|
1
|
+
{"version":3,"file":"gui3DManager.js","sourceRoot":"","sources":["../../../../dev/gui/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C;;AArQgB,mCAAsB,GAAW,KAAK,AAAhB,CAAiB","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\r\nimport type { Observer } from \"core/Misc/observable\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport { Vector3 } from \"core/Maths/math.vector\";\r\nimport type { PointerInfo } from \"core/Events/pointerEvents\";\r\nimport { PointerEventTypes } from \"core/Events/pointerEvents\";\r\nimport type { Material } from \"core/Materials/material\";\r\nimport { HemisphericLight } from \"core/Lights/hemisphericLight\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport { UtilityLayerRenderer } from \"core/Rendering/utilityLayerRenderer\";\r\nimport { EngineStore } from \"core/Engines/engineStore\";\r\nimport type { IDisposable, Scene } from \"core/scene\";\r\n\r\nimport { Container3D } from \"./controls/container3D\";\r\nimport type { Control3D } from \"./controls/control3D\";\r\nimport type { IPointerEvent } from \"core/Events/deviceInputEvents\";\r\n\r\n/**\r\n * Class used to manage 3D user interface\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui3D\r\n */\r\nexport class GUI3DManager implements IDisposable {\r\n private _scene: Scene;\r\n private _sceneDisposeObserver: Nullable<Observer<Scene>>;\r\n private _utilityLayer: Nullable<UtilityLayerRenderer>;\r\n private _rootContainer: Container3D;\r\n private _pointerObserver: Nullable<Observer<PointerInfo>>;\r\n private _pointerOutObserver: Nullable<Observer<number>>;\r\n private _customControlScaling = 1.0;\r\n /** @internal */\r\n public _lastPickedControl: Control3D;\r\n /** @internal */\r\n public _lastControlOver: { [pointerId: number]: Control3D } = {};\r\n /** @internal */\r\n public _lastControlDown: { [pointerId: number]: Control3D } = {};\r\n\r\n protected static MRTK_REALISTIC_SCALING: number = 0.032;\r\n\r\n /**\r\n * Observable raised when the point picked by the pointer events changed\r\n */\r\n public onPickedPointChangedObservable = new Observable<Nullable<Vector3>>();\r\n\r\n /**\r\n * Observable raised when a picking happens\r\n */\r\n public onPickingObservable = new Observable<Nullable<AbstractMesh>>();\r\n\r\n // Shared resources\r\n /** @internal */\r\n public _sharedMaterials: { [key: string]: Material } = {};\r\n\r\n /** @internal */\r\n public _touchSharedMaterials: { [key: string]: Material } = {};\r\n\r\n /** Gets the hosting scene */\r\n public get scene(): Scene {\r\n return this._scene;\r\n }\r\n\r\n /** Gets associated utility layer */\r\n public get utilityLayer(): Nullable<UtilityLayerRenderer> {\r\n return this._utilityLayer;\r\n }\r\n\r\n /** Gets the scaling for all UI elements owned by this manager */\r\n public get controlScaling() {\r\n return this._customControlScaling;\r\n }\r\n\r\n /** Sets the scaling adjustment for all UI elements owned by this manager */\r\n public set controlScaling(newScale: number) {\r\n if (this._customControlScaling !== newScale && newScale > 0) {\r\n const scaleRatio = newScale / this._customControlScaling;\r\n this._customControlScaling = newScale;\r\n\r\n this._rootContainer.children.forEach((control: Control3D) => {\r\n control.scaling.scaleInPlace(scaleRatio);\r\n\r\n if (newScale !== 1) {\r\n control._isScaledByManager = true;\r\n }\r\n });\r\n }\r\n }\r\n\r\n /** Gets if controls attached to this manager are realistically sized, based on the fact that 1 unit length is 1 meter */\r\n public get useRealisticScaling() {\r\n return this.controlScaling === GUI3DManager.MRTK_REALISTIC_SCALING;\r\n }\r\n\r\n /** Sets if controls attached to this manager are realistically sized, based on the fact that 1 unit length is 1 meter */\r\n public set useRealisticScaling(newValue: boolean) {\r\n this.controlScaling = newValue ? GUI3DManager.MRTK_REALISTIC_SCALING : 1;\r\n }\r\n\r\n /**\r\n * Creates a new GUI3DManager\r\n * @param scene\r\n */\r\n public constructor(scene?: Scene) {\r\n this._scene = scene || EngineStore.LastCreatedScene!;\r\n this._sceneDisposeObserver = this._scene.onDisposeObservable.add(() => {\r\n this._sceneDisposeObserver = null;\r\n this._utilityLayer = null;\r\n this.dispose();\r\n });\r\n\r\n this._utilityLayer = UtilityLayerRenderer._CreateDefaultUtilityLayerFromScene(this._scene);\r\n this._utilityLayer.onlyCheckPointerDownEvents = false;\r\n this._utilityLayer.pickUtilitySceneFirst = false;\r\n this._utilityLayer.mainSceneTrackerPredicate = (mesh: Nullable<AbstractMesh>) => {\r\n return mesh && mesh.reservedDataStore?.GUI3D?.control?._node;\r\n };\r\n\r\n // Root\r\n this._rootContainer = new Container3D(\"RootContainer\");\r\n this._rootContainer._host = this;\r\n const utilityLayerScene = this._utilityLayer.utilityLayerScene;\r\n\r\n // Events\r\n this._pointerOutObserver = this._utilityLayer.onPointerOutObservable.add((pointerId) => {\r\n this._handlePointerOut(pointerId, true);\r\n });\r\n\r\n this._pointerObserver = utilityLayerScene.onPointerObservable.add((pi) => {\r\n this._doPicking(pi);\r\n });\r\n\r\n // Scene\r\n this._utilityLayer.utilityLayerScene.autoClear = false;\r\n this._utilityLayer.utilityLayerScene.autoClearDepthAndStencil = false;\r\n new HemisphericLight(\"hemi\", Vector3.Up(), this._utilityLayer.utilityLayerScene);\r\n }\r\n\r\n private _handlePointerOut(pointerId: number, isPointerUp: boolean) {\r\n const previousControlOver = this._lastControlOver[pointerId];\r\n if (previousControlOver) {\r\n previousControlOver._onPointerOut(previousControlOver);\r\n delete this._lastControlOver[pointerId];\r\n }\r\n\r\n if (isPointerUp) {\r\n if (this._lastControlDown[pointerId]) {\r\n this._lastControlDown[pointerId].forcePointerUp();\r\n delete this._lastControlDown[pointerId];\r\n }\r\n }\r\n\r\n this.onPickedPointChangedObservable.notifyObservers(null);\r\n }\r\n\r\n private _doPicking(pi: PointerInfo): boolean {\r\n if (!this._utilityLayer || !this._utilityLayer.shouldRender || !this._utilityLayer.utilityLayerScene.activeCamera) {\r\n return false;\r\n }\r\n\r\n const pointerEvent = <IPointerEvent>pi.event;\r\n\r\n const pointerId = pointerEvent.pointerId || 0;\r\n const buttonIndex = pointerEvent.button;\r\n\r\n const pickingInfo = pi.pickInfo;\r\n if (pickingInfo) {\r\n this.onPickingObservable.notifyObservers(pickingInfo.pickedMesh);\r\n }\r\n\r\n if (!pickingInfo || !pickingInfo.hit) {\r\n this._handlePointerOut(pointerId, pi.type === PointerEventTypes.POINTERUP);\r\n return false;\r\n }\r\n\r\n if (pickingInfo.pickedPoint) {\r\n this.onPickedPointChangedObservable.notifyObservers(pickingInfo.pickedPoint);\r\n }\r\n\r\n const control = <Control3D>pickingInfo.pickedMesh!.reservedDataStore?.GUI3D?.control;\r\n if (!!control && !control._processObservables(pi.type, pickingInfo.pickedPoint!, pickingInfo.originMesh?.position || null, pointerId, buttonIndex)) {\r\n if (pi.type === PointerEventTypes.POINTERMOVE) {\r\n if (this._lastControlOver[pointerId]) {\r\n this._lastControlOver[pointerId]._onPointerOut(this._lastControlOver[pointerId]);\r\n }\r\n\r\n delete this._lastControlOver[pointerId];\r\n }\r\n }\r\n\r\n if (pi.type === PointerEventTypes.POINTERUP) {\r\n if (this._lastControlDown[pointerEvent.pointerId]) {\r\n this._lastControlDown[pointerEvent.pointerId].forcePointerUp();\r\n delete this._lastControlDown[pointerEvent.pointerId];\r\n }\r\n\r\n if (pointerEvent.pointerType === \"touch\" || (pointerEvent.pointerType === \"xr\" && this._scene.getEngine().hostInformation.isMobile)) {\r\n this._handlePointerOut(pointerId, false);\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Gets the root container\r\n */\r\n public get rootContainer(): Container3D {\r\n return this._rootContainer;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if the given control is in the root child list\r\n * @param control defines the control to check\r\n * @returns true if the control is in the root child list\r\n */\r\n public containsControl(control: Control3D): boolean {\r\n return this._rootContainer.containsControl(control);\r\n }\r\n\r\n /**\r\n * Adds a control to the root child list\r\n * @param control defines the control to add\r\n * @returns the current manager\r\n */\r\n public addControl(control: Control3D): GUI3DManager {\r\n this._rootContainer.addControl(control);\r\n if (this._customControlScaling !== 1) {\r\n control.scaling.scaleInPlace(this._customControlScaling);\r\n control._isScaledByManager = true;\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * Removes a control from the root child list\r\n * @param control defines the control to remove\r\n * @returns the current container\r\n */\r\n public removeControl(control: Control3D): GUI3DManager {\r\n this._rootContainer.removeControl(control);\r\n if (control._isScaledByManager) {\r\n control.scaling.scaleInPlace(1 / this._customControlScaling);\r\n control._isScaledByManager = false;\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * Releases all associated resources\r\n */\r\n public dispose() {\r\n this._rootContainer.dispose();\r\n\r\n for (const materialName in this._sharedMaterials) {\r\n if (!Object.prototype.hasOwnProperty.call(this._sharedMaterials, materialName)) {\r\n continue;\r\n }\r\n\r\n this._sharedMaterials[materialName].dispose();\r\n }\r\n\r\n this._sharedMaterials = {};\r\n\r\n for (const materialName in this._touchSharedMaterials) {\r\n if (!Object.prototype.hasOwnProperty.call(this._touchSharedMaterials, materialName)) {\r\n continue;\r\n }\r\n\r\n this._touchSharedMaterials[materialName].dispose();\r\n }\r\n\r\n this._touchSharedMaterials = {};\r\n\r\n if (this._pointerOutObserver && this._utilityLayer) {\r\n this._utilityLayer.onPointerOutObservable.remove(this._pointerOutObserver);\r\n this._pointerOutObserver = null;\r\n }\r\n\r\n this.onPickedPointChangedObservable.clear();\r\n this.onPickingObservable.clear();\r\n\r\n const utilityLayerScene = this._utilityLayer ? this._utilityLayer.utilityLayerScene : null;\r\n\r\n if (utilityLayerScene) {\r\n if (this._pointerObserver) {\r\n utilityLayerScene.onPointerObservable.remove(this._pointerObserver);\r\n this._pointerObserver = null;\r\n }\r\n }\r\n if (this._scene) {\r\n if (this._sceneDisposeObserver) {\r\n this._scene.onDisposeObservable.remove(this._sceneDisposeObserver);\r\n this._sceneDisposeObserver = null;\r\n }\r\n }\r\n\r\n if (this._utilityLayer) {\r\n this._utilityLayer.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,E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E,CAAC,IAAI,cAAc,CAAC,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 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"]}
|
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,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AAK,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 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"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"fluentBackplateMaterial.js","sourceRoot":"","sources":["../../../../../../dev/gui/src/3D/materials/fluentBackplate/fluentBackplateMaterial.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,2CAA6B;AACrE,OAAO,EAAE,mBAAmB,EAAE,yDAA2C;AAEzE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,6CAA+B;AAG1D,OAAO,EAAE,OAAO,EAAE,sDAAwC;AAC1D,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,4CAA8B;AAC/C,OAAO,EAAE,eAAe,EAAE,qDAAuC;AACjE,O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,SAAS,EAAE;0DACkD;AAMvD;IADN,SAAS,EAAE;8DACgB;AAMrB;IADN,SAAS,EAAE;4DACc;AAMnB;IADN,SAAS,EAAE;iEACgB;AAMrB;IADN,SAAS,EAAE;gEACkB;AAMvB;IADN,SAAS,EAAE;+DACiB;AAMtB;IADN,SAAS,EAAE;6DACe;AAMpB;IADN,SAAS,EAAE;0DACS;AAMd;IADN,SAAS,EAAE;yDACQ;AAMb;IADN,SAAS,EAAE;8DACgB;AAMrB;IADN,SAAS,EAAE;2DACU;AAMf;IADN,SAAS,EAAE;0DACS;AASd;IADN,SAAS,EAAE;+DAC4C;AAMjD;IADN,SAAS,EAAE;+DACiB;AAYtB;IADN,SAAS,EAAE;qEACoB;AAMzB;IADN,SAAS,EAAE;yEACwB;AAS7B;IADN,SAAS,EAAE;wDACO;AAeZ;IADN,kBAAkB,EAAE;2EAC8B;AAO5C;IADN,kBAAkB,EAAE;4EAC+B;AAsTxD,aAAa,CAAC,qCAAqC,EAAE,uBAAuB,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\r\nimport { serialize, serializeAsVector3 } from \"core/Misc/decorators\";\r\nimport { SerializationHelper } from \"core/Misc/decorators.serialization\";\r\nimport type { Matrix } from \"core/Maths/math.vector\";\r\nimport { Vector3, Vector4 } from \"core/Maths/math.vector\";\r\nimport type { IAnimatable } from \"core/Animations/animatable.interface\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { Texture } from \"core/Materials/Textures/texture\";\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 { Color4 } from \"core/Maths/math.color\";\r\nimport { EffectFallbacks } from \"core/Materials/effectFallbacks\";\r\nimport { Constants } from \"core/Engines/constants\";\r\n\r\nimport \"./shaders/fluentBackplate.fragment\";\r\nimport \"./shaders/fluentBackplate.vertex\";\r\nimport { HandleFallbacksForShadows, PrepareAttributesForInstances, PrepareDefinesForAttributes, PrepareUniformsAndSamplersList } from \"core/Materials/materialHelper.functions\";\r\n\r\n/** @internal */\r\nclass FluentBackplateMaterialDefines extends MaterialDefines {\r\n public BLOB_ENABLE = true;\r\n public BLOB_ENABLE_2 = true;\r\n public SMOOTH_EDGES = true;\r\n public IRIDESCENT_MAP_ENABLE = true;\r\n\r\n constructor() {\r\n super();\r\n this._needNormals = true;\r\n this.rebuild();\r\n }\r\n}\r\n\r\n/**\r\n * Class used to render square buttons with fluent design\r\n */\r\nexport class FluentBackplateMaterial extends PushMaterial {\r\n /**\r\n * URL pointing to the texture used to define the coloring for the fluent blob effect.\r\n */\r\n public static BLOB_TEXTURE_URL = \"https://assets.babylonjs.com/meshes/MRTK/mrtk-fluent-backplate-blob.png\";\r\n\r\n /**\r\n * URL pointing to the texture used to define iridescent map.\r\n */\r\n public static IM_TEXTURE_URL = \"https://assets.babylonjs.com/meshes/MRTK/mrtk-fluent-backplate-iridescence.png\";\r\n\r\n private _blobTexture: Texture;\r\n private _iridescentMap: Texture;\r\n\r\n /**\r\n * Gets or sets the corner radius on the backplate. Best to keep this value between 0.01 and 0.5. Default is 0.03.\r\n */\r\n @serialize()\r\n public radius = 0.03;\r\n\r\n /**\r\n * Gets or sets the line width of the backplate.\r\n */\r\n @serialize()\r\n public lineWidth = 0.01;\r\n\r\n /**\r\n * Gets or sets whether to use absolute sizes when calculating effects on the backplate.\r\n * Since desktop and VR/AR have different relative sizes, it's usually best to keep this false.\r\n */\r\n @serialize()\r\n public absoluteSizes = false;\r\n\r\n /** @internal */\r\n public _filterWidth = 1;\r\n\r\n /**\r\n * Gets or sets the base color of the backplate.\r\n */\r\n @serialize()\r\n public baseColor = new Color4(0.0392157, 0.0666667, 0.207843, 1);\r\n\r\n /**\r\n * Gets or sets the line color of the backplate.\r\n */\r\n @serialize()\r\n public lineColor = new Color4(0.14902, 0.133333, 0.384314, 1);\r\n\r\n /**\r\n * Gets or sets the intensity of the fluent hover glow effect.\r\n */\r\n @serialize()\r\n public blobIntensity = 0.98;\r\n\r\n /**\r\n * Gets or sets the far size of the fluent hover glow effect.\r\n */\r\n @serialize()\r\n public blobFarSize = 0.04;\r\n\r\n /**\r\n * Gets or sets the distance considered \"near\" to the backplate, which controls the size of the fluent hover glow effect (see blobNearSize).\r\n */\r\n @serialize()\r\n public blobNearDistance = 0;\r\n\r\n /**\r\n * Gets or sets the distance considered \"far\" from the backplate, which controls the size of the fluent hover glow effect (see blobFarSize).\r\n */\r\n @serialize()\r\n public blobFarDistance = 0.08;\r\n\r\n /**\r\n * Gets or sets the length of the fluent hover glow effect fade.\r\n */\r\n @serialize()\r\n public blobFadeLength = 0.08;\r\n\r\n /**\r\n * Gets or sets the size of the fluent hover glow effect when the left pointer is considered \"near\" to the backplate (see blobNearDistance).\r\n */\r\n @serialize()\r\n public blobNearSize = 0.22;\r\n\r\n /**\r\n * Gets or sets the progress of the fluent hover glow effect selection animation corresponding to the left pointer (0.0 - 1.0).\r\n */\r\n @serialize()\r\n public blobPulse = 0;\r\n\r\n /**\r\n * Gets or sets the opacity of the fluent hover glow effect corresponding to the left pointer (0.0 - 1.0). Default is 0.\r\n */\r\n @serialize()\r\n public blobFade = 0;\r\n\r\n /**\r\n * Gets or sets the size of the fluent hover glow effect when the right pointer is considered \"near\" to the backplate (see blobNearDistance).\r\n */\r\n @serialize()\r\n public blobNearSize2 = 0.22;\r\n\r\n /**\r\n * Gets or sets the progress of the fluent hover glow effect selection animation corresponding to the right pointer (0.0 - 1.0).\r\n */\r\n @serialize()\r\n public blobPulse2 = 0;\r\n\r\n /**\r\n * Gets or sets the opacity of the fluent hover glow effect corresponding to the right pointer (0.0 - 1.0). Default is 0.\r\n */\r\n @serialize()\r\n public blobFade2 = 0;\r\n\r\n /** @internal */\r\n public _rate = 0.135;\r\n\r\n /**\r\n * Gets or sets the color of the highlights on the backplate line.\r\n */\r\n @serialize()\r\n public highlightColor = new Color4(0.98, 0.98, 0.98, 1);\r\n\r\n /**\r\n * Gets or sets the width of the highlights on the backplate line.\r\n */\r\n @serialize()\r\n public highlightWidth = 0.25;\r\n\r\n /** @internal */\r\n public _highlightTransform = new Vector4(1, 1, 0, 0);\r\n\r\n /** @internal */\r\n public _highlight = 1;\r\n\r\n /**\r\n * Gets or sets the intensity of the iridescence effect.\r\n */\r\n @serialize()\r\n public iridescenceIntensity = 0;\r\n\r\n /**\r\n * Gets or sets the intensity of the iridescence effect on the backplate edges.\r\n */\r\n @serialize()\r\n public iridescenceEdgeIntensity = 1;\r\n\r\n /** @internal */\r\n public _angle = -45;\r\n\r\n /**\r\n * Gets or sets the opacity of the backplate (0.0 - 1.0).\r\n */\r\n @serialize()\r\n public fadeOut = 1;\r\n\r\n /** @internal */\r\n public _reflected = true;\r\n\r\n /** @internal */\r\n public _frequency = 1;\r\n\r\n /** @internal */\r\n public _verticalOffset = 0;\r\n\r\n /**\r\n * Gets or sets the world-space position of the tip of the left index finger.\r\n */\r\n @serializeAsVector3()\r\n public globalLeftIndexTipPosition = Vector3.Zero();\r\n private _globalLeftIndexTipPosition4 = Vector4.Zero();\r\n\r\n /**\r\n * Gets or sets the world-space position of the tip of the right index finger.\r\n */\r\n @serializeAsVector3()\r\n public globalRightIndexTipPosition = Vector3.Zero();\r\n private _globalRightIndexTipPosition4 = Vector4.Zero();\r\n\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n this.alphaMode = Constants.ALPHA_DISABLE;\r\n this.backFaceCulling = false;\r\n\r\n this._blobTexture = new Texture(FluentBackplateMaterial.BLOB_TEXTURE_URL, this.getScene(), true, false, Texture.NEAREST_SAMPLINGMODE);\r\n this._iridescentMap = new Texture(FluentBackplateMaterial.IM_TEXTURE_URL, this.getScene(), true, false, Texture.NEAREST_SAMPLINGMODE);\r\n }\r\n\r\n public override needAlphaBlending(): boolean {\r\n return false;\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 FluentBackplateMaterialDefines();\r\n }\r\n\r\n const defines = <FluentBackplateMaterialDefines>subMesh.materialDefines;\r\n const scene = this.getScene();\r\n\r\n if (this._isReadyForSubMesh(subMesh)) {\r\n return true;\r\n }\r\n\r\n const engine = scene.getEngine();\r\n\r\n // Attribs\r\n PrepareDefinesForAttributes(mesh, defines, false, false);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n\r\n scene.resetCachedMaterial();\r\n\r\n // Fallbacks\r\n const fallbacks = new EffectFallbacks();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n\r\n HandleFallbacksForShadows(defines, fallbacks);\r\n\r\n defines.IMAGEPROCESSINGPOSTPROCESS = scene.imageProcessingConfiguration.applyByPostProcess;\r\n\r\n //Attributes\r\n const attribs = [VertexBuffer.PositionKind];\r\n\r\n if (defines.NORMAL) {\r\n attribs.push(VertexBuffer.NormalKind);\r\n }\r\n\r\n if (defines.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\r\n }\r\n\r\n if (defines.UV2) {\r\n attribs.push(VertexBuffer.UV2Kind);\r\n }\r\n\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(VertexBuffer.ColorKind);\r\n }\r\n\r\n if (defines.TANGENT) {\r\n attribs.push(VertexBuffer.TangentKind);\r\n }\r\n\r\n PrepareAttributesForInstances(attribs, defines);\r\n\r\n // Legacy browser patch\r\n const shaderName = \"fluentBackplate\";\r\n const join = defines.toString();\r\n\r\n const uniforms = [\r\n \"world\",\r\n \"viewProjection\",\r\n \"cameraPosition\",\r\n \"_Radius_\",\r\n \"_Line_Width_\",\r\n \"_Absolute_Sizes_\",\r\n \"_Filter_Width_\",\r\n \"_Base_Color_\",\r\n \"_Line_Color_\",\r\n \"_Radius_Top_Left_\",\r\n \"_Radius_Top_Right_\",\r\n \"_Radius_Bottom_Left_\",\r\n \"_Radius_Bottom_Right_\",\r\n \"_Blob_Position_\",\r\n \"_Blob_Intensity_\",\r\n \"_Blob_Near_Size_\",\r\n \"_Blob_Far_Size_\",\r\n \"_Blob_Near_Distance_\",\r\n \"_Blob_Far_Distance_\",\r\n \"_Blob_Fade_Length_\",\r\n \"_Blob_Pulse_\",\r\n \"_Blob_Fade_\",\r\n \"_Blob_Texture_\",\r\n \"_Blob_Position_2_\",\r\n \"_Blob_Near_Size_2_\",\r\n \"_Blob_Pulse_2_\",\r\n \"_Blob_Fade_2_\",\r\n \"_Rate_\",\r\n \"_Highlight_Color_\",\r\n \"_Highlight_Width_\",\r\n \"_Highlight_Transform_\",\r\n \"_Highlight_\",\r\n \"_Iridescence_Intensity_\",\r\n \"_Iridescence_Edge_Intensity_\",\r\n \"_Angle_\",\r\n \"_Fade_Out_\",\r\n \"_Reflected_\",\r\n \"_Frequency_\",\r\n \"_Vertical_Offset_\",\r\n \"_Iridescent_Map_\",\r\n \"_Use_Global_Left_Index_\",\r\n \"_Use_Global_Right_Index_\",\r\n \"Global_Left_Index_Tip_Position\",\r\n \"Global_Right_Index_Tip_Position\",\r\n ];\r\n const samplers: string[] = [\"_Blob_Texture_\", \"_Iridescent_Map_\"];\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 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: fallbacks,\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 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 defines = <FluentBackplateMaterialDefines>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\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this._activeEffect.setMatrix(\"viewProjection\", this.getScene().getTransformMatrix());\r\n this._activeEffect.setVector3(\"cameraPosition\", this.getScene().activeCamera?.position ?? Vector3.ZeroReadOnly);\r\n\r\n // \"Round Rect\"\r\n this._activeEffect.setFloat(\"_Radius_\", this.radius);\r\n this._activeEffect.setFloat(\"_Line_Width_\", this.lineWidth);\r\n this._activeEffect.setFloat(\"_Absolute_Sizes_\", this.absoluteSizes ? 1.0 : 0.0);\r\n this._activeEffect.setFloat(\"_Filter_Width_\", this._filterWidth);\r\n this._activeEffect.setDirectColor4(\"_Base_Color_\", this.baseColor);\r\n this._activeEffect.setDirectColor4(\"_Line_Color_\", this.lineColor);\r\n\r\n // \"Radii Multipliers\"\r\n this._activeEffect.setFloat(\"_Radius_Top_Left_\", 1);\r\n this._activeEffect.setFloat(\"_Radius_Top_Right_\", 1.0);\r\n this._activeEffect.setFloat(\"_Radius_Bottom_Left_\", 1.0);\r\n this._activeEffect.setFloat(\"_Radius_Bottom_Right_\", 1.0);\r\n\r\n // \"Blob\"\r\n //define BLOB_ENABLE true;\r\n this._activeEffect.setFloat(\"_Blob_Intensity_\", this.blobIntensity);\r\n this._activeEffect.setFloat(\"_Blob_Near_Size_\", this.blobNearSize);\r\n this._activeEffect.setFloat(\"_Blob_Far_Size_\", this.blobFarSize);\r\n this._activeEffect.setFloat(\"_Blob_Near_Distance_\", this.blobNearDistance);\r\n this._activeEffect.setFloat(\"_Blob_Far_Distance_\", this.blobFarDistance);\r\n this._activeEffect.setFloat(\"_Blob_Fade_Length_\", this.blobFadeLength);\r\n this._activeEffect.setFloat(\"_Blob_Pulse_\", this.blobPulse);\r\n this._activeEffect.setFloat(\"_Blob_Fade_\", this.blobFade);\r\n\r\n // \"Blob Texture\"\r\n this._activeEffect.setTexture(\"_Blob_Texture_\", this._blobTexture);\r\n\r\n // \"Blob 2\"\r\n //define BLOB_ENABLE_2 true;\r\n this._activeEffect.setFloat(\"_Blob_Near_Size_2_\", this.blobNearSize2);\r\n this._activeEffect.setFloat(\"_Blob_Pulse_2_\", this.blobPulse2);\r\n this._activeEffect.setFloat(\"_Blob_Fade_2_\", this.blobFade2);\r\n\r\n // \"Line Highlight\"\r\n this._activeEffect.setFloat(\"_Rate_\", this._rate);\r\n this._activeEffect.setDirectColor4(\"_Highlight_Color_\", this.highlightColor);\r\n this._activeEffect.setFloat(\"_Highlight_Width_\", this.highlightWidth);\r\n this._activeEffect.setVector4(\"_Highlight_Transform_\", this._highlightTransform);\r\n this._activeEffect.setFloat(\"_Highlight_\", this._highlight);\r\n\r\n // \"Iridescence\"\r\n this._activeEffect.setFloat(\"_Iridescence_Intensity_\", this.iridescenceIntensity);\r\n this._activeEffect.setFloat(\"_Iridescence_Edge_Intensity_\", this.iridescenceEdgeIntensity);\r\n this._activeEffect.setFloat(\"_Angle_\", this._angle);\r\n\r\n // \"Fade\"\r\n this._activeEffect.setFloat(\"_Fade_Out_\", this.fadeOut);\r\n\r\n // \"Antialiasing\"\r\n //define SMOOTH_EDGES true;\r\n\r\n // \"ChooseAngle\"\r\n this._activeEffect.setFloat(\"_Reflected_\", this._reflected ? 1.0 : 0.0);\r\n\r\n // \"Multiply\"\r\n this._activeEffect.setFloat(\"_Frequency_\", this._frequency);\r\n this._activeEffect.setFloat(\"_Vertical_Offset_\", this._verticalOffset);\r\n\r\n // \"Color Texture\"\r\n //define IRIDESCENT_MAP_ENABLE true;\r\n this._activeEffect.setTexture(\"_Iridescent_Map_\", this._iridescentMap);\r\n\r\n // \"Global\"\r\n this._activeEffect.setFloat(\"_Use_Global_Left_Index_\", 1.0);\r\n this._activeEffect.setFloat(\"_Use_Global_Right_Index_\", 1.0);\r\n\r\n this._globalLeftIndexTipPosition4.set(this.globalLeftIndexTipPosition.x, this.globalLeftIndexTipPosition.y, this.globalLeftIndexTipPosition.z, 1.0);\r\n this._activeEffect.setVector4(\"Global_Left_Index_Tip_Position\", this._globalLeftIndexTipPosition4);\r\n\r\n this._globalRightIndexTipPosition4.set(this.globalRightIndexTipPosition.x, this.globalRightIndexTipPosition.y, this.globalRightIndexTipPosition.z, 1.0);\r\n this._activeEffect.setVector4(\"Global_Right_Index_Tip_Position\", this._globalRightIndexTipPosition4);\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n /**\r\n * Get the list of animatables in the material.\r\n * @returns the list of animatables object used in the material\r\n */\r\n public override getAnimatables(): IAnimatable[] {\r\n return [];\r\n }\r\n\r\n public override dispose(forceDisposeEffect?: boolean): void {\r\n super.dispose(forceDisposeEffect);\r\n\r\n this._blobTexture.dispose();\r\n this._iridescentMap.dispose();\r\n }\r\n\r\n public override clone(name: string): FluentBackplateMaterial {\r\n return SerializationHelper.Clone(() => new FluentBackplateMaterial(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.FluentBackplateMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"FluentBackplateMaterial\";\r\n }\r\n\r\n // Statics\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): FluentBackplateMaterial {\r\n return SerializationHelper.Parse(() => new FluentBackplateMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GUI.FluentBackplateMaterial\", FluentBackplateMaterial);\r\n"]}
|
1
|
+
{"version":3,"file":"fluentBackplateMaterial.js","sourceRoot":"","sources":["../../../../../../dev/gui/src/3D/materials/fluentBackplate/fluentBackplateMaterial.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,2CAA6B;AACrE,OAAO,EAAE,mBAAmB,EAAE,yDAA2C;AAEzE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,6CAA+B;AAG1D,OAAO,EAAE,OAAO,EAAE,sDAAwC;AAC1D,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,4CAA8B;AAC/C,OAAO,EAAE,eAAe,EAAE,qDAAuC;AACjE,OAAO,EAAE,SAAS,EAAE,6CAA+B;AAEnD,OAAO,oCAAoC,CAAC;AAC5C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,EAAE,yBAAyB,EAAE,6BAA6B,EAAE,2BAA2B,EAAE,8BAA8B,EAAE,8DAAgD;AAEhL,gBAAgB;AAChB,MAAM,8BAA+B,SAAQ,eAAe;IAMxD;QACI,KAAK,EAAE,CAAC;QANL,gBAAW,GAAG,IAAI,CAAC;QAC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;AAMrB;IADN,SAAS,EAAE;gEACkB;AAMvB;IADN,SAAS,EAAE;+DACiB;AAMtB;IADN,SAAS,EAAE;6DACe;AAMpB;IADN,SAAS,EAAE;0DACS;AAMd;IADN,SAAS,EAAE;yDACQ;AAMb;IADN,SAAS,EAAE;8DACgB;AAMrB;IADN,SAAS,EAAE;2DACU;AAMf;IADN,SAAS,EAAE;0DACS;AASd;IADN,SAAS,EAAE;+DAC4C;AAMjD;IADN,SAAS,EAAE;+DACiB;AAYtB;IADN,SAAS,EAAE;qEACoB;AAMzB;IADN,SAAS,EAAE;yEACwB;AAS7B;IADN,SAAS,EAAE;wDACO;AAeZ;IADN,kBAAkB,EAAE;2EAC8B;AAO5C;IADN,kBAAkB,EAAE;4EAC+B;AAsTxD,aAAa,CAAC,qCAAqC,EAAE,uBAAuB,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\r\nimport { serialize, serializeAsVector3 } from \"core/Misc/decorators\";\r\nimport { SerializationHelper } from \"core/Misc/decorators.serialization\";\r\nimport type { Matrix } from \"core/Maths/math.vector\";\r\nimport { Vector3, Vector4 } from \"core/Maths/math.vector\";\r\nimport type { IAnimatable } from \"core/Animations/animatable.interface\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { Texture } from \"core/Materials/Textures/texture\";\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 { Color4 } from \"core/Maths/math.color\";\r\nimport { EffectFallbacks } from \"core/Materials/effectFallbacks\";\r\nimport { Constants } from \"core/Engines/constants\";\r\n\r\nimport \"./shaders/fluentBackplate.fragment\";\r\nimport \"./shaders/fluentBackplate.vertex\";\r\nimport { HandleFallbacksForShadows, PrepareAttributesForInstances, PrepareDefinesForAttributes, PrepareUniformsAndSamplersList } from \"core/Materials/materialHelper.functions\";\r\n\r\n/** @internal */\r\nclass FluentBackplateMaterialDefines extends MaterialDefines {\r\n public BLOB_ENABLE = true;\r\n public BLOB_ENABLE_2 = true;\r\n public SMOOTH_EDGES = true;\r\n public IRIDESCENT_MAP_ENABLE = true;\r\n\r\n constructor() {\r\n super();\r\n this._needNormals = true;\r\n this.rebuild();\r\n }\r\n}\r\n\r\n/**\r\n * Class used to render square buttons with fluent design\r\n */\r\nexport class FluentBackplateMaterial extends PushMaterial {\r\n /**\r\n * URL pointing to the texture used to define the coloring for the fluent blob effect.\r\n */\r\n public static BLOB_TEXTURE_URL = \"https://assets.babylonjs.com/meshes/MRTK/mrtk-fluent-backplate-blob.png\";\r\n\r\n /**\r\n * URL pointing to the texture used to define iridescent map.\r\n */\r\n public static IM_TEXTURE_URL = \"https://assets.babylonjs.com/meshes/MRTK/mrtk-fluent-backplate-iridescence.png\";\r\n\r\n private _blobTexture: Texture;\r\n private _iridescentMap: Texture;\r\n\r\n /**\r\n * Gets or sets the corner radius on the backplate. Best to keep this value between 0.01 and 0.5. Default is 0.03.\r\n */\r\n @serialize()\r\n public radius = 0.03;\r\n\r\n /**\r\n * Gets or sets the line width of the backplate.\r\n */\r\n @serialize()\r\n public lineWidth = 0.01;\r\n\r\n /**\r\n * Gets or sets whether to use absolute sizes when calculating effects on the backplate.\r\n * Since desktop and VR/AR have different relative sizes, it's usually best to keep this false.\r\n */\r\n @serialize()\r\n public absoluteSizes = false;\r\n\r\n /** @internal */\r\n public _filterWidth = 1;\r\n\r\n /**\r\n * Gets or sets the base color of the backplate.\r\n */\r\n @serialize()\r\n public baseColor = new Color4(0.0392157, 0.0666667, 0.207843, 1);\r\n\r\n /**\r\n * Gets or sets the line color of the backplate.\r\n */\r\n @serialize()\r\n public lineColor = new Color4(0.14902, 0.133333, 0.384314, 1);\r\n\r\n /**\r\n * Gets or sets the intensity of the fluent hover glow effect.\r\n */\r\n @serialize()\r\n public blobIntensity = 0.98;\r\n\r\n /**\r\n * Gets or sets the far size of the fluent hover glow effect.\r\n */\r\n @serialize()\r\n public blobFarSize = 0.04;\r\n\r\n /**\r\n * Gets or sets the distance considered \"near\" to the backplate, which controls the size of the fluent hover glow effect (see blobNearSize).\r\n */\r\n @serialize()\r\n public blobNearDistance = 0;\r\n\r\n /**\r\n * Gets or sets the distance considered \"far\" from the backplate, which controls the size of the fluent hover glow effect (see blobFarSize).\r\n */\r\n @serialize()\r\n public blobFarDistance = 0.08;\r\n\r\n /**\r\n * Gets or sets the length of the fluent hover glow effect fade.\r\n */\r\n @serialize()\r\n public blobFadeLength = 0.08;\r\n\r\n /**\r\n * Gets or sets the size of the fluent hover glow effect when the left pointer is considered \"near\" to the backplate (see blobNearDistance).\r\n */\r\n @serialize()\r\n public blobNearSize = 0.22;\r\n\r\n /**\r\n * Gets or sets the progress of the fluent hover glow effect selection animation corresponding to the left pointer (0.0 - 1.0).\r\n */\r\n @serialize()\r\n public blobPulse = 0;\r\n\r\n /**\r\n * Gets or sets the opacity of the fluent hover glow effect corresponding to the left pointer (0.0 - 1.0). Default is 0.\r\n */\r\n @serialize()\r\n public blobFade = 0;\r\n\r\n /**\r\n * Gets or sets the size of the fluent hover glow effect when the right pointer is considered \"near\" to the backplate (see blobNearDistance).\r\n */\r\n @serialize()\r\n public blobNearSize2 = 0.22;\r\n\r\n /**\r\n * Gets or sets the progress of the fluent hover glow effect selection animation corresponding to the right pointer (0.0 - 1.0).\r\n */\r\n @serialize()\r\n public blobPulse2 = 0;\r\n\r\n /**\r\n * Gets or sets the opacity of the fluent hover glow effect corresponding to the right pointer (0.0 - 1.0). Default is 0.\r\n */\r\n @serialize()\r\n public blobFade2 = 0;\r\n\r\n /** @internal */\r\n public _rate = 0.135;\r\n\r\n /**\r\n * Gets or sets the color of the highlights on the backplate line.\r\n */\r\n @serialize()\r\n public highlightColor = new Color4(0.98, 0.98, 0.98, 1);\r\n\r\n /**\r\n * Gets or sets the width of the highlights on the backplate line.\r\n */\r\n @serialize()\r\n public highlightWidth = 0.25;\r\n\r\n /** @internal */\r\n public _highlightTransform = new Vector4(1, 1, 0, 0);\r\n\r\n /** @internal */\r\n public _highlight = 1;\r\n\r\n /**\r\n * Gets or sets the intensity of the iridescence effect.\r\n */\r\n @serialize()\r\n public iridescenceIntensity = 0;\r\n\r\n /**\r\n * Gets or sets the intensity of the iridescence effect on the backplate edges.\r\n */\r\n @serialize()\r\n public iridescenceEdgeIntensity = 1;\r\n\r\n /** @internal */\r\n public _angle = -45;\r\n\r\n /**\r\n * Gets or sets the opacity of the backplate (0.0 - 1.0).\r\n */\r\n @serialize()\r\n public fadeOut = 1;\r\n\r\n /** @internal */\r\n public _reflected = true;\r\n\r\n /** @internal */\r\n public _frequency = 1;\r\n\r\n /** @internal */\r\n public _verticalOffset = 0;\r\n\r\n /**\r\n * Gets or sets the world-space position of the tip of the left index finger.\r\n */\r\n @serializeAsVector3()\r\n public globalLeftIndexTipPosition = Vector3.Zero();\r\n private _globalLeftIndexTipPosition4 = Vector4.Zero();\r\n\r\n /**\r\n * Gets or sets the world-space position of the tip of the right index finger.\r\n */\r\n @serializeAsVector3()\r\n public globalRightIndexTipPosition = Vector3.Zero();\r\n private _globalRightIndexTipPosition4 = Vector4.Zero();\r\n\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n this.alphaMode = Constants.ALPHA_DISABLE;\r\n this.backFaceCulling = false;\r\n\r\n this._blobTexture = new Texture(FluentBackplateMaterial.BLOB_TEXTURE_URL, this.getScene(), true, false, Texture.NEAREST_SAMPLINGMODE);\r\n this._iridescentMap = new Texture(FluentBackplateMaterial.IM_TEXTURE_URL, this.getScene(), true, false, Texture.NEAREST_SAMPLINGMODE);\r\n }\r\n\r\n public override needAlphaBlending(): boolean {\r\n return false;\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 FluentBackplateMaterialDefines();\r\n }\r\n\r\n const defines = <FluentBackplateMaterialDefines>subMesh.materialDefines;\r\n const scene = this.getScene();\r\n\r\n if (this._isReadyForSubMesh(subMesh)) {\r\n return true;\r\n }\r\n\r\n const engine = scene.getEngine();\r\n\r\n // Attribs\r\n PrepareDefinesForAttributes(mesh, defines, false, false);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n\r\n scene.resetCachedMaterial();\r\n\r\n // Fallbacks\r\n const fallbacks = new EffectFallbacks();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n\r\n HandleFallbacksForShadows(defines, fallbacks);\r\n\r\n defines.IMAGEPROCESSINGPOSTPROCESS = scene.imageProcessingConfiguration.applyByPostProcess;\r\n\r\n //Attributes\r\n const attribs = [VertexBuffer.PositionKind];\r\n\r\n if (defines.NORMAL) {\r\n attribs.push(VertexBuffer.NormalKind);\r\n }\r\n\r\n if (defines.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\r\n }\r\n\r\n if (defines.UV2) {\r\n attribs.push(VertexBuffer.UV2Kind);\r\n }\r\n\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(VertexBuffer.ColorKind);\r\n }\r\n\r\n if (defines.TANGENT) {\r\n attribs.push(VertexBuffer.TangentKind);\r\n }\r\n\r\n PrepareAttributesForInstances(attribs, defines);\r\n\r\n // Legacy browser patch\r\n const shaderName = \"fluentBackplate\";\r\n const join = defines.toString();\r\n\r\n const uniforms = [\r\n \"world\",\r\n \"viewProjection\",\r\n \"cameraPosition\",\r\n \"_Radius_\",\r\n \"_Line_Width_\",\r\n \"_Absolute_Sizes_\",\r\n \"_Filter_Width_\",\r\n \"_Base_Color_\",\r\n \"_Line_Color_\",\r\n \"_Radius_Top_Left_\",\r\n \"_Radius_Top_Right_\",\r\n \"_Radius_Bottom_Left_\",\r\n \"_Radius_Bottom_Right_\",\r\n \"_Blob_Position_\",\r\n \"_Blob_Intensity_\",\r\n \"_Blob_Near_Size_\",\r\n \"_Blob_Far_Size_\",\r\n \"_Blob_Near_Distance_\",\r\n \"_Blob_Far_Distance_\",\r\n \"_Blob_Fade_Length_\",\r\n \"_Blob_Pulse_\",\r\n \"_Blob_Fade_\",\r\n \"_Blob_Texture_\",\r\n \"_Blob_Position_2_\",\r\n \"_Blob_Near_Size_2_\",\r\n \"_Blob_Pulse_2_\",\r\n \"_Blob_Fade_2_\",\r\n \"_Rate_\",\r\n \"_Highlight_Color_\",\r\n \"_Highlight_Width_\",\r\n \"_Highlight_Transform_\",\r\n \"_Highlight_\",\r\n \"_Iridescence_Intensity_\",\r\n \"_Iridescence_Edge_Intensity_\",\r\n \"_Angle_\",\r\n \"_Fade_Out_\",\r\n \"_Reflected_\",\r\n \"_Frequency_\",\r\n \"_Vertical_Offset_\",\r\n \"_Iridescent_Map_\",\r\n \"_Use_Global_Left_Index_\",\r\n \"_Use_Global_Right_Index_\",\r\n \"Global_Left_Index_Tip_Position\",\r\n \"Global_Right_Index_Tip_Position\",\r\n ];\r\n const samplers: string[] = [\"_Blob_Texture_\", \"_Iridescent_Map_\"];\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 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: fallbacks,\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 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 defines = <FluentBackplateMaterialDefines>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\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this._activeEffect.setMatrix(\"viewProjection\", this.getScene().getTransformMatrix());\r\n this._activeEffect.setVector3(\"cameraPosition\", this.getScene().activeCamera?.position ?? Vector3.ZeroReadOnly);\r\n\r\n // \"Round Rect\"\r\n this._activeEffect.setFloat(\"_Radius_\", this.radius);\r\n this._activeEffect.setFloat(\"_Line_Width_\", this.lineWidth);\r\n this._activeEffect.setFloat(\"_Absolute_Sizes_\", this.absoluteSizes ? 1.0 : 0.0);\r\n this._activeEffect.setFloat(\"_Filter_Width_\", this._filterWidth);\r\n this._activeEffect.setDirectColor4(\"_Base_Color_\", this.baseColor);\r\n this._activeEffect.setDirectColor4(\"_Line_Color_\", this.lineColor);\r\n\r\n // \"Radii Multipliers\"\r\n this._activeEffect.setFloat(\"_Radius_Top_Left_\", 1);\r\n this._activeEffect.setFloat(\"_Radius_Top_Right_\", 1.0);\r\n this._activeEffect.setFloat(\"_Radius_Bottom_Left_\", 1.0);\r\n this._activeEffect.setFloat(\"_Radius_Bottom_Right_\", 1.0);\r\n\r\n // \"Blob\"\r\n //define BLOB_ENABLE true;\r\n this._activeEffect.setFloat(\"_Blob_Intensity_\", this.blobIntensity);\r\n this._activeEffect.setFloat(\"_Blob_Near_Size_\", this.blobNearSize);\r\n this._activeEffect.setFloat(\"_Blob_Far_Size_\", this.blobFarSize);\r\n this._activeEffect.setFloat(\"_Blob_Near_Distance_\", this.blobNearDistance);\r\n this._activeEffect.setFloat(\"_Blob_Far_Distance_\", this.blobFarDistance);\r\n this._activeEffect.setFloat(\"_Blob_Fade_Length_\", this.blobFadeLength);\r\n this._activeEffect.setFloat(\"_Blob_Pulse_\", this.blobPulse);\r\n this._activeEffect.setFloat(\"_Blob_Fade_\", this.blobFade);\r\n\r\n // \"Blob Texture\"\r\n this._activeEffect.setTexture(\"_Blob_Texture_\", this._blobTexture);\r\n\r\n // \"Blob 2\"\r\n //define BLOB_ENABLE_2 true;\r\n this._activeEffect.setFloat(\"_Blob_Near_Size_2_\", this.blobNearSize2);\r\n this._activeEffect.setFloat(\"_Blob_Pulse_2_\", this.blobPulse2);\r\n this._activeEffect.setFloat(\"_Blob_Fade_2_\", this.blobFade2);\r\n\r\n // \"Line Highlight\"\r\n this._activeEffect.setFloat(\"_Rate_\", this._rate);\r\n this._activeEffect.setDirectColor4(\"_Highlight_Color_\", this.highlightColor);\r\n this._activeEffect.setFloat(\"_Highlight_Width_\", this.highlightWidth);\r\n this._activeEffect.setVector4(\"_Highlight_Transform_\", this._highlightTransform);\r\n this._activeEffect.setFloat(\"_Highlight_\", this._highlight);\r\n\r\n // \"Iridescence\"\r\n this._activeEffect.setFloat(\"_Iridescence_Intensity_\", this.iridescenceIntensity);\r\n this._activeEffect.setFloat(\"_Iridescence_Edge_Intensity_\", this.iridescenceEdgeIntensity);\r\n this._activeEffect.setFloat(\"_Angle_\", this._angle);\r\n\r\n // \"Fade\"\r\n this._activeEffect.setFloat(\"_Fade_Out_\", this.fadeOut);\r\n\r\n // \"Antialiasing\"\r\n //define SMOOTH_EDGES true;\r\n\r\n // \"ChooseAngle\"\r\n this._activeEffect.setFloat(\"_Reflected_\", this._reflected ? 1.0 : 0.0);\r\n\r\n // \"Multiply\"\r\n this._activeEffect.setFloat(\"_Frequency_\", this._frequency);\r\n this._activeEffect.setFloat(\"_Vertical_Offset_\", this._verticalOffset);\r\n\r\n // \"Color Texture\"\r\n //define IRIDESCENT_MAP_ENABLE true;\r\n this._activeEffect.setTexture(\"_Iridescent_Map_\", this._iridescentMap);\r\n\r\n // \"Global\"\r\n this._activeEffect.setFloat(\"_Use_Global_Left_Index_\", 1.0);\r\n this._activeEffect.setFloat(\"_Use_Global_Right_Index_\", 1.0);\r\n\r\n this._globalLeftIndexTipPosition4.set(this.globalLeftIndexTipPosition.x, this.globalLeftIndexTipPosition.y, this.globalLeftIndexTipPosition.z, 1.0);\r\n this._activeEffect.setVector4(\"Global_Left_Index_Tip_Position\", this._globalLeftIndexTipPosition4);\r\n\r\n this._globalRightIndexTipPosition4.set(this.globalRightIndexTipPosition.x, this.globalRightIndexTipPosition.y, this.globalRightIndexTipPosition.z, 1.0);\r\n this._activeEffect.setVector4(\"Global_Right_Index_Tip_Position\", this._globalRightIndexTipPosition4);\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n /**\r\n * Get the list of animatables in the material.\r\n * @returns the list of animatables object used in the material\r\n */\r\n public override getAnimatables(): IAnimatable[] {\r\n return [];\r\n }\r\n\r\n public override dispose(forceDisposeEffect?: boolean): void {\r\n super.dispose(forceDisposeEffect);\r\n\r\n this._blobTexture.dispose();\r\n this._iridescentMap.dispose();\r\n }\r\n\r\n public override clone(name: string): FluentBackplateMaterial {\r\n return SerializationHelper.Clone(() => new FluentBackplateMaterial(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.FluentBackplateMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"FluentBackplateMaterial\";\r\n }\r\n\r\n // Statics\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): FluentBackplateMaterial {\r\n return SerializationHelper.Parse(() => new FluentBackplateMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GUI.FluentBackplateMaterial\", FluentBackplateMaterial);\r\n"]}
|