e4089c1369a50786ff7920ea8ce5c3ad46a5ea0956baf7936dba4618c600272f.json 7.0 KB

1
  1. {"ast":null,"code":"import { __decorate } from \"../tslib.es6.js\";\nimport { PostProcess } from \"./postProcess.js\";\nimport { RegisterClass } from \"../Misc/typeStore.js\";\nimport { serializeAsMatrix } from \"../Misc/decorators.js\";\nimport { SerializationHelper } from \"../Misc/decorators.serialization.js\";\n/**\n * Applies a kernel filter to the image\n */\nexport class FilterPostProcess extends PostProcess {\n /**\n * Gets a string identifying the name of the class\n * @returns \"FilterPostProcess\" string\n */\n getClassName() {\n return \"FilterPostProcess\";\n }\n /**\n *\n * @param name The name of the effect.\n * @param kernelMatrix The matrix to be applied to the image\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 */\n constructor(name, kernelMatrix, options, camera, samplingMode, engine, reusable) {\n super(name, \"filter\", [\"kernelMatrix\"], null, options, camera, samplingMode, engine, reusable);\n this.kernelMatrix = kernelMatrix;\n this.onApply = effect => {\n effect.setMatrix(\"kernelMatrix\", this.kernelMatrix);\n };\n }\n _gatherImports(useWebGPU, list) {\n if (useWebGPU) {\n this._webGPUReady = true;\n list.push(Promise.all([import(\"../ShadersWGSL/filter.fragment.js\")]));\n } else {\n list.push(Promise.all([import(\"../Shaders/filter.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 FilterPostProcess(parsedPostProcess.name, parsedPostProcess.kernelMatrix, parsedPostProcess.options, targetCamera, parsedPostProcess.renderTargetSamplingMode, scene.getEngine(), parsedPostProcess.reusable);\n }, parsedPostProcess, scene, rootUrl);\n }\n}\n__decorate([serializeAsMatrix()], FilterPostProcess.prototype, \"kernelMatrix\", void 0);\nRegisterClass(\"BABYLON.FilterPostProcess\", FilterPostProcess);","map":{"version":3,"names":["__decorate","PostProcess","RegisterClass","serializeAsMatrix","SerializationHelper","FilterPostProcess","getClassName","constructor","name","kernelMatrix","options","camera","samplingMode","engine","reusable","onApply","effect","setMatrix","_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/filterPostProcess.js"],"sourcesContent":["import { __decorate } from \"../tslib.es6.js\";\nimport { PostProcess } from \"./postProcess.js\";\nimport { RegisterClass } from \"../Misc/typeStore.js\";\nimport { serializeAsMatrix } from \"../Misc/decorators.js\";\nimport { SerializationHelper } from \"../Misc/decorators.serialization.js\";\n/**\n * Applies a kernel filter to the image\n */\nexport class FilterPostProcess extends PostProcess {\n /**\n * Gets a string identifying the name of the class\n * @returns \"FilterPostProcess\" string\n */\n getClassName() {\n return \"FilterPostProcess\";\n }\n /**\n *\n * @param name The name of the effect.\n * @param kernelMatrix The matrix to be applied to the image\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 */\n constructor(name, kernelMatrix, options, camera, samplingMode, engine, reusable) {\n super(name, \"filter\", [\"kernelMatrix\"], null, options, camera, samplingMode, engine, reusable);\n this.kernelMatrix = kernelMatrix;\n this.onApply = (effect) => {\n effect.setMatrix(\"kernelMatrix\", this.kernelMatrix);\n };\n }\n _gatherImports(useWebGPU, list) {\n if (useWebGPU) {\n this._webGPUReady = true;\n list.push(Promise.all([import(\"../ShadersWGSL/filter.fragment.js\")]));\n }\n else {\n list.push(Promise.all([import(\"../Shaders/filter.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 FilterPostProcess(parsedPostProcess.name, parsedPostProcess.kernelMatrix, parsedPostProcess.options, targetCamera, parsedPostProcess.renderTargetSamplingMode, scene.getEngine(), parsedPostProcess.reusable);\n }, parsedPostProcess, scene, rootUrl);\n }\n}\n__decorate([\n serializeAsMatrix()\n], FilterPostProcess.prototype, \"kernelMatrix\", void 0);\nRegisterClass(\"BABYLON.FilterPostProcess\", FilterPostProcess);\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,iBAAiB;AAC5C,SAASC,WAAW,QAAQ,kBAAkB;AAC9C,SAASC,aAAa,QAAQ,sBAAsB;AACpD,SAASC,iBAAiB,QAAQ,uBAAuB;AACzD,SAASC,mBAAmB,QAAQ,qCAAqC;AACzE;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,SAASJ,WAAW,CAAC;EAC/C;AACJ;AACA;AACA;EACIK,YAAYA,CAAA,EAAG;IACX,OAAO,mBAAmB;EAC9B;EACA;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACIC,WAAWA,CAACC,IAAI,EAAEC,YAAY,EAAEC,OAAO,EAAEC,MAAM,EAAEC,YAAY,EAAEC,MAAM,EAAEC,QAAQ,EAAE;IAC7E,KAAK,CAACN,IAAI,EAAE,QAAQ,EAAE,CAAC,cAAc,CAAC,EAAE,IAAI,EAAEE,OAAO,EAAEC,MAAM,EAAEC,YAAY,EAAEC,MAAM,EAAEC,QAAQ,CAAC;IAC9F,IAAI,CAACL,YAAY,GAAGA,YAAY;IAChC,IAAI,CAACM,OAAO,GAAIC,MAAM,IAAK;MACvBA,MAAM,CAACC,SAAS,CAAC,cAAc,EAAE,IAAI,CAACR,YAAY,CAAC;IACvD,CAAC;EACL;EACAS,cAAcA,CAACC,SAAS,EAAEC,IAAI,EAAE;IAC5B,IAAID,SAAS,EAAE;MACX,IAAI,CAACE,YAAY,GAAG,IAA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