@onerjs/core 8.27.9 → 8.27.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -63,6 +63,7 @@ export declare class PointerDragBehavior implements Behavior<AbstractMesh> {
63
63
  updateDragPlane: boolean;
64
64
  private _debugMode;
65
65
  private _moving;
66
+ private _prevAttachedNodeAbsPosition;
66
67
  /**
67
68
  * Fires each time the attached mesh is dragged with the pointer
68
69
  */
@@ -87,6 +87,8 @@ export class PointerDragBehavior {
87
87
  // Debug mode will display drag planes to help visualize behavior
88
88
  this._debugMode = false;
89
89
  this._moving = false;
90
+ //
91
+ this._prevAttachedNodeAbsPosition = new Vector3();
90
92
  /**
91
93
  * Fires each time the attached mesh is dragged with the pointer
92
94
  */
@@ -295,6 +297,7 @@ export class PointerDragBehavior {
295
297
  }
296
298
  });
297
299
  }
300
+ this._prevAttachedNodeAbsPosition.copyFrom(this.attachedNode.absolutePosition);
298
301
  this._beforeRenderObserver = this._scene.onBeforeRenderObservable.add(() => {
299
302
  if (this._moving && this.moveAttached) {
300
303
  let needMatrixUpdate = false;
@@ -315,7 +318,10 @@ export class PointerDragBehavior {
315
318
  if (needMatrixUpdate) {
316
319
  this.attachedNode.computeWorldMatrix();
317
320
  }
318
- this.onAttachedNodePositionChangeObservable.notifyObservers(absPosition);
321
+ if (!this._prevAttachedNodeAbsPosition.equals(absPosition)) {
322
+ this.onAttachedNodePositionChangeObservable.notifyObservers(absPosition);
323
+ this._prevAttachedNodeAbsPosition.copyFrom(absPosition);
324
+ }
319
325
  }
320
326
  });
321
327
  }
@@ -1 +1 @@
1
- {"version":3,"file":"pointerDragBehavior.js","sourceRoot":"","sources":["../../../../../dev/core/src/Behaviors/Meshes/pointerDragBehavior.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpC,OAAO,EAAE,UA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K,EAAE,CAAC;QACjC,IAAI,CAAC,YAAY,GAAG,IAAW,CAAC;IACpC,CAAC;;AArnBc,+BAAW,GAAG,CAAC,CAAC,AAAL,CAAM","sourcesContent":["import type { Behavior } from \"../../Behaviors/behavior\";\r\nimport { Mesh } from \"../../Meshes/mesh\";\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport { Scene } from \"../../scene\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Observer } from \"../../Misc/observable\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { TmpVectors, Vector3 } from \"../../Maths/math.vector\";\r\nimport type { PointerInfo } from \"../../Events/pointerEvents\";\r\nimport { PointerEventTypes } from \"../../Events/pointerEvents\";\r\nimport { Ray } from \"../../Culling/ray\";\r\nimport { PivotTools } from \"../../Misc/pivotTools\";\r\nimport type { ArcRotateCamera } from \"../../Cameras/arcRotateCamera\";\r\nimport { CreatePlane } from \"../../Meshes/Builders/planeBuilder\";\r\n\r\nimport type { IPointerEvent } from \"../../Events/deviceInputEvents\";\r\nimport { Epsilon } from \"../../Maths/math.constants\";\r\nimport type { DragEvent, DragStartEndEvent } from \"./pointerDragEvents\";\r\nimport type { TransformNode } from \"../../Meshes/transformNode\";\r\n\r\n/**\r\n * A behavior that when attached to a mesh will allow the mesh to be dragged around the screen based on pointer events\r\n */\r\nexport class PointerDragBehavior implements Behavior<AbstractMesh> {\r\n private static _AnyMouseId = -2;\r\n /**\r\n * Abstract mesh the behavior is set on\r\n */\r\n public attachedNode: TransformNode;\r\n protected _dragPlane: Mesh;\r\n private _scene: Scene;\r\n private _pointerObserver: Nullable<Observer<PointerInfo>>;\r\n private _beforeRenderObserver: Nullable<Observer<Scene>>;\r\n private static _PlaneScene: Scene;\r\n private _useAlternatePickedPointAboveMaxDragAngleDragSpeed = -1.1;\r\n private _activeDragButton: number = -1;\r\n private _activePointerInfo: Nullable<PointerInfo>;\r\n /**\r\n * The maximum tolerated angle between the drag plane and dragging pointer rays to trigger pointer events. Set to 0 to allow any angle (default: 0)\r\n */\r\n public maxDragAngle = 0;\r\n /**\r\n * Butttons that can be used to initiate a drag\r\n */\r\n public dragButtons = [0, 1, 2];\r\n /**\r\n * @internal\r\n */\r\n public _useAlternatePickedPointAboveMaxDragAngle = false;\r\n /**\r\n * Get or set the currentDraggingPointerId\r\n * @deprecated Please use currentDraggingPointerId instead\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public get currentDraggingPointerID(): number {\r\n return this.currentDraggingPointerId;\r\n }\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public set currentDraggingPointerID(currentDraggingPointerId: number) {\r\n this.currentDraggingPointerId = currentDraggingPointerId;\r\n }\r\n /**\r\n * The id of the pointer that is currently interacting with the behavior (-1 when no pointer is active)\r\n */\r\n public currentDraggingPointerId = -1;\r\n /**\r\n * The last position where the pointer hit the drag plane in world space\r\n */\r\n public lastDragPosition: Vector3;\r\n /**\r\n * If the behavior is currently in a dragging state\r\n */\r\n public dragging = false;\r\n /**\r\n * The distance towards the target drag position to move each frame. This can be useful to avoid jitter. Set this to 1 for no delay. (Default: 0.2)\r\n */\r\n public dragDeltaRatio = 0.2;\r\n /**\r\n * If the drag plane orientation should be updated during the dragging (Default: true)\r\n */\r\n public updateDragPlane = true;\r\n // Debug mode will display drag planes to help visualize behavior\r\n private _debugMode = false;\r\n private _moving = false;\r\n /**\r\n * Fires each time the attached mesh is dragged with the pointer\r\n */\r\n public onDragObservable = new Observable<DragEvent>();\r\n /**\r\n * Fires each time a drag begins (eg. mouse down on mesh)\r\n */\r\n public onDragStartObservable = new Observable<DragStartEndEvent>();\r\n /**\r\n * Fires each time a drag ends (eg. mouse release after drag)\r\n */\r\n public onDragEndObservable = new Observable<DragStartEndEvent>();\r\n /**\r\n * Fires each time behavior enabled state changes\r\n */\r\n public onEnabledObservable = new Observable<boolean>();\r\n /**\r\n * An observable that triggers when the position of the attached node changes.\r\n * Observers will be notified with a Vector3 object representing the new position.\r\n */\r\n public onAttachedNodePositionChangeObservable = new Observable<Vector3>();\r\n\r\n /**\r\n * If the attached mesh should be moved when dragged\r\n */\r\n public moveAttached = true;\r\n\r\n /**\r\n * A boolean flag that, when set to true, enables the handling of pointer events at runtime.\r\n * This can be used to dynamically control whether an application should respond to\r\n * touch, mouse, or other pointer input. Setting this to false will disable such interactions,\r\n * effectively ignoring pointer events until re-enabled.\r\n */\r\n public anyRuntimePointerEventsEnabled = false;\r\n\r\n /**\r\n * A boolean flag that, when set to true, disables the automatic handling of pointer events.\r\n * When disabled, manual configuration of pointer events is required.\r\n */\r\n public disableAutoPointerEvents = false;\r\n\r\n /**\r\n * If the drag behavior will react to drag events (Default: true)\r\n */\r\n public set enabled(value: boolean) {\r\n if (value != this._enabled) {\r\n this.onEnabledObservable.notifyObservers(value);\r\n }\r\n this._enabled = value;\r\n }\r\n\r\n public get enabled() {\r\n return this._enabled;\r\n }\r\n private _enabled = true;\r\n\r\n /**\r\n * If pointer events should start and release the drag (Default: true)\r\n */\r\n public startAndReleaseDragOnPointerEvents = true;\r\n /**\r\n * If camera controls should be detached during the drag\r\n */\r\n public detachCameraControls = true;\r\n\r\n /**\r\n * If set, the drag plane/axis will be rotated based on the attached mesh's world rotation (Default: true)\r\n */\r\n public useObjectOrientationForDragging = true;\r\n\r\n /**\r\n * Normally a drag is canceled when the user presses another button on the same pointer. If this is set to true,\r\n * the drag will continue even if another button is pressed on the same pointer.\r\n */\r\n public allowOtherButtonsDuringDrag = false;\r\n\r\n private _options: { dragAxis?: Vector3; dragPlaneNormal?: Vector3 };\r\n\r\n /**\r\n * Gets the options used by the behavior\r\n */\r\n public get options(): { dragAxis?: Vector3; dragPlaneNormal?: Vector3 } {\r\n return this._options;\r\n }\r\n\r\n /**\r\n * Sets the options used by the behavior\r\n */\r\n public set options(options: { dragAxis?: Vector3; dragPlaneNormal?: Vector3 }) {\r\n this._options = options;\r\n }\r\n\r\n /**\r\n * Creates a pointer drag behavior that can be attached to a mesh\r\n * @param options The drag axis or normal of the plane that will be dragged across. If no options are specified the drag plane will always face the ray's origin (eg. camera)\r\n * @param options.dragAxis\r\n * @param options.dragPlaneNormal\r\n */\r\n constructor(options?: { dragAxis?: Vector3; dragPlaneNormal?: Vector3 }) {\r\n this._options = options ? options : {};\r\n\r\n let optionCount = 0;\r\n if (this._options.dragAxis) {\r\n optionCount++;\r\n }\r\n if (this._options.dragPlaneNormal) {\r\n optionCount++;\r\n }\r\n if (optionCount > 1) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"Multiple drag modes specified in dragBehavior options. Only one expected\";\r\n }\r\n }\r\n\r\n /**\r\n * Predicate to determine if it is valid to move the object to a new position when it is moved.\r\n * In the case of rotation gizmo, target contains the angle.\r\n * @param target destination position or desired angle delta\r\n * @returns boolean for whether or not it is valid to move\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public validateDrag = (target: Vector3) => {\r\n return true;\r\n };\r\n\r\n /**\r\n * The name of the behavior\r\n */\r\n public get name(): string {\r\n return \"PointerDrag\";\r\n }\r\n\r\n /**\r\n * Initializes the behavior\r\n */\r\n public init() {}\r\n\r\n private _tmpVector = new Vector3(0, 0, 0);\r\n private _alternatePickedPoint = new Vector3(0, 0, 0);\r\n private _worldDragAxis = new Vector3(0, 0, 0);\r\n private _targetPosition = new Vector3(0, 0, 0);\r\n private _attachedToElement: boolean = false;\r\n /**\r\n * Attaches the drag behavior the passed in mesh\r\n * @param ownerNode The mesh that will be dragged around once attached\r\n * @param predicate Predicate to use for pick filtering\r\n */\r\n public attach(ownerNode: TransformNode, predicate?: (m: AbstractMesh) => boolean): void {\r\n this._scene = ownerNode.getScene();\r\n if ((ownerNode as Mesh)._isMesh) {\r\n (ownerNode as AbstractMesh).isNearGrabbable = true;\r\n }\r\n this.attachedNode = ownerNode;\r\n\r\n // Initialize drag plane to not interfere with existing scene\r\n if (!PointerDragBehavior._PlaneScene) {\r\n if (this._debugMode) {\r\n PointerDragBehavior._PlaneScene = this._scene;\r\n } else {\r\n PointerDragBehavior._PlaneScene = new Scene(this._scene.getEngine(), { virtual: true });\r\n PointerDragBehavior._PlaneScene.detachControl();\r\n this._scene.onDisposeObservable.addOnce(() => {\r\n PointerDragBehavior._PlaneScene.dispose();\r\n (<any>PointerDragBehavior._PlaneScene) = null;\r\n });\r\n }\r\n }\r\n this._dragPlane = CreatePlane(\r\n \"pointerDragPlane\",\r\n { size: this._debugMode ? 1 : 10000, updatable: false, sideOrientation: Mesh.DOUBLESIDE },\r\n PointerDragBehavior._PlaneScene\r\n );\r\n\r\n // State of the drag\r\n this.lastDragPosition = new Vector3(0, 0, 0);\r\n\r\n const pickPredicate = predicate\r\n ? predicate\r\n : (m: AbstractMesh) => {\r\n return this.attachedNode == m || m.isDescendantOf(this.attachedNode);\r\n };\r\n\r\n if (!this.disableAutoPointerEvents) {\r\n this._pointerObserver = this._scene.onPointerObservable.add((pointerInfo) => {\r\n if (!this.enabled) {\r\n // If behavior is disabled before releaseDrag is ever called, call it now.\r\n if (this._attachedToElement) {\r\n this.releaseDrag();\r\n }\r\n\r\n return;\r\n }\r\n\r\n // If we are dragging and the user presses another button on the same pointer, end the drag. Otherwise,\r\n // tracking when the drag should end becomes very complex.\r\n // gizmo.ts has similar behavior.\r\n if (\r\n this.dragging &&\r\n this.currentDraggingPointerId == (<IPointerEvent>pointerInfo.event).pointerId &&\r\n pointerInfo.event.button !== -1 &&\r\n pointerInfo.event.button !== this._activeDragButton &&\r\n !this.allowOtherButtonsDuringDrag\r\n ) {\r\n this.releaseDrag();\r\n return;\r\n }\r\n\r\n if (pointerInfo.type == PointerEventTypes.POINTERDOWN) {\r\n if (\r\n this.startAndReleaseDragOnPointerEvents &&\r\n !this.dragging &&\r\n pointerInfo.pickInfo &&\r\n pointerInfo.pickInfo.hit &&\r\n pointerInfo.pickInfo.pickedMesh &&\r\n pointerInfo.pickInfo.pickedPoint &&\r\n pointerInfo.pickInfo.ray &&\r\n pickPredicate(pointerInfo.pickInfo.pickedMesh)\r\n ) {\r\n if (this._activeDragButton === -1 && this.dragButtons.indexOf(pointerInfo.event.button) !== -1) {\r\n this._activeDragButton = pointerInfo.event.button;\r\n this._activePointerInfo = pointerInfo;\r\n this._startDrag((<IPointerEvent>pointerInfo.event).pointerId, pointerInfo.pickInfo.ray, pointerInfo.pickInfo.pickedPoint);\r\n }\r\n }\r\n } else if (pointerInfo.type == PointerEventTypes.POINTERUP) {\r\n if (\r\n this.startAndReleaseDragOnPointerEvents &&\r\n this.currentDraggingPointerId == (<IPointerEvent>pointerInfo.event).pointerId &&\r\n (this._activeDragButton === pointerInfo.event.button || this._activeDragButton === -1)\r\n ) {\r\n this.releaseDrag();\r\n }\r\n } else if (pointerInfo.type == PointerEventTypes.POINTERMOVE) {\r\n const pointerId = (<IPointerEvent>pointerInfo.event).pointerId;\r\n\r\n // If drag was started with anyMouseID specified, set pointerID to the next mouse that moved\r\n if (this.currentDraggingPointerId === PointerDragBehavior._AnyMouseId && pointerId !== PointerDragBehavior._AnyMouseId) {\r\n const evt = <IPointerEvent>pointerInfo.event;\r\n const isMouseEvent = evt.pointerType === \"mouse\" || (!this._scene.getEngine().hostInformation.isMobile && evt instanceof MouseEvent);\r\n if (isMouseEvent) {\r\n if (this._lastPointerRay[this.currentDraggingPointerId]) {\r\n this._lastPointerRay[pointerId] = this._lastPointerRay[this.currentDraggingPointerId];\r\n delete this._lastPointerRay[this.currentDraggingPointerId];\r\n }\r\n this.currentDraggingPointerId = pointerId;\r\n }\r\n }\r\n\r\n // Keep track of last pointer ray, this is used simulating the start of a drag in startDrag()\r\n if (!this._lastPointerRay[pointerId]) {\r\n this._lastPointerRay[pointerId] = new Ray(new Vector3(), new Vector3());\r\n }\r\n if (pointerInfo.pickInfo && pointerInfo.pickInfo.ray) {\r\n this._lastPointerRay[pointerId].origin.copyFrom(pointerInfo.pickInfo.ray.origin);\r\n this._lastPointerRay[pointerId].direction.copyFrom(pointerInfo.pickInfo.ray.direction);\r\n\r\n if (this.currentDraggingPointerId == pointerId && this.dragging) {\r\n this._moveDrag(pointerInfo.pickInfo.ray);\r\n }\r\n }\r\n if (this.anyRuntimePointerEventsEnabled) {\r\n this.currentDraggingPointerId = pointerId;\r\n }\r\n }\r\n });\r\n }\r\n\r\n this._beforeRenderObserver = this._scene.onBeforeRenderObservable.add(() => {\r\n if (this._moving && this.moveAttached) {\r\n let needMatrixUpdate = false;\r\n PivotTools._RemoveAndStorePivotPoint(this.attachedNode);\r\n // Slowly move mesh to avoid jitter\r\n const absPosition = this.attachedNode.absolutePosition;\r\n if (this._targetPosition.equals(absPosition)) {\r\n return;\r\n }\r\n this._targetPosition.subtractToRef(absPosition, this._tmpVector);\r\n this._tmpVector.scaleInPlace(this.dragDeltaRatio);\r\n absPosition.addToRef(this._tmpVector, this._tmpVector);\r\n if (this.validateDrag(this._tmpVector)) {\r\n this.attachedNode.setAbsolutePosition(this._tmpVector);\r\n needMatrixUpdate = true;\r\n }\r\n PivotTools._RestorePivotPoint(this.attachedNode);\r\n if (needMatrixUpdate) {\r\n this.attachedNode.computeWorldMatrix();\r\n }\r\n this.onAttachedNodePositionChangeObservable.notifyObservers(absPosition);\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Force release the drag action by code.\r\n */\r\n public releaseDrag() {\r\n if (this.dragging) {\r\n this.dragging = false;\r\n this.onDragEndObservable.notifyObservers({ dragPlanePoint: this.lastDragPosition, pointerId: this.currentDraggingPointerId, pointerInfo: this._activePointerInfo });\r\n }\r\n\r\n this.currentDraggingPointerId = -1;\r\n this._activeDragButton = -1;\r\n this._activePointerInfo = null;\r\n this._moving = false;\r\n\r\n // Reattach camera controls\r\n if (this.detachCameraControls && this._attachedToElement && this._scene.activeCamera && !this._scene.activeCamera.leftCamera) {\r\n if (this._scene.activeCamera.getClassName() === \"ArcRotateCamera\") {\r\n const arcRotateCamera = this._scene.activeCamera as ArcRotateCamera;\r\n arcRotateCamera.attachControl(\r\n arcRotateCamera.inputs ? arcRotateCamera.inputs.noPreventDefault : true,\r\n arcRotateCamera._useCtrlForPanning,\r\n arcRotateCamera._panningMouseButton\r\n );\r\n } else {\r\n this._scene.activeCamera.attachControl(this._scene.activeCamera.inputs ? this._scene.activeCamera.inputs.noPreventDefault : true);\r\n }\r\n this._attachedToElement = false;\r\n }\r\n }\r\n\r\n private _startDragRay = new Ray(new Vector3(), new Vector3());\r\n private _lastPointerRay: { [key: number]: Ray } = {};\r\n /**\r\n * Simulates the start of a pointer drag event on the behavior\r\n * @param pointerId pointerID of the pointer that should be simulated (Default: Any mouse pointer ID)\r\n * @param fromRay initial ray of the pointer to be simulated (Default: Ray from camera to attached mesh)\r\n * @param startPickedPoint picked point of the pointer to be simulated (Default: attached mesh position)\r\n */\r\n public startDrag(pointerId: number = PointerDragBehavior._AnyMouseId, fromRay?: Ray, startPickedPoint?: Vector3) {\r\n this._startDrag(pointerId, fromRay, startPickedPoint);\r\n\r\n let lastRay = this._lastPointerRay[pointerId];\r\n if (pointerId === PointerDragBehavior._AnyMouseId) {\r\n lastRay = this._lastPointerRay[<any>Object.keys(this._lastPointerRay)[0]];\r\n }\r\n\r\n if (lastRay) {\r\n // if there was a last pointer ray drag the object there\r\n this._moveDrag(lastRay);\r\n }\r\n }\r\n\r\n protected _startDrag(pointerId: number, fromRay?: Ray, startPickedPoint?: Vector3) {\r\n if (!this._scene.activeCamera || this.dragging || !this.attachedNode) {\r\n return;\r\n }\r\n\r\n PivotTools._RemoveAndStorePivotPoint(this.attachedNode);\r\n // Create start ray from the camera to the object\r\n if (fromRay) {\r\n this._startDragRay.direction.copyFrom(fromRay.direction);\r\n this._startDragRay.origin.copyFrom(fromRay.origin);\r\n } else {\r\n this._startDragRay.origin.copyFrom(this._scene.activeCamera.position);\r\n this.attachedNode.getWorldMatrix().getTranslationToRef(this._tmpVector);\r\n this._tmpVector.subtractToRef(this._scene.activeCamera.position, this._startDragRay.direction);\r\n }\r\n\r\n this._updateDragPlanePosition(this._startDragRay, startPickedPoint ? startPickedPoint : this._tmpVector);\r\n\r\n const pickedPoint = this._pickWithRayOnDragPlane(this._startDragRay);\r\n if (pickedPoint) {\r\n this.dragging = true;\r\n this.currentDraggingPointerId = pointerId;\r\n this.lastDragPosition.copyFrom(pickedPoint);\r\n this.onDragStartObservable.notifyObservers({ dragPlanePoint: pickedPoint, pointerId: this.currentDraggingPointerId, pointerInfo: this._activePointerInfo });\r\n this._targetPosition.copyFrom(this.attachedNode.getAbsolutePosition());\r\n\r\n // Detatch camera controls\r\n if (this.detachCameraControls && this._scene.activeCamera && this._scene.activeCamera.inputs && !this._scene.activeCamera.leftCamera) {\r\n if (this._scene.activeCamera.inputs.attachedToElement) {\r\n this._scene.activeCamera.detachControl();\r\n this._attachedToElement = true;\r\n } else {\r\n this._attachedToElement = false;\r\n }\r\n }\r\n } else {\r\n this.releaseDrag();\r\n }\r\n PivotTools._RestorePivotPoint(this.attachedNode);\r\n }\r\n\r\n private _dragDelta = new Vector3();\r\n protected _moveDrag(ray: Ray) {\r\n this._moving = true;\r\n const pickedPoint = this._pickWithRayOnDragPlane(ray);\r\n\r\n if (pickedPoint) {\r\n PivotTools._RemoveAndStorePivotPoint(this.attachedNode);\r\n\r\n if (this.updateDragPlane) {\r\n this._updateDragPlanePosition(ray, pickedPoint);\r\n }\r\n let dragLength = 0;\r\n // depending on the drag mode option drag accordingly\r\n if (this._options.dragAxis) {\r\n // Convert local drag axis to world if useObjectOrientationForDragging\r\n this.useObjectOrientationForDragging\r\n ? Vector3.TransformCoordinatesToRef(this._options.dragAxis, this.attachedNode.getWorldMatrix().getRotationMatrix(), this._worldDragAxis)\r\n : this._worldDragAxis.copyFrom(this._options.dragAxis);\r\n // Project delta drag from the drag plane onto the drag axis\r\n pickedPoint.subtractToRef(this.lastDragPosition, this._tmpVector);\r\n\r\n this._worldDragAxis.normalize();\r\n dragLength = Vector3.Dot(this._tmpVector, this._worldDragAxis);\r\n this._worldDragAxis.scaleToRef(dragLength, this._dragDelta);\r\n } else {\r\n dragLength = this._dragDelta.length();\r\n pickedPoint.subtractToRef(this.lastDragPosition, this._dragDelta);\r\n }\r\n this._targetPosition.addInPlace(this._dragDelta);\r\n this.onDragObservable.notifyObservers({\r\n dragDistance: dragLength,\r\n delta: this._dragDelta,\r\n dragPlanePoint: pickedPoint,\r\n dragPlaneNormal: this._dragPlane.forward,\r\n pointerId: this.currentDraggingPointerId,\r\n pointerInfo: this._activePointerInfo,\r\n });\r\n this.lastDragPosition.copyFrom(pickedPoint);\r\n\r\n PivotTools._RestorePivotPoint(this.attachedNode);\r\n }\r\n }\r\n\r\n private _pickWithRayOnDragPlane(ray: Nullable<Ray>) {\r\n if (!ray) {\r\n return null;\r\n }\r\n\r\n // Calculate angle between plane normal and ray\r\n let angle = Math.acos(Vector3.Dot(this._dragPlane.forward, ray.direction));\r\n // Correct if ray is casted from oposite side\r\n if (angle > Math.PI / 2) {\r\n angle = Math.PI - angle;\r\n }\r\n\r\n // If the angle is too perpendicular to the plane pick another point on the plane where it is looking\r\n if (this.maxDragAngle > 0 && angle > this.maxDragAngle) {\r\n if (this._useAlternatePickedPointAboveMaxDragAngle) {\r\n // Invert ray direction along the towards object axis\r\n this._tmpVector.copyFrom(ray.direction);\r\n this.attachedNode.absolutePosition.subtractToRef(ray.origin, this._alternatePickedPoint);\r\n this._alternatePickedPoint.normalize();\r\n this._alternatePickedPoint.scaleInPlace(this._useAlternatePickedPointAboveMaxDragAngleDragSpeed * Vector3.Dot(this._alternatePickedPoint, this._tmpVector));\r\n this._tmpVector.addInPlace(this._alternatePickedPoint);\r\n\r\n // Project resulting vector onto the drag plane and add it to the attached nodes absolute position to get a picked point\r\n const dot = Vector3.Dot(this._dragPlane.forward, this._tmpVector);\r\n this._dragPlane.forward.scaleToRef(-dot, this._alternatePickedPoint);\r\n this._alternatePickedPoint.addInPlace(this._tmpVector);\r\n this._alternatePickedPoint.addInPlace(this.attachedNode.absolutePosition);\r\n return this._alternatePickedPoint;\r\n } else {\r\n return null;\r\n }\r\n }\r\n\r\n // use an infinite plane instead of ray picking a mesh that must be updated every frame\r\n const planeNormal = this._dragPlane.forward;\r\n const planePosition = this._dragPlane.position;\r\n const dotProduct = ray.direction.dot(planeNormal);\r\n if (Math.abs(dotProduct) < Epsilon) {\r\n // Ray and plane are parallel, no intersection\r\n return null;\r\n }\r\n\r\n planePosition.subtractToRef(ray.origin, TmpVectors.Vector3[0]);\r\n const t = TmpVectors.Vector3[0].dot(planeNormal) / dotProduct;\r\n // Ensure the intersection point is in front of the ray (t must be positive)\r\n if (t < 0) {\r\n // Intersection point is behind the ray\r\n return null;\r\n }\r\n\r\n // Calculate the intersection point using the parameter t\r\n ray.direction.scaleToRef(t, TmpVectors.Vector3[0]);\r\n const intersectionPoint = ray.origin.add(TmpVectors.Vector3[0]);\r\n return intersectionPoint;\r\n }\r\n\r\n // Variables to avoid instantiation in the below method\r\n private _pointA = new Vector3(0, 0, 0);\r\n private _pointC = new Vector3(0, 0, 0);\r\n private _localAxis = new Vector3(0, 0, 0);\r\n private _lookAt = new Vector3(0, 0, 0);\r\n // Position the drag plane based on the attached mesh position, for single axis rotate the plane along the axis to face the camera\r\n private _updateDragPlanePosition(ray: Ray, dragPlanePosition: Vector3) {\r\n this._pointA.copyFrom(dragPlanePosition);\r\n if (this._options.dragAxis) {\r\n this.useObjectOrientationForDragging\r\n ? Vector3.TransformCoordinatesToRef(this._options.dragAxis, this.attachedNode.getWorldMatrix().getRotationMatrix(), this._localAxis)\r\n : this._localAxis.copyFrom(this._options.dragAxis);\r\n\r\n // Calculate plane normal that is the cross product of local axis and (eye-dragPlanePosition)\r\n ray.origin.subtractToRef(this._pointA, this._pointC);\r\n this._pointC.normalize();\r\n if (Math.abs(Vector3.Dot(this._localAxis, this._pointC)) > 0.999) {\r\n // the drag axis is colinear with the (eye to position) ray. The cross product will give jittered values.\r\n // A new axis vector need to be computed\r\n if (Math.abs(Vector3.Dot(Vector3.UpReadOnly, this._pointC)) > 0.999) {\r\n this._lookAt.copyFrom(Vector3.Right());\r\n } else {\r\n this._lookAt.copyFrom(Vector3.UpReadOnly);\r\n }\r\n } else {\r\n Vector3.CrossToRef(this._localAxis, this._pointC, this._lookAt);\r\n // Get perpendicular line from previous result and drag axis to adjust lineB to be perpendicular to camera\r\n Vector3.CrossToRef(this._localAxis, this._lookAt, this._lookAt);\r\n this._lookAt.normalize();\r\n }\r\n\r\n this._dragPlane.position.copyFrom(this._pointA);\r\n this._pointA.addToRef(this._lookAt, this._lookAt);\r\n this._dragPlane.lookAt(this._lookAt);\r\n } else if (this._options.dragPlaneNormal) {\r\n this.useObjectOrientationForDragging\r\n ? Vector3.TransformCoordinatesToRef(this._options.dragPlaneNormal, this.attachedNode.getWorldMatrix().getRotationMatrix(), this._localAxis)\r\n : this._localAxis.copyFrom(this._options.dragPlaneNormal);\r\n this._dragPlane.position.copyFrom(this._pointA);\r\n this._pointA.addToRef(this._localAxis, this._lookAt);\r\n this._dragPlane.lookAt(this._lookAt);\r\n } else {\r\n if (this._scene.activeCamera) {\r\n this._scene.activeCamera.getForwardRay().direction.normalizeToRef(this._localAxis);\r\n }\r\n this._dragPlane.position.copyFrom(this._pointA);\r\n this._dragPlane.lookAt(this._pointA.add(this._localAxis));\r\n }\r\n // Update the position of the drag plane so it doesn't get out of sync with the node (eg. when moving back and forth quickly)\r\n this._dragPlane.position.copyFrom(this.attachedNode.getAbsolutePosition());\r\n\r\n this._dragPlane.computeWorldMatrix(true);\r\n }\r\n\r\n /**\r\n * Detaches the behavior from the mesh\r\n */\r\n public detach(): void {\r\n this._lastPointerRay = {};\r\n if (this.attachedNode && (this.attachedNode as Mesh)._isMesh) {\r\n (this.attachedNode as AbstractMesh).isNearGrabbable = false;\r\n }\r\n if (this._pointerObserver) {\r\n this._scene.onPointerObservable.remove(this._pointerObserver);\r\n }\r\n if (this._beforeRenderObserver) {\r\n this._scene.onBeforeRenderObservable.remove(this._beforeRenderObserver);\r\n }\r\n if (this._dragPlane) {\r\n this._dragPlane.dispose();\r\n }\r\n this.releaseDrag();\r\n }\r\n\r\n /**\r\n * Disposes the current instance, cleaning up all associated observables and detaching any attached nodes.\r\n */\r\n public dispose(): void {\r\n this.detach();\r\n this.onDragObservable.clear();\r\n this.onAttachedNodePositionChangeObservable.clear();\r\n this.onDragEndObservable.clear();\r\n this.onDragStartObservable.clear();\r\n this.onEnabledObservable.clear();\r\n this.attachedNode = null as any;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"pointerDragBehavior.js","sourceRoot":"","sources":["../../../../../dev/core/src/Behaviors/Meshes/pointerDragBehavior.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAGjE,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAIrD;;GAEG;AACH,MAAM,OAAO,mBAAmB;IA0B5B;;;OAGG;IACH,gEAAgE;IAChE,IAAW,wBAAwB;QAC/B,OAAO,IAAI,CAAC,wBAAwB,CAAC;IACzC,CAAC;IACD,gEAAgE;IAChE,IAAW,wBAAwB,CAAC,wBAAgC;QAChE,IAAI,CAAC,wBAAwB,GAAG,wBAAwB,CAAC;IAC7D,CAAC;IAmED;;OAEG;IACH,IAAW,OAAO,CAAC,KAAc;QAC7B,IAAI,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACzB,IAAI,CAAC,mBAAmB,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QACpD,CAAC;QACD,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KAAK,CAAC;QAChE,CAAC;QACD,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACxB,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAClE,CAAC;QACD,IAAI,IAAI,CAAC,qBAAqB,EAAE,CAAC;YAC7B,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAC,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QAC5E,CAAC;QACD,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YAClB,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;QAC9B,CAAC;QACD,IAAI,CAAC,WAAW,EAAE,CAAC;IACvB,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,MAAM,EAAE,CAAC;QACd,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;QAC9B,IAAI,CAAC,sCAAsC,CAAC,KAAK,EAAE,CAAC;QACpD,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,CAAC;QACjC,IAAI,CAAC,qBAAqB,CAAC,KAAK,EAAE,CAAC;QACnC,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,CAAC;QACjC,IAAI,CAAC,YAAY,GAAG,IAAW,CAAC;IACpC,CAAC;;AA5nBc,+BAAW,GAAG,CAAC,CAAC,AAAL,CAAM","sourcesContent":["import type { Behavior } from \"../../Behaviors/behavior\";\r\nimport { Mesh } from \"../../Meshes/mesh\";\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport { Scene } from \"../../scene\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Observer } from \"../../Misc/observable\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { TmpVectors, Vector3 } from \"../../Maths/math.vector\";\r\nimport type { PointerInfo } from \"../../Events/pointerEvents\";\r\nimport { PointerEventTypes } from \"../../Events/pointerEvents\";\r\nimport { Ray } from \"../../Culling/ray\";\r\nimport { PivotTools } from \"../../Misc/pivotTools\";\r\nimport type { ArcRotateCamera } from \"../../Cameras/arcRotateCamera\";\r\nimport { CreatePlane } from \"../../Meshes/Builders/planeBuilder\";\r\n\r\nimport type { IPointerEvent } from \"../../Events/deviceInputEvents\";\r\nimport { Epsilon } from \"../../Maths/math.constants\";\r\nimport type { DragEvent, DragStartEndEvent } from \"./pointerDragEvents\";\r\nimport type { TransformNode } from \"../../Meshes/transformNode\";\r\n\r\n/**\r\n * A behavior that when attached to a mesh will allow the mesh to be dragged around the screen based on pointer events\r\n */\r\nexport class PointerDragBehavior implements Behavior<AbstractMesh> {\r\n private static _AnyMouseId = -2;\r\n /**\r\n * Abstract mesh the behavior is set on\r\n */\r\n public attachedNode: TransformNode;\r\n protected _dragPlane: Mesh;\r\n private _scene: Scene;\r\n private _pointerObserver: Nullable<Observer<PointerInfo>>;\r\n private _beforeRenderObserver: Nullable<Observer<Scene>>;\r\n private static _PlaneScene: Scene;\r\n private _useAlternatePickedPointAboveMaxDragAngleDragSpeed = -1.1;\r\n private _activeDragButton: number = -1;\r\n private _activePointerInfo: Nullable<PointerInfo>;\r\n /**\r\n * The maximum tolerated angle between the drag plane and dragging pointer rays to trigger pointer events. Set to 0 to allow any angle (default: 0)\r\n */\r\n public maxDragAngle = 0;\r\n /**\r\n * Butttons that can be used to initiate a drag\r\n */\r\n public dragButtons = [0, 1, 2];\r\n /**\r\n * @internal\r\n */\r\n public _useAlternatePickedPointAboveMaxDragAngle = false;\r\n /**\r\n * Get or set the currentDraggingPointerId\r\n * @deprecated Please use currentDraggingPointerId instead\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public get currentDraggingPointerID(): number {\r\n return this.currentDraggingPointerId;\r\n }\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public set currentDraggingPointerID(currentDraggingPointerId: number) {\r\n this.currentDraggingPointerId = currentDraggingPointerId;\r\n }\r\n /**\r\n * The id of the pointer that is currently interacting with the behavior (-1 when no pointer is active)\r\n */\r\n public currentDraggingPointerId = -1;\r\n /**\r\n * The last position where the pointer hit the drag plane in world space\r\n */\r\n public lastDragPosition: Vector3;\r\n /**\r\n * If the behavior is currently in a dragging state\r\n */\r\n public dragging = false;\r\n /**\r\n * The distance towards the target drag position to move each frame. This can be useful to avoid jitter. Set this to 1 for no delay. (Default: 0.2)\r\n */\r\n public dragDeltaRatio = 0.2;\r\n /**\r\n * If the drag plane orientation should be updated during the dragging (Default: true)\r\n */\r\n public updateDragPlane = true;\r\n // Debug mode will display drag planes to help visualize behavior\r\n private _debugMode = false;\r\n private _moving = false;\r\n //\r\n private _prevAttachedNodeAbsPosition: Vector3 = new Vector3();\r\n /**\r\n * Fires each time the attached mesh is dragged with the pointer\r\n */\r\n public onDragObservable = new Observable<DragEvent>();\r\n /**\r\n * Fires each time a drag begins (eg. mouse down on mesh)\r\n */\r\n public onDragStartObservable = new Observable<DragStartEndEvent>();\r\n /**\r\n * Fires each time a drag ends (eg. mouse release after drag)\r\n */\r\n public onDragEndObservable = new Observable<DragStartEndEvent>();\r\n /**\r\n * Fires each time behavior enabled state changes\r\n */\r\n public onEnabledObservable = new Observable<boolean>();\r\n /**\r\n * An observable that triggers when the position of the attached node changes.\r\n * Observers will be notified with a Vector3 object representing the new position.\r\n */\r\n public onAttachedNodePositionChangeObservable = new Observable<Vector3>();\r\n\r\n /**\r\n * If the attached mesh should be moved when dragged\r\n */\r\n public moveAttached = true;\r\n\r\n /**\r\n * A boolean flag that, when set to true, enables the handling of pointer events at runtime.\r\n * This can be used to dynamically control whether an application should respond to\r\n * touch, mouse, or other pointer input. Setting this to false will disable such interactions,\r\n * effectively ignoring pointer events until re-enabled.\r\n */\r\n public anyRuntimePointerEventsEnabled = false;\r\n\r\n /**\r\n * A boolean flag that, when set to true, disables the automatic handling of pointer events.\r\n * When disabled, manual configuration of pointer events is required.\r\n */\r\n public disableAutoPointerEvents = false;\r\n\r\n /**\r\n * If the drag behavior will react to drag events (Default: true)\r\n */\r\n public set enabled(value: boolean) {\r\n if (value != this._enabled) {\r\n this.onEnabledObservable.notifyObservers(value);\r\n }\r\n this._enabled = value;\r\n }\r\n\r\n public get enabled() {\r\n return this._enabled;\r\n }\r\n private _enabled = true;\r\n\r\n /**\r\n * If pointer events should start and release the drag (Default: true)\r\n */\r\n public startAndReleaseDragOnPointerEvents = true;\r\n /**\r\n * If camera controls should be detached during the drag\r\n */\r\n public detachCameraControls = true;\r\n\r\n /**\r\n * If set, the drag plane/axis will be rotated based on the attached mesh's world rotation (Default: true)\r\n */\r\n public useObjectOrientationForDragging = true;\r\n\r\n /**\r\n * Normally a drag is canceled when the user presses another button on the same pointer. If this is set to true,\r\n * the drag will continue even if another button is pressed on the same pointer.\r\n */\r\n public allowOtherButtonsDuringDrag = false;\r\n\r\n private _options: { dragAxis?: Vector3; dragPlaneNormal?: Vector3 };\r\n\r\n /**\r\n * Gets the options used by the behavior\r\n */\r\n public get options(): { dragAxis?: Vector3; dragPlaneNormal?: Vector3 } {\r\n return this._options;\r\n }\r\n\r\n /**\r\n * Sets the options used by the behavior\r\n */\r\n public set options(options: { dragAxis?: Vector3; dragPlaneNormal?: Vector3 }) {\r\n this._options = options;\r\n }\r\n\r\n /**\r\n * Creates a pointer drag behavior that can be attached to a mesh\r\n * @param options The drag axis or normal of the plane that will be dragged across. If no options are specified the drag plane will always face the ray's origin (eg. camera)\r\n * @param options.dragAxis\r\n * @param options.dragPlaneNormal\r\n */\r\n constructor(options?: { dragAxis?: Vector3; dragPlaneNormal?: Vector3 }) {\r\n this._options = options ? options : {};\r\n\r\n let optionCount = 0;\r\n if (this._options.dragAxis) {\r\n optionCount++;\r\n }\r\n if (this._options.dragPlaneNormal) {\r\n optionCount++;\r\n }\r\n if (optionCount > 1) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"Multiple drag modes specified in dragBehavior options. Only one expected\";\r\n }\r\n }\r\n\r\n /**\r\n * Predicate to determine if it is valid to move the object to a new position when it is moved.\r\n * In the case of rotation gizmo, target contains the angle.\r\n * @param target destination position or desired angle delta\r\n * @returns boolean for whether or not it is valid to move\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public validateDrag = (target: Vector3) => {\r\n return true;\r\n };\r\n\r\n /**\r\n * The name of the behavior\r\n */\r\n public get name(): string {\r\n return \"PointerDrag\";\r\n }\r\n\r\n /**\r\n * Initializes the behavior\r\n */\r\n public init() {}\r\n\r\n private _tmpVector = new Vector3(0, 0, 0);\r\n private _alternatePickedPoint = new Vector3(0, 0, 0);\r\n private _worldDragAxis = new Vector3(0, 0, 0);\r\n private _targetPosition = new Vector3(0, 0, 0);\r\n private _attachedToElement: boolean = false;\r\n /**\r\n * Attaches the drag behavior the passed in mesh\r\n * @param ownerNode The mesh that will be dragged around once attached\r\n * @param predicate Predicate to use for pick filtering\r\n */\r\n public attach(ownerNode: TransformNode, predicate?: (m: AbstractMesh) => boolean): void {\r\n this._scene = ownerNode.getScene();\r\n if ((ownerNode as Mesh)._isMesh) {\r\n (ownerNode as AbstractMesh).isNearGrabbable = true;\r\n }\r\n this.attachedNode = ownerNode;\r\n\r\n // Initialize drag plane to not interfere with existing scene\r\n if (!PointerDragBehavior._PlaneScene) {\r\n if (this._debugMode) {\r\n PointerDragBehavior._PlaneScene = this._scene;\r\n } else {\r\n PointerDragBehavior._PlaneScene = new Scene(this._scene.getEngine(), { virtual: true });\r\n PointerDragBehavior._PlaneScene.detachControl();\r\n this._scene.onDisposeObservable.addOnce(() => {\r\n PointerDragBehavior._PlaneScene.dispose();\r\n (<any>PointerDragBehavior._PlaneScene) = null;\r\n });\r\n }\r\n }\r\n this._dragPlane = CreatePlane(\r\n \"pointerDragPlane\",\r\n { size: this._debugMode ? 1 : 10000, updatable: false, sideOrientation: Mesh.DOUBLESIDE },\r\n PointerDragBehavior._PlaneScene\r\n );\r\n\r\n // State of the drag\r\n this.lastDragPosition = new Vector3(0, 0, 0);\r\n\r\n const pickPredicate = predicate\r\n ? predicate\r\n : (m: AbstractMesh) => {\r\n return this.attachedNode == m || m.isDescendantOf(this.attachedNode);\r\n };\r\n\r\n if (!this.disableAutoPointerEvents) {\r\n this._pointerObserver = this._scene.onPointerObservable.add((pointerInfo) => {\r\n if (!this.enabled) {\r\n // If behavior is disabled before releaseDrag is ever called, call it now.\r\n if (this._attachedToElement) {\r\n this.releaseDrag();\r\n }\r\n\r\n return;\r\n }\r\n\r\n // If we are dragging and the user presses another button on the same pointer, end the drag. Otherwise,\r\n // tracking when the drag should end becomes very complex.\r\n // gizmo.ts has similar behavior.\r\n if (\r\n this.dragging &&\r\n this.currentDraggingPointerId == (<IPointerEvent>pointerInfo.event).pointerId &&\r\n pointerInfo.event.button !== -1 &&\r\n pointerInfo.event.button !== this._activeDragButton &&\r\n !this.allowOtherButtonsDuringDrag\r\n ) {\r\n this.releaseDrag();\r\n return;\r\n }\r\n\r\n if (pointerInfo.type == PointerEventTypes.POINTERDOWN) {\r\n if (\r\n this.startAndReleaseDragOnPointerEvents &&\r\n !this.dragging &&\r\n pointerInfo.pickInfo &&\r\n pointerInfo.pickInfo.hit &&\r\n pointerInfo.pickInfo.pickedMesh &&\r\n pointerInfo.pickInfo.pickedPoint &&\r\n pointerInfo.pickInfo.ray &&\r\n pickPredicate(pointerInfo.pickInfo.pickedMesh)\r\n ) {\r\n if (this._activeDragButton === -1 && this.dragButtons.indexOf(pointerInfo.event.button) !== -1) {\r\n this._activeDragButton = pointerInfo.event.button;\r\n this._activePointerInfo = pointerInfo;\r\n this._startDrag((<IPointerEvent>pointerInfo.event).pointerId, pointerInfo.pickInfo.ray, pointerInfo.pickInfo.pickedPoint);\r\n }\r\n }\r\n } else if (pointerInfo.type == PointerEventTypes.POINTERUP) {\r\n if (\r\n this.startAndReleaseDragOnPointerEvents &&\r\n this.currentDraggingPointerId == (<IPointerEvent>pointerInfo.event).pointerId &&\r\n (this._activeDragButton === pointerInfo.event.button || this._activeDragButton === -1)\r\n ) {\r\n this.releaseDrag();\r\n }\r\n } else if (pointerInfo.type == PointerEventTypes.POINTERMOVE) {\r\n const pointerId = (<IPointerEvent>pointerInfo.event).pointerId;\r\n\r\n // If drag was started with anyMouseID specified, set pointerID to the next mouse that moved\r\n if (this.currentDraggingPointerId === PointerDragBehavior._AnyMouseId && pointerId !== PointerDragBehavior._AnyMouseId) {\r\n const evt = <IPointerEvent>pointerInfo.event;\r\n const isMouseEvent = evt.pointerType === \"mouse\" || (!this._scene.getEngine().hostInformation.isMobile && evt instanceof MouseEvent);\r\n if (isMouseEvent) {\r\n if (this._lastPointerRay[this.currentDraggingPointerId]) {\r\n this._lastPointerRay[pointerId] = this._lastPointerRay[this.currentDraggingPointerId];\r\n delete this._lastPointerRay[this.currentDraggingPointerId];\r\n }\r\n this.currentDraggingPointerId = pointerId;\r\n }\r\n }\r\n\r\n // Keep track of last pointer ray, this is used simulating the start of a drag in startDrag()\r\n if (!this._lastPointerRay[pointerId]) {\r\n this._lastPointerRay[pointerId] = new Ray(new Vector3(), new Vector3());\r\n }\r\n if (pointerInfo.pickInfo && pointerInfo.pickInfo.ray) {\r\n this._lastPointerRay[pointerId].origin.copyFrom(pointerInfo.pickInfo.ray.origin);\r\n this._lastPointerRay[pointerId].direction.copyFrom(pointerInfo.pickInfo.ray.direction);\r\n\r\n if (this.currentDraggingPointerId == pointerId && this.dragging) {\r\n this._moveDrag(pointerInfo.pickInfo.ray);\r\n }\r\n }\r\n if (this.anyRuntimePointerEventsEnabled) {\r\n this.currentDraggingPointerId = pointerId;\r\n }\r\n }\r\n });\r\n }\r\n\r\n this._prevAttachedNodeAbsPosition.copyFrom(this.attachedNode.absolutePosition);\r\n\r\n this._beforeRenderObserver = this._scene.onBeforeRenderObservable.add(() => {\r\n if (this._moving && this.moveAttached) {\r\n let needMatrixUpdate = false;\r\n PivotTools._RemoveAndStorePivotPoint(this.attachedNode);\r\n // Slowly move mesh to avoid jitter\r\n const absPosition = this.attachedNode.absolutePosition;\r\n if (this._targetPosition.equals(absPosition)) {\r\n return;\r\n }\r\n this._targetPosition.subtractToRef(absPosition, this._tmpVector);\r\n this._tmpVector.scaleInPlace(this.dragDeltaRatio);\r\n absPosition.addToRef(this._tmpVector, this._tmpVector);\r\n if (this.validateDrag(this._tmpVector)) {\r\n this.attachedNode.setAbsolutePosition(this._tmpVector);\r\n needMatrixUpdate = true;\r\n }\r\n PivotTools._RestorePivotPoint(this.attachedNode);\r\n if (needMatrixUpdate) {\r\n this.attachedNode.computeWorldMatrix();\r\n }\r\n if (!this._prevAttachedNodeAbsPosition.equals(absPosition)) {\r\n this.onAttachedNodePositionChangeObservable.notifyObservers(absPosition);\r\n this._prevAttachedNodeAbsPosition.copyFrom(absPosition);\r\n }\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Force release the drag action by code.\r\n */\r\n public releaseDrag() {\r\n if (this.dragging) {\r\n this.dragging = false;\r\n this.onDragEndObservable.notifyObservers({ dragPlanePoint: this.lastDragPosition, pointerId: this.currentDraggingPointerId, pointerInfo: this._activePointerInfo });\r\n }\r\n\r\n this.currentDraggingPointerId = -1;\r\n this._activeDragButton = -1;\r\n this._activePointerInfo = null;\r\n this._moving = false;\r\n\r\n // Reattach camera controls\r\n if (this.detachCameraControls && this._attachedToElement && this._scene.activeCamera && !this._scene.activeCamera.leftCamera) {\r\n if (this._scene.activeCamera.getClassName() === \"ArcRotateCamera\") {\r\n const arcRotateCamera = this._scene.activeCamera as ArcRotateCamera;\r\n arcRotateCamera.attachControl(\r\n arcRotateCamera.inputs ? arcRotateCamera.inputs.noPreventDefault : true,\r\n arcRotateCamera._useCtrlForPanning,\r\n arcRotateCamera._panningMouseButton\r\n );\r\n } else {\r\n this._scene.activeCamera.attachControl(this._scene.activeCamera.inputs ? this._scene.activeCamera.inputs.noPreventDefault : true);\r\n }\r\n this._attachedToElement = false;\r\n }\r\n }\r\n\r\n private _startDragRay = new Ray(new Vector3(), new Vector3());\r\n private _lastPointerRay: { [key: number]: Ray } = {};\r\n /**\r\n * Simulates the start of a pointer drag event on the behavior\r\n * @param pointerId pointerID of the pointer that should be simulated (Default: Any mouse pointer ID)\r\n * @param fromRay initial ray of the pointer to be simulated (Default: Ray from camera to attached mesh)\r\n * @param startPickedPoint picked point of the pointer to be simulated (Default: attached mesh position)\r\n */\r\n public startDrag(pointerId: number = PointerDragBehavior._AnyMouseId, fromRay?: Ray, startPickedPoint?: Vector3) {\r\n this._startDrag(pointerId, fromRay, startPickedPoint);\r\n\r\n let lastRay = this._lastPointerRay[pointerId];\r\n if (pointerId === PointerDragBehavior._AnyMouseId) {\r\n lastRay = this._lastPointerRay[<any>Object.keys(this._lastPointerRay)[0]];\r\n }\r\n\r\n if (lastRay) {\r\n // if there was a last pointer ray drag the object there\r\n this._moveDrag(lastRay);\r\n }\r\n }\r\n\r\n protected _startDrag(pointerId: number, fromRay?: Ray, startPickedPoint?: Vector3) {\r\n if (!this._scene.activeCamera || this.dragging || !this.attachedNode) {\r\n return;\r\n }\r\n\r\n PivotTools._RemoveAndStorePivotPoint(this.attachedNode);\r\n // Create start ray from the camera to the object\r\n if (fromRay) {\r\n this._startDragRay.direction.copyFrom(fromRay.direction);\r\n this._startDragRay.origin.copyFrom(fromRay.origin);\r\n } else {\r\n this._startDragRay.origin.copyFrom(this._scene.activeCamera.position);\r\n this.attachedNode.getWorldMatrix().getTranslationToRef(this._tmpVector);\r\n this._tmpVector.subtractToRef(this._scene.activeCamera.position, this._startDragRay.direction);\r\n }\r\n\r\n this._updateDragPlanePosition(this._startDragRay, startPickedPoint ? startPickedPoint : this._tmpVector);\r\n\r\n const pickedPoint = this._pickWithRayOnDragPlane(this._startDragRay);\r\n if (pickedPoint) {\r\n this.dragging = true;\r\n this.currentDraggingPointerId = pointerId;\r\n this.lastDragPosition.copyFrom(pickedPoint);\r\n this.onDragStartObservable.notifyObservers({ dragPlanePoint: pickedPoint, pointerId: this.currentDraggingPointerId, pointerInfo: this._activePointerInfo });\r\n this._targetPosition.copyFrom(this.attachedNode.getAbsolutePosition());\r\n\r\n // Detatch camera controls\r\n if (this.detachCameraControls && this._scene.activeCamera && this._scene.activeCamera.inputs && !this._scene.activeCamera.leftCamera) {\r\n if (this._scene.activeCamera.inputs.attachedToElement) {\r\n this._scene.activeCamera.detachControl();\r\n this._attachedToElement = true;\r\n } else {\r\n this._attachedToElement = false;\r\n }\r\n }\r\n } else {\r\n this.releaseDrag();\r\n }\r\n PivotTools._RestorePivotPoint(this.attachedNode);\r\n }\r\n\r\n private _dragDelta = new Vector3();\r\n protected _moveDrag(ray: Ray) {\r\n this._moving = true;\r\n const pickedPoint = this._pickWithRayOnDragPlane(ray);\r\n\r\n if (pickedPoint) {\r\n PivotTools._RemoveAndStorePivotPoint(this.attachedNode);\r\n\r\n if (this.updateDragPlane) {\r\n this._updateDragPlanePosition(ray, pickedPoint);\r\n }\r\n let dragLength = 0;\r\n // depending on the drag mode option drag accordingly\r\n if (this._options.dragAxis) {\r\n // Convert local drag axis to world if useObjectOrientationForDragging\r\n this.useObjectOrientationForDragging\r\n ? Vector3.TransformCoordinatesToRef(this._options.dragAxis, this.attachedNode.getWorldMatrix().getRotationMatrix(), this._worldDragAxis)\r\n : this._worldDragAxis.copyFrom(this._options.dragAxis);\r\n // Project delta drag from the drag plane onto the drag axis\r\n pickedPoint.subtractToRef(this.lastDragPosition, this._tmpVector);\r\n\r\n this._worldDragAxis.normalize();\r\n dragLength = Vector3.Dot(this._tmpVector, this._worldDragAxis);\r\n this._worldDragAxis.scaleToRef(dragLength, this._dragDelta);\r\n } else {\r\n dragLength = this._dragDelta.length();\r\n pickedPoint.subtractToRef(this.lastDragPosition, this._dragDelta);\r\n }\r\n this._targetPosition.addInPlace(this._dragDelta);\r\n this.onDragObservable.notifyObservers({\r\n dragDistance: dragLength,\r\n delta: this._dragDelta,\r\n dragPlanePoint: pickedPoint,\r\n dragPlaneNormal: this._dragPlane.forward,\r\n pointerId: this.currentDraggingPointerId,\r\n pointerInfo: this._activePointerInfo,\r\n });\r\n this.lastDragPosition.copyFrom(pickedPoint);\r\n\r\n PivotTools._RestorePivotPoint(this.attachedNode);\r\n }\r\n }\r\n\r\n private _pickWithRayOnDragPlane(ray: Nullable<Ray>) {\r\n if (!ray) {\r\n return null;\r\n }\r\n\r\n // Calculate angle between plane normal and ray\r\n let angle = Math.acos(Vector3.Dot(this._dragPlane.forward, ray.direction));\r\n // Correct if ray is casted from oposite side\r\n if (angle > Math.PI / 2) {\r\n angle = Math.PI - angle;\r\n }\r\n\r\n // If the angle is too perpendicular to the plane pick another point on the plane where it is looking\r\n if (this.maxDragAngle > 0 && angle > this.maxDragAngle) {\r\n if (this._useAlternatePickedPointAboveMaxDragAngle) {\r\n // Invert ray direction along the towards object axis\r\n this._tmpVector.copyFrom(ray.direction);\r\n this.attachedNode.absolutePosition.subtractToRef(ray.origin, this._alternatePickedPoint);\r\n this._alternatePickedPoint.normalize();\r\n this._alternatePickedPoint.scaleInPlace(this._useAlternatePickedPointAboveMaxDragAngleDragSpeed * Vector3.Dot(this._alternatePickedPoint, this._tmpVector));\r\n this._tmpVector.addInPlace(this._alternatePickedPoint);\r\n\r\n // Project resulting vector onto the drag plane and add it to the attached nodes absolute position to get a picked point\r\n const dot = Vector3.Dot(this._dragPlane.forward, this._tmpVector);\r\n this._dragPlane.forward.scaleToRef(-dot, this._alternatePickedPoint);\r\n this._alternatePickedPoint.addInPlace(this._tmpVector);\r\n this._alternatePickedPoint.addInPlace(this.attachedNode.absolutePosition);\r\n return this._alternatePickedPoint;\r\n } else {\r\n return null;\r\n }\r\n }\r\n\r\n // use an infinite plane instead of ray picking a mesh that must be updated every frame\r\n const planeNormal = this._dragPlane.forward;\r\n const planePosition = this._dragPlane.position;\r\n const dotProduct = ray.direction.dot(planeNormal);\r\n if (Math.abs(dotProduct) < Epsilon) {\r\n // Ray and plane are parallel, no intersection\r\n return null;\r\n }\r\n\r\n planePosition.subtractToRef(ray.origin, TmpVectors.Vector3[0]);\r\n const t = TmpVectors.Vector3[0].dot(planeNormal) / dotProduct;\r\n // Ensure the intersection point is in front of the ray (t must be positive)\r\n if (t < 0) {\r\n // Intersection point is behind the ray\r\n return null;\r\n }\r\n\r\n // Calculate the intersection point using the parameter t\r\n ray.direction.scaleToRef(t, TmpVectors.Vector3[0]);\r\n const intersectionPoint = ray.origin.add(TmpVectors.Vector3[0]);\r\n return intersectionPoint;\r\n }\r\n\r\n // Variables to avoid instantiation in the below method\r\n private _pointA = new Vector3(0, 0, 0);\r\n private _pointC = new Vector3(0, 0, 0);\r\n private _localAxis = new Vector3(0, 0, 0);\r\n private _lookAt = new Vector3(0, 0, 0);\r\n // Position the drag plane based on the attached mesh position, for single axis rotate the plane along the axis to face the camera\r\n private _updateDragPlanePosition(ray: Ray, dragPlanePosition: Vector3) {\r\n this._pointA.copyFrom(dragPlanePosition);\r\n if (this._options.dragAxis) {\r\n this.useObjectOrientationForDragging\r\n ? Vector3.TransformCoordinatesToRef(this._options.dragAxis, this.attachedNode.getWorldMatrix().getRotationMatrix(), this._localAxis)\r\n : this._localAxis.copyFrom(this._options.dragAxis);\r\n\r\n // Calculate plane normal that is the cross product of local axis and (eye-dragPlanePosition)\r\n ray.origin.subtractToRef(this._pointA, this._pointC);\r\n this._pointC.normalize();\r\n if (Math.abs(Vector3.Dot(this._localAxis, this._pointC)) > 0.999) {\r\n // the drag axis is colinear with the (eye to position) ray. The cross product will give jittered values.\r\n // A new axis vector need to be computed\r\n if (Math.abs(Vector3.Dot(Vector3.UpReadOnly, this._pointC)) > 0.999) {\r\n this._lookAt.copyFrom(Vector3.Right());\r\n } else {\r\n this._lookAt.copyFrom(Vector3.UpReadOnly);\r\n }\r\n } else {\r\n Vector3.CrossToRef(this._localAxis, this._pointC, this._lookAt);\r\n // Get perpendicular line from previous result and drag axis to adjust lineB to be perpendicular to camera\r\n Vector3.CrossToRef(this._localAxis, this._lookAt, this._lookAt);\r\n this._lookAt.normalize();\r\n }\r\n\r\n this._dragPlane.position.copyFrom(this._pointA);\r\n this._pointA.addToRef(this._lookAt, this._lookAt);\r\n this._dragPlane.lookAt(this._lookAt);\r\n } else if (this._options.dragPlaneNormal) {\r\n this.useObjectOrientationForDragging\r\n ? Vector3.TransformCoordinatesToRef(this._options.dragPlaneNormal, this.attachedNode.getWorldMatrix().getRotationMatrix(), this._localAxis)\r\n : this._localAxis.copyFrom(this._options.dragPlaneNormal);\r\n this._dragPlane.position.copyFrom(this._pointA);\r\n this._pointA.addToRef(this._localAxis, this._lookAt);\r\n this._dragPlane.lookAt(this._lookAt);\r\n } else {\r\n if (this._scene.activeCamera) {\r\n this._scene.activeCamera.getForwardRay().direction.normalizeToRef(this._localAxis);\r\n }\r\n this._dragPlane.position.copyFrom(this._pointA);\r\n this._dragPlane.lookAt(this._pointA.add(this._localAxis));\r\n }\r\n // Update the position of the drag plane so it doesn't get out of sync with the node (eg. when moving back and forth quickly)\r\n this._dragPlane.position.copyFrom(this.attachedNode.getAbsolutePosition());\r\n\r\n this._dragPlane.computeWorldMatrix(true);\r\n }\r\n\r\n /**\r\n * Detaches the behavior from the mesh\r\n */\r\n public detach(): void {\r\n this._lastPointerRay = {};\r\n if (this.attachedNode && (this.attachedNode as Mesh)._isMesh) {\r\n (this.attachedNode as AbstractMesh).isNearGrabbable = false;\r\n }\r\n if (this._pointerObserver) {\r\n this._scene.onPointerObservable.remove(this._pointerObserver);\r\n }\r\n if (this._beforeRenderObserver) {\r\n this._scene.onBeforeRenderObservable.remove(this._beforeRenderObserver);\r\n }\r\n if (this._dragPlane) {\r\n this._dragPlane.dispose();\r\n }\r\n this.releaseDrag();\r\n }\r\n\r\n /**\r\n * Disposes the current instance, cleaning up all associated observables and detaching any attached nodes.\r\n */\r\n public dispose(): void {\r\n this.detach();\r\n this.onDragObservable.clear();\r\n this.onAttachedNodePositionChangeObservable.clear();\r\n this.onDragEndObservable.clear();\r\n this.onDragStartObservable.clear();\r\n this.onEnabledObservable.clear();\r\n this.attachedNode = null as any;\r\n }\r\n}\r\n"]}
@@ -1,6 +1,6 @@
1
1
  import { __decorate } from "../../tslib.es6.js";
2
2
  /* eslint-disable @typescript-eslint/naming-convention */
3
- import { serialize, expandToProperty, addAccessorsForMaterialProperty } from "../../Misc/decorators.js";
3
+ import { serialize, expandToProperty, addAccessorsForMaterialProperty, serializeAsTexture, serializeAsColor3, serializeAsVector2 } from "../../Misc/decorators.js";
4
4
  import { GetEnvironmentBRDFTexture } from "../../Misc/brdfTextureTools.js";
5
5
  import { Scene } from "../../scene.js";
6
6
  import { Color3 } from "../../Maths/math.color.js";
@@ -1814,162 +1814,285 @@ OpenPBRMaterial._noiseTextures = {};
1814
1814
  * False by default. This is mostly meant for backward compatibility.
1815
1815
  */
1816
1816
  OpenPBRMaterial.ForceGLSL = false;
1817
+ __decorate([
1818
+ serialize()
1819
+ ], OpenPBRMaterial.prototype, "baseWeight", void 0);
1817
1820
  __decorate([
1818
1821
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "baseWeight")
1819
1822
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1820
1823
  ], OpenPBRMaterial.prototype, "_baseWeight", void 0);
1824
+ __decorate([
1825
+ serializeAsTexture()
1826
+ ], OpenPBRMaterial.prototype, "baseWeightTexture", void 0);
1821
1827
  __decorate([
1822
1828
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "baseWeightTexture")
1823
1829
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1824
1830
  ], OpenPBRMaterial.prototype, "_baseWeightTexture", void 0);
1831
+ __decorate([
1832
+ serializeAsColor3()
1833
+ ], OpenPBRMaterial.prototype, "baseColor", void 0);
1825
1834
  __decorate([
1826
1835
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "baseColor")
1827
1836
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1828
1837
  ], OpenPBRMaterial.prototype, "_baseColor", void 0);
1838
+ __decorate([
1839
+ serializeAsTexture()
1840
+ ], OpenPBRMaterial.prototype, "baseColorTexture", void 0);
1829
1841
  __decorate([
1830
1842
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "baseColorTexture")
1831
1843
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1832
1844
  ], OpenPBRMaterial.prototype, "_baseColorTexture", void 0);
1845
+ __decorate([
1846
+ serialize()
1847
+ ], OpenPBRMaterial.prototype, "baseDiffuseRoughness", void 0);
1833
1848
  __decorate([
1834
1849
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "baseDiffuseRoughness")
1835
1850
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1836
1851
  ], OpenPBRMaterial.prototype, "_baseDiffuseRoughness", void 0);
1852
+ __decorate([
1853
+ serializeAsTexture()
1854
+ ], OpenPBRMaterial.prototype, "baseDiffuseRoughnessTexture", void 0);
1837
1855
  __decorate([
1838
1856
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "baseDiffuseRoughnessTexture")
1839
1857
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1840
1858
  ], OpenPBRMaterial.prototype, "_baseDiffuseRoughnessTexture", void 0);
1859
+ __decorate([
1860
+ serialize()
1861
+ ], OpenPBRMaterial.prototype, "baseMetalness", void 0);
1841
1862
  __decorate([
1842
1863
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "baseMetalness")
1843
1864
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1844
1865
  ], OpenPBRMaterial.prototype, "_baseMetalness", void 0);
1866
+ __decorate([
1867
+ serializeAsTexture()
1868
+ ], OpenPBRMaterial.prototype, "baseMetalnessTexture", void 0);
1845
1869
  __decorate([
1846
1870
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "baseMetalnessTexture")
1847
1871
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1848
1872
  ], OpenPBRMaterial.prototype, "_baseMetalnessTexture", void 0);
1873
+ __decorate([
1874
+ serialize()
1875
+ ], OpenPBRMaterial.prototype, "specularWeight", void 0);
1849
1876
  __decorate([
1850
1877
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "specularWeight")
1851
1878
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1852
1879
  ], OpenPBRMaterial.prototype, "_specularWeight", void 0);
1880
+ __decorate([
1881
+ serializeAsTexture()
1882
+ ], OpenPBRMaterial.prototype, "specularWeightTexture", void 0);
1853
1883
  __decorate([
1854
1884
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "specularWeightTexture")
1855
1885
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1856
1886
  ], OpenPBRMaterial.prototype, "_specularWeightTexture", void 0);
1887
+ __decorate([
1888
+ serializeAsColor3()
1889
+ ], OpenPBRMaterial.prototype, "specularColor", void 0);
1857
1890
  __decorate([
1858
1891
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "specularColor")
1859
1892
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1860
1893
  ], OpenPBRMaterial.prototype, "_specularColor", void 0);
1894
+ __decorate([
1895
+ serializeAsTexture()
1896
+ ], OpenPBRMaterial.prototype, "specularColorTexture", void 0);
1861
1897
  __decorate([
1862
1898
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "specularColorTexture")
1863
1899
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1864
1900
  ], OpenPBRMaterial.prototype, "_specularColorTexture", void 0);
1901
+ __decorate([
1902
+ serialize()
1903
+ ], OpenPBRMaterial.prototype, "specularRoughness", void 0);
1865
1904
  __decorate([
1866
1905
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "specularRoughness")
1867
1906
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1868
1907
  ], OpenPBRMaterial.prototype, "_specularRoughness", void 0);
1908
+ __decorate([
1909
+ serializeAsTexture()
1910
+ ], OpenPBRMaterial.prototype, "specularRoughnessTexture", void 0);
1869
1911
  __decorate([
1870
1912
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "specularRoughnessTexture")
1871
1913
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1872
1914
  ], OpenPBRMaterial.prototype, "_specularRoughnessTexture", void 0);
1915
+ __decorate([
1916
+ serialize()
1917
+ ], OpenPBRMaterial.prototype, "specularRoughnessAnisotropy", void 0);
1873
1918
  __decorate([
1874
1919
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "specularRoughnessAnisotropy")
1875
1920
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1876
1921
  ], OpenPBRMaterial.prototype, "_specularRoughnessAnisotropy", void 0);
1922
+ __decorate([
1923
+ serializeAsTexture()
1924
+ ], OpenPBRMaterial.prototype, "specularRoughnessAnisotropyTexture", void 0);
1877
1925
  __decorate([
1878
1926
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "specularRoughnessAnisotropyTexture")
1879
1927
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1880
1928
  ], OpenPBRMaterial.prototype, "_specularRoughnessAnisotropyTexture", void 0);
1929
+ __decorate([
1930
+ serialize()
1931
+ ], OpenPBRMaterial.prototype, "specularIor", void 0);
1881
1932
  __decorate([
1882
1933
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "specularIor")
1883
1934
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1884
1935
  ], OpenPBRMaterial.prototype, "_specularIor", void 0);
1936
+ __decorate([
1937
+ serialize()
1938
+ ], OpenPBRMaterial.prototype, "coatWeight", void 0);
1885
1939
  __decorate([
1886
1940
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "coatWeight")
1887
1941
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1888
1942
  ], OpenPBRMaterial.prototype, "_coatWeight", void 0);
1943
+ __decorate([
1944
+ serializeAsTexture()
1945
+ ], OpenPBRMaterial.prototype, "coatWeightTexture", void 0);
1889
1946
  __decorate([
1890
1947
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "coatWeightTexture")
1891
1948
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1892
1949
  ], OpenPBRMaterial.prototype, "_coatWeightTexture", void 0);
1950
+ __decorate([
1951
+ serializeAsColor3()
1952
+ ], OpenPBRMaterial.prototype, "coatColor", void 0);
1893
1953
  __decorate([
1894
1954
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "coatColor")
1895
1955
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1896
1956
  ], OpenPBRMaterial.prototype, "_coatColor", void 0);
1957
+ __decorate([
1958
+ serializeAsTexture()
1959
+ ], OpenPBRMaterial.prototype, "coatColorTexture", void 0);
1897
1960
  __decorate([
1898
1961
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "coatColorTexture")
1899
1962
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1900
1963
  ], OpenPBRMaterial.prototype, "_coatColorTexture", void 0);
1964
+ __decorate([
1965
+ serialize()
1966
+ ], OpenPBRMaterial.prototype, "coatRoughness", void 0);
1901
1967
  __decorate([
1902
1968
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "coatRoughness")
1903
1969
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1904
1970
  ], OpenPBRMaterial.prototype, "_coatRoughness", void 0);
1971
+ __decorate([
1972
+ serializeAsTexture()
1973
+ ], OpenPBRMaterial.prototype, "coatRoughnessTexture", void 0);
1905
1974
  __decorate([
1906
1975
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "coatRoughnessTexture")
1907
1976
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1908
1977
  ], OpenPBRMaterial.prototype, "_coatRoughnessTexture", void 0);
1978
+ __decorate([
1979
+ serialize()
1980
+ ], OpenPBRMaterial.prototype, "coatRoughnessAnisotropy", void 0);
1909
1981
  __decorate([
1910
1982
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "coatRoughnessAnisotropy")
1911
1983
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1912
1984
  ], OpenPBRMaterial.prototype, "_coatRoughnessAnisotropy", void 0);
1985
+ __decorate([
1986
+ serializeAsTexture()
1987
+ ], OpenPBRMaterial.prototype, "coatRoughnessAnisotropyTexture", void 0);
1913
1988
  __decorate([
1914
1989
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "coatRoughnessAnisotropyTexture")
1915
1990
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1916
1991
  ], OpenPBRMaterial.prototype, "_coatRoughnessAnisotropyTexture", void 0);
1992
+ __decorate([
1993
+ serialize()
1994
+ ], OpenPBRMaterial.prototype, "coatIor", void 0);
1917
1995
  __decorate([
1918
1996
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "coatIor")
1919
1997
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1920
1998
  ], OpenPBRMaterial.prototype, "_coatIor", void 0);
1999
+ __decorate([
2000
+ serialize()
2001
+ ], OpenPBRMaterial.prototype, "coatDarkening", void 0);
1921
2002
  __decorate([
1922
2003
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "coatDarkening")
1923
2004
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1924
2005
  ], OpenPBRMaterial.prototype, "_coatDarkening", void 0);
2006
+ __decorate([
2007
+ serializeAsTexture()
2008
+ ], OpenPBRMaterial.prototype, "coatDarkeningTexture", void 0);
1925
2009
  __decorate([
1926
2010
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "coatDarkeningTexture")
1927
2011
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1928
2012
  ], OpenPBRMaterial.prototype, "_coatDarkeningTexture", void 0);
2013
+ __decorate([
2014
+ serialize()
2015
+ ], OpenPBRMaterial.prototype, "useCoatRoughnessFromWeightTexture", void 0);
2016
+ __decorate([
2017
+ serializeAsTexture()
2018
+ ], OpenPBRMaterial.prototype, "geometryNormalTexture", void 0);
1929
2019
  __decorate([
1930
2020
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "geometryNormalTexture")
1931
2021
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1932
2022
  ], OpenPBRMaterial.prototype, "_geometryNormalTexture", void 0);
2023
+ __decorate([
2024
+ serializeAsVector2()
2025
+ ], OpenPBRMaterial.prototype, "geometryTangent", void 0);
1933
2026
  __decorate([
1934
2027
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "geometryTangent")
1935
2028
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1936
2029
  ], OpenPBRMaterial.prototype, "_geometryTangent", void 0);
2030
+ __decorate([
2031
+ serializeAsTexture()
2032
+ ], OpenPBRMaterial.prototype, "geometryTangentTexture", void 0);
1937
2033
  __decorate([
1938
2034
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "geometryTangentTexture")
1939
2035
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1940
2036
  ], OpenPBRMaterial.prototype, "_geometryTangentTexture", void 0);
2037
+ __decorate([
2038
+ serializeAsTexture()
2039
+ ], OpenPBRMaterial.prototype, "geometryCoatNormalTexture", void 0);
1941
2040
  __decorate([
1942
2041
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "geometryCoatNormalTexture")
1943
2042
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1944
2043
  ], OpenPBRMaterial.prototype, "_geometryCoatNormalTexture", void 0);
2044
+ __decorate([
2045
+ serializeAsVector2()
2046
+ ], OpenPBRMaterial.prototype, "geometryCoatTangent", void 0);
1945
2047
  __decorate([
1946
2048
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "geometryCoatTangent")
1947
2049
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1948
2050
  ], OpenPBRMaterial.prototype, "_geometryCoatTangent", void 0);
2051
+ __decorate([
2052
+ serializeAsTexture()
2053
+ ], OpenPBRMaterial.prototype, "geometryCoatTangentTexture", void 0);
1949
2054
  __decorate([
1950
2055
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "geometryCoatTangentTexture")
1951
2056
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1952
2057
  ], OpenPBRMaterial.prototype, "_geometryCoatTangentTexture", void 0);
2058
+ __decorate([
2059
+ serialize()
2060
+ ], OpenPBRMaterial.prototype, "geometryOpacity", void 0);
1953
2061
  __decorate([
1954
2062
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "geometryOpacity")
1955
2063
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1956
2064
  ], OpenPBRMaterial.prototype, "_geometryOpacity", void 0);
2065
+ __decorate([
2066
+ serializeAsTexture()
2067
+ ], OpenPBRMaterial.prototype, "geometryOpacityTexture", void 0);
1957
2068
  __decorate([
1958
2069
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "geometryOpacityTexture")
1959
2070
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1960
2071
  ], OpenPBRMaterial.prototype, "_geometryOpacityTexture", void 0);
2072
+ __decorate([
2073
+ serialize()
2074
+ ], OpenPBRMaterial.prototype, "emissionLuminance", void 0);
1961
2075
  __decorate([
1962
2076
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "emissionLuminance")
1963
2077
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1964
2078
  ], OpenPBRMaterial.prototype, "_emissionLuminance", void 0);
2079
+ __decorate([
2080
+ serializeAsColor3()
2081
+ ], OpenPBRMaterial.prototype, "emissionColor", void 0);
1965
2082
  __decorate([
1966
2083
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "emissionColor")
1967
2084
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1968
2085
  ], OpenPBRMaterial.prototype, "_emissionColor", void 0);
2086
+ __decorate([
2087
+ serializeAsTexture()
2088
+ ], OpenPBRMaterial.prototype, "emissionColorTexture", void 0);
1969
2089
  __decorate([
1970
2090
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "emissionColorTexture")
1971
2091
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1972
2092
  ], OpenPBRMaterial.prototype, "_emissionColorTexture", void 0);
2093
+ __decorate([
2094
+ serializeAsTexture()
2095
+ ], OpenPBRMaterial.prototype, "ambientOcclusionTexture", void 0);
1973
2096
  __decorate([
1974
2097
  addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "ambientOcclusionTexture")
1975
2098
  // eslint-disable-next-line @typescript-eslint/no-unused-vars