1b36b86b26c4b8b0c78ea98bab9799cd4f2b6883927005a092ef26eac0b09afe.json 14 KB

1
  1. {"ast":null,"code":"import { __decorate } from \"../tslib.es6.js\";\nimport { Vector2 } from \"../Maths/math.vector.js\";\nimport { PostProcess } from \"./postProcess.js\";\nimport { RegisterClass } from \"../Misc/typeStore.js\";\nimport { serialize } from \"../Misc/decorators.js\";\nimport { SerializationHelper } from \"../Misc/decorators.serialization.js\";\n/**\n * The ChromaticAberrationPostProcess separates the rgb channels in an image to produce chromatic distortion around the edges of the screen\n */\nexport class ChromaticAberrationPostProcess extends PostProcess {\n /**\n * Gets a string identifying the name of the class\n * @returns \"ChromaticAberrationPostProcess\" string\n */\n getClassName() {\n return \"ChromaticAberrationPostProcess\";\n }\n /**\n * Creates a new instance ChromaticAberrationPostProcess\n * @param name The name of the effect.\n * @param screenWidth The width of the screen to apply the effect on.\n * @param screenHeight The height of the screen to apply the effect on.\n * @param options The required width/height ratio to downsize to before computing the render pass.\n * @param camera The camera to apply the render pass to.\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\n * @param engine The engine which the post process will be applied. (default: current engine)\n * @param reusable If the post process can be reused on the same frame. (default: false)\n * @param textureType Type of textures used when performing the post process. (default: 0)\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\n */\n constructor(name, screenWidth, screenHeight, options, camera, samplingMode, engine, reusable, textureType = 0, blockCompilation = false) {\n super(name, \"chromaticAberration\", [\"chromatic_aberration\", \"screen_width\", \"screen_height\", \"direction\", \"radialIntensity\", \"centerPosition\"], [], options, camera, samplingMode, engine, reusable, null, textureType, undefined, null, blockCompilation);\n /**\n * The amount of separation of rgb channels (default: 30)\n */\n this.aberrationAmount = 30;\n /**\n * The amount the effect will increase for pixels closer to the edge of the screen. (default: 0)\n */\n this.radialIntensity = 0;\n /**\n * The normalized direction in which the rgb channels should be separated. If set to 0,0 radial direction will be used. (default: Vector2(0.707,0.707))\n */\n this.direction = new Vector2(0.707, 0.707);\n /**\n * The center position where the radialIntensity should be around. [0.5,0.5 is center of screen, 1,1 is top right corner] (default: Vector2(0.5 ,0.5))\n */\n this.centerPosition = new Vector2(0.5, 0.5);\n this.screenWidth = screenWidth;\n this.screenHeight = screenHeight;\n this.onApplyObservable.add(effect => {\n effect.setFloat(\"chromatic_aberration\", this.aberrationAmount);\n effect.setFloat(\"screen_width\", screenWidth);\n effect.setFloat(\"screen_height\", screenHeight);\n effect.setFloat(\"radialIntensity\", this.radialIntensity);\n effect.setFloat2(\"direction\", this.direction.x, this.direction.y);\n effect.setFloat2(\"centerPosition\", this.centerPosition.x, this.centerPosition.y);\n });\n }\n _gatherImports(useWebGPU, list) {\n if (useWebGPU) {\n this._webGPUReady = true;\n list.push(Promise.all([import(\"../ShadersWGSL/chromaticAberration.fragment.js\")]));\n } else {\n list.push(Promise.all([import(\"../Shaders/chromaticAberration.fragment.js\")]));\n }\n super._gatherImports(useWebGPU, list);\n }\n /**\n * @internal\n */\n static _Parse(parsedPostProcess, targetCamera, scene, rootUrl) {\n return SerializationHelper.Parse(() => {\n return new ChromaticAberrationPostProcess(parsedPostProcess.name, parsedPostProcess.screenWidth, parsedPostProcess.screenHeight, parsedPostProcess.options, targetCamera, parsedPostProcess.renderTargetSamplingMode, scene.getEngine(), parsedPostProcess.reusable, parsedPostProcess.textureType, false);\n }, parsedPostProcess, scene, rootUrl);\n }\n}\n__decorate([serialize()], ChromaticAberrationPostProcess.prototype, \"aberrationAmount\", void 0);\n__decorate([serialize()], ChromaticAberrationPostProcess.prototype, \"radialIntensity\", void 0);\n__decorate([serialize()], ChromaticAberrationPostProcess.prototype, \"direction\", void 0);\n__decorate([serialize()], ChromaticAberrationPostProcess.prototype, \"centerPosition\", void 0);\n__decorate([serialize()], ChromaticAberrationPostProcess.prototype, \"screenWidth\", void 0);\n__decorate([serialize()], ChromaticAberrationPostProcess.prototype, \"screenHeight\", void 0);\nRegisterClass(\"BABYLON.ChromaticAberrationPostProcess\", ChromaticAberrationPostProcess);","map":{"version":3,"names":["__decorate","Vector2","PostProcess","RegisterClass","serialize","SerializationHelper","ChromaticAberrationPostProcess","getClassName","constructor","name","screenWidth","screenHeight","options","camera","samplingMode","engine","reusable","textureType","blockCompilation","undefined","aberrationAmount","radialIntensity","direction","centerPosition","onApplyObservable","add","effect","setFloat","setFloat2","x","y","_gatherImports","useWebGPU","list","_webGPUReady","push","Promise","all","_Parse","parsedPostProcess","targetCamera","scene","rootUrl","Parse","renderTargetSamplingMode","getEngine","prototype"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/PostProcesses/chromaticAberrationPostProcess.js"],"sourcesContent":["import { __decorate } from \"../tslib.es6.js\";\nimport { Vector2 } from \"../Maths/math.vector.js\";\nimport { PostProcess } from \"./postProcess.js\";\n\nimport { RegisterClass } from \"../Misc/typeStore.js\";\nimport { serialize } from \"../Misc/decorators.js\";\nimport { SerializationHelper } from \"../Misc/decorators.serialization.js\";\n/**\n * The ChromaticAberrationPostProcess separates the rgb channels in an image to produce chromatic distortion around the edges of the screen\n */\nexport class ChromaticAberrationPostProcess extends PostProcess {\n /**\n * Gets a string identifying the name of the class\n * @returns \"ChromaticAberrationPostProcess\" string\n */\n getClassName() {\n return \"ChromaticAberrationPostProcess\";\n }\n /**\n * Creates a new instance ChromaticAberrationPostProcess\n * @param name The name of the effect.\n * @param screenWidth The width of the screen to apply the effect on.\n * @param screenHeight The height of the screen to apply the effect on.\n * @param options The required width/height ratio to downsize to before computing the render pass.\n * @param camera The camera to apply the render pass to.\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\n * @param engine The engine which the post process will be applied. (default: current engine)\n * @param reusable If the post process can be reused on the same frame. (default: false)\n * @param textureType Type of textures used when performing the post process. (default: 0)\n * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)\n */\n constructor(name, screenWidth, screenHeight, options, camera, samplingMode, engine, reusable, textureType = 0, blockCompilation = false) {\n super(name, \"chromaticAberration\", [\"chromatic_aberration\", \"screen_width\", \"screen_height\", \"direction\", \"radialIntensity\", \"centerPosition\"], [], options, camera, samplingMode, engine, reusable, null, textureType, undefined, null, blockCompilation);\n /**\n * The amount of separation of rgb channels (default: 30)\n */\n this.aberrationAmount = 30;\n /**\n * The amount the effect will increase for pixels closer to the edge of the screen. (default: 0)\n */\n this.radialIntensity = 0;\n /**\n * The normalized direction in which the rgb channels should be separated. If set to 0,0 radial direction will be used. (default: Vector2(0.707,0.707))\n */\n this.direction = new Vector2(0.707, 0.707);\n /**\n * The center position where the radialIntensity should be around. [0.5,0.5 is center of screen, 1,1 is top right corner] (default: Vector2(0.5 ,0.5))\n */\n this.centerPosition = new Vector2(0.5, 0.5);\n this.screenWidth = screenWidth;\n this.screenHeight = screenHeight;\n this.onApplyObservable.add((effect) => {\n effect.setFloat(\"chromatic_aberration\", this.aberrationAmount);\n effect.setFloat(\"screen_width\", screenWidth);\n effect.setFloat(\"screen_height\", screenHeight);\n effect.setFloat(\"radialIntensity\", this.radialIntensity);\n effect.setFloat2(\"direction\", this.direction.x, this.direction.y);\n effect.setFloat2(\"centerPosition\", this.centerPosition.x, this.centerPosition.y);\n });\n }\n _gatherImports(useWebGPU, list) {\n if (useWebGPU) {\n this._webGPUReady = true;\n list.push(Promise.all([import(\"../ShadersWGSL/chromaticAberration.fragment.js\")]));\n }\n else {\n list.push(Promise.all([import(\"../Shaders/chromaticAberration.fragment.js\")]));\n }\n super._gatherImports(useWebGPU, list);\n }\n /**\n * @internal\n */\n static _Parse(parsedPostProcess, targetCamera, scene, rootUrl) {\n return SerializationHelper.Parse(() => {\n return new ChromaticAberrationPostProcess(parsedPostProcess.name, parsedPostProcess.screenWidth, parsedPostProcess.screenHeight, parsedPostProcess.options, targetCamera, parsedPostProcess.renderTargetSamplingMode, scene.getEngine(), parsedPostProcess.reusable, parsedPostProcess.textureType, false);\n }, parsedPostProcess, scene, rootUrl);\n }\n}\n__decorate([\n serialize()\n], ChromaticAberrationPostProcess.prototype, \"aberrationAmount\", void 0);\n__decorate([\n serialize()\n], ChromaticAberrationPostProcess.prototype, \"radialIntensity\", void 0);\n__decorate([\n serialize()\n], ChromaticAberrationPostProcess.prototype, \"direction\", void 0);\n__decorate([\n serialize()\n], ChromaticAberrationPostProcess.prototype, \"centerPosition\", void 0);\n__decorate([\n serialize()\n], ChromaticAberrationPostProcess.prototype, \"screenWidth\", void 0);\n__decorate([\n serialize()\n], ChromaticAberrationPostProcess.prototype, \"screenHeight\", void 0);\nRegisterClass(\"BABYLON.ChromaticAberrationPostProcess\", ChromaticAberrationPostProcess);\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,iBAAiB;AAC5C,SAASC,OAAO,QAAQ,yBAAyB;AACjD,SAASC,WAAW,QAAQ,kBAAkB;AAE9C,SAASC,aAAa,QAAQ,sBAAsB;AACpD,SAASC,SAAS,QAAQ,uBAAuB;AACjD,SAASC,mBAAmB,QAAQ,qCAAqC;AACzE;AACA;AACA;AACA,OAAO,MAAMC,8BAA8B,SAASJ,WAAW,CAAC;EAC5D;AACJ;AACA;AACA;EACIK,YAAYA,CAAA,EAAG;IACX,OAAO,gCAAgC;EAC3C;EACA;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACIC,WAAWA,CAACC,IAAI,EAAEC,WAAW,EAAEC,YAAY,EAAEC,OAAO,EAAEC,MAAM,EAAEC,YAAY,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,WAAW,GAAG,CAAC,EAAEC,gBAAgB,GAAG,KAAK,EAAE;IACrI,KAAK,CAACT,IAAI,EAAE,qBAAqB,EAAE,CAAC,sBAAsB,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,iBAAiB,EAAE,gBAAgB,CAAC,EAAE,EAAE,EAAEG,OAAO,EAAEC,MAAM,EAAEC,YAAY,EAAEC,MAAM,EAAEC,QAAQ,EAAE,IAAI,EAAEC,WAAW,EAAEE,SAAS,EAAE,IA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