e6b76e031e3bd5598b339c1fef11b4697b6dc3fa467097b07de014da01e67fd7.json 10 KB

1
  1. {"ast":null,"code":"import { MultiRenderTarget } from \"./multiRenderTarget.js\";\nimport { ImageProcessingPostProcess } from \"../../PostProcesses/imageProcessingPostProcess.js\";\n/**\n * A multi render target designed to render the prepass.\n * Prepass is a scene component used to render information in multiple textures\n * alongside with the scene materials rendering.\n * Note : This is an internal class, and you should NOT need to instanciate this.\n * Only the `PrePassRenderer` should instanciate this class.\n * It is more likely that you need a regular `MultiRenderTarget`\n * @internal\n */\nexport class PrePassRenderTarget extends MultiRenderTarget {\n constructor(name, renderTargetTexture, size, count, scene, options) {\n super(name, size, count, scene, options);\n /**\n * @internal\n */\n this._beforeCompositionPostProcesses = [];\n /**\n * @internal\n */\n this._internalTextureDirty = false;\n /**\n * Is this render target enabled for prepass rendering\n */\n this.enabled = false;\n /**\n * Render target associated with this prePassRenderTarget\n * If this is `null`, it means this prePassRenderTarget is associated with the scene\n */\n this.renderTargetTexture = null;\n this.renderTargetTexture = renderTargetTexture;\n }\n /**\n * Creates a composition effect for this RT\n * @internal\n */\n _createCompositionEffect() {\n this.imageProcessingPostProcess = new ImageProcessingPostProcess(\"prePassComposition\", 1, null, undefined, this._engine);\n this.imageProcessingPostProcess._updateParameters();\n }\n /**\n * Checks that the size of this RT is still adapted to the desired render size.\n * @internal\n */\n _checkSize() {\n const requiredWidth = this._engine.getRenderWidth(true);\n const requiredHeight = this._engine.getRenderHeight(true);\n const width = this.getRenderWidth();\n const height = this.getRenderHeight();\n if (width !== requiredWidth || height !== requiredHeight) {\n this.resize({\n width: requiredWidth,\n height: requiredHeight\n });\n this._internalTextureDirty = true;\n }\n }\n /**\n * Changes the number of render targets in this MRT\n * Be careful as it will recreate all the data in the new texture.\n * @param count new texture count\n * @param options Specifies texture types and sampling modes for new textures\n * @param textureNames Specifies the names of the textures (optional)\n */\n updateCount(count, options, textureNames) {\n super.updateCount(count, options, textureNames);\n this._internalTextureDirty = true;\n }\n /**\n * Resets the post processes chains applied to this RT.\n * @internal\n */\n _resetPostProcessChain() {\n this._beforeCompositionPostProcesses.length = 0;\n }\n /**\n * Diposes this render target\n */\n dispose() {\n const scene = this._scene;\n super.dispose();\n if (scene && scene.prePassRenderer) {\n const index = scene.prePassRenderer.renderTargets.indexOf(this);\n if (index !== -1) {\n scene.prePassRenderer.renderTargets.splice(index, 1);\n }\n }\n if (this.imageProcessingPostProcess) {\n this.imageProcessingPostProcess.dispose();\n }\n if (this.renderTargetTexture) {\n this.renderTargetTexture._prePassRenderTarget = null;\n }\n if (this._outputPostProcess) {\n this._outputPostProcess.autoClear = true;\n this._outputPostProcess.restoreDefaultInputTexture();\n }\n }\n}","map":{"version":3,"names":["MultiRenderTarget","ImageProcessingPostProcess","PrePassRenderTarget","constructor","name","renderTargetTexture","size","count","scene","options","_beforeCompositionPostProcesses","_internalTextureDirty","enabled","_createCompositionEffect","imageProcessingPostProcess","undefined","_engine","_updateParameters","_checkSize","requiredWidth","getRenderWidth","requiredHeight","getRenderHeight","width","height","resize","updateCount","textureNames","_resetPostProcessChain","length","dispose","_scene","prePassRenderer","index","renderTargets","indexOf","splice","_prePassRenderTarget","_outputPostProcess","autoClear","restoreDefaultInputTexture"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Materials/Textures/prePassRenderTarget.js"],"sourcesContent":["import { MultiRenderTarget } from \"./multiRenderTarget.js\";\nimport { ImageProcessingPostProcess } from \"../../PostProcesses/imageProcessingPostProcess.js\";\n/**\n * A multi render target designed to render the prepass.\n * Prepass is a scene component used to render information in multiple textures\n * alongside with the scene materials rendering.\n * Note : This is an internal class, and you should NOT need to instanciate this.\n * Only the `PrePassRenderer` should instanciate this class.\n * It is more likely that you need a regular `MultiRenderTarget`\n * @internal\n */\nexport class PrePassRenderTarget extends MultiRenderTarget {\n constructor(name, renderTargetTexture, size, count, scene, options) {\n super(name, size, count, scene, options);\n /**\n * @internal\n */\n this._beforeCompositionPostProcesses = [];\n /**\n * @internal\n */\n this._internalTextureDirty = false;\n /**\n * Is this render target enabled for prepass rendering\n */\n this.enabled = false;\n /**\n * Render target associated with this prePassRenderTarget\n * If this is `null`, it means this prePassRenderTarget is associated with the scene\n */\n this.renderTargetTexture = null;\n this.renderTargetTexture = renderTargetTexture;\n }\n /**\n * Creates a composition effect for this RT\n * @internal\n */\n _createCompositionEffect() {\n this.imageProcessingPostProcess = new ImageProcessingPostProcess(\"prePassComposition\", 1, null, undefined, this._engine);\n this.imageProcessingPostProcess._updateParameters();\n }\n /**\n * Checks that the size of this RT is still adapted to the desired render size.\n * @internal\n */\n _checkSize() {\n const requiredWidth = this._engine.getRenderWidth(true);\n const requiredHeight = this._engine.getRenderHeight(true);\n const width = this.getRenderWidth();\n const height = this.getRenderHeight();\n if (width !== requiredWidth || height !== requiredHeight) {\n this.resize({ width: requiredWidth, height: requiredHeight });\n this._internalTextureDirty = true;\n }\n }\n /**\n * Changes the number of render targets in this MRT\n * Be careful as it will recreate all the data in the new texture.\n * @param count new texture count\n * @param options Specifies texture types and sampling modes for new textures\n * @param textureNames Specifies the names of the textures (optional)\n */\n updateCount(count, options, textureNames) {\n super.updateCount(count, options, textureNames);\n this._internalTextureDirty = true;\n }\n /**\n * Resets the post processes chains applied to this RT.\n * @internal\n */\n _resetPostProcessChain() {\n this._beforeCompositionPostProcesses.length = 0;\n }\n /**\n * Diposes this render target\n */\n dispose() {\n const scene = this._scene;\n super.dispose();\n if (scene && scene.prePassRenderer) {\n const index = scene.prePassRenderer.renderTargets.indexOf(this);\n if (index !== -1) {\n scene.prePassRenderer.renderTargets.splice(index, 1);\n }\n }\n if (this.imageProcessingPostProcess) {\n this.imageProcessingPostProcess.dispose();\n }\n if (this.renderTargetTexture) {\n this.renderTargetTexture._prePassRenderTarget = null;\n }\n if (this._outputPostProcess) {\n this._outputPostProcess.autoClear = true;\n this._outputPostProcess.restoreDefaultInputTexture();\n }\n }\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,w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,KAAK,EAAEJ,aAAa;QAAEK,MAAM,EAAEH;MAAe,CAAC,CAAC;MAC7D,IAAI,CAACV,qBAAqB,GAAG,IAAI;IACrC;EACJ;EACA;AACJ;AACA;AACA;AACA;AACA;AACA;EACIe,WAAWA,CAACnB,KAAK,EAAEE,OAAO,EAAEkB,YAAY,EAAE;IACtC,KAAK,CAACD,WAAW,CAACnB,KAAK,EAAEE,OAAO,EAAEkB,YAAY,CAAC;IAC/C,IAAI,CAAChB,qBAAqB,GAAG,IAAI;EACrC;EACA;AACJ;AACA;AACA;EACIiB,sBAAsBA,CAAA,EAAG;IACrB,IAAI,CAAClB,+BAA+B,CAACmB,MAAM,GAAG,CAAC;EACnD;EACA;AACJ;AACA;EACIC,OAAOA,CAAA,EAAG;IACN,MAAMtB,KAAK,GAAG,IAAI,CAACuB,MAAM;IACzB,KAAK,CAACD,OAAO,CAAC,CAAC;IACf,IAAItB,KAAK,IAAIA,KAAK,CAACwB,eAAe,EAAE;MAChC,MAAMC,KAAK,GAAGzB,KAAK,CAACwB,eAAe,CAACE,aAAa,CAACC,OAAO,CAAC,IAAI,CAAC;MAC/D,IAAIF,KAAK,KAAK,CAAC,CAAC,EAAE;QACdzB,KAAK,CAACwB,eAAe,CAACE,aAAa,CAACE,MAAM,CAACH,KAAK,EAAE,CAAC,CAAC;MACxD;IACJ;IACA,IAAI,IAAI,CAACnB,0BAA0B,EAAE;MACjC,IAAI,CAACA,0BAA0B,CAACgB,OAAO,CAAC,CAAC;IAC7C;IACA,IAAI,IAAI,CAACzB,mBAAmB,EAAE;MAC1B,IAAI,CAACA,mBAAmB,CAACgC,oBAAoB,GAAG,IAAI;IACxD;IACA,IAAI,IAAI,CAACC,kBAAkB,EAAE;MACzB,IAAI,CAACA,kBAAkB,CAACC,SAAS,GAAG,IAAI;MACxC,IAAI,CAACD,kBAAkB,CAACE,0BAA0B,CAAC,CAAC;IACxD;EACJ;AACJ","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]}