{"ast":null,"code":"import { WebXRAbstractMotionController } from \"./webXRAbstractMotionController.js\";\nimport { Mesh } from \"../../Meshes/mesh.js\";\nimport { Quaternion } from \"../../Maths/math.vector.js\";\nimport { WebXRMotionControllerManager } from \"./webXRMotionControllerManager.js\";\n/**\n * The motion controller class for the standard HTC-Vive controllers\n */\nexport class WebXRHTCViveMotionController extends WebXRAbstractMotionController {\n /**\n * Create a new Vive motion controller object\n * @param scene the scene to use to create this controller\n * @param gamepadObject the corresponding gamepad object\n * @param handedness the handedness of the controller\n */\n constructor(scene, gamepadObject, handedness) {\n super(scene, HTCViveLayout[handedness], gamepadObject, handedness);\n this.profileId = \"htc-vive\";\n }\n _getFilenameAndPath() {\n const filename = WebXRHTCViveMotionController.MODEL_FILENAME;\n const path = WebXRHTCViveMotionController.MODEL_BASE_URL;\n return {\n filename,\n path\n };\n }\n _getModelLoadingConstraints() {\n return true;\n }\n _processLoadedModel(_meshes) {\n this.getComponentIds().forEach(id => {\n const comp = id && this.getComponent(id);\n if (comp) {\n comp.onButtonStateChangedObservable.add(component => {\n if (!this.rootMesh || this.disableAnimation) {\n return;\n }\n switch (id) {\n case \"xr-standard-trigger\":\n this._modelRootNode.getChildren()[6].rotation.x = -component.value * 0.15;\n return;\n case \"xr-standard-touchpad\":\n return;\n case \"xr-standard-squeeze\":\n return;\n }\n }, undefined, true);\n }\n });\n }\n _setRootMesh(meshes) {\n this.rootMesh = new Mesh(this.profileId + \" \" + this.handedness, this.scene);\n meshes.forEach(mesh => {\n mesh.isPickable = false;\n });\n this._modelRootNode = meshes[1];\n this._modelRootNode.parent = this.rootMesh;\n if (!this.scene.useRightHandedSystem) {\n this.rootMesh.rotationQuaternion = Quaternion.FromEulerAngles(0, Math.PI, 0);\n }\n }\n _updateModel() {\n // no-op. model is updated using observables.\n }\n}\n/**\n * The base url used to load the left and right controller models\n */\nWebXRHTCViveMotionController.MODEL_BASE_URL = \"https://controllers.babylonjs.com/vive/\";\n/**\n * File name for the controller model.\n */\nWebXRHTCViveMotionController.MODEL_FILENAME = \"wand.babylon\";\n// register the profile\nWebXRMotionControllerManager.RegisterController(\"htc-vive\", (xrInput, scene) => {\n return new WebXRHTCViveMotionController(scene, xrInput.gamepad, xrInput.handedness);\n});\n// WebXRMotionControllerManager.RegisterController(\"htc-vive-legacy\", (xrInput: XRInputSource, scene: Scene) => {\n// return new WebXRHTCViveMotionController(scene, (xrInput.gamepad), xrInput.handedness, true);\n// });\nconst HTCViveLayout = {\n left: {\n selectComponentId: \"xr-standard-trigger\",\n components: {\n \"xr-standard-trigger\": {\n type: \"trigger\",\n gamepadIndices: {\n button: 0\n },\n rootNodeName: \"xr_standard_trigger\",\n visualResponses: {}\n },\n \"xr-standard-squeeze\": {\n type: \"squeeze\",\n gamepadIndices: {\n button: 1\n },\n rootNodeName: \"xr_standard_squeeze\",\n visualResponses: {}\n },\n \"xr-standard-touchpad\": {\n type: \"touchpad\",\n gamepadIndices: {\n button: 2,\n xAxis: 0,\n yAxis: 1\n },\n rootNodeName: \"xr_standard_touchpad\",\n visualResponses: {}\n },\n menu: {\n type: \"button\",\n gamepadIndices: {\n button: 4\n },\n rootNodeName: \"menu\",\n visualResponses: {}\n }\n },\n gamepadMapping: \"xr-standard\",\n rootNodeName: \"htc_vive_none\",\n assetPath: \"none.glb\"\n },\n right: {\n selectComponentId: \"xr-standard-trigger\",\n components: {\n \"xr-standard-trigger\": {\n type: \"trigger\",\n gamepadIndices: {\n button: 0\n },\n rootNodeName: \"xr_standard_trigger\",\n visualResponses: {}\n },\n \"xr-standard-squeeze\": {\n type: \"squeeze\",\n gamepadIndices: {\n button: 1\n },\n rootNodeName: \"xr_standard_squeeze\",\n visualResponses: {}\n },\n \"xr-standard-touchpad\": {\n type: \"touchpad\",\n gamepadIndices: {\n button: 2,\n xAxis: 0,\n yAxis: 1\n },\n rootNodeName: \"xr_standard_touchpad\",\n visualResponses: {}\n },\n menu: {\n type: \"button\",\n gamepadIndices: {\n button: 4\n },\n rootNodeName: \"menu\",\n visualResponses: {}\n }\n },\n gamepadMapping: \"xr-standard\",\n rootNodeName: \"htc_vive_none\",\n assetPath: \"none.glb\"\n },\n none: {\n selectComponentId: \"xr-standard-trigger\",\n components: {\n \"xr-standard-trigger\": {\n type: \"trigger\",\n gamepadIndices: {\n button: 0\n },\n rootNodeName: \"xr_standard_trigger\",\n visualResponses: {}\n },\n \"xr-standard-squeeze\": {\n type: \"squeeze\",\n gamepadIndices: {\n button: 1\n },\n rootNodeName: \"xr_standard_squeeze\",\n visualResponses: {}\n },\n \"xr-standard-touchpad\": {\n type: \"touchpad\",\n gamepadIndices: {\n button: 2,\n xAxis: 0,\n yAxis: 1\n },\n rootNodeName: \"xr_standard_touchpad\",\n visualResponses: {}\n },\n menu: {\n type: \"button\",\n gamepadIndices: {\n button: 4\n },\n rootNodeName: \"menu\",\n visualResponses: {}\n }\n },\n gamepadMapping: \"xr-standard\",\n rootNodeName: \"htc-vive-none\",\n assetPath: \"none.glb\"\n }\n};","map":{"version":3,"names":["WebXRAbstractMotionController","Mesh","Quaternion","WebXRMotionControllerManager","WebXRHTCViveMotionController","constructor","scene","gamepadObject","handedness","HTCViveLayout","profileId","_getFilenameAndPath","filename","MODEL_FILENAME","path","MODEL_BASE_URL","_getModelLoadingConstraints","_processLoadedModel","_meshes","getComponentIds","forEach","id","comp","getComponent","onButtonStateChangedObservable","add","component","rootMesh","disableAnimation","_modelRootNode","getChildren","rotation","x","value","undefined","_setRootMesh","meshes","mesh","isPickable","parent","useRightHandedSystem","rotationQuaternion","FromEulerAngles","Math","PI","_updateModel","RegisterController","xrInput","gamepad","left","selectComponentId","components","type","gamepadIndices","button","rootNodeName","visualResponses","xAxis","yAxis","menu","gamepadMapping","assetPath","right","none"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/XR/motionController/webXRHTCViveMotionController.js"],"sourcesContent":["import { WebXRAbstractMotionController } from \"./webXRAbstractMotionController.js\";\nimport { Mesh } from \"../../Meshes/mesh.js\";\nimport { Quaternion } from \"../../Maths/math.vector.js\";\nimport { WebXRMotionControllerManager } from \"./webXRMotionControllerManager.js\";\n/**\n * The motion controller class for the standard HTC-Vive controllers\n */\nexport class WebXRHTCViveMotionController extends WebXRAbstractMotionController {\n /**\n * Create a new Vive motion controller object\n * @param scene the scene to use to create this controller\n * @param gamepadObject the corresponding gamepad object\n * @param handedness the handedness of the controller\n */\n constructor(scene, gamepadObject, handedness) {\n super(scene, HTCViveLayout[handedness], gamepadObject, handedness);\n this.profileId = \"htc-vive\";\n }\n _getFilenameAndPath() {\n const filename = WebXRHTCViveMotionController.MODEL_FILENAME;\n const path = WebXRHTCViveMotionController.MODEL_BASE_URL;\n return {\n filename,\n path,\n };\n }\n _getModelLoadingConstraints() {\n return true;\n }\n _processLoadedModel(_meshes) {\n this.getComponentIds().forEach((id) => {\n const comp = id && this.getComponent(id);\n if (comp) {\n comp.onButtonStateChangedObservable.add((component) => {\n if (!this.rootMesh || this.disableAnimation) {\n return;\n }\n switch (id) {\n case \"xr-standard-trigger\":\n this._modelRootNode.getChildren()[6].rotation.x = -component.value * 0.15;\n return;\n case \"xr-standard-touchpad\":\n return;\n case \"xr-standard-squeeze\":\n return;\n }\n }, undefined, true);\n }\n });\n }\n _setRootMesh(meshes) {\n this.rootMesh = new Mesh(this.profileId + \" \" + this.handedness, this.scene);\n meshes.forEach((mesh) => {\n mesh.isPickable = false;\n });\n this._modelRootNode = meshes[1];\n this._modelRootNode.parent = this.rootMesh;\n if (!this.scene.useRightHandedSystem) {\n this.rootMesh.rotationQuaternion = Quaternion.FromEulerAngles(0, Math.PI, 0);\n }\n }\n _updateModel() {\n // no-op. model is updated using observables.\n }\n}\n/**\n * The base url used to load the left and right controller models\n */\nWebXRHTCViveMotionController.MODEL_BASE_URL = \"https://controllers.babylonjs.com/vive/\";\n/**\n * File name for the controller model.\n */\nWebXRHTCViveMotionController.MODEL_FILENAME = \"wand.babylon\";\n// register the profile\nWebXRMotionControllerManager.RegisterController(\"htc-vive\", (xrInput, scene) => {\n return new WebXRHTCViveMotionController(scene, xrInput.gamepad, xrInput.handedness);\n});\n// WebXRMotionControllerManager.RegisterController(\"htc-vive-legacy\", (xrInput: XRInputSource, scene: Scene) => {\n// return new WebXRHTCViveMotionController(scene, (xrInput.gamepad), xrInput.handedness, true);\n// });\nconst HTCViveLayout = {\n left: {\n selectComponentId: \"xr-standard-trigger\",\n components: {\n \"xr-standard-trigger\": {\n type: \"trigger\",\n gamepadIndices: {\n button: 0,\n },\n rootNodeName: \"xr_standard_trigger\",\n visualResponses: {},\n },\n \"xr-standard-squeeze\": {\n type: \"squeeze\",\n gamepadIndices: {\n button: 1,\n },\n rootNodeName: \"xr_standard_squeeze\",\n visualResponses: {},\n },\n \"xr-standard-touchpad\": {\n type: \"touchpad\",\n gamepadIndices: {\n button: 2,\n xAxis: 0,\n yAxis: 1,\n },\n rootNodeName: \"xr_standard_touchpad\",\n visualResponses: {},\n },\n menu: {\n type: \"button\",\n gamepadIndices: {\n button: 4,\n },\n rootNodeName: \"menu\",\n visualResponses: {},\n },\n },\n gamepadMapping: \"xr-standard\",\n rootNodeName: \"htc_vive_none\",\n assetPath: \"none.glb\",\n },\n right: {\n selectComponentId: \"xr-standard-trigger\",\n components: {\n \"xr-standard-trigger\": {\n type: \"trigger\",\n gamepadIndices: {\n button: 0,\n },\n rootNodeName: \"xr_standard_trigger\",\n visualResponses: {},\n },\n \"xr-standard-squeeze\": {\n type: \"squeeze\",\n gamepadIndices: {\n button: 1,\n },\n rootNodeName: \"xr_standard_squeeze\",\n visualResponses: {},\n },\n \"xr-standard-touchpad\": {\n type: \"touchpad\",\n gamepadIndices: {\n button: 2,\n xAxis: 0,\n yAxis: 1,\n },\n rootNodeName: \"xr_standard_touchpad\",\n visualResponses: {},\n },\n menu: {\n type: \"button\",\n gamepadIndices: {\n button: 4,\n },\n rootNodeName: \"menu\",\n visualResponses: {},\n },\n },\n gamepadMapping: \"xr-standard\",\n rootNodeName: \"htc_vive_none\",\n assetPath: \"none.glb\",\n },\n none: {\n selectComponentId: \"xr-standard-trigger\",\n components: {\n \"xr-standard-trigger\": {\n type: \"trigger\",\n gamepadIndices: {\n button: 0,\n },\n rootNodeName: \"xr_standard_trigger\",\n visualResponses: {},\n },\n \"xr-standard-squeeze\": {\n type: \"squeeze\",\n gamepadIndices: {\n button: 1,\n },\n rootNodeName: \"xr_standard_squeeze\",\n visualResponses: {},\n },\n \"xr-standard-touchpad\": {\n type: \"touchpad\",\n gamepadIndices: {\n button: 2,\n xAxis: 0,\n yAxis: 1,\n },\n rootNodeName: \"xr_standard_touchpad\",\n visualResponses: {},\n },\n menu: {\n type: \"button\",\n gamepadIndices: {\n button: 4,\n },\n rootNodeName: \"menu\",\n visualResponses: {},\n },\n },\n gamepadMapping: \"xr-standard\",\n rootNodeName: \"htc-vive-none\",\n assetPath: \"none.glb\",\n },\n};\n"],"mappings":"AAAA,SAASA,6BAA6B,QAAQ,oCAAoC;AAClF,SAASC,IAAI,QAAQ,sBAAsB;AAC3C,SAASC,UAAU,QAAQ,4BAA4B;AACvD,SAASC,4BAA4B,QAAQ,mCAAmC;AAChF;AACA;AACA;AACA,OAAO,MAAMC,4BAA4B,SAASJ,6BAA6B,CAAC;EAC5E;AACJ;AACA;AACA;AACA;AACA;EACIK,WAAWA,CAACC,KAAK,EAAEC,aAAa,EAAEC,UAAU,EAAE;IAC1C,KAAK,CAACF,KAAK,EAAEG,aAAa,CAACD,UAAU,CAAC,EAAED,aAAa,EAAEC,UAAU,CAAC;IAClE,IAAI,CAACE,SAAS,GAAG,UAAU;EAC/B;EACAC,mBAAmBA,CAAA,EAAG;IAClB,MAAMC,QAAQ,GAAGR,4BAA4B,CAACS,cAAc;IAC5D,MAAMC,IAAI,GAAGV,4BAA4B,CAACW,cAAc;IACxD,OAAO;MACHH,QAAQ;MACRE;IACJ,CAAC;EACL;EACAE,2BAA2BA,CAAA,EAAG;IAC1B,OAAO,IAAI;EACf;EACAC,mBAAmBA,CAACC,OAAO,EAAE;IAC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