1 |
- {"ast":null,"code":"import { __decorate } from \"../../tslib.es6.js\";\nimport { Tools } from \"../../Misc/tools.js\";\nimport { serialize } from \"../../Misc/decorators.js\";\n/**\n * PostProcessRenderPipeline\n * @see https://doc.babylonjs.com/features/featuresDeepDive/postProcesses/postProcessRenderPipeline\n */\nexport class PostProcessRenderPipeline {\n /**\n * Gets pipeline name\n */\n get name() {\n return this._name;\n }\n /** Gets the list of attached cameras */\n get cameras() {\n return this._cameras;\n }\n /**\n * Gets the active engine\n */\n get engine() {\n return this._engine;\n }\n /**\n * Initializes a PostProcessRenderPipeline\n * @param _engine engine to add the pipeline to\n * @param name name of the pipeline\n */\n constructor(_engine, name) {\n this._engine = _engine;\n this._name = name;\n this._renderEffects = {};\n this._renderEffectsForIsolatedPass = new Array();\n this._cameras = [];\n }\n /**\n * Gets the class name\n * @returns \"PostProcessRenderPipeline\"\n */\n getClassName() {\n return \"PostProcessRenderPipeline\";\n }\n /**\n * If all the render effects in the pipeline are supported\n */\n get isSupported() {\n for (const renderEffectName in this._renderEffects) {\n if (Object.prototype.hasOwnProperty.call(this._renderEffects, renderEffectName)) {\n if (!this._renderEffects[renderEffectName].isSupported) {\n return false;\n }\n }\n }\n return true;\n }\n /**\n * Adds an effect to the pipeline\n * @param renderEffect the effect to add\n */\n addEffect(renderEffect) {\n this._renderEffects[renderEffect._name] = renderEffect;\n }\n // private\n /** @internal */\n _rebuild() {}\n /**\n * @internal\n */\n _enableEffect(renderEffectName, cameras) {\n const renderEffects = this._renderEffects[renderEffectName];\n if (!renderEffects) {\n return;\n }\n renderEffects._enable(Tools.MakeArray(cameras || this._cameras));\n }\n /**\n * @internal\n */\n _disableEffect(renderEffectName, cameras) {\n const renderEffects = this._renderEffects[renderEffectName];\n if (!renderEffects) {\n return;\n }\n renderEffects._disable(Tools.MakeArray(cameras || this._cameras));\n }\n /**\n * @internal\n */\n _attachCameras(cameras, unique) {\n const cams = Tools.MakeArray(cameras || this._cameras);\n if (!cams) {\n return;\n }\n const indicesToDelete = [];\n let i;\n for (i = 0; i < cams.length; i++) {\n const camera = cams[i];\n if (!camera) {\n continue;\n }\n if (this._cameras.indexOf(camera) === -1) {\n this._cameras.push(camera);\n } else if (unique) {\n indicesToDelete.push(i);\n }\n }\n for (i = 0; i < indicesToDelete.length; i++) {\n cams.splice(indicesToDelete[i], 1);\n }\n for (const renderEffectName in this._renderEffects) {\n if (Object.prototype.hasOwnProperty.call(this._renderEffects, renderEffectName)) {\n this._renderEffects[renderEffectName]._attachCameras(cams);\n }\n }\n }\n /**\n * @internal\n */\n _detachCameras(cameras) {\n const cams = Tools.MakeArray(cameras || this._cameras);\n if (!cams) {\n return;\n }\n for (const renderEffectName in this._renderEffects) {\n if (Object.prototype.hasOwnProperty.call(this._renderEffects, renderEffectName)) {\n this._renderEffects[renderEffectName]._detachCameras(cams);\n }\n }\n for (let i = 0; i < cams.length; i++) {\n this._cameras.splice(this._cameras.indexOf(cams[i]), 1);\n }\n }\n /** @internal */\n _update() {\n for (const renderEffectName in this._renderEffects) {\n if (Object.prototype.hasOwnProperty.call(this._renderEffects, renderEffectName)) {\n this._renderEffects[renderEffectName]._update();\n }\n }\n for (let i = 0; i < this._cameras.length; i++) {\n if (!this._cameras[i]) {\n continue;\n }\n const cameraName = this._cameras[i].name;\n if (this._renderEffectsForIsolatedPass[cameraName]) {\n this._renderEffectsForIsolatedPass[cameraName]._update();\n }\n }\n }\n /** @internal */\n _reset() {\n this._renderEffects = {};\n this._renderEffectsForIsolatedPass = new Array();\n }\n _enableMSAAOnFirstPostProcess(sampleCount) {\n if (!this._engine._features.supportMSAA) {\n return false;\n }\n // Set samples of the very first post process to 4 to enable native anti-aliasing in browsers that support webGL 2.0 (See: https://github.com/BabylonJS/Babylon.js/issues/3754)\n const effectKeys = Object.keys(this._renderEffects);\n if (effectKeys.length > 0) {\n const postProcesses = this._renderEffects[effectKeys[0]].getPostProcesses();\n if (postProcesses) {\n postProcesses[0].samples = sampleCount;\n }\n }\n return true;\n }\n /**\n * Ensures that all post processes in the pipeline are the correct size according to the\n * the viewport's required size\n */\n _adaptPostProcessesToViewPort() {\n const effectKeys = Object.keys(this._renderEffects);\n for (const effectKey of effectKeys) {\n const postProcesses = this._renderEffects[effectKey].getPostProcesses();\n if (postProcesses) {\n for (const postProcess of postProcesses) {\n postProcess.adaptScaleToCurrentViewport = true;\n }\n }\n }\n }\n /**\n * Sets the required values to the prepass renderer.\n * @param prePassRenderer defines the prepass renderer to setup.\n * @returns true if the pre pass is needed.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n setPrePassRenderer(prePassRenderer) {\n // Do Nothing by default\n return false;\n }\n /**\n * Disposes of the pipeline\n */\n dispose() {\n // Must be implemented by children\n }\n}\n__decorate([serialize()], PostProcessRenderPipeline.prototype, \"_name\", void 0);","map":{"version":3,"names":["__decorate","Tools","serialize","PostProcessRenderPipeline","name","_name","cameras","_cameras","engine","_engine","constructor","_renderEffects","_renderEffectsForIsolatedPass","Array","getClassName","isSupported","renderEffectName","Object","prototype","hasOwnProperty","call","addEffect","renderEffect","_rebuild","_enableEffect","renderEffects","_enable","MakeArray","_disableEffect","_disable","_attachCameras","unique","cams","indicesToDelete","i","length","camera","indexOf","push","splice","_detachCameras","_update","cameraName","_reset","_enableMSAAOnFirstPostProcess","sampleCount","_features","supportMSAA","effectKeys","keys","postProcesses","getPostProcesses","samples","_adaptPostProcessesToViewPort","effectKey","postProcess","adaptScaleToCurrentViewport","setPrePassRenderer","prePassRenderer","dispose"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/PostProcesses/RenderPipeline/postProcessRenderPipeline.js"],"sourcesContent":["import { __decorate } from \"../../tslib.es6.js\";\nimport { Tools } from \"../../Misc/tools.js\";\nimport { serialize } from \"../../Misc/decorators.js\";\n/**\n * PostProcessRenderPipeline\n * @see https://doc.babylonjs.com/features/featuresDeepDive/postProcesses/postProcessRenderPipeline\n */\nexport class PostProcessRenderPipeline {\n /**\n * Gets pipeline name\n */\n get name() {\n return this._name;\n }\n /** Gets the list of attached cameras */\n get cameras() {\n return this._cameras;\n }\n /**\n * Gets the active engine\n */\n get engine() {\n return this._engine;\n }\n /**\n * Initializes a PostProcessRenderPipeline\n * @param _engine engine to add the pipeline to\n * @param name name of the pipeline\n */\n constructor(_engine, name) {\n this._engine = _engine;\n this._name = name;\n this._renderEffects = {};\n this._renderEffectsForIsolatedPass = new Array();\n this._cameras = [];\n }\n /**\n * Gets the class name\n * @returns \"PostProcessRenderPipeline\"\n */\n getClassName() {\n return \"PostProcessRenderPipeline\";\n }\n /**\n * If all the render effects in the pipeline are supported\n */\n get isSupported() {\n for (const renderEffectName in this._renderEffects) {\n if (Object.prototype.hasOwnProperty.call(this._renderEffects, renderEffectName)) {\n if (!this._renderEffects[renderEffectName].isSupported) {\n return false;\n }\n }\n }\n return true;\n }\n /**\n * Adds an effect to the pipeline\n * @param renderEffect the effect to add\n */\n addEffect(renderEffect) {\n this._renderEffects[renderEffect._name] = renderEffect;\n }\n // private\n /** @internal */\n _rebuild() { }\n /**\n * @internal\n */\n _enableEffect(renderEffectName, cameras) {\n const renderEffects = this._renderEffects[renderEffectName];\n if (!renderEffects) {\n return;\n }\n renderEffects._enable(Tools.MakeArray(cameras || this._cameras));\n }\n /**\n * @internal\n */\n _disableEffect(renderEffectName, cameras) {\n const renderEffects = this._renderEffects[renderEffectName];\n if (!renderEffects) {\n return;\n }\n renderEffects._disable(Tools.MakeArray(cameras || this._cameras));\n }\n /**\n * @internal\n */\n _attachCameras(cameras, unique) {\n const cams = Tools.MakeArray(cameras || this._cameras);\n if (!cams) {\n return;\n }\n const indicesToDelete = [];\n let i;\n for (i = 0; i < cams.length; i++) {\n const camera = cams[i];\n if (!camera) {\n continue;\n }\n if (this._cameras.indexOf(camera) === -1) {\n this._cameras.push(camera);\n }\n else if (unique) {\n indicesToDelete.push(i);\n }\n }\n for (i = 0; i < indicesToDelete.length; i++) {\n cams.splice(indicesToDelete[i], 1);\n }\n for (const renderEffectName in this._renderEffects) {\n if (Object.prototype.hasOwnProperty.call(this._renderEffects, renderEffectName)) {\n this._renderEffects[renderEffectName]._attachCameras(cams);\n }\n }\n }\n /**\n * @internal\n */\n _detachCameras(cameras) {\n const cams = Tools.MakeArray(cameras || this._cameras);\n if (!cams) {\n return;\n }\n for (const renderEffectName in this._renderEffects) {\n if (Object.prototype.hasOwnProperty.call(this._renderEffects, renderEffectName)) {\n this._renderEffects[renderEffectName]._detachCameras(cams);\n }\n }\n for (let i = 0; i < cams.length; i++) {\n this._cameras.splice(this._cameras.indexOf(cams[i]), 1);\n }\n }\n /** @internal */\n _update() {\n for (const renderEffectName in this._renderEffects) {\n if (Object.prototype.hasOwnProperty.call(this._renderEffects, renderEffectName)) {\n this._renderEffects[renderEffectName]._update();\n }\n }\n for (let i = 0; i < this._cameras.length; i++) {\n if (!this._cameras[i]) {\n continue;\n }\n const cameraName = this._cameras[i].name;\n if (this._renderEffectsForIsolatedPass[cameraName]) {\n this._renderEffectsForIsolatedPass[cameraName]._update();\n }\n }\n }\n /** @internal */\n _reset() {\n this._renderEffects = {};\n this._renderEffectsForIsolatedPass = new Array();\n }\n _enableMSAAOnFirstPostProcess(sampleCount) {\n if (!this._engine._features.supportMSAA) {\n return false;\n }\n // Set samples of the very first post process to 4 to enable native anti-aliasing in browsers that support webGL 2.0 (See: https://github.com/BabylonJS/Babylon.js/issues/3754)\n const effectKeys = Object.keys(this._renderEffects);\n if (effectKeys.length > 0) {\n const postProcesses = this._renderEffects[effectKeys[0]].getPostProcesses();\n if (postProcesses) {\n postProcesses[0].samples = sampleCount;\n }\n }\n return true;\n }\n /**\n * Ensures that all post processes in the pipeline are the correct size according to the\n * the viewport's required size\n */\n _adaptPostProcessesToViewPort() {\n const effectKeys = Object.keys(this._renderEffects);\n for (const effectKey of effectKeys) {\n const postProcesses = this._renderEffects[effectKey].getPostProcesses();\n if (postProcesses) {\n for (const postProcess of postProcesses) {\n postProcess.adaptScaleToCurrentViewport = true;\n }\n }\n }\n }\n /**\n * Sets the required values to the prepass renderer.\n * @param prePassRenderer defines the prepass renderer to setup.\n * @returns true if the pre pass is needed.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n setPrePassRenderer(prePassRenderer) {\n // Do Nothing by default\n return false;\n }\n /**\n * Disposes of the pipeline\n */\n dispose() {\n // Must be implemented by children\n }\n}\n__decorate([\n serialize()\n], PostProcessRenderPipeline.prototype, \"_name\", void 0);\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,KAAK,QAAQ,qBAAqB;AAC3C,SAASC,SAAS,QAAQ,0BAA0B;AACpD;AACA;AACA;AACA;AACA,OAAO,MAAMC,yBAAyB,CAAC;EACnC;AACJ;AACA;EACI,IAAIC,IAAIA,CAAA,EAAG;IACP,OAAO,IAAI,CAACC,KAAK;EACrB;EACA;EACA,IAAIC,OAAOA,CAAA,EAAG;IACV,OAAO,IAAI,CAACC,QAAQ;EACxB;EACA;AACJ;AACA;EACI,IAAIC,MAAMA,CAAA,EAAG;IACT,OAAO,IAAI,CAACC,OAAO;EACvB;EACA;AACJ;AACA;AACA;AACA;EACIC,WAAWA,CAACD,OAAO,EAAEL,IAAI,EAAE;IACvB,IAAI,CAACK,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACJ,KAAK,GAAGD,IAAI;IACjB,IAAI,CAACO,cAAc,GAAG,CAAC,CAAC;IACxB,IAAI,CAACC,6BAA6B,GAAG,IAAIC,KAAK,CAAC,CAAC;IAChD,IAAI,CAACN,QAAQ,GAAG,EAAE;EACtB;EACA;AACJ;AACA;AACA;EACIO,YAAYA,CAAA,EAAG;IACX,OAAO,2BAA2B;EACtC;EACA;AACJ;AACA;EACI,IAAIC,WAAWA,CAAA,EAAG;IACd,KAAK,MAAMC,gBAAgB,IAAI,IAAI,CAACL,cAAc,EAAE;MAChD,IAAIM,MAAM,CAACC,SAAS,CAACC,cAAc,CAACC,IAAI,CAAC,IAAI,CAACT,cAAc,EAAEK,gBAAgB,CA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AC,IAAI,CAACtC,cAAc,CAAC;IACnD,IAAIqC,UAAU,CAACb,MAAM,GAAG,CAAC,EAAE;MACvB,MAAMe,aAAa,GAAG,IAAI,CAACvC,cAAc,CAACqC,UAAU,CAAC,CAAC,CAAC,CAAC,CAACG,gBAAgB,CAAC,CAAC;MAC3E,IAAID,aAAa,EAAE;QACfA,aAAa,CAAC,CAAC,CAAC,CAACE,OAAO,GAAGP,WAAW;MAC1C;IACJ;IACA,OAAO,IAAI;EACf;EACA;AACJ;AACA;AACA;EACIQ,6BAA6BA,CAAA,EAAG;IAC5B,MAAML,UAAU,GAAG/B,MAAM,CAACgC,IAAI,CAAC,IAAI,CAACtC,cAAc,CAAC;IACnD,KAAK,MAAM2C,SAAS,IAAIN,UAAU,EAAE;MAChC,MAAME,aAAa,GAAG,IAAI,CAACvC,cAAc,CAAC2C,SAAS,CAAC,CAACH,gBAAgB,CAAC,CAAC;MACvE,IAAID,aAAa,EAAE;QACf,KAAK,MAAMK,WAAW,IAAIL,aAAa,EAAE;UACrCK,WAAW,CAACC,2BAA2B,GAAG,IAAI;QAClD;MACJ;IACJ;EACJ;EACA;AACJ;AACA;AACA;AACA;EACI;EACAC,kBAAkBA,CAACC,eAAe,EAAE;IAChC;IACA,OAAO,KAAK;EAChB;EACA;AACJ;AACA;EACIC,OAAOA,CAAA,EAAG;IACN;EAAA;AAER;AACA3D,UAAU,CAAC,CACPE,SAAS,CAAC,CAAC,CACd,EAAEC,yBAAyB,CAACe,SAAS,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]}
|