PageSourceSearch

https://cheyne711-octomatic-trackio.hf.space/assets/axesViewer-CTpkWhuK.js

js cheyne711-octomatic-trackio.hf.space collected 2026-10-04 16:46:00 UTC 36,383 bytes, 1 lines download raw bytes

1import{M as k,V as h,O as R,T as s,E as L,Q as F}from"./math.vector-C1xyPDEl.js";import{StandardMaterial as A}from"./standardMaterial-BX8HF7fn.js";import{M as E,C as U,T as V}from"./mesh-BczlZ8bV.js";import{C as G,a as I}from"./planeBuilder-B1r5WTAe.js";import{S as Q}from"./scene-gn_hoGMy.js";import{P as m,a as S}from"./deviceInputEvents-BTza-zoR.js";import{R as z}from"./ray-Sc9D_Y4B.js";import{E as H}from"./math.scalar.functions-DkeaWAWz.js";import{P as K}from"./sceneComponent-Dflhczui.js";import{HemisphericLight as Y}from"./hemisphericLight-DUUZAi58.js";import{Color3 as O}from"./math.color-CzLaKyb6.js";import{L as w}from"./light-DT53MGnW.js";import"./index-Bc7OztLw.js";import"./bufferUtils-DTRdUD8L.js";import"./smartArray-CO6iJ0u5.js";import"./buffer-DqKlo1ts.js";import"./dataBuffer-CgoqiUzT.js";import"./imageProcessing-2WziWti-.js";import"./material-CrEsrP1R.js";import"./tools-D01N7ptR.js";import"./decorators.serialization-C7d7ykGG.js";import"./subMesh-UWDo5wjI.js";import"./drawWrapper-CZVk0xN-.js";import"./lightConstants-B1TSTh-k.js";import"./math.plane-Ce_75-g5.js";import"./texture-BEqhDl5Y.js";import"./baseTexture-CgAggsey.js";import"./drawWrapper.functions-Dzz0ghog.js";import"./pushMaterial-B8MG1fVH.js";import"./material.detailMapConfiguration-D1Pl6X8T.js";import"./mesh.vertexData-Cr3zcPIw.js";import"./node-C-Iu0ALa.js";import"./math.viewport-CgkTt1RS.js";import"./sceneLoaderFlags-wywyb9ml.js";import"./math.axis-Ck7JfPPj.js";import"./renderingManager-CiY2OUrf.js";import"./perfCounter-DusmGz8t.js";class l{static _RemoveAndStorePivotPoint(t){t&&l._PivotCached===0&&(t.getPivotPointToRef(l._OldPivotPoint),l._PivotPostMultiplyPivotMatrix=t._postMultiplyPivotMatrix,l._OldPivotPoint.equalsToFloats(0,0,0)||(t.setPivotMatrix(k.IdentityReadOnly),l._OldPivotPoint.subtractToRef(t.getPivotPoint(),l._PivotTranslation),l._PivotTmpVector.copyFromFloats(1,1,1),l._PivotTmpVector.subtractInPlace(t.scaling),l._PivotTmpVector.multiplyInPlace(l._PivotTranslation),t.position.addInPlace(l._PivotTmpVector))),l._PivotCached++}static _RestorePivotPoint(t){t&&!l._OldPivotPoint.equalsToFloats(0,0,0)&&l._PivotCached===1&&(t.setPivotPoint(l._OldPivotPoint),t._postMultiplyPivotMatrix=l._PivotPostMultiplyPivotMatrix,l._PivotTmpVector.copyFromFloats(1,1,1),l._PivotTmpVector.subtractInPlace(t.scaling),l._PivotTmpVector.multiplyInPlace(l._PivotTranslation),t.position.subtractInPlace(l._PivotTmpVector)),this._PivotCached--}}l._PivotCached=0;l._OldPivotPoint=new h;l._PivotTranslation=new h;l._PivotTmpVector=new h;l._PivotPostMultiplyPivotMatrix=!1;class f{get currentDraggingPointerID(){return this.currentDraggingPointerId}set currentDraggingPointerID(t){this.currentDraggingPointerId=t}set enabled(t){t!=this._enabled&&this.onEnabledObservable.notifyObservers(t),this._enabled=t}get enabled(){return this._enabled}get options(){return this._options}set options(t){this._options=t}constructor(t){this._useAlternatePickedPointAboveMaxDragAngleDragSpeed=-1.1,this._activeDragButton=-1,this.maxDragAngle=0,this.dragButtons=[0,1,2],this._useAlternatePickedPointAboveMaxDragAngle=!1,this.currentDraggingPointerId=-1,this.dragging=!1,this.dragDeltaRatio=.2,this.updateDragPlane=!0,this._debugMode=!1,this._moving=!1,this.onDragObservable=new R,this.onDragStartObservable=new R,this.onDragEndObservable=new R,this.onEnabledObservable=new R,this.moveAttached=!0,this._enabled=!0,this.startAndReleaseDragOnPointerEvents=!0,this.detachCameraControls=!0,this.useObjectOrientationForDragging=!0,this.allowOtherButtonsDuringDrag=!1,this.validateDrag=a=>!0,this._tmpVector=new h(0,0,0),this._alternatePickedPoint=new h(0,0,0),this._worldDragAxis=new h(0,0,0),this._targetPosition=new h(0,0,0),this._attachedToElement=!1,this._startDragRay=new z(new h,new h),this._lastPointerRay={},this._dragDelta=new h,this._pointA=new h(0,0,0),this._pointC=new h(0,0,0),this._localAxis=new h(0,0,0),this._lookAt=new h(0,0,0),this._options=t||{};let i=0;if(this._options.dragAxis&&i++,this._options.dragPlaneNormal&&i++,i>1)throw"Multiple drag modes specified in dragBehavior options. Only one expected"}get name(){return"PointerDrag"}init(){}
1attach(t,i){this._scene=t.getScene(),t.isNearGrabbable=!0,this.attachedNode=t,f._PlaneScene||(this._debugMode?f._PlaneScene=this._scene:(f._PlaneScene=new Q(this._scene.getEngine(),{virtual:!0}),f._PlaneScene.detachControl(),this._scene.onDisposeObservable.addOnce(()=>{f._PlaneScene.dispose(),f._PlaneScene=null}))),this._dragPlane=G("pointerDragPlane",{size:this._debugMode?1:1e4,updatable:!1,sideOrientation:E.DOUBLESIDE},f._PlaneScene),this.lastDragPosition=new h(0,0,0);const a=i||(e=>this.attachedNode==e||e.isDescendantOf(this.attachedNode));this._pointerObserver=this._scene.onPointerObservable.add(e=>{if(!this.enabled){this._attachedToElement&&this.releaseDrag();return}if(this.dragging&&this.currentDraggingPointerId==e.event.pointerId&&e.event.button!==-1&&e.event.button!==this._activeDragButton&&!this.allowOtherButtonsDuringDrag){this.releaseDrag();return}if(e.type==m.POINTERDOWN)this.startAndReleaseDragOnPointerEvents&&!this.dragging&&e.pickInfo&&e.pickInfo.hit&&e.pickInfo.pickedMesh&&e.pickInfo.pickedPoint&&e.pickInfo.ray&&a(e.pickInfo.pickedMesh)&&this._activeDragButton===-1&&this.dragButtons.indexOf(e.event.button)!==-1&&(this._activeDragButton=e.event.button,this._activePointerInfo=e,this._startDrag(e.event.pointerId,e.pickInfo.ray,e.pickInfo.pickedPoint));else if(e.type==m.POINTERUP)this.startAndReleaseDragOnPointerEvents&&this.currentDraggingPointerId==e.event.pointerId&&(this._activeDragButton===e.event.button||this._activeDragButton===-1)&&this.releaseDrag();else if(e.type==m.POINTERMOVE){const r=e.event.pointerId;if(this.currentDraggingPointerId===f._AnyMouseId&&r!==f._AnyMouseId){const c=e.event;(c.pointerType==="mouse"||!this._scene.getEngine().hostInformation.isMobile&&c instanceof MouseEvent)&&(this._lastPointerRay[this.currentDraggingPointerId]&&(this._lastPointerRay[r]=this._lastPointerRay[this.currentDraggingPointerId],delete this._lastPointerRay[this.currentDraggingPointerId]),this.currentDraggingPointerId=r)}this._lastPointerRay[r]||(this._lastPointerRay[r]=new z(new h,new h)),e.pickInfo&&e.pickInfo.ray&&(this._lastPointerRay[r].origin.copyFrom(e.pickInfo.ray.origin),this._lastPointerRay[r].direction.copyFrom(e.pickInfo.ray.direction),this.currentDraggingPointerId==r&&this.dragging&&this._moveDrag(e.pickInfo.ray))}}),this._beforeRenderObserver=this._scene.onBeforeRenderObservable.add(()=>{if(this._moving&&this.moveAttached){let e=!1;l._RemoveAndStorePivotPoint(this.attachedNode),this._targetPosition.subtractToRef(this.attachedNode.absolutePosition,this._tmpVector),this._tmpVector.scaleInPlace(this.dragDeltaRatio),this.attachedNode.getAbsolutePosition().addToRef(this._tmpVector,this._tmpVector),this.validateDrag(this._tmpVector)&&(this.attachedNode.setAbsolutePosition(this._tmpVector),e=!0),l._RestorePivotPoint(this.attachedNode),e&&this.attachedNode.computeWorldMatrix()}})}releaseDrag(){if(this.dragging&&(this.dragging=!1,this.onDragEndObservable.notifyObservers({dragPlanePoint:this.lastDragPosition,pointerId:this.currentDraggingPointerId,pointerInfo:this._activePointerInfo})),this.currentDraggingPointerId=-1,this._activeDragButton=-1,this._activePointerInfo=null,this._moving=!1,this.detachCameraControls&&this._attachedToElement&&this._scene.activeCamera&&!this._scene.activeCamera.leftCamera){if(this._scene.activeCamera.getClassName()==="ArcRotateCamera"){const t=this._scene.activeCamera;t.attachControl(t.inputs?t.inputs.noPreventDefault:!0,t._useCtrlForPanning,t._panningMouseButton)}else this._scene.activeCamera.attachControl(this._scene.activeCamera.inputs?this._scene.activeCamera.inputs.noPreventDefault:!0);this._attachedToElement=!1}}startDrag(t=f._AnyMouseId,i,a){this._startDrag(t,i,a);let e=this._lastPointerRay[t];t===f._AnyMouseId&&(e=this._lastPointerRay[Object.keys(this._lastPointerRay)[0]]),e&&this._moveDrag(e)}_startDrag(t,i,a){if(!this._scene.activeCamera||this.dragging||!this.attachedNode)return;l._RemoveAndStorePivotPoint(this.attachedNode),i?(this._startDragRay.direction.copyFrom(i.direction),this._startDragRay.origin.copyFrom(i.origin)):(this._startDragRay.origin.copyFrom(this._scene.activeCamera.position),this.attachedNode.getWorldMatrix().getTranslationToRef(this._tmpVector),this._tmpVector.subtractToRef(this._scene.activeCamera.position,this._startDragRay.direction)),this._updateDragPlanePosition(this._startDragRay,a||this._tmpVector);const e=this._pickWithRayOnDragPlane(this._startDragRay);e?(this.dragging=!0,this.currentDraggingPointerId=t,this.lastDragPosition.copyFrom(e),this.onDragStartObservable.notifyObservers({dragPlanePoint:e,pointerId:this.currentDraggingPointerId,pointerInfo:this._activePointerInfo}),this._targetPosition.copyFrom(this.attachedNode.getAbsolutePosition()),this.detachCameraControls&&this._scene.activeCamera&&this._scene.activeCamera.inputs&&!this._scene.activeCamera.leftCamera&&(this._scene.activeCamera.inputs.attachedToElement?(this._scene.activeCamera.detachControl(),this._attachedToElement=!0):this._attachedToElement=!1)):this.releaseDrag(),l._RestorePivotPoint(this.attachedNode)}_moveDrag(t){this._moving=!0;const i=this._pickWithRayOnDragPlane(t);if(i){l._RemoveAndStorePivotPoint(this.attachedNode),this.updateDragPlane&&this._updateDragPlanePosition(t,i);let a;this._options.dragAxis?(this.useObjectOrientationForDragging?h.TransformCoordinatesToRef(this._options.dragAxis,this.attachedNode.getWorldMatrix().getRotationMatrix(),this._worldDragAxis):this._worldDragAxis.copyFrom(this._options.dragAxis),i.subtractToRef(this.lastDragPosition,this._tmpVector),this.additionalTransformNode&&(this.additionalTransformNode.getWorldMatrix().invertToRef(s.Matrix[0]),h.TransformNormalToRef(this._worldDragAxis,s.Matrix[0],this._worldDragAxis)),this._worldDragAxis.normalize(),a=h.Dot(this._tmpVector,this._worldDragAxis),this._worldDragAxis.scaleToRef(a,this._dragDelta)):(a=this._dragDelta.length(),i.subtractToRef(this.lastDragPosition,this._dragDelta)),this._targetPosition.addInPlace(this._dragDelta),this.onDragOb
1servable.notifyObservers({dragDistance:a,delta:this._dragDelta,dragPlanePoint:i,dragPlaneNormal:this._dragPlane.forward,pointerId:this.currentDraggingPointerId,pointerInfo:this._activePointerInfo}),this.lastDragPosition.copyFrom(i),l._RestorePivotPoint(this.attachedNode)}}_pickWithRayOnDragPlane(t){if(!t)return null;let i=Math.acos(h.Dot(this._dragPlane.forward,t.direction));if(i>Math.PI/2&&(i=Math.PI-i),this.maxDragAngle>0&&i>this.maxDragAngle)if(this._useAlternatePickedPointAboveMaxDragAngle){this._tmpVector.copyFrom(t.direction),this.attachedNode.absolutePosition.subtractToRef(t.origin,this._alternatePickedPoint),this._alternatePickedPoint.normalize(),this._alternatePickedPoint.scaleInPlace(this._useAlternatePickedPointAboveMaxDragAngleDragSpeed*h.Dot(this._alternatePickedPoint,this._tmpVector)),this._tmpVector.addInPlace(this._alternatePickedPoint);const g=h.Dot(this._dragPlane.forward,this._tmpVector);return this._dragPlane.forward.scaleToRef(-g,this._alternatePickedPoint),this._alternatePickedPoint.addInPlace(this._tmpVector),this._alternatePickedPoint.addInPlace(this.attachedNode.absolutePosition),this._alternatePickedPoint}else return null;const a=this._dragPlane.forward,e=this._dragPlane.position,r=t.direction.dot(a);if(Math.abs(r)<H)return null;e.subtractToRef(t.origin,s.Vector3[0]);const c=s.Vector3[0].dot(a)/r;return c<0?null:(t.direction.scaleToRef(c,s.Vector3[0]),t.origin.add(s.Vector3[0]))}_updateDragPlanePosition(t,i){this._pointA.copyFrom(i),this._options.dragAxis?(this.useObjectOrientationForDragging?h.TransformCoordinatesToRef(this._options.dragAxis,this.attachedNode.getWorldMatrix().getRotationMatrix(),this._localAxis):this._localAxis.copyFrom(this._options.dragAxis),t.origin.subtractToRef(this._pointA,this._pointC),this._pointC.normalize(),Math.abs(h.Dot(this._localAxis,this._pointC))>.999?Math.abs(h.Dot(h.UpReadOnly,this._pointC))>.999?this._lookAt.copyFrom(h.Right()):this._lookAt.copyFrom(h.UpReadOnly):(h.CrossToRef(this._localAxis,this._pointC,this._lookAt),h.CrossToRef(this._localAxis,this._lookAt,this._lookAt),this._lookAt.normalize()),this._dragPlane.position.copyFrom(this._pointA),this._pointA.addToRef(this._lookAt,this._lookAt),this._dragPlane.lookAt(this._lookAt)):this._options.dragPlaneNormal?(this.useObjectOrientationForDragging?h.TransformCoordinatesToRef(this._options.dragPlaneNormal,this.attachedNode.getWorldMatrix().getRotationMatrix(),this._localAxis):this._localAxis.copyFrom(this._options.dragPlaneNormal),this._dragPlane.position.copyFrom(this._pointA),this._pointA.addToRef(this._localAxis,this._lookAt),this._dragPlane.lookAt(this._lookAt)):(this._scene.activeCamera&&this._scene.activeCamera.getForwardRay().direction.normalizeToRef(this._localAxis),this._dragPlane.position.copyFrom(this._pointA),this._dragPlane.lookAt(this._pointA.add(this._localAxis))),this._dragPlane.position.copyFrom(this.attachedNode.getAbsolutePosition()),this._dragPlane.computeWorldMatrix(!0)}detach(){this._lastPointerRay={},this.attachedNode&&(this.attachedNode.isNearGrabbable=!1),this._pointerObserver&&this._scene.onPointerObservable.remove(this._pointerObserver),this._beforeRenderObserver&&this._scene.onBeforeRenderObservable.remove(this._beforeRenderObserver),this._dragPlane&&this._dragPlane.dispose(),this.releaseDrag()}}f._AnyMouseId=-2;class _{getRenderCamera(t){if(this._renderCamera)return this._renderCamera;{let i;return this.originalScene.activeCameras&&this.originalScene.activeCameras.length>1?i=this.originalScene.activeCameras[this.originalScene.activeCameras.length-1]:i=this.originalScene.activeCamera,t&&i&&i.isRigCamera?i.rigParent:i}}setRenderCamera(t){this._renderCamera=t}_getSharedGizmoLight(){return this._sharedGizmoLight||(this._sharedGizmoLight=new Y("shared gizmo light",new h(0,1,0),this.utilityLayerScene),this._sharedGizmoLight.intensity=2,this._sharedGizmoLight.groundColor=O.Gray()),this._sharedGizmoLight}static get DefaultUtilityLayer(){return _._DefaultUtilityLayer==null?_._CreateDefaultUtilityLayerFromScene(L.LastCreatedScene):_._DefaultUtilityLayer}static _CreateDefaultUtilityLayerFromScene(t){return _._DefaultUtilityLayer=new _(t),_._DefaultUtilityLayer.originalScene.onDisposeObservable.addOnce(()=>{_._DefaultUtilityLayer=null}),_._DefaultUtilityLayer}static get DefaultKeepDepthUtilityLayer(){return _._DefaultKeepDepthUtilityLayer==null?_._CreateDefaultKeepUtilityLayerFromScene(L.LastCreatedScene):_._DefaultKeepDepthUtilityLayer}static _CreateDefaultKeepUtilityLayerFromScene(t){return _._DefaultKeepDepthUtilityLayer=new _(t),_._DefaultKeepDepthUtilityLayer.utilityLayerScene.autoClearDepthAndStencil=!1,_._DefaultKeepDepthUtilityLayer.originalScene.onDisposeObservable.addOnce(()=>{_._DefaultKeepDepthUtilityLayer=null}),_._DefaultKeepDepthUtilityLayer}constructor(t,i=!0,a=!1){this.originalScene=t,this.handleEvents=i,this._pointerCaptures={},this._lastPointerEvents={},this._sharedGizmoLight=null,this._renderCamera=null,this.pickUtilitySceneFirst=!0,this.shouldRender=!0,this.onlyCheckPointerDownEvents=!0,this.processAllEvents=!1,this.pickingEnabled=!0,this.onPointerOutObservable=new R,this.utilityLayerScene=new Q(t.getEngine(),{virtual:!0,useFloatingOrigin:t.floatingOriginMode}),this.utilityLayerScene.useRightHandedSystem=t.useRightHandedSystem,this.utilityLayerScene._allowPostProcessClearColor=!1,this.utilityLayerScene.postProcessesEnabled=!1,this.utilityLayerScene.detachControl(),i&&(this._originalPointerObserver=t.onPrePointerObservable.add(e=>{var g;if(!this.utilityLayerScene.activeCamera||!this.pickingEnabled||!this.processAllEvents&&e.type!==m.POINTERMOVE&&e.type!==m.POINTERUP&&e.type!==m.POINTERDOWN&&e.type!==m.POINTERDOUBLETAP)return;this.utilityLayerScene.pointerX=t.pointerX,this.utilityLayerScene.pointerY=t.pointerY;const r=e.event;if(t.isPointerCaptured(r.pointerId)){this._pointerCaptures[r.pointerId]=!1;return}const c=d=>{let n;if(e.nearInteractionPickingInfo)e.nearInteractionPickingInfo.pickedMesh.getScene()==d?n=e.nearInteractionPickingInfo:n=new K;else if(d!==this.utilityLayerScene&&e.originalPickingInfo)n=e.originalPickingInfo;else{let u=null;this._renderCamera&&(u=d._activeCamera,d._activeCamera=this._renderCamera,e.ray=null),n=e.ray?d.pickWithRay(e.ray):d.pick(t.pointerX,t.pointerY),u&&(d._activeCamera=u)}return n},o=c(this.utilityLayerScene);
1if(!e.ray&&o&&(e.ray=o.ray),(g=e.originalPickingInfo)!=null&&g.aimTransform&&o&&(o.aimTransform=e.originalPickingInfo.aimTransform,o.gripTransform=e.originalPickingInfo.gripTransform),this.utilityLayerScene.onPrePointerObservable.notifyObservers(e),this.onlyCheckPointerDownEvents&&e.type!=m.POINTERDOWN){e.skipOnPointerObservable||this.utilityLayerScene.onPointerObservable.notifyObservers(new S(e.type,e.event,o),e.type),e.type===m.POINTERUP&&this._pointerCaptures[r.pointerId]&&(this._pointerCaptures[r.pointerId]=!1);return}if(this.utilityLayerScene.autoClearDepthAndStencil||this.pickUtilitySceneFirst)o&&o.hit&&(e.skipOnPointerObservable||this.utilityLayerScene.onPointerObservable.notifyObservers(new S(e.type,e.event,o),e.type),e.skipOnPointerObservable=!0);else{const d=c(t),n=e.event;d&&o&&(o.distance===0&&d.pickedMesh?this.mainSceneTrackerPredicate&&this.mainSceneTrackerPredicate(d.pickedMesh)?(this._notifyObservers(e,d,n),e.skipOnPointerObservable=!0):e.type===m.POINTERDOWN?(this._pointerCaptures[n.pointerId]=!0,this._notifyObservers(e,d,n)):(e.type===m.POINTERMOVE||e.type===m.POINTERUP)&&(this._lastPointerEvents[n.pointerId]&&(this.onPointerOutObservable.notifyObservers(n.pointerId),delete this._lastPointerEvents[n.pointerId]),this._notifyObservers(e,d,n)):!this._pointerCaptures[n.pointerId]&&(o.distance<d.distance||d.distance===0)?(this._notifyObservers(e,o,n),e.skipOnPointerObservable||(e.skipOnPointerObservable=o.distance>0)):!this._pointerCaptures[n.pointerId]&&o.distance>=d.distance&&(this.mainSceneTrackerPredicate&&this.mainSceneTrackerPredicate(d.pickedMesh)?(this._notifyObservers(e,d,n),e.skipOnPointerObservable=!0):((e.type===m.POINTERMOVE||e.type===m.POINTERUP)&&this._lastPointerEvents[n.pointerId]&&(this.onPointerOutObservable.notifyObservers(n.pointerId),delete this._lastPointerEvents[n.pointerId]),this._notifyObservers(e,o,n))),e.type===m.POINTERUP&&this._pointerCaptures[n.pointerId]&&(this._pointerCaptures[n.pointerId]=!1))}}),this._originalPointerObserver&&t.onPrePointerObservable.makeObserverTopPriority(this._originalPointerObserver)),this.utilityLayerScene.autoClear=!1,a||(this._afterRenderObserver=this.originalScene.onAfterRenderCameraObservable.add(e=>{this.shouldRender&&e==this.getRenderCamera()&&this.render()})),this._sceneDisposeObserver=this.originalScene.onDisposeObservable.add(()=>{this.dispose()}),this._updateCamera()}_notifyObservers(t,i,a){t.skipOnPointerObservable||(this.utilityLayerScene.onPointerObservable.notifyObservers(new S(t.type,t.event,i),t.type),this._lastPointerEvents[a.pointerId]=!0)}render(){if(this._updateCamera(),this.utilityLayerScene.activeCamera){const t=this.utilityLayerScene.activeCamera.getScene(),i=this.utilityLayerScene.activeCamera;i._scene=this.utilityLayerScene,i.leftCamera&&(i.leftCamera._scene=this.utilityLayerScene),i.rightCamera&&(i.rightCamera._scene=this.utilityLayerScene),this.utilityLayerScene.render(!1),i._scene=t,i.leftCamera&&(i.leftCamera._scene=t),i.rightCamera&&(i.rightCamera._scene=t)}}dispose(){this.onPointerOutObservable.clear(),this._afterRenderObserver&&this.originalScene.onAfterCameraRenderObservable.remove(this._afterRenderObserver),this._sceneDisposeObserver&&this.originalScene.onDisposeObservable.remove(this._sceneDisposeObserver),this._originalPointerObserver&&this.originalScene.onPrePointerObservable.remove(this._originalPointerObserver),this.utilityLayerScene.dispose()}_updateCamera(){this.utilityLayerScene.cameraToUseForPointers=this.getRenderCamera(),this.utilityLayerScene.activeCamera=this.getRenderCamera()}}_._DefaultUtilityLayer=null;_._DefaultKeepDepthUtilityLayer=null;var B;(function(b){b[b.Origin=0]="Origin",b[b.Pivot=1]="Pivot"})(B||(B={}));var W;(function(b){b[b.World=0]="World",b[b.Local=1]="Local"})(W||(W={}));class y{set scaleRatio(t){this._scaleRatio=t}get scaleRatio(){return this._scaleRatio}get isHovered(){return this._isHovered}get attachedMesh(){return this._attachedMesh}set attachedMesh(t){this._attachedMesh=t,t&&(this._attachedNode=t),this._rootMesh.setEnabled(!!t),this._attachedNodeChanged(t)}get attachedNode(){return this._attachedNode}set attachedNode(t){this._attachedNode=t,this._attachedMesh=null,this._rootMesh.setEnabled(!!t),this._attachedNodeChanged(t)}
1setCustomMesh(t){if(t.getScene()!=this.gizmoLayer.utilityLayerScene)throw"When setting a custom mesh on a gizmo, the custom meshes scene must be the same as the gizmos (eg. gizmo.gizmoLayer.utilityLayerScene)";const i=this._rootMesh.getChildMeshes();for(const a of i)a.dispose();t.parent=this._rootMesh,this._customMeshSet=!0}get additionalTransformNode(){return this._additionalTransformNode}set additionalTransformNode(t){this._additionalTransformNode=t}set updateGizmoRotationToMatchAttachedMesh(t){this._updateGizmoRotationToMatchAttachedMesh=t}get updateGizmoRotationToMatchAttachedMesh(){return this._updateGizmoRotationToMatchAttachedMesh}set updateGizmoPositionToMatchAttachedMesh(t){this._updateGizmoPositionToMatchAttachedMesh=t}get updateGizmoPositionToMatchAttachedMesh(){return this._updateGizmoPositionToMatchAttachedMesh}set anchorPoint(t){this._anchorPoint=t}get anchorPoint(){return this._anchorPoint}set coordinatesMode(t){this._coordinatesMode=t;const i=t==1;this.updateGizmoRotationToMatchAttachedMesh=i,this.updateGizmoPositionToMatchAttachedMesh=!0}get coordinatesMode(){return this._coordinatesMode}set updateScale(t){this._updateScale=t}get updateScale(){return this._updateScale}_attachedNodeChanged(t){}constructor(t=_.DefaultUtilityLayer){this.gizmoLayer=t,this._attachedMesh=null,this._attachedNode=null,this._customRotationQuaternion=null,this._scaleRatio=1,this._isHovered=!1,this._customMeshSet=!1,this._updateGizmoRotationToMatchAttachedMesh=!0,this._updateGizmoPositionToMatchAttachedMesh=!0,this._anchorPoint=0,this._updateScale=!0,this._coordinatesMode=1,this._interactionsEnabled=!0,this._rightHandtoLeftHandMatrix=k.RotationY(Math.PI),this._rootMesh=new E("gizmoRootNode",t.utilityLayerScene),this._rootMesh.rotationQuaternion=F.Identity(),this._beforeRenderObserver=this.gizmoLayer.utilityLayerScene.onBeforeRenderObservable.add(()=>{this._update()})}get customRotationQuaternion(){return this._customRotationQuaternion}set customRotationQuaternion(t){this._customRotationQuaternion=t}_update(){if(this.attachedNode){let t=this.attachedNode;if(this.attachedMesh&&(t=this.attachedMesh),this.updateGizmoPositionToMatchAttachedMesh)if(this.anchorPoint==1&&t.getAbsolutePivotPoint){const i=t.getAbsolutePivotPoint();this._rootMesh.position.copyFrom(i)}else{const i=t.getWorldMatrix().getRow(3),a=i?i.toVector3():new h(0,0,0);this._rootMesh.position.copyFrom(a)}if(this.updateGizmoRotationToMatchAttachedMesh){const a=t._isMesh||t.getClassName()==="AbstractMesh"||t.getClassName()==="TransformNode"||t.getClassName()==="InstancedMesh"?t:void 0;t.getWorldMatrix().decompose(void 0,this._rootMesh.rotationQuaternion,void 0,y.PreserveScaling?a:void 0),this._rootMesh.rotationQuaternion.normalize()}else this._customRotationQuaternion?this._rootMesh.rotationQuaternion.copyFrom(this._customRotationQuaternion):this._rootMesh.rotationQuaternion.set(0,0,0,1);if(this.updateScale){const i=this.gizmoLayer.utilityLayerScene.activeCamera,a=i.globalPosition,e=s.Vector3[0];this._rootMesh.absolutePosition.subtractToRef(a,e);let r=this.scaleRatio;if(i.mode==U.ORTHOGRAPHIC_CAMERA){if(i.orthoTop&&i.orthoBottom){const c=i.orthoTop-i.orthoBottom;r*=c}}else{const c=i.getScene().useRightHandedSystem?h.RightHandedForwardReadOnly:h.LeftHandedForwardReadOnly,o=i.getDirection(c);r*=h.Dot(e,o)}if(this.additionalTransformNode){this.additionalTransformNode.getWorldMatrix().decompose(s.Vector3[1]);const c=Math.max(Math.abs(s.Vector3[1].x),Math.abs(s.Vector3[1].y),Math.abs(s.Vector3[1].z));r*=1/c}this._rootMesh.scaling.setAll(r),t._getWorldMatrixDeterminant()<0&&!y.PreserveScaling&&(this._rootMesh.scaling.y*=-1)}else this._rootMesh.scaling.setAll(this.scaleRatio)}this.additionalTransformNode&&(this._rootMesh.computeWorldMatrix(!0),this._rootMesh.getWorldMatrix().multiplyToRef(this.additionalTransformNode.getWorldMatrix(),s.Matrix[0]),s.Matrix[0].decompose(this._rootMesh.scaling,this._rootMesh.rotationQuaternion,this._rootMesh.position))}_handlePivotMatrixInverse(t,i,a){if(t.isUsingPivotMatrix()&&!t.isUsingPostMultiplyPivotMatrix()){t.getPivotMatrix().invertToRef(s.Matrix[5]),s.Matrix[5].multiplyToRef(i,a);return}a.copyFrom(i)}_matrixChanged(){if(this._attachedNode)if(this._attachedNode._isCamera){const t=this._attachedNode;let i,a;if(t.parent){const r=s.Matrix[1];t.parent._worldMatrix.invertToRef(r),this._attachedNode._worldMatrix.multiplyToRef(r,s.Matrix[0]),i=s.Matrix[0]}else i=this._attachedNode._worldMatrix;
1if(t.getScene().useRightHandedSystem?(this._rightHandtoLeftHandMatrix.multiplyToRef(i,s.Matrix[1]),a=s.Matrix[1]):a=i,a.decompose(s.Vector3[1],s.Quaternion[0],s.Vector3[0]),this._attachedNode.getClassName()==="FreeCamera"||this._attachedNode.getClassName()==="FlyCamera"||this._attachedNode.getClassName()==="ArcFollowCamera"||this._attachedNode.getClassName()==="TargetCamera"||this._attachedNode.getClassName()==="TouchCamera"||this._attachedNode.getClassName()==="UniversalCamera"){const r=this._attachedNode;r.rotation=s.Quaternion[0].toEulerAngles(),r.rotationQuaternion&&(r.rotationQuaternion.copyFrom(s.Quaternion[0]),r.rotationQuaternion.normalize())}t.position.copyFrom(s.Vector3[0])}else if(this._attachedNode._isMesh||this._attachedNode.getClassName()==="AbstractMesh"||this._attachedNode.getClassName()==="TransformNode"||this._attachedNode.getClassName()==="InstancedMesh"){const t=this._attachedNode;if(t.parent){const i=s.Matrix[0],a=s.Matrix[1];t.parent.getWorldMatrix().invertToRef(i),this._attachedNode.getWorldMatrix().multiplyToRef(i,a);const e=s.Matrix[4];if(this._handlePivotMatrixInverse(t,a,e),e.decompose(s.Vector3[0],s.Quaternion[0],t.position,y.PreserveScaling?t:void 0,y.UseAbsoluteScaling),s.Quaternion[0].normalize(),t.isUsingPivotMatrix()){const r=s.Quaternion[1];F.RotationYawPitchRollToRef(t.rotation.y,t.rotation.x,t.rotation.z,r);const c=s.Matrix[2];k.ScalingToRef(t.scaling.x,t.scaling.y,t.scaling.z,c);const o=s.Matrix[7];r.toRotationMatrix(o);const g=t.getPivotMatrix(),d=s.Matrix[3];g.invertToRef(d),g.multiplyToRef(c,s.Matrix[4]),s.Matrix[4].multiplyToRef(o,s.Matrix[5]),s.Matrix[5].multiplyToRef(d,s.Matrix[6]),s.Matrix[6].getTranslationToRef(s.Vector3[1]),t.position.subtractInPlace(s.Vector3[1])}}else{const i=s.Matrix[4];this._handlePivotMatrixInverse(t,this._attachedNode._worldMatrix,i),i.decompose(s.Vector3[0],s.Quaternion[0],t.position,y.PreserveScaling?t:void 0,y.UseAbsoluteScaling)}s.Vector3[0].scaleInPlace(1/t.scalingDeterminant),t.scaling.copyFrom(s.Vector3[0]),t.billboardMode||(t.rotationQuaternion?(t.rotationQuaternion.copyFrom(s.Quaternion[0]),t.rotationQuaternion.normalize()):t.rotation=s.Quaternion[0].toEulerAngles())}else if(this._attachedNode.getClassName()==="Bone"){const t=this._attachedNode,i=t.getParent();if(i){const a=s.Matrix[0],e=s.Matrix[1];i.getFinalMatrix().invertToRef(a),t.getFinalMatrix().multiplyToRef(a,e),t.getLocalMatrix().copyFrom(e)}else t.getLocalMatrix().copyFrom(t.getFinalMatrix());t.markAsDirty()}else{const t=this._attachedNode;if(t.getTypeID){const i=t.getTypeID();if(i===w.LIGHTTYPEID_DIRECTIONALLIGHT||i===w.LIGHTTYPEID_SPOTLIGHT||i===w.LIGHTTYPEID_POINTLIGHT){const a=t.parent;if(a){const e=s.Matrix[0],r=s.Matrix[1];a.getWorldMatrix().invertToRef(e),t.getWorldMatrix().multiplyToRef(e,r),r.decompose(void 0,s.Quaternion[0],s.Vector3[0])}else this._attachedNode._worldMatrix.decompose(void 0,s.Quaternion[0],s.Vector3[0]);t.position=new h(s.Vector3[0].x,s.Vector3[0].y,s.Vector3[0].z),t.direction&&(t.direction=new h(t.direction.x,t.direction.y,t.direction.z))}}}}_setGizmoMeshMaterial(t,i){if(t)for(const a of t)a.material=i,a.color&&(a.color=i.diffuseColor)}static GizmoAxisPointerObserver(t,i){let a=!1,e=-1,r=!1;return t.utilityLayerScene.onPointerObservable.add(o=>{var g,d;if(o.pickInfo){if(r=a&&o.event.button!==-1&&o.event.button!==e,r||o.type===m.POINTERUP)i.forEach(n=>{n.active=!1,a=!1,e=-1;for(const u of n.gizmoMeshes)u.material=n.dragBehavior.enabled?n.material:n.disableMaterial,u.color&&(u.color=n.material.diffuseColor)});else if(o.type===m.POINTERMOVE){if(a)return;i.forEach(n=>{var u,x;if(n.colliderMeshes&&n.gizmoMeshes){const v=((x=n.colliderMeshes)==null?void 0:x.indexOf((u=o==null?void 0:o.pickInfo)==null?void 0:u.pickedMesh))!=-1,C=n.dragBehavior.enabled?v||n.active?n.hoverMaterial:n.material:n.disableMaterial;for(const p of n.gizmoMeshes)p.material=C,p.color&&(p.color=C.diffuseColor)}})}else if(o.type===m.POINTERDOWN&&i.has((g=o.pickInfo.pickedMesh)==null?void 0:g.parent)){a=!0,e=o.event.button;const n=i.get((d=o.pickInfo.pickedMesh)==null?void 0:d.parent);
1n.active=!0,i.forEach(u=>{var C,p;const v=(((p=u.colliderMeshes)==null?void 0:p.indexOf((C=o==null?void 0:o.pickInfo)==null?void 0:C.pickedMesh))!=-1||u.active)&&u.dragBehavior.enabled?u.hoverMaterial:u.disableMaterial;for(const P of u.gizmoMeshes)P.material=v,P.color&&(P.color=v.diffuseColor)})}}})}dispose(){this._rootMesh.dispose(),this._beforeRenderObserver&&this.gizmoLayer.utilityLayerScene.onBeforeRenderObservable.remove(this._beforeRenderObserver)}}y.PreserveScaling=!1;y.UseAbsoluteScaling=!0;class D extends y{get coloredMaterial(){return this._coloredMaterial}get hoverMaterial(){return this._hoverMaterial}get disableMaterial(){return this._disableMaterial}static _CreateArrow(t,i,a=1,e=!1){const r=new V("arrow",t),c=I("cylinder",{diameterTop:0,height:.075,diameterBottom:.0375*(1+(a-1)/4),tessellation:96},t),o=I("cylinder",{diameterTop:.005*a,height:.275,diameterBottom:.005*a,tessellation:96},t);return c.parent=r,c.material=i,c.rotation.x=Math.PI/2,c.position.z+=.3,o.parent=r,o.material=i,o.position.z+=.275/2,o.rotation.x=Math.PI/2,e&&(o.visibility=0,c.visibility=0),r}static _CreateArrowInstance(t,i){const a=new V("arrow",t);for(const e of i.getChildMeshes()){const r=e.createInstance(e.name);r.parent=a}return a}constructor(t,i=O.Gray(),a=_.DefaultUtilityLayer,e=null,r=1,c=O.Yellow(),o=O.Gray()){var C;super(a),this._pointerObserver=null,this.snapDistance=0,this.onSnapObservable=new R,this._isEnabled=!0,this._parent=null,this._dragging=!1,this._parent=e,this._coloredMaterial=new A("",a.utilityLayerScene),this._coloredMaterial.diffuseColor=i,this._coloredMaterial.specularColor=i.subtract(new O(.1,.1,.1)),this._hoverMaterial=new A("",a.utilityLayerScene),this._hoverMaterial.diffuseColor=c,this._disableMaterial=new A("",a.utilityLayerScene),this._disableMaterial.diffuseColor=o,this._disableMaterial.alpha=.4;const g=D._CreateArrow(a.utilityLayerScene,this._coloredMaterial,r),d=D._CreateArrow(a.utilityLayerScene,this._coloredMaterial,r+4,!0);this._gizmoMesh=new E("",a.utilityLayerScene),this._gizmoMesh.addChild(g),this._gizmoMesh.addChild(d),this._gizmoMesh.lookAt(this._rootMesh.position.add(t)),this._gizmoMesh.scaling.scaleInPlace(1/3),this._gizmoMesh.parent=this._rootMesh;let n=0;const u={snapDistance:0};this.dragBehavior=new f({dragAxis:t}),this.dragBehavior.moveAttached=!1,this.dragBehavior.updateDragPlane=!1,this._rootMesh.addBehavior(this.dragBehavior),this.dragBehavior.onDragObservable.add(p=>{if(this.attachedNode){let P=!1,M=p.delta;if(this._additionalTransformNode){const T=s.Matrix[0];this._additionalTransformNode.getWorldMatrix().invertToRef(T),h.TransformNormalToRef(p.delta,T,s.Vector3[3]),M=s.Vector3[3]}if(this.snapDistance==0)this.attachedNode.getWorldMatrix().getTranslationToRef(s.Vector3[2]),s.Vector3[2].addInPlace(M),this.dragBehavior.validateDrag(s.Vector3[2])&&(this.attachedNode.position&&this.attachedNode.position.addInPlaceFromFloats(M.x,M.y,M.z),this.attachedNode.getWorldMatrix().addTranslationFromFloats(M.x,M.y,M.z),this.attachedNode.updateCache(),P=!0);else if(n+=p.dragDistance,Math.abs(n)>this.snapDistance){const T=Math.floor(Math.abs(n)/this.snapDistance);n=n%this.snapDistance,M.normalizeToRef(s.Vector3[1]),s.Vector3[1].scaleInPlace(this.snapDistance*T),this.attachedNode.getWorldMatrix().getTranslationToRef(s.Vector3[2]),s.Vector3[2].addInPlace(s.Vector3[1]),this.dragBehavior.validateDrag(s.Vector3[2])&&(this.attachedNode.getWorldMatrix().addTranslationFromFloats(s.Vector3[1].x,s.Vector3[1].y,s.Vector3[1].z),this.attachedNode.updateCache(),u.snapDistance=this.snapDistance*T*Math.sign(n),this.onSnapObservable.notifyObservers(u),P=!0)}P&&this._matrixChanged()}}),this.dragBehavior.onDragStartObservable.add(()=>{this._dragging=!0}),this.dragBehavior.onDragEndObservable.add(()=>{this._dragging=!1});const x=a._getSharedGizmoLight();x.includedOnlyMeshes=x.includedOnlyMeshes.concat(this._rootMesh.getChildMeshes(!1));const v={gizmoMeshes:g.getChildMeshes(),colliderMeshes:d.getChildMeshes(),material:this._coloredMaterial,hoverMaterial:this._hoverMaterial,disableMaterial:this._disableMaterial,active:!1,dragBehavior:this.dragBehavior};(C=this._parent)==null||C.addToAxisCache(d,v),this._pointerObserver=a.utilityLayerScene.onPointerObservable.add(p=>{var P;if(!this._customMeshSet&&(this._isHovered=v.colliderMeshes.indexOf((P=p==null?void 0:p.pickInfo)==null?void 0:P.pickedMesh)!=-1,!this._parent)){const M=this.dragBehavior.enabled?this._isHovered||this._dragging?this._hoverMaterial:this._coloredMaterial:this._disableMaterial;this._setGizmoMeshMaterial(v.gizmoMeshes,M)}}),this.dragBehavior.onEnabledObservable.add(p=>{this._setGizmoMeshMaterial(v.gizmoMeshes,p?v.material:v.disableMaterial)})}_attachedNodeChanged(t){this.dragBehavior&&(this.dragBehavior.enabled=!!t)}set isEnabled(t){this._isEnabled=t,t?this._parent&&(this.attachedMesh=this._parent.attachedMesh,this.attachedNode=this._parent.attachedNode):(this.attachedMesh=null,this.attachedNode=null)}get isEnabled(){return this._isEnabled}dispose(){this.onSnapObservable.clear(),this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver),this.dragBehavior.detach(),this._gizmoMesh&&this._gizmoMesh.dispose();const t=[this._coloredMaterial,this._hoverMaterial,this._disableMaterial];for(const i of t)i&&i.dispose();super.dispose()}}class N{get scaleLines(){return this._scaleLines}set scaleLines(t){this._scaleLines=t,this._xAxis.scaling.setAll(this._scaleLines*this._scaleLinesFactor),this._yAxis.scaling.setAll(this._scaleLines*this._scaleLinesFactor),this._zAxis.scaling.setAll(this._scaleLines*this._scaleLinesFactor)}get xAxis(){return this._xAxis}get yAxis(){return this._yAxis}get zAxis(){return this._zAxis}constructor(t,i=1,a=2,e,r,c,o=1){if(this._scaleLinesFactor=4,this._instanced=!1,this.scene=null,this._scaleLines=1,t=t||L.LastCreatedScene,!!t){if(!e){const g=new A("xAxisMaterial",t);g.disableLighting=!0,g.emissiveColor=O.Red().scale(.5),e=D._CreateArrow(t,g,o)}if(!r){const g=new A("yAxisMaterial",t);g.disableLighting=!0,g.emissiveColor=O.Green().scale(.5),r=D._CreateArrow(t,g,o)}if(!c){const g=new A("zAxisMaterial",t);g.disableLighting=!0,g.emissiveColor=O.Blue().scale(.5),c=D._CreateArrow(t,g,o)}this._xAxis=e,this._yAxis=r,this._zAxis=c,this.scaleLines=i,a!=null&&(N._SetRenderingGroupId(this._xAxis,a),N._SetRenderingGroupId(this._yAxis,a),N._SetRenderingGroupId(this._zAxis,a)),this.scene=t,this.update(new h,h.Right(),h.Up(),h.Forward())}}update(t,i,a,e){this._xAxis.position.copyFrom(t),this._xAxis.setDirection(i),this._yAxis.position.copyFrom(t),this._yAxis.setDirection(a),this._zAxis.position.copyFrom(t),this._zAxis.setDirection(e)}createInstance(){const t=D._CreateArrowInstance(this.scene,this._xAxis),i=D._CreateArrowInstance(this.scene,this._yAxis),a=D._CreateArrowInstance(this.scene,this._zAxis),e=new N(this.scene,this.scaleLines,null,t,i,a);return e._instanced=!0,e}dispose(){this._xAxis&&this._xAxis.dispose(!1,!this._instanced),this._yAxis&&this._yAxis.dispose(!1,!this._instanced),this._zAxis&&this._zAxis.dispose(!1,!this._instanced),this.scene=null}static _SetRenderingGroupId(t,i){const a=t.getChildMeshes();for(const e of a)e.renderingGroupId=i}}export{N as AxesViewer};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.