cf41c95472f850d48c3fd125a64a95c4fc7ef336ccb5845a4bc278011e43c7c3.json 6.8 KB

1
  1. {"ast":null,"code":"import { ThinBloomMergePostProcess } from \"./thinBloomMergePostProcess.js\";\nimport { Vector2 } from \"../Maths/math.vector.js\";\nimport { ThinBlurPostProcess } from \"./thinBlurPostProcess.js\";\nimport { ThinExtractHighlightsPostProcess } from \"./thinExtractHighlightsPostProcess.js\";\n/**\n * The bloom effect spreads bright areas of an image to simulate artifacts seen in cameras\n */\nexport class ThinBloomEffect {\n /**\n * The luminance threshold to find bright areas of the image to bloom.\n */\n get threshold() {\n return this._downscale.threshold;\n }\n set threshold(value) {\n this._downscale.threshold = value;\n }\n /**\n * The strength of the bloom.\n */\n get weight() {\n return this._merge.weight;\n }\n set weight(value) {\n this._merge.weight = value;\n }\n /**\n * Specifies the size of the bloom blur kernel, relative to the final output size\n */\n get kernel() {\n return this._blurX.kernel / this.scale;\n }\n set kernel(value) {\n this._blurX.kernel = value * this.scale;\n this._blurY.kernel = value * this.scale;\n }\n /**\n * Creates a new instance of @see ThinBloomEffect\n * @param name The name of the bloom render effect\n * @param engine The engine which the render effect will be applied. (default: current engine)\n * @param scale The ratio of the blur texture to the input texture that should be used to compute the bloom.\n * @param blockCompilation If shaders should not be compiled when the effect is created (default: false)\n */\n constructor(name, engine, scale, blockCompilation = false) {\n this.scale = scale;\n this._downscale = new ThinExtractHighlightsPostProcess(name + \"_downscale\", engine, {\n blockCompilation\n });\n this._blurX = new ThinBlurPostProcess(name + \"_blurX\", engine, new Vector2(1, 0), 10, {\n blockCompilation\n });\n this._blurY = new ThinBlurPostProcess(name + \"_blurY\", engine, new Vector2(0, 1), 10, {\n blockCompilation\n });\n this._merge = new ThinBloomMergePostProcess(name + \"_merge\", engine, {\n blockCompilation\n });\n }\n /**\n * Checks if the effect is ready to be used\n * @returns if the effect is ready\n */\n isReady() {\n return this._downscale.isReady() && this._blurX.isReady() && this._blurY.isReady() && this._merge.isReady();\n }\n}","map":{"version":3,"names":["ThinBloomMergePostProcess","Vector2","ThinBlurPostProcess","ThinExtractHighlightsPostProcess","ThinBloomEffect","threshold","_downscale","value","weight","_merge","kernel","_blurX","scale","_blurY","constructor","name","engine","blockCompilation","isReady"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/PostProcesses/thinBloomEffect.js"],"sourcesContent":["import { ThinBloomMergePostProcess } from \"./thinBloomMergePostProcess.js\";\nimport { Vector2 } from \"../Maths/math.vector.js\";\nimport { ThinBlurPostProcess } from \"./thinBlurPostProcess.js\";\nimport { ThinExtractHighlightsPostProcess } from \"./thinExtractHighlightsPostProcess.js\";\n/**\n * The bloom effect spreads bright areas of an image to simulate artifacts seen in cameras\n */\nexport class ThinBloomEffect {\n /**\n * The luminance threshold to find bright areas of the image to bloom.\n */\n get threshold() {\n return this._downscale.threshold;\n }\n set threshold(value) {\n this._downscale.threshold = value;\n }\n /**\n * The strength of the bloom.\n */\n get weight() {\n return this._merge.weight;\n }\n set weight(value) {\n this._merge.weight = value;\n }\n /**\n * Specifies the size of the bloom blur kernel, relative to the final output size\n */\n get kernel() {\n return this._blurX.kernel / this.scale;\n }\n set kernel(value) {\n this._blurX.kernel = value * this.scale;\n this._blurY.kernel = value * this.scale;\n }\n /**\n * Creates a new instance of @see ThinBloomEffect\n * @param name The name of the bloom render effect\n * @param engine The engine which the render effect will be applied. (default: current engine)\n * @param scale The ratio of the blur texture to the input texture that should be used to compute the bloom.\n * @param blockCompilation If shaders should not be compiled when the effect is created (default: false)\n */\n constructor(name, engine, scale, blockCompilation = false) {\n this.scale = scale;\n this._downscale = new ThinExtractHighlightsPostProcess(name + \"_downscale\", engine, { blockCompilation });\n this._blurX = new ThinBlurPostProcess(name + \"_blurX\", engine, new Vector2(1, 0), 10, { blockCompilation });\n this._blurY = new ThinBlurPostProcess(name + \"_blurY\", engine, new Vector2(0, 1), 10, { blockCompilation });\n this._merge = new ThinBloomMergePostProcess(name + \"_merge\", engine, { blockCompilation });\n }\n /**\n * Checks if the effect is ready to be used\n * @returns if the effect is ready\n */\n isReady() {\n return this._downscale.isReady() && this._blurX.isReady() && this._blurY.isReady() && this._merge.isReady();\n }\n}\n"],"mappings":"AAAA,SAASA,yBAAyB,QAAQ,gCAAgC;AAC1E,SAASC,OAAO,QAAQ,yBAAyB;AACjD,SAASC,mBAAmB,QAAQ,0BAA0B;AAC9D,SAASC,gCAAgC,QAAQ,uCAAuC;AACxF;AACA;AACA;AACA,OAAO,MAAMC,eAAe,CAAC;EACzB;AACJ;AACA;EACI,IAAIC,SAASA,CAAA,EAAG;IACZ,OAAO,IAAI,CAACC,UAAU,CAACD,SAAS;EACpC;EACA,IAAIA,SAASA,CAACE,KAAK,EAAE;IACjB,IAAI,CAACD,UAAU,CAACD,SAAS,GAAGE,KAAK;EACrC;EACA;AACJ;AACA;EACI,IAAIC,MAAMA,CAAA,EAAG;IACT,OAAO,IAAI,CAACC,MAAM,CAACD,MAAM;EAC7B;EACA,IAAIA,MAAMA,CAACD,KAAK,EAAE;IACd,IAAI,CAACE,MAAM,CAACD,MAAM,GAAGD,KAAK;EAC9B;EACA;AACJ;AACA;EACI,IAAIG,MAAMA,CAAA,EAAG;IACT,OAAO,IAAI,CAACC,MAAM,CAACD,MAAM,GAAG,IAAI,CAACE,KAAK;EAC1C;EACA,IAAIF,MAAMA,CAACH,KAAK,EAAE;IACd,IAAI,CAACI,MAAM,CAACD,MAAM,GAAGH,KAAK,GAAG,IAAI,CAACK,KAAK;IACvC,IAAI,CAACC,MAAM,CAACH,MAAM,GAAGH,KAAK,GAAG,IAAI,CAACK,KAAK;EAC3C;EACA;AACJ;AACA;AACA;AACA;AACA;AACA;EACIE,WAAWA,CAACC,IAAI,EAAEC,MAAM,EAAEJ,KAAK,EAAEK,gBAAgB,GAAG,KAAK,EAAE;IACvD,IAAI,CAACL,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACN,UAAU,GAAG,IAAIH,gCAAgC,CAACY,IAAI,GAAG,YAAY,EAAEC,MAAM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