{"ast":null,"code":"import { Vector2 } from \"../Maths/math.vector.js\";\nimport { Texture } from \"../Materials/Textures/texture.js\";\nimport { PostProcess } from \"./postProcess.js\";\n/**\n * VRDistortionCorrectionPostProcess used for mobile VR\n */\nexport class VRDistortionCorrectionPostProcess extends PostProcess {\n /**\n * Gets a string identifying the name of the class\n * @returns \"VRDistortionCorrectionPostProcess\" string\n */\n getClassName() {\n return \"VRDistortionCorrectionPostProcess\";\n }\n /**\n * Initializes the VRDistortionCorrectionPostProcess\n * @param name The name of the effect.\n * @param camera The camera to apply the render pass to.\n * @param isRightEye If this is for the right eye distortion\n * @param vrMetrics All the required metrics for the VR camera\n */\n constructor(name, camera, isRightEye, vrMetrics) {\n super(name, \"vrDistortionCorrection\", [\"LensCenter\", \"Scale\", \"ScaleIn\", \"HmdWarpParam\"], null, vrMetrics.postProcessScaleFactor, camera, Texture.BILINEAR_SAMPLINGMODE);\n this._isRightEye = isRightEye;\n this._distortionFactors = vrMetrics.distortionK;\n this._postProcessScaleFactor = vrMetrics.postProcessScaleFactor;\n this._lensCenterOffset = vrMetrics.lensCenterOffset;\n this.adaptScaleToCurrentViewport = true;\n this.onSizeChangedObservable.add(() => {\n this._scaleIn = new Vector2(2, 2 / this.aspectRatio);\n this._scaleFactor = new Vector2(0.5 * (1 / this._postProcessScaleFactor), 0.5 * (1 / this._postProcessScaleFactor) * this.aspectRatio);\n this._lensCenter = new Vector2(this._isRightEye ? 0.5 - this._lensCenterOffset * 0.5 : 0.5 + this._lensCenterOffset * 0.5, 0.5);\n });\n this.onApplyObservable.add(effect => {\n effect.setFloat2(\"LensCenter\", this._lensCenter.x, this._lensCenter.y);\n effect.setFloat2(\"Scale\", this._scaleFactor.x, this._scaleFactor.y);\n effect.setFloat2(\"ScaleIn\", this._scaleIn.x, this._scaleIn.y);\n effect.setFloat4(\"HmdWarpParam\", this._distortionFactors[0], this._distortionFactors[1], this._distortionFactors[2], this._distortionFactors[3]);\n });\n }\n _gatherImports(useWebGPU, list) {\n if (useWebGPU) {\n this._webGPUReady = true;\n list.push(import(\"../ShadersWGSL/vrDistortionCorrection.fragment.js\"));\n } else {\n list.push(import(\"../Shaders/vrDistortionCorrection.fragment.js\"));\n }\n super._gatherImports(useWebGPU, list);\n }\n}","map":{"version":3,"names":["Vector2","Texture","PostProcess","VRDistortionCorrectionPostProcess","getClassName","constructor","name","camera","isRightEye","vrMetrics","postProcessScaleFactor","BILINEAR_SAMPLINGMODE","_isRightEye","_distortionFactors","distortionK","_postProcessScaleFactor","_lensCenterOffset","lensCenterOffset","adaptScaleToCurrentViewport","onSizeChangedObservable","add","_scaleIn","aspectRatio","_scaleFactor","_lensCenter","onApplyObservable","effect","setFloat2","x","y","setFloat4","_gatherImports","useWebGPU","list","_webGPUReady","push"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/PostProcesses/vrDistortionCorrectionPostProcess.js"],"sourcesContent":["import { Vector2 } from \"../Maths/math.vector.js\";\nimport { Texture } from \"../Materials/Textures/texture.js\";\nimport { PostProcess } from \"./postProcess.js\";\n/**\n * VRDistortionCorrectionPostProcess used for mobile VR\n */\nexport class VRDistortionCorrectionPostProcess extends PostProcess {\n /**\n * Gets a string identifying the name of the class\n * @returns \"VRDistortionCorrectionPostProcess\" string\n */\n getClassName() {\n return \"VRDistortionCorrectionPostProcess\";\n }\n /**\n * Initializes the VRDistortionCorrectionPostProcess\n * @param name The name of the effect.\n * @param camera The camera to apply the render pass to.\n * @param isRightEye If this is for the right eye distortion\n * @param vrMetrics All the required metrics for the VR camera\n */\n constructor(name, camera, isRightEye, vrMetrics) {\n super(name, \"vrDistortionCorrection\", [\"LensCenter\", \"Scale\", \"ScaleIn\", \"HmdWarpParam\"], null, vrMetrics.postProcessScaleFactor, camera, Texture.BILINEAR_SAMPLINGMODE);\n this._isRightEye = isRightEye;\n this._distortionFactors = vrMetrics.distortionK;\n this._postProcessScaleFactor = vrMetrics.postProcessScaleFactor;\n this._lensCenterOffset = vrMetrics.lensCenterOffset;\n this.adaptScaleToCurrentViewport = true;\n this.onSizeChangedObservable.add(() => {\n this._scaleIn = new Vector2(2, 2 / this.aspectRatio);\n this._scaleFactor = new Vector2(0.5 * (1 / this._postProcessScaleFactor), 0.5 * (1 / this._postProcessScaleFactor) * this.aspectRatio);\n this._lensCenter = new Vector2(this._isRightEye ? 0.5 - this._lensCenterOffset * 0.5 : 0.5 + this._lensCenterOffset * 0.5, 0.5);\n });\n this.onApplyObservable.add((effect) => {\n effect.setFloat2(\"LensCenter\", this._lensCenter.x, this._lensCenter.y);\n effect.setFloat2(\"Scale\", this._scaleFactor.x, this._scaleFactor.y);\n effect.setFloat2(\"ScaleIn\", this._scaleIn.x, this._scaleIn.y);\n effect.setFloat4(\"HmdWarpParam\", this._distortionFactors[0], this._distortionFactors[1], this._distortionFactors[2], this._distortionFactors[3]);\n });\n }\n _gatherImports(useWebGPU, list) {\n if (useWebGPU) {\n this._webGPUReady = true;\n list.push(import(\"../ShadersWGSL/vrDistortionCorrection.fragment.js\"));\n }\n else {\n list.push(import(\"../Shaders/vrDistortionCorrection.fragment.js\"));\n }\n super._gatherImports(useWebGPU, list);\n }\n}\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,yBAAyB;AACjD,SAASC,OAAO,QAAQ,kCAAkC;AAC1D,SAASC,WAAW,QAAQ,kBAAkB;AAC9C;AACA;AACA;AACA,OAAO,MAAMC,iCAAiC,SAASD,WAAW,CAAC;EAC/D;AACJ;AACA;AACA;EACIE,YAAYA,CAAA,EAAG;IACX,OAAO,mCAAmC;EAC9C;EACA;AACJ;AACA;AACA;AACA;AACA;AACA;EACIC,WAAWA,CAACC,IAAI,EAAEC,MAAM,EAAEC,UAAU,EAAEC,SAAS,EAAE;IAC7C,KAAK,CAACH,IAAI,EAAE,wBAAwB,EAAE,CAAC,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,CAAC,EAAE,IAAI,EAAEG,SAAS,CAACC,sBAAsB,EAAEH,MAAM,EAAEN,OAA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