{"ast":null,"code":"import { DepthRenderer } from \"../Rendering/depthRenderer.js\";\nimport { MinMaxReducer } from \"./minMaxReducer.js\";\n/**\n * This class is a small wrapper around the MinMaxReducer class to compute the min/max values of a depth texture\n */\nexport class DepthReducer extends MinMaxReducer {\n /**\n * Gets the depth renderer used for the computation.\n * Note that the result is null if you provide your own renderer when calling setDepthRenderer.\n */\n get depthRenderer() {\n return this._depthRenderer;\n }\n /**\n * Creates a depth reducer\n * @param camera The camera used to render the depth texture\n */\n constructor(camera) {\n super(camera);\n }\n /**\n * Sets the depth renderer to use to generate the depth map\n * @param depthRenderer The depth renderer to use. If not provided, a new one will be created automatically\n * @param type The texture type of the depth map (default: TEXTURETYPE_HALF_FLOAT)\n * @param forceFullscreenViewport Forces the post processes used for the reduction to be applied without taking into account viewport (defaults to true)\n */\n setDepthRenderer(depthRenderer = null, type = 2, forceFullscreenViewport = true) {\n const scene = this._camera.getScene();\n if (this._depthRenderer) {\n delete scene._depthRenderer[this._depthRendererId];\n this._depthRenderer.dispose();\n this._depthRenderer = null;\n }\n if (depthRenderer === null) {\n if (!scene._depthRenderer) {\n scene._depthRenderer = {};\n }\n depthRenderer = this._depthRenderer = new DepthRenderer(scene, type, this._camera, false, 1);\n depthRenderer.enabled = false;\n this._depthRendererId = \"minmax\" + this._camera.id;\n scene._depthRenderer[this._depthRendererId] = depthRenderer;\n }\n super.setSourceTexture(depthRenderer.getDepthMap(), true, type, forceFullscreenViewport);\n }\n /**\n * @internal\n */\n setSourceTexture(sourceTexture, depthRedux, type = 2, forceFullscreenViewport = true) {\n super.setSourceTexture(sourceTexture, depthRedux, type, forceFullscreenViewport);\n }\n /**\n * Activates the reduction computation.\n * When activated, the observers registered in onAfterReductionPerformed are\n * called after the computation is performed\n */\n activate() {\n if (this._depthRenderer) {\n this._depthRenderer.enabled = true;\n }\n super.activate();\n }\n /**\n * Deactivates the reduction computation.\n */\n deactivate() {\n super.deactivate();\n if (this._depthRenderer) {\n this._depthRenderer.enabled = false;\n }\n }\n /**\n * Disposes the depth reducer\n * @param disposeAll true to dispose all the resources. You should always call this function with true as the parameter (or without any parameter as it is the default one). This flag is meant to be used internally.\n */\n dispose(disposeAll = true) {\n super.dispose(disposeAll);\n if (this._depthRenderer && disposeAll) {\n const scene = this._depthRenderer.getDepthMap().getScene();\n if (scene) {\n delete scene._depthRenderer[this._depthRendererId];\n }\n this._depthRenderer.dispose();\n this._depthRenderer = null;\n }\n }\n}","map":{"version":3,"names":["DepthRenderer","MinMaxReducer","DepthReducer","depthRenderer","_depthRenderer","constructor","camera","setDepthRenderer","type","forceFullscreenViewport","scene","_camera","getScene","_depthRendererId","dispose","enabled","id","setSourceTexture","getDepthMap","sourceTexture","depthRedux","activate","deactivate","disposeAll"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Misc/depthReducer.js"],"sourcesContent":["\nimport { DepthRenderer } from \"../Rendering/depthRenderer.js\";\nimport { MinMaxReducer } from \"./minMaxReducer.js\";\n/**\n * This class is a small wrapper around the MinMaxReducer class to compute the min/max values of a depth texture\n */\nexport class DepthReducer extends MinMaxReducer {\n /**\n * Gets the depth renderer used for the computation.\n * Note that the result is null if you provide your own renderer when calling setDepthRenderer.\n */\n get depthRenderer() {\n return this._depthRenderer;\n }\n /**\n * Creates a depth reducer\n * @param camera The camera used to render the depth texture\n */\n constructor(camera) {\n super(camera);\n }\n /**\n * Sets the depth renderer to use to generate the depth map\n * @param depthRenderer The depth renderer to use. If not provided, a new one will be created automatically\n * @param type The texture type of the depth map (default: TEXTURETYPE_HALF_FLOAT)\n * @param forceFullscreenViewport Forces the post processes used for the reduction to be applied without taking into account viewport (defaults to true)\n */\n setDepthRenderer(depthRenderer = null, type = 2, forceFullscreenViewport = true) {\n const scene = this._camera.getScene();\n if (this._depthRenderer) {\n delete scene._depthRenderer[this._depthRendererId];\n this._depthRenderer.dispose();\n this._depthRenderer = null;\n }\n if (depthRenderer === null) {\n if (!scene._depthRenderer) {\n scene._depthRenderer = {};\n }\n depthRenderer = this._depthRenderer = new DepthRenderer(scene, type, this._camera, false, 1);\n depthRenderer.enabled = false;\n this._depthRendererId = \"minmax\" + this._camera.id;\n scene._depthRenderer[this._depthRendererId] = depthRenderer;\n }\n super.setSourceTexture(depthRenderer.getDepthMap(), true, type, forceFullscreenViewport);\n }\n /**\n * @internal\n */\n setSourceTexture(sourceTexture, depthRedux, type = 2, forceFullscreenViewport = true) {\n super.setSourceTexture(sourceTexture, depthRedux, type, forceFullscreenViewport);\n }\n /**\n * Activates the reduction computation.\n * When activated, the observers registered in onAfterReductionPerformed are\n * called after the computation is performed\n */\n activate() {\n if (this._depthRenderer) {\n this._depthRenderer.enabled = true;\n }\n super.activate();\n }\n /**\n * Deactivates the reduction computation.\n */\n deactivate() {\n super.deactivate();\n if (this._depthRenderer) {\n this._depthRenderer.enabled = false;\n }\n }\n /**\n * Disposes the depth reducer\n * @param disposeAll true to dispose all the resources. You should always call this function with true as the parameter (or without any parameter as it is the default one). This flag is meant to be used internally.\n */\n dispose(disposeAll = true) {\n super.dispose(disposeAll);\n if (this._depthRenderer && disposeAll) {\n const scene = this._depthRenderer.getDepthMap().getScene();\n if (scene) {\n delete scene._depthRenderer[this._depthRendererId];\n }\n this._depthRenderer.dispose();\n this._depthRenderer = null;\n }\n }\n}\n"],"mappings":"AACA,SAASA,aAAa,QAAQ,+BAA+B;AAC7D,SAASC,aAAa,QAAQ,oBAAoB;AAClD;AACA;AACA;AACA,OAAO,MAAMC,YAAY,SAASD,aAAa,CAAC;EAC5C;AACJ;AACA;AACA;EACI,IAAIE,aAAaA,CAAA,EAAG;IAChB,OAAO,IAAI,CAACC,cAAc;EAC9B;EACA;AACJ;AACA;AACA;EACIC,WAAWA,CAACC,MAAM,EAAE;IAChB,KAAK,CAACA,MAAM,CAAC;EACjB;EACA;AACJ;AACA;AACA;AACA;AACA;EACIC,gBAAgBA,CAACJ,aAAa,GAAG,IAAI,EAAEK,IAAI,GAAG,CAAC,EAAEC,uBAAuB,GAAG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