d56ff4912afdc6e57a98acc6c5c43e324275501937f62376a12f5a6ff1feb6ae.json 8.0 KB

1
  1. {"ast":null,"code":"import { Texture } from \"../Materials/Textures/texture.js\";\nimport { BlurPostProcess } from \"./blurPostProcess.js\";\nimport { RegisterClass } from \"../Misc/typeStore.js\";\n/**\n * The DepthOfFieldBlurPostProcess applied a blur in a give direction.\n * This blur differs from the standard BlurPostProcess as it attempts to avoid blurring pixels\n * based on samples that have a large difference in distance than the center pixel.\n * See section 2.6.2 http://fileadmin.cs.lth.se/cs/education/edan35/lectures/12dof.pdf\n */\nexport class DepthOfFieldBlurPostProcess extends BlurPostProcess {\n /**\n * Gets a string identifying the name of the class\n * @returns \"DepthOfFieldBlurPostProcess\" string\n */\n getClassName() {\n return \"DepthOfFieldBlurPostProcess\";\n }\n /**\n * Creates a new instance DepthOfFieldBlurPostProcess\n * @param name The name of the effect.\n * @param _scene The scene the effect belongs to (not used, you can pass null)\n * @param direction The direction the blur should be applied.\n * @param kernel The size of the kernel used to blur.\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 circleOfConfusion The circle of confusion + depth map to be used to avoid blurring across edges\n * @param imageToBlur The image to apply the blur to (default: Current rendered frame)\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 * @param textureFormat Format of textures used when performing the post process. (default: TEXTUREFORMAT_RGBA)\n */\n constructor(name, _scene, direction, kernel, options, camera, circleOfConfusion, imageToBlur = null, samplingMode = Texture.BILINEAR_SAMPLINGMODE, engine, reusable, textureType = 0, blockCompilation = false, textureFormat = 5) {\n super(name, direction, kernel, {\n camera,\n engine,\n reusable,\n textureType,\n defines: `#define DOF 1\\n`,\n blockCompilation,\n textureFormat,\n ...options,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n samplingMode: samplingMode = 2\n });\n this.externalTextureSamplerBinding = !!imageToBlur;\n this.onApplyObservable.add(effect => {\n if (imageToBlur != null) {\n effect.setTextureFromPostProcess(\"textureSampler\", imageToBlur);\n }\n effect.setTextureFromPostProcessOutput(\"circleOfConfusionSampler\", circleOfConfusion);\n });\n }\n}\nRegisterClass(\"BABYLON.DepthOfFieldBlurPostProcess\", DepthOfFieldBlurPostProcess);","map":{"version":3,"names":["Texture","BlurPostProcess","RegisterClass","DepthOfFieldBlurPostProcess","getClassName","constructor","name","_scene","direction","kernel","options","camera","circleOfConfusion","imageToBlur","samplingMode","BILINEAR_SAMPLINGMODE","engine","reusable","textureType","blockCompilation","textureFormat","defines","externalTextureSamplerBinding","onApplyObservable","add","effect","setTextureFromPostProcess","setTextureFromPostProcessOutput"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/PostProcesses/depthOfFieldBlurPostProcess.js"],"sourcesContent":["import { Texture } from \"../Materials/Textures/texture.js\";\nimport { BlurPostProcess } from \"./blurPostProcess.js\";\n\nimport { RegisterClass } from \"../Misc/typeStore.js\";\n/**\n * The DepthOfFieldBlurPostProcess applied a blur in a give direction.\n * This blur differs from the standard BlurPostProcess as it attempts to avoid blurring pixels\n * based on samples that have a large difference in distance than the center pixel.\n * See section 2.6.2 http://fileadmin.cs.lth.se/cs/education/edan35/lectures/12dof.pdf\n */\nexport class DepthOfFieldBlurPostProcess extends BlurPostProcess {\n /**\n * Gets a string identifying the name of the class\n * @returns \"DepthOfFieldBlurPostProcess\" string\n */\n getClassName() {\n return \"DepthOfFieldBlurPostProcess\";\n }\n /**\n * Creates a new instance DepthOfFieldBlurPostProcess\n * @param name The name of the effect.\n * @param _scene The scene the effect belongs to (not used, you can pass null)\n * @param direction The direction the blur should be applied.\n * @param kernel The size of the kernel used to blur.\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 circleOfConfusion The circle of confusion + depth map to be used to avoid blurring across edges\n * @param imageToBlur The image to apply the blur to (default: Current rendered frame)\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 * @param textureFormat Format of textures used when performing the post process. (default: TEXTUREFORMAT_RGBA)\n */\n constructor(name, _scene, direction, kernel, options, camera, circleOfConfusion, imageToBlur = null, samplingMode = Texture.BILINEAR_SAMPLINGMODE, engine, reusable, textureType = 0, blockCompilation = false, textureFormat = 5) {\n super(name, direction, kernel, {\n camera,\n engine,\n reusable,\n textureType,\n defines: `#define DOF 1\\n`,\n blockCompilation,\n textureFormat,\n ...options,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n samplingMode: (samplingMode = 2),\n });\n this.externalTextureSamplerBinding = !!imageToBlur;\n this.onApplyObservable.add((effect) => {\n if (imageToBlur != null) {\n effect.setTextureFromPostProcess(\"textureSampler\", imageToBlur);\n }\n effect.setTextureFromPostProcessOutput(\"circleOfConfusionSampler\", circleOfConfusion);\n });\n }\n}\nRegisterClass(\"BABYLON.DepthOfFieldBlurPostProcess\", DepthOfFieldBlurPostProcess);\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,kCAAkC;AAC1D,SAASC,eAAe,QAAQ,sBAAsB;AAEtD,SAASC,aAAa,QAAQ,sBAAsB;AACpD;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,2BAA2B,SAASF,eAAe,CAAC;EAC7D;AACJ;AACA;AACA;EACIG,YAAYA,CAAA,EAAG;IACX,OAAO,6BAA6B;EACxC;EACA;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACIC,WAAWA,CAACC,IAAI,EAAEC,MAA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