1 |
- {"ast":null,"code":"import { __decorate } from \"../tslib.es6.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 GrainPostProcess adds noise to the image at mid luminance levels\n */\nexport class GrainPostProcess extends PostProcess {\n /**\n * Gets a string identifying the name of the class\n * @returns \"GrainPostProcess\" string\n */\n getClassName() {\n return \"GrainPostProcess\";\n }\n /**\n * Creates a new instance of @see GrainPostProcess\n * @param name The name of the effect.\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, options, camera, samplingMode, engine, reusable, textureType = 0, blockCompilation = false) {\n super(name, \"grain\", [\"intensity\", \"animatedSeed\"], [], options, camera, samplingMode, engine, reusable, null, textureType, undefined, null, blockCompilation);\n /**\n * The intensity of the grain added (default: 30)\n */\n this.intensity = 30;\n /**\n * If the grain should be randomized on every frame\n */\n this.animated = false;\n this.onApplyObservable.add(effect => {\n effect.setFloat(\"intensity\", this.intensity);\n effect.setFloat(\"animatedSeed\", this.animated ? Math.random() + 1 : 1);\n });\n }\n _gatherImports(useWebGPU, list) {\n if (useWebGPU) {\n this._webGPUReady = true;\n list.push(Promise.all([import(\"../ShadersWGSL/grain.fragment.js\")]));\n } else {\n list.push(Promise.all([import(\"../Shaders/grain.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 GrainPostProcess(parsedPostProcess.name, parsedPostProcess.options, targetCamera, parsedPostProcess.renderTargetSamplingMode, scene.getEngine(), parsedPostProcess.reusable);\n }, parsedPostProcess, scene, rootUrl);\n }\n}\n__decorate([serialize()], GrainPostProcess.prototype, \"intensity\", void 0);\n__decorate([serialize()], GrainPostProcess.prototype, \"animated\", void 0);\nRegisterClass(\"BABYLON.GrainPostProcess\", GrainPostProcess);","map":{"version":3,"names":["__decorate","PostProcess","RegisterClass","serialize","SerializationHelper","GrainPostProcess","getClassName","constructor","name","options","camera","samplingMode","engine","reusable","textureType","blockCompilation","undefined","intensity","animated","onApplyObservable","add","effect","setFloat","Math","random","_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/grainPostProcess.js"],"sourcesContent":["import { __decorate } from \"../tslib.es6.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 GrainPostProcess adds noise to the image at mid luminance levels\n */\nexport class GrainPostProcess extends PostProcess {\n /**\n * Gets a string identifying the name of the class\n * @returns \"GrainPostProcess\" string\n */\n getClassName() {\n return \"GrainPostProcess\";\n }\n /**\n * Creates a new instance of @see GrainPostProcess\n * @param name The name of the effect.\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, options, camera, samplingMode, engine, reusable, textureType = 0, blockCompilation = false) {\n super(name, \"grain\", [\"intensity\", \"animatedSeed\"], [], options, camera, samplingMode, engine, reusable, null, textureType, undefined, null, blockCompilation);\n /**\n * The intensity of the grain added (default: 30)\n */\n this.intensity = 30;\n /**\n * If the grain should be randomized on every frame\n */\n this.animated = false;\n this.onApplyObservable.add((effect) => {\n effect.setFloat(\"intensity\", this.intensity);\n effect.setFloat(\"animatedSeed\", this.animated ? Math.random() + 1 : 1);\n });\n }\n _gatherImports(useWebGPU, list) {\n if (useWebGPU) {\n this._webGPUReady = true;\n list.push(Promise.all([import(\"../ShadersWGSL/grain.fragment.js\")]));\n }\n else {\n list.push(Promise.all([import(\"../Shaders/grain.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 GrainPostProcess(parsedPostProcess.name, parsedPostProcess.options, targetCamera, parsedPostProcess.renderTargetSamplingMode, scene.getEngine(), parsedPostProcess.reusable);\n }, parsedPostProcess, scene, rootUrl);\n }\n}\n__decorate([\n serialize()\n], GrainPostProcess.prototype, \"intensity\", void 0);\n__decorate([\n serialize()\n], GrainPostProcess.prototype, \"animated\", void 0);\nRegisterClass(\"BABYLON.GrainPostProcess\", GrainPostProcess);\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,iBAAiB;AAC5C,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,gBAAgB,SAASJ,WAAW,CAAC;EAC9C;AACJ;AACA;AACA;EACIK,YAAYA,CAAA,EAAG;IACX,OAAO,kBAAkB;EAC7B;EACA;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACIC,WAAWA,CAACC,IAAI,EAAEC,OAAO,EAAEC,MAAM,EAAEC,Y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