{"ast":null,"code":"import { Texture } from \"../Materials/Textures/texture.js\";\nimport { PostProcess } from \"./postProcess.js\";\nimport { Logger } from \"../Misc/logger.js\";\nimport \"../Shaders/imageProcessing.fragment.js\";\nimport \"../Shaders/subSurfaceScattering.fragment.js\";\nimport \"../Shaders/postprocess.vertex.js\";\n/**\n * Sub surface scattering post process\n */\nexport class SubSurfaceScatteringPostProcess extends PostProcess {\n /**\n * Gets a string identifying the name of the class\n * @returns \"SubSurfaceScatteringPostProcess\" string\n */\n getClassName() {\n return \"SubSurfaceScatteringPostProcess\";\n }\n constructor(name, scene, options, camera = null, samplingMode, engine, reusable, textureType = 0) {\n super(name, \"subSurfaceScattering\", [\"texelSize\", \"viewportSize\", \"metersPerUnit\"], [\"diffusionS\", \"diffusionD\", \"filterRadii\", \"irradianceSampler\", \"depthSampler\", \"albedoSampler\"], options, camera, samplingMode || Texture.BILINEAR_SAMPLINGMODE, engine, reusable, null, textureType, \"postprocess\", undefined, true);\n this._scene = scene;\n this.updateEffect();\n this.onApplyObservable.add(effect => {\n if (!scene.prePassRenderer || !scene.subSurfaceConfiguration) {\n Logger.Error(\"PrePass and subsurface configuration needs to be enabled for subsurface scattering.\");\n return;\n }\n const texelSize = this.texelSize;\n effect.setFloat(\"metersPerUnit\", scene.subSurfaceConfiguration.metersPerUnit);\n effect.setFloat2(\"texelSize\", texelSize.x, texelSize.y);\n effect.setTexture(\"irradianceSampler\", scene.prePassRenderer.getRenderTarget().textures[scene.prePassRenderer.getIndex(0)]);\n effect.setTexture(\"depthSampler\", scene.prePassRenderer.getRenderTarget().textures[scene.prePassRenderer.getIndex(5)]);\n effect.setTexture(\"albedoSampler\", scene.prePassRenderer.getRenderTarget().textures[scene.prePassRenderer.getIndex(7)]);\n effect.setFloat2(\"viewportSize\", Math.tan(scene.activeCamera.fov / 2) * scene.getEngine().getAspectRatio(scene.activeCamera, true), Math.tan(scene.activeCamera.fov / 2));\n effect.setArray3(\"diffusionS\", scene.subSurfaceConfiguration.ssDiffusionS);\n effect.setArray(\"diffusionD\", scene.subSurfaceConfiguration.ssDiffusionD);\n effect.setArray(\"filterRadii\", scene.subSurfaceConfiguration.ssFilterRadii);\n });\n }\n}","map":{"version":3,"names":["Texture","PostProcess","Logger","SubSurfaceScatteringPostProcess","getClassName","constructor","name","scene","options","camera","samplingMode","engine","reusable","textureType","BILINEAR_SAMPLINGMODE","undefined","_scene","updateEffect","onApplyObservable","add","effect","prePassRenderer","subSurfaceConfiguration","Error","texelSize","setFloat","metersPerUnit","setFloat2","x","y","setTexture","getRenderTarget","textures","getIndex","Math","tan","activeCamera","fov","getEngine","getAspectRatio","setArray3","ssDiffusionS","setArray","ssDiffusionD","ssFilterRadii"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/PostProcesses/subSurfaceScatteringPostProcess.js"],"sourcesContent":["import { Texture } from \"../Materials/Textures/texture.js\";\nimport { PostProcess } from \"./postProcess.js\";\n\nimport { Logger } from \"../Misc/logger.js\";\nimport \"../Shaders/imageProcessing.fragment.js\";\nimport \"../Shaders/subSurfaceScattering.fragment.js\";\nimport \"../Shaders/postprocess.vertex.js\";\n/**\n * Sub surface scattering post process\n */\nexport class SubSurfaceScatteringPostProcess extends PostProcess {\n /**\n * Gets a string identifying the name of the class\n * @returns \"SubSurfaceScatteringPostProcess\" string\n */\n getClassName() {\n return \"SubSurfaceScatteringPostProcess\";\n }\n constructor(name, scene, options, camera = null, samplingMode, engine, reusable, textureType = 0) {\n super(name, \"subSurfaceScattering\", [\"texelSize\", \"viewportSize\", \"metersPerUnit\"], [\"diffusionS\", \"diffusionD\", \"filterRadii\", \"irradianceSampler\", \"depthSampler\", \"albedoSampler\"], options, camera, samplingMode || Texture.BILINEAR_SAMPLINGMODE, engine, reusable, null, textureType, \"postprocess\", undefined, true);\n this._scene = scene;\n this.updateEffect();\n this.onApplyObservable.add((effect) => {\n if (!scene.prePassRenderer || !scene.subSurfaceConfiguration) {\n Logger.Error(\"PrePass and subsurface configuration needs to be enabled for subsurface scattering.\");\n return;\n }\n const texelSize = this.texelSize;\n effect.setFloat(\"metersPerUnit\", scene.subSurfaceConfiguration.metersPerUnit);\n effect.setFloat2(\"texelSize\", texelSize.x, texelSize.y);\n effect.setTexture(\"irradianceSampler\", scene.prePassRenderer.getRenderTarget().textures[scene.prePassRenderer.getIndex(0)]);\n effect.setTexture(\"depthSampler\", scene.prePassRenderer.getRenderTarget().textures[scene.prePassRenderer.getIndex(5)]);\n effect.setTexture(\"albedoSampler\", scene.prePassRenderer.getRenderTarget().textures[scene.prePassRenderer.getIndex(7)]);\n effect.setFloat2(\"viewportSize\", Math.tan(scene.activeCamera.fov / 2) * scene.getEngine().getAspectRatio(scene.activeCamera, true), Math.tan(scene.activeCamera.fov / 2));\n effect.setArray3(\"diffusionS\", scene.subSurfaceConfiguration.ssDiffusionS);\n effect.setArray(\"diffusionD\", scene.subSurfaceConfiguration.ssDiffusionD);\n effect.setArray(\"filterRadii\", scene.subSurfaceConfiguration.ssFilterRadii);\n });\n }\n}\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,kCAAkC;AAC1D,SAASC,WAAW,QAAQ,kBAAkB;AAE9C,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAO,wCAAwC;AAC/C,OAAO,6CAA6C;AACpD,OAAO,kCAAkC;AACzC;AACA;AACA;AACA,OAAO,MAAMC,+BAA+B,SAASF,WAAW,CAAC;EAC7D;AACJ;AACA;AACA;EACIG,YAAYA,CAAA,EAAG;IACX,OAAO,iCAAiC;EAC5C;EACAC,WAAWA,CAACC,IAAI,EAAEC,KAAK,EAAEC,OAAO,EAAEC,MAAM,GAAG,IAAI,EAAEC,YAAY,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,WAAW,GAAG,CAAC,EAAE;IAC9F,KAAK,CAACP,IAAI,EAAE,sBAAsB,EAAE,CAAC,WAAW,EAAE,cAAc,EAAE,eAAe,CAAC,EAAE,CAAC,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,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