{"ast":null,"code":"import { __decorate } from \"../tslib.es6.js\";\nimport { Logger } from \"../Misc/logger.js\";\nimport { PostProcess } from \"./postProcess.js\";\nimport \"../Rendering/geometryBufferRendererSceneComponent.js\";\nimport \"../Shaders/screenSpaceCurvature.fragment.js\";\nimport { EngineStore } from \"../Engines/engineStore.js\";\nimport { RegisterClass } from \"../Misc/typeStore.js\";\nimport { serialize } from \"../Misc/decorators.js\";\nimport { SerializationHelper } from \"../Misc/decorators.serialization.js\";\n/**\n * The Screen Space curvature effect can help highlighting ridge and valley of a model.\n */\nexport class ScreenSpaceCurvaturePostProcess extends PostProcess {\n /**\n * Gets a string identifying the name of the class\n * @returns \"ScreenSpaceCurvaturePostProcess\" string\n */\n getClassName() {\n return \"ScreenSpaceCurvaturePostProcess\";\n }\n /**\n * Creates a new instance ScreenSpaceCurvaturePostProcess\n * @param name The name of the effect.\n * @param scene The scene containing the objects to blur according to their velocity.\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, scene, options, camera, samplingMode, engine, reusable, textureType = 0, blockCompilation = false) {\n super(name, \"screenSpaceCurvature\", [\"curvature_ridge\", \"curvature_valley\"], [\"textureSampler\", \"normalSampler\"], options, camera, samplingMode, engine, reusable, undefined, textureType, undefined, null, blockCompilation);\n /**\n * Defines how much ridge the curvature effect displays.\n */\n this.ridge = 1;\n /**\n * Defines how much valley the curvature effect displays.\n */\n this.valley = 1;\n this._geometryBufferRenderer = scene.enableGeometryBufferRenderer();\n if (!this._geometryBufferRenderer) {\n // Geometry buffer renderer is not supported. So, work as a passthrough.\n Logger.Error(\"Multiple Render Target support needed for screen space curvature post process. Please use IsSupported test first.\");\n } else {\n if (this._geometryBufferRenderer.generateNormalsInWorldSpace) {\n Logger.Error(\"ScreenSpaceCurvaturePostProcess does not support generateNormalsInWorldSpace=true for the geometry buffer renderer!\");\n }\n // Geometry buffer renderer is supported.\n this.onApply = effect => {\n effect.setFloat(\"curvature_ridge\", 0.5 / Math.max(this.ridge * this.ridge, 1e-4));\n effect.setFloat(\"curvature_valley\", 0.7 / Math.max(this.valley * this.valley, 1e-4));\n const normalTexture = this._geometryBufferRenderer.getGBuffer().textures[1];\n effect.setTexture(\"normalSampler\", normalTexture);\n };\n }\n }\n /**\n * Support test.\n */\n static get IsSupported() {\n const engine = EngineStore.LastCreatedEngine;\n if (!engine) {\n return false;\n }\n return engine.getCaps().drawBuffersExtension;\n }\n /**\n * @internal\n */\n static _Parse(parsedPostProcess, targetCamera, scene, rootUrl) {\n return SerializationHelper.Parse(() => {\n return new ScreenSpaceCurvaturePostProcess(parsedPostProcess.name, scene, parsedPostProcess.options, targetCamera, parsedPostProcess.renderTargetSamplingMode, scene.getEngine(), parsedPostProcess.textureType, parsedPostProcess.reusable);\n }, parsedPostProcess, scene, rootUrl);\n }\n}\n__decorate([serialize()], ScreenSpaceCurvaturePostProcess.prototype, \"ridge\", void 0);\n__decorate([serialize()], ScreenSpaceCurvaturePostProcess.prototype, \"valley\", void 0);\nRegisterClass(\"BABYLON.ScreenSpaceCurvaturePostProcess\", ScreenSpaceCurvaturePostProcess);","map":{"version":3,"names":["__decorate","Logger","PostProcess","EngineStore","RegisterClass","serialize","SerializationHelper","ScreenSpaceCurvaturePostProcess","getClassName","constructor","name","scene","options","camera","samplingMode","engine","reusable","textureType","blockCompilation","undefined","ridge","valley","_geometryBufferRenderer","enableGeometryBufferRenderer","Error","generateNormalsInWorldSpace","onApply","effect","setFloat","Math","max","normalTexture","getGBuffer","textures","setTexture","IsSupported","LastCreatedEngine","getCaps","drawBuffersExtension","_Parse","parsedPostProcess","targetCamera","rootUrl","Parse","renderTargetSamplingMode","getEngine","prototype"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/PostProcesses/screenSpaceCurvaturePostProcess.js"],"sourcesContent":["import { __decorate } from \"../tslib.es6.js\";\nimport { Logger } from \"../Misc/logger.js\";\nimport { PostProcess } from \"./postProcess.js\";\n\nimport \"../Rendering/geometryBufferRendererSceneComponent.js\";\nimport \"../Shaders/screenSpaceCurvature.fragment.js\";\nimport { EngineStore } from \"../Engines/engineStore.js\";\nimport { RegisterClass } from \"../Misc/typeStore.js\";\nimport { serialize } from \"../Misc/decorators.js\";\nimport { SerializationHelper } from \"../Misc/decorators.serialization.js\";\n/**\n * The Screen Space curvature effect can help highlighting ridge and valley of a model.\n */\nexport class ScreenSpaceCurvaturePostProcess extends PostProcess {\n /**\n * Gets a string identifying the name of the class\n * @returns \"ScreenSpaceCurvaturePostProcess\" string\n */\n getClassName() {\n return \"ScreenSpaceCurvaturePostProcess\";\n }\n /**\n * Creates a new instance ScreenSpaceCurvaturePostProcess\n * @param name The name of the effect.\n * @param scene The scene containing the objects to blur according to their velocity.\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, scene, options, camera, samplingMode, engine, reusable, textureType = 0, blockCompilation = false) {\n super(name, \"screenSpaceCurvature\", [\"curvature_ridge\", \"curvature_valley\"], [\"textureSampler\", \"normalSampler\"], options, camera, samplingMode, engine, reusable, undefined, textureType, undefined, null, blockCompilation);\n /**\n * Defines how much ridge the curvature effect displays.\n */\n this.ridge = 1;\n /**\n * Defines how much valley the curvature effect displays.\n */\n this.valley = 1;\n this._geometryBufferRenderer = scene.enableGeometryBufferRenderer();\n if (!this._geometryBufferRenderer) {\n // Geometry buffer renderer is not supported. So, work as a passthrough.\n Logger.Error(\"Multiple Render Target support needed for screen space curvature post process. Please use IsSupported test first.\");\n }\n else {\n if (this._geometryBufferRenderer.generateNormalsInWorldSpace) {\n Logger.Error(\"ScreenSpaceCurvaturePostProcess does not support generateNormalsInWorldSpace=true for the geometry buffer renderer!\");\n }\n // Geometry buffer renderer is supported.\n this.onApply = (effect) => {\n effect.setFloat(\"curvature_ridge\", 0.5 / Math.max(this.ridge * this.ridge, 1e-4));\n effect.setFloat(\"curvature_valley\", 0.7 / Math.max(this.valley * this.valley, 1e-4));\n const normalTexture = this._geometryBufferRenderer.getGBuffer().textures[1];\n effect.setTexture(\"normalSampler\", normalTexture);\n };\n }\n }\n /**\n * Support test.\n */\n static get IsSupported() {\n const engine = EngineStore.LastCreatedEngine;\n if (!engine) {\n return false;\n }\n return engine.getCaps().drawBuffersExtension;\n }\n /**\n * @internal\n */\n static _Parse(parsedPostProcess, targetCamera, scene, rootUrl) {\n return SerializationHelper.Parse(() => {\n return new ScreenSpaceCurvaturePostProcess(parsedPostProcess.name, scene, parsedPostProcess.options, targetCamera, parsedPostProcess.renderTargetSamplingMode, scene.getEngine(), parsedPostProcess.textureType, parsedPostProcess.reusable);\n }, parsedPostProcess, scene, rootUrl);\n }\n}\n__decorate([\n serialize()\n], ScreenSpaceCurvaturePostProcess.prototype, \"ridge\", void 0);\n__decorate([\n serialize()\n], ScreenSpaceCurvaturePostProcess.prototype, \"valley\", void 0);\nRegisterClass(\"BABYLON.ScreenSpaceCurvaturePostProcess\", ScreenSpaceCurvaturePostProcess);\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,iBAAiB;AAC5C,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,WAAW,QAAQ,kBAAkB;AAE9C,OAAO,sDAAsD;AAC7D,OAAO,6CAA6C;AACpD,SAASC,WAAW,QAAQ,2BAA2B;AACvD,SAASC,aAAa,QAAQ,sBAAsB;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