9932d07d912637031c59ceba2af709610fb50a65c259d1a3b2f091b2d16bc7c2.json 53 KB

1
  1. {"ast":null,"code":"import _asyncToGenerator from \"F:/workspace/202226701027/huinongbao-app/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\";\nimport { VertexBuffer } from \"../Buffers/buffer.js\";\nimport { Viewport } from \"../Maths/math.viewport.js\";\nimport { Observable } from \"../Misc/observable.js\";\nimport { Effect } from \"./effect.js\";\nimport { DrawWrapper } from \"./drawWrapper.js\";\n// Prevents ES6 issue if not imported.\nimport \"../Shaders/postprocess.vertex.js\";\n// Fullscreen quad buffers by default.\nconst defaultOptions = {\n positions: [1, 1, -1, 1, -1, -1, 1, -1],\n indices: [0, 1, 2, 0, 2, 3]\n};\n/**\n * Helper class to render one or more effects.\n * You can access the previous rendering in your shader by declaring a sampler named textureSampler\n */\nexport class EffectRenderer {\n /**\n * Creates an effect renderer\n * @param engine the engine to use for rendering\n * @param options defines the options of the effect renderer\n */\n constructor(engine, options = defaultOptions) {\n var _options$positions, _options$indices;\n this._fullscreenViewport = new Viewport(0, 0, 1, 1);\n const positions = (_options$positions = options.positions) !== null && _options$positions !== void 0 ? _options$positions : defaultOptions.positions;\n const indices = (_options$indices = options.indices) !== null && _options$indices !== void 0 ? _options$indices : defaultOptions.indices;\n this.engine = engine;\n this._vertexBuffers = {\n [VertexBuffer.PositionKind]: new VertexBuffer(engine, positions, VertexBuffer.PositionKind, false, false, 2)\n };\n this._indexBuffer = engine.createIndexBuffer(indices);\n this._onContextRestoredObserver = engine.onContextRestoredObservable.add(() => {\n this._indexBuffer = engine.createIndexBuffer(indices);\n for (const key in this._vertexBuffers) {\n const vertexBuffer = this._vertexBuffers[key];\n vertexBuffer._rebuild();\n }\n });\n }\n /**\n * Sets the current viewport in normalized coordinates 0-1\n * @param viewport Defines the viewport to set (defaults to 0 0 1 1)\n */\n setViewport(viewport = this._fullscreenViewport) {\n this.engine.setViewport(viewport);\n }\n /**\n * Binds the embedded attributes buffer to the effect.\n * @param effect Defines the effect to bind the attributes for\n */\n bindBuffers(effect) {\n this.engine.bindBuffers(this._vertexBuffers, this._indexBuffer, effect);\n }\n /**\n * Sets the current effect wrapper to use during draw.\n * The effect needs to be ready before calling this api.\n * This also sets the default full screen position attribute.\n * @param effectWrapper Defines the effect to draw with\n */\n applyEffectWrapper(effectWrapper) {\n this.engine.setState(true);\n this.engine.depthCullingState.depthTest = false;\n this.engine.stencilState.stencilTest = false;\n this.engine.enableEffect(effectWrapper.drawWrapper);\n this.bindBuffers(effectWrapper.effect);\n effectWrapper.onApplyObservable.notifyObservers({});\n }\n /**\n * Saves engine states\n */\n saveStates() {\n this._savedStateDepthTest = this.engine.depthCullingState.depthTest;\n this._savedStateStencilTest = this.engine.stencilState.stencilTest;\n }\n /**\n * Restores engine states\n */\n restoreStates() {\n this.engine.depthCullingState.depthTest = this._savedStateDepthTest;\n this.engine.stencilState.stencilTest = this._savedStateStencilTest;\n }\n /**\n * Draws a full screen quad.\n */\n draw() {\n this.engine.drawElementsType(0, 0, 6);\n }\n _isRenderTargetTexture(texture) {\n return texture.renderTarget !== undefined;\n }\n /**\n * renders one or more effects to a specified texture\n * @param effectWrapper the effect to renderer\n * @param outputTexture texture to draw to, if null it will render to the currently bound frame buffer\n */\n render(effectWrapper, outputTexture = null) {\n // Ensure effect is ready\n if (!effectWrapper.effect.isReady()) {\n return;\n }\n this.saveStates();\n // Reset state\n this.setViewport();\n const out = outputTexture === null ? null : this._isRenderTargetTexture(outputTexture) ? outputTexture.renderTarget : outputTexture;\n if (out) {\n this.engine.bindFramebuffer(out);\n }\n this.applyEffectWrapper(effectWrapper);\n this.draw();\n if (out) {\n this.engine.unBindFramebuffer(out);\n }\n this.restoreStates();\n }\n /**\n * Disposes of the effect renderer\n */\n dispose() {\n const vertexBuffer = this._vertexBuffers[VertexBuffer.PositionKind];\n if (vertexBuffer) {\n vertexBuffer.dispose();\n delete this._vertexBuffers[VertexBuffer.PositionKind];\n }\n if (this._indexBuffer) {\n this.engine._releaseBuffer(this._indexBuffer);\n }\n if (this._onContextRestoredObserver) {\n this.engine.onContextRestoredObservable.remove(this._onContextRestoredObserver);\n this._onContextRestoredObserver = null;\n }\n }\n}\n/**\n * Wraps an effect to be used for rendering\n */\nexport class EffectWrapper {\n /**\n * Registers a shader code processing with an effect wrapper name.\n * @param effectWrapperName name of the effect wrapper. Use null for the fallback shader code processing. This is the shader code processing that will be used in case no specific shader code processing has been associated to an effect wrapper name\n * @param customShaderCodeProcessing shader code processing to associate to the effect wrapper name\n */\n static RegisterShaderCodeProcessing(effectWrapperName, customShaderCodeProcessing) {\n if (!customShaderCodeProcessing) {\n delete EffectWrapper._CustomShaderCodeProcessing[effectWrapperName !== null && effectWrapperName !== void 0 ? effectWrapperName : \"\"];\n return;\n }\n EffectWrapper._CustomShaderCodeProcessing[effectWrapperName !== null && effectWrapperName !== void 0 ? effectWrapperName : \"\"] = customShaderCodeProcessing;\n }\n static _GetShaderCodeProcessing(effectWrapperName) {\n var _EffectWrapper$_Custo;\n return (_EffectWrapper$_Custo = EffectWrapper._CustomShaderCodeProcessing[effectWrapperName]) !== null && _EffectWrapper$_Custo !== void 0 ? _EffectWrapper$_Custo : EffectWrapper._CustomShaderCodeProcessing[\"\"];\n }\n /**\n * Gets or sets the name of the effect wrapper\n */\n get name() {\n return this.options.name;\n }\n set name(value) {\n this.options.name = value;\n }\n /**\n * Get a value indicating if the effect is ready to be used\n * @returns true if the post-process is ready (shader is compiled)\n */\n isReady() {\n var _this$_drawWrapper$ef, _this$_drawWrapper$ef2;\n return (_this$_drawWrapper$ef = (_this$_drawWrapper$ef2 = this._drawWrapper.effect) === null || _this$_drawWrapper$ef2 === void 0 ? void 0 : _this$_drawWrapper$ef2.isReady()) !== null && _this$_drawWrapper$ef !== void 0 ? _this$_drawWrapper$ef : false;\n }\n /**\n * Get the draw wrapper associated with the effect wrapper\n * @returns the draw wrapper associated with the effect wrapper\n */\n get drawWrapper() {\n return this._drawWrapper;\n }\n /**\n * The underlying effect\n */\n get effect() {\n return this._drawWrapper.effect;\n }\n set effect(effect) {\n this._drawWrapper.effect = effect;\n }\n /**\n * Creates an effect to be rendered\n * @param creationOptions options to create the effect\n */\n constructor(creationOptions) {\n var _creationOptions$useA;\n /**\n * Type of alpha mode to use when applying the effect (default: Engine.ALPHA_DISABLE). Used only if useAsPostProcess is true.\n */\n this.alphaMode = 0;\n /**\n * Executed when the effect is created\n * @returns effect that was created for this effect wrapper\n */\n this.onEffectCreatedObservable = new Observable(undefined, true);\n /**\n * Event that is fired (only when the EffectWrapper is used with an EffectRenderer) right before the effect is drawn (should be used to update uniforms)\n */\n this.onApplyObservable = new Observable();\n this._shadersLoaded = false;\n /** @internal */\n this._webGPUReady = false;\n this._importPromises = [];\n this.options = {\n ...creationOptions,\n name: creationOptions.name || \"effectWrapper\",\n engine: creationOptions.engine,\n uniforms: creationOptions.uniforms || creationOptions.uniformNames || [],\n uniformNames: undefined,\n samplers: creationOptions.samplers || creationOptions.samplerNames || [],\n samplerNames: undefined,\n attributeNames: creationOptions.attributeNames || [\"position\"],\n uniformBuffers: creationOptions.uniformBuffers || [],\n defines: creationOptions.defines || \"\",\n useShaderStore: creationOptions.useShaderStore || false,\n vertexUrl: creationOptions.vertexUrl || creationOptions.vertexShader || \"postprocess\",\n vertexShader: undefined,\n fragmentShader: creationOptions.fragmentShader || \"pass\",\n indexParameters: creationOptions.indexParameters,\n blockCompilation: creationOptions.blockCompilation || false,\n shaderLanguage: creationOptions.shaderLanguage || 0 /* ShaderLanguage.GLSL */,\n onCompiled: creationOptions.onCompiled || undefined,\n extraInitializations: creationOptions.extraInitializations || undefined,\n extraInitializationsAsync: creationOptions.extraInitializationsAsync || undefined,\n useAsPostProcess: (_creationOptions$useA = creationOptions.useAsPostProcess) !== null && _creationOptions$useA !== void 0 ? _creationOptions$useA : false\n };\n this.options.uniformNames = this.options.uniforms;\n this.options.samplerNames = this.options.samplers;\n this.options.vertexShader = this.options.vertexUrl;\n if (this.options.useAsPostProcess) {\n if (this.options.samplers.indexOf(\"textureSampler\") === -1) {\n this.options.samplers.push(\"textureSampler\");\n }\n if (this.options.uniforms.indexOf(\"scale\") === -1) {\n this.options.uniforms.push(\"scale\");\n }\n }\n if (creationOptions.vertexUrl || creationOptions.vertexShader) {\n this._shaderPath = {\n vertexSource: this.options.vertexShader\n };\n } else {\n if (!this.options.useAsPostProcess) {\n this.options.uniforms.push(\"scale\");\n this.onApplyObservable.add(() => {\n this.effect.setFloat2(\"scale\", 1, 1);\n });\n }\n this._shaderPath = {\n vertex: this.options.vertexShader\n };\n }\n this._shaderPath.fragmentSource = this.options.fragmentShader;\n this._shaderPath.spectorName = this.options.name;\n if (this.options.useShaderStore) {\n this._shaderPath.fragment = this._shaderPath.fragmentSource;\n if (!this._shaderPath.vertex) {\n this._shaderPath.vertex = this._shaderPath.vertexSource;\n }\n delete this._shaderPath.fragmentSource;\n delete this._shaderPath.vertexSource;\n }\n this.onApplyObservable.add(() => {\n this.bind();\n });\n if (!this.options.useShaderStore) {\n this._onContextRestoredObserver = this.options.engine.onContextRestoredObservable.add(() => {\n this.effect._pipelineContext = null; // because _prepareEffect will try to dispose this pipeline before recreating it and that would lead to webgl errors\n this.effect._prepareEffect();\n });\n }\n this._drawWrapper = new DrawWrapper(this.options.engine);\n this._webGPUReady = this.options.shaderLanguage === 1 /* ShaderLanguage.WGSL */;\n const defines = Array.isArray(this.options.defines) ? this.options.defines.join(\"\\n\") : this.options.defines;\n this._postConstructor(this.options.blockCompilation, defines, this.options.extraInitializations);\n }\n _gatherImports(useWebGPU = false, list) {\n if (!this.options.useAsPostProcess) {\n return;\n }\n // this._webGPUReady is used to detect when an effect wrapper is intended to be used with WebGPU\n if (useWebGPU && this._webGPUReady) {\n list.push(Promise.all([import(\"../ShadersWGSL/postprocess.vertex.js\")]));\n } else {\n list.push(Promise.all([import(\"../Shaders/postprocess.vertex.js\")]));\n }\n }\n /** @internal */\n _postConstructor(blockCompilation, defines = null, extraInitializations, importPromises) {\n this._importPromises.length = 0;\n if (importPromises) {\n this._importPromises.push(...importPromises);\n }\n const useWebGPU = this.options.engine.isWebGPU && !EffectWrapper.ForceGLSL;\n this._gatherImports(useWebGPU, this._importPromises);\n if (extraInitializations !== undefined) {\n extraInitializations(useWebGPU, this._importPromises);\n }\n if (useWebGPU && this._webGPUReady) {\n this.options.shaderLanguage = 1 /* ShaderLanguage.WGSL */;\n }\n if (!blockCompilation) {\n this.updateEffect(defines);\n }\n }\n /**\n * Updates the effect with the current effect wrapper compile time values and recompiles the shader.\n * @param defines Define statements that should be added at the beginning of the shader. (default: null)\n * @param uniforms Set of uniform variables that will be passed to the shader. (default: null)\n * @param samplers Set of Texture2D variables that will be passed to the shader. (default: null)\n * @param indexParameters The index parameters to be used for babylons include syntax \"#include<kernelBlurVaryingDeclaration>[0..varyingCount]\". (default: undefined) See usage in babylon.blurPostProcess.ts and kernelBlur.vertex.fx\n * @param onCompiled Called when the shader has been compiled.\n * @param onError Called if there is an error when compiling a shader.\n * @param vertexUrl The url of the vertex shader to be used (default: the one given at construction time)\n * @param fragmentUrl The url of the fragment shader to be used (default: the one given at construction time)\n */\n updateEffect(defines = null, uniforms = null, samplers = null, indexParameters, onCompiled, onError, vertexUrl, fragmentUrl) {\n var _this = this;\n const customShaderCodeProcessing = EffectWrapper._GetShaderCodeProcessing(this.name);\n if (customShaderCodeProcessing !== null && customShaderCodeProcessing !== void 0 && customShaderCodeProcessing.defineCustomBindings) {\n var _uniforms$slice, _uniforms, _samplers$slice, _samplers;\n const newUniforms = (_uniforms$slice = (_uniforms = uniforms) === null || _uniforms === void 0 ? void 0 : _uniforms.slice()) !== null && _uniforms$slice !== void 0 ? _uniforms$slice : [];\n newUniforms.push(...this.options.uniforms);\n const newSamplers = (_samplers$slice = (_samplers = samplers) === null || _samplers === void 0 ? void 0 : _samplers.slice()) !== null && _samplers$slice !== void 0 ? _samplers$slice : [];\n newSamplers.push(...this.options.samplers);\n defines = customShaderCodeProcessing.defineCustomBindings(this.name, defines, newUniforms, newSamplers);\n uniforms = newUniforms;\n samplers = newSamplers;\n }\n this.options.defines = defines || \"\";\n const waitImportsLoaded = this._shadersLoaded || this._importPromises.length === 0 ? undefined : /*#__PURE__*/_asyncToGenerator(function* () {\n yield Promise.all(_this._importPromises);\n _this._shadersLoaded = true;\n });\n let extraInitializationsAsync;\n if (this.options.extraInitializationsAsync) {\n extraInitializationsAsync = /*#__PURE__*/function () {\n var _ref2 = _asyncToGenerator(function* () {\n waitImportsLoaded === null || waitImportsLoaded === void 0 || waitImportsLoaded();\n yield _this.options.extraInitializationsAsync;\n });\n return function extraInitializationsAsync() {\n return _ref2.apply(this, arguments);\n };\n }();\n } else {\n extraInitializationsAsync = waitImportsLoaded;\n }\n if (this.options.useShaderStore) {\n this._drawWrapper.effect = this.options.engine.createEffect({\n vertex: vertexUrl !== null && vertexUrl !== void 0 ? vertexUrl : this._shaderPath.vertex,\n fragment: fragmentUrl !== null && fragmentUrl !== void 0 ? fragmentUrl : this._shaderPath.fragment\n }, {\n attributes: this.options.attributeNames,\n uniformsNames: uniforms || this.options.uniforms,\n uniformBuffersNames: this.options.uniformBuffers,\n samplers: samplers || this.options.samplers,\n defines: defines !== null ? defines : \"\",\n fallbacks: null,\n onCompiled: onCompiled !== null && onCompiled !== void 0 ? onCompiled : this.options.onCompiled,\n onError: onError !== null && onError !== void 0 ? onError : null,\n indexParameters: indexParameters || this.options.indexParameters,\n processCodeAfterIncludes: customShaderCodeProcessing !== null && customShaderCodeProcessing !== void 0 && customShaderCodeProcessing.processCodeAfterIncludes ? (shaderType, code) => customShaderCodeProcessing.processCodeAfterIncludes(this.name, shaderType, code) : null,\n processFinalCode: customShaderCodeProcessing !== null && customShaderCodeProcessing !== void 0 && customShaderCodeProcessing.processFinalCode ? (shaderType, code) => customShaderCodeProcessing.processFinalCode(this.name, shaderType, code) : null,\n shaderLanguage: this.options.shaderLanguage,\n extraInitializationsAsync\n }, this.options.engine);\n } else {\n this._drawWrapper.effect = new Effect(this._shaderPath, this.options.attributeNames, uniforms || this.options.uniforms, samplers || this.options.samplerNames, this.options.engine, defines, undefined, onCompiled || this.options.onCompiled, undefined, undefined, undefined, this.options.shaderLanguage, extraInitializationsAsync);\n }\n this.onEffectCreatedObservable.notifyObservers(this._drawWrapper.effect);\n }\n /**\n * Binds the data to the effect.\n */\n bind() {\n var _EffectWrapper$_GetSh, _EffectWrapper$_GetSh2;\n if (this.options.useAsPostProcess) {\n this.options.engine.setAlphaMode(this.alphaMode);\n this.drawWrapper.effect.setFloat2(\"scale\", 1, 1);\n }\n (_EffectWrapper$_GetSh = EffectWrapper._GetShaderCodeProcessing(this.name)) === null || _EffectWrapper$_GetSh === void 0 || (_EffectWrapper$_GetSh2 = _EffectWrapper$_GetSh.bindCustomBindings) === null || _EffectWrapper$_GetSh2 === void 0 || _EffectWrapper$_GetSh2.call(_EffectWrapper$_GetSh, this.name, this._drawWrapper.effect);\n }\n /**\n * Disposes of the effect wrapper\n * @param _ignored kept for backward compatibility\n */\n dispose(_ignored = false) {\n if (this._onContextRestoredObserver) {\n this.effect.getEngine().onContextRestoredObservable.remove(this._onContextRestoredObserver);\n this._onContextRestoredObserver = null;\n }\n this.onEffectCreatedObservable.clear();\n this.effect.dispose();\n }\n}\n/**\n * Force code to compile to glsl even on WebGPU engines.\n * False by default. This is mostly meant for backward compatibility.\n */\nEffectWrapper.ForceGLSL = false;\nEffectWrapper._CustomShaderCodeProcessing = {};","map":{"version":3,"names":["VertexBuffer","Viewport","Observable","Effect","DrawWrapper","defaultOptions","positions","indices","EffectRenderer","constructor","engine","options","_options$positions","_options$indices","_fullscreenViewport","_vertexBuffers","PositionKind","_indexBuffer","createIndexBuffer","_onContextRestoredObserver","onContextRestoredObservable","add","key","vertexBuffer","_rebuild","setViewport","viewport","bindBuffers","effect","applyEffectWrapper","effectWrapper","setState","depthCullingState","depthTest","stencilState","stencilTest","enableEffect","drawWrapper","onApplyObservable","notifyObservers","saveStates","_savedStateDepthTest","_savedStateStencilTest","restoreStates","draw","drawElementsType","_isRenderTargetTexture","texture","renderTarget","undefined","render","outputTexture","isReady","out","bindFramebuffer","unBindFramebuffer","dispose","_releaseBuffer","remove","EffectWrapper","RegisterShaderCodeProcessing","effectWrapperName","customShaderCodeProcessing","_CustomShaderCodeProcessing","_GetShaderCodeProcessing","_EffectWrapper$_Custo","name","value","_this$_drawWrapper$ef","_this$_drawWrapper$ef2","_drawWrapper","creationOptions","_creationOptions$useA","alphaMode","onEffectCreatedObservable","_shadersLoaded","_webGPUReady","_importPromises","uniforms","uniformNames","samplers","samplerNames","attributeNames","uniformBuffers","defines","useShaderStore","vertexUrl","vertexShader","fragmentShader","indexParameters","blockCompilation","shaderLanguage","onCompiled","extraInitializations","extraInitializationsAsync","useAsPostProcess","indexOf","push","_shaderPath","vertexSource","setFloat2","vertex","fragmentSource","spectorName","fragment","bind","_pipelineContext","_prepareEffect","Array","isArray","join","_postConstructor","_gatherImports","useWebGPU","list","Promise","all","importPromises","length","isWebGPU","ForceGLSL","updateEffect","onError","fragmentUrl","_this","defineCustomBindings","_uniforms$slice","_uniforms","_samplers$slice","_samplers","newUniforms","slice","newSamplers","waitImportsLoaded","_asyncToGenerator","_ref2","apply","arguments","createEffect","attributes","uniformsNames","uniformBuffersNames","fallbacks","processCodeAfterIncludes","shaderType","code","processFinalCode","_EffectWrapper$_GetSh","_EffectWrapper$_GetSh2","setAlphaMode","bindCustomBindings","call","_ignored","getEngine","clear"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Materials/effectRenderer.js"],"sourcesContent":["import { VertexBuffer } from \"../Buffers/buffer.js\";\nimport { Viewport } from \"../Maths/math.viewport.js\";\n\nimport { Observable } from \"../Misc/observable.js\";\nimport { Effect } from \"./effect.js\";\nimport { DrawWrapper } from \"./drawWrapper.js\";\n// Prevents ES6 issue if not imported.\nimport \"../Shaders/postprocess.vertex.js\";\n// Fullscreen quad buffers by default.\nconst defaultOptions = {\n positions: [1, 1, -1, 1, -1, -1, 1, -1],\n indices: [0, 1, 2, 0, 2, 3],\n};\n/**\n * Helper class to render one or more effects.\n * You can access the previous rendering in your shader by declaring a sampler named textureSampler\n */\nexport class EffectRenderer {\n /**\n * Creates an effect renderer\n * @param engine the engine to use for rendering\n * @param options defines the options of the effect renderer\n */\n constructor(engine, options = defaultOptions) {\n this._fullscreenViewport = new Viewport(0, 0, 1, 1);\n const positions = options.positions ?? defaultOptions.positions;\n const indices = options.indices ?? defaultOptions.indices;\n this.engine = engine;\n this._vertexBuffers = {\n [VertexBuffer.PositionKind]: new VertexBuffer(engine, positions, VertexBuffer.PositionKind, false, false, 2),\n };\n this._indexBuffer = engine.createIndexBuffer(indices);\n this._onContextRestoredObserver = engine.onContextRestoredObservable.add(() => {\n this._indexBuffer = engine.createIndexBuffer(indices);\n for (const key in this._vertexBuffers) {\n const vertexBuffer = this._vertexBuffers[key];\n vertexBuffer._rebuild();\n }\n });\n }\n /**\n * Sets the current viewport in normalized coordinates 0-1\n * @param viewport Defines the viewport to set (defaults to 0 0 1 1)\n */\n setViewport(viewport = this._fullscreenViewport) {\n this.engine.setViewport(viewport);\n }\n /**\n * Binds the embedded attributes buffer to the effect.\n * @param effect Defines the effect to bind the attributes for\n */\n bindBuffers(effect) {\n this.engine.bindBuffers(this._vertexBuffers, this._indexBuffer, effect);\n }\n /**\n * Sets the current effect wrapper to use during draw.\n * The effect needs to be ready before calling this api.\n * This also sets the default full screen position attribute.\n * @param effectWrapper Defines the effect to draw with\n */\n applyEffectWrapper(effectWrapper) {\n this.engine.setState(true);\n this.engine.depthCullingState.depthTest = false;\n this.engine.stencilState.stencilTest = false;\n this.engine.enableEffect(effectWrapper.drawWrapper);\n this.bindBuffers(effectWrapper.effect);\n effectWrapper.onApplyObservable.notifyObservers({});\n }\n /**\n * Saves engine states\n */\n saveStates() {\n this._savedStateDepthTest = this.engine.depthCullingState.depthTest;\n this._savedStateStencilTest = this.engine.stencilState.stencilTest;\n }\n /**\n * Restores engine states\n */\n restoreStates() {\n this.engine.depthCullingState.depthTest = this._savedStateDepthTest;\n this.engine.stencilState.stencilTest = this._savedStateStencilTest;\n }\n /**\n * Draws a full screen quad.\n */\n draw() {\n this.engine.drawElementsType(0, 0, 6);\n }\n _isRenderTargetTexture(texture) {\n return texture.renderTarget !== undefined;\n }\n /**\n * renders one or more effects to a specified texture\n * @param effectWrapper the effect to renderer\n * @param outputTexture texture to draw to, if null it will render to the currently bound frame buffer\n */\n render(effectWrapper, outputTexture = null) {\n // Ensure effect is ready\n if (!effectWrapper.effect.isReady()) {\n return;\n }\n this.saveStates();\n // Reset state\n this.setViewport();\n const out = outputTexture === null ? null : this._isRenderTargetTexture(outputTexture) ? outputTexture.renderTarget : outputTexture;\n if (out) {\n this.engine.bindFramebuffer(out);\n }\n this.applyEffectWrapper(effectWrapper);\n this.draw();\n if (out) {\n this.engine.unBindFramebuffer(out);\n }\n this.restoreStates();\n }\n /**\n * Disposes of the effect renderer\n */\n dispose() {\n const vertexBuffer = this._vertexBuffers[VertexBuffer.PositionKind];\n if (vertexBuffer) {\n vertexBuffer.dispose();\n delete this._vertexBuffers[VertexBuffer.PositionKind];\n }\n if (this._indexBuffer) {\n this.engine._releaseBuffer(this._indexBuffer);\n }\n if (this._onContextRestoredObserver) {\n this.engine.onContextRestoredObservable.remove(this._onContextRestoredObserver);\n this._onContextRestoredObserver = null;\n }\n }\n}\n/**\n * Wraps an effect to be used for rendering\n */\nexport class EffectWrapper {\n /**\n * Registers a shader code processing with an effect wrapper name.\n * @param effectWrapperName name of the effect wrapper. Use null for the fallback shader code processing. This is the shader code processing that will be used in case no specific shader code processing has been associated to an effect wrapper name\n * @param customShaderCodeProcessing shader code processing to associate to the effect wrapper name\n */\n static RegisterShaderCodeProcessing(effectWrapperName, customShaderCodeProcessing) {\n if (!customShaderCodeProcessing) {\n delete EffectWrapper._CustomShaderCodeProcessing[effectWrapperName ?? \"\"];\n return;\n }\n EffectWrapper._CustomShaderCodeProcessing[effectWrapperName ?? \"\"] = customShaderCodeProcessing;\n }\n static _GetShaderCodeProcessing(effectWrapperName) {\n return EffectWrapper._CustomShaderCodeProcessing[effectWrapperName] ?? EffectWrapper._CustomShaderCodeProcessing[\"\"];\n }\n /**\n * Gets or sets the name of the effect wrapper\n */\n get name() {\n return this.options.name;\n }\n set name(value) {\n this.options.name = value;\n }\n /**\n * Get a value indicating if the effect is ready to be used\n * @returns true if the post-process is ready (shader is compiled)\n */\n isReady() {\n return this._drawWrapper.effect?.isReady() ?? false;\n }\n /**\n * Get the draw wrapper associated with the effect wrapper\n * @returns the draw wrapper associated with the effect wrapper\n */\n get drawWrapper() {\n return this._drawWrapper;\n }\n /**\n * The underlying effect\n */\n get effect() {\n return this._drawWrapper.effect;\n }\n set effect(effect) {\n this._drawWrapper.effect = effect;\n }\n /**\n * Creates an effect to be rendered\n * @param creationOptions options to create the effect\n */\n constructor(creationOptions) {\n /**\n * Type of alpha mode to use when applying the effect (default: Engine.ALPHA_DISABLE). Used only if useAsPostProcess is true.\n */\n this.alphaMode = 0;\n /**\n * Executed when the effect is created\n * @returns effect that was created for this effect wrapper\n */\n this.onEffectCreatedObservable = new Observable(undefined, true);\n /**\n * Event that is fired (only when the EffectWrapper is used with an EffectRenderer) right before the effect is drawn (should be used to update uniforms)\n */\n this.onApplyObservable = new Observable();\n this._shadersLoaded = false;\n /** @internal */\n this._webGPUReady = false;\n this._importPromises = [];\n this.options = {\n ...creationOptions,\n name: creationOptions.name || \"effectWrapper\",\n engine: creationOptions.engine,\n uniforms: creationOptions.uniforms || creationOptions.uniformNames || [],\n uniformNames: undefined,\n samplers: creationOptions.samplers || creationOptions.samplerNames || [],\n samplerNames: undefined,\n attributeNames: creationOptions.attributeNames || [\"position\"],\n uniformBuffers: creationOptions.uniformBuffers || [],\n defines: creationOptions.defines || \"\",\n useShaderStore: creationOptions.useShaderStore || false,\n vertexUrl: creationOptions.vertexUrl || creationOptions.vertexShader || \"postprocess\",\n vertexShader: undefined,\n fragmentShader: creationOptions.fragmentShader || \"pass\",\n indexParameters: creationOptions.indexParameters,\n blockCompilation: creationOptions.blockCompilation || false,\n shaderLanguage: creationOptions.shaderLanguage || 0 /* ShaderLanguage.GLSL */,\n onCompiled: creationOptions.onCompiled || undefined,\n extraInitializations: creationOptions.extraInitializations || undefined,\n extraInitializationsAsync: creationOptions.extraInitializationsAsync || undefined,\n useAsPostProcess: creationOptions.useAsPostProcess ?? false,\n };\n this.options.uniformNames = this.options.uniforms;\n this.options.samplerNames = this.options.samplers;\n this.options.vertexShader = this.options.vertexUrl;\n if (this.options.useAsPostProcess) {\n if (this.options.samplers.indexOf(\"textureSampler\") === -1) {\n this.options.samplers.push(\"textureSampler\");\n }\n if (this.options.uniforms.indexOf(\"scale\") === -1) {\n this.options.uniforms.push(\"scale\");\n }\n }\n if (creationOptions.vertexUrl || creationOptions.vertexShader) {\n this._shaderPath = {\n vertexSource: this.options.vertexShader,\n };\n }\n else {\n if (!this.options.useAsPostProcess) {\n this.options.uniforms.push(\"scale\");\n this.onApplyObservable.add(() => {\n this.effect.setFloat2(\"scale\", 1, 1);\n });\n }\n this._shaderPath = {\n vertex: this.options.vertexShader,\n };\n }\n this._shaderPath.fragmentSource = this.options.fragmentShader;\n this._shaderPath.spectorName = this.options.name;\n if (this.options.useShaderStore) {\n this._shaderPath.fragment = this._shaderPath.fragmentSource;\n if (!this._shaderPath.vertex) {\n this._shaderPath.vertex = this._shaderPath.vertexSource;\n }\n delete this._shaderPath.fragmentSource;\n delete this._shaderPath.vertexSource;\n }\n this.onApplyObservable.add(() => {\n this.bind();\n });\n if (!this.options.useShaderStore) {\n this._onContextRestoredObserver = this.options.engine.onContextRestoredObservable.add(() => {\n this.effect._pipelineContext = null; // because _prepareEffect will try to dispose this pipeline before recreating it and that would lead to webgl errors\n this.effect._prepareEffect();\n });\n }\n this._drawWrapper = new DrawWrapper(this.options.engine);\n this._webGPUReady = this.options.shaderLanguage === 1 /* ShaderLanguage.WGSL */;\n const defines = Array.isArray(this.options.defines) ? this.options.defines.join(\"\\n\") : this.options.defines;\n this._postConstructor(this.options.blockCompilation, defines, this.options.extraInitializations);\n }\n _gatherImports(useWebGPU = false, list) {\n if (!this.options.useAsPostProcess) {\n return;\n }\n // this._webGPUReady is used to detect when an effect wrapper is intended to be used with WebGPU\n if (useWebGPU && this._webGPUReady) {\n list.push(Promise.all([import(\"../ShadersWGSL/postprocess.vertex.js\")]));\n }\n else {\n list.push(Promise.all([import(\"../Shaders/postprocess.vertex.js\")]));\n }\n }\n /** @internal */\n _postConstructor(blockCompilation, defines = null, extraInitializations, importPromises) {\n this._importPromises.length = 0;\n if (importPromises) {\n this._importPromises.push(...importPromises);\n }\n const useWebGPU = this.options.engine.isWebGPU && !EffectWrapper.ForceGLSL;\n this._gatherImports(useWebGPU, this._importPromises);\n if (extraInitializations !== undefined) {\n extraInitializations(useWebGPU, this._importPromises);\n }\n if (useWebGPU && this._webGPUReady) {\n this.options.shaderLanguage = 1 /* ShaderLanguage.WGSL */;\n }\n if (!blockCompilation) {\n this.updateEffect(defines);\n }\n }\n /**\n * Updates the effect with the current effect wrapper compile time values and recompiles the shader.\n * @param defines Define statements that should be added at the beginning of the shader. (default: null)\n * @param uniforms Set of uniform variables that will be passed to the shader. (default: null)\n * @param samplers Set of Texture2D variables that will be passed to the shader. (default: null)\n * @param indexParameters The index parameters to be used for babylons include syntax \"#include<kernelBlurVaryingDeclaration>[0..varyingCount]\". (default: undefined) See usage in babylon.blurPostProcess.ts and kernelBlur.vertex.fx\n * @param onCompiled Called when the shader has been compiled.\n * @param onError Called if there is an error when compiling a shader.\n * @param vertexUrl The url of the vertex shader to be used (default: the one given at construction time)\n * @param fragmentUrl The url of the fragment shader to be used (default: the one given at construction time)\n */\n updateEffect(defines = null, uniforms = null, samplers = null, indexParameters, onCompiled, onError, vertexUrl, fragmentUrl) {\n const customShaderCodeProcessing = EffectWrapper._GetShaderCodeProcessing(this.name);\n if (customShaderCodeProcessing?.defineCustomBindings) {\n const newUniforms = uniforms?.slice() ?? [];\n newUniforms.push(...this.options.uniforms);\n const newSamplers = samplers?.slice() ?? [];\n newSamplers.push(...this.options.samplers);\n defines = customShaderCodeProcessing.defineCustomBindings(this.name, defines, newUniforms, newSamplers);\n uniforms = newUniforms;\n samplers = newSamplers;\n }\n this.options.defines = defines || \"\";\n const waitImportsLoaded = this._shadersLoaded || this._importPromises.length === 0\n ? undefined\n : async () => {\n await Promise.all(this._importPromises);\n this._shadersLoaded = true;\n };\n let extraInitializationsAsync;\n if (this.options.extraInitializationsAsync) {\n extraInitializationsAsync = async () => {\n waitImportsLoaded?.();\n await this.options.extraInitializationsAsync;\n };\n }\n else {\n extraInitializationsAsync = waitImportsLoaded;\n }\n if (this.options.useShaderStore) {\n this._drawWrapper.effect = this.options.engine.createEffect({ vertex: vertexUrl ?? this._shaderPath.vertex, fragment: fragmentUrl ?? this._shaderPath.fragment }, {\n attributes: this.options.attributeNames,\n uniformsNames: uniforms || this.options.uniforms,\n uniformBuffersNames: this.options.uniformBuffers,\n samplers: samplers || this.options.samplers,\n defines: defines !== null ? defines : \"\",\n fallbacks: null,\n onCompiled: onCompiled ?? this.options.onCompiled,\n onError: onError ?? null,\n indexParameters: indexParameters || this.options.indexParameters,\n processCodeAfterIncludes: customShaderCodeProcessing?.processCodeAfterIncludes\n ? (shaderType, code) => customShaderCodeProcessing.processCodeAfterIncludes(this.name, shaderType, code)\n : null,\n processFinalCode: customShaderCodeProcessing?.processFinalCode\n ? (shaderType, code) => customShaderCodeProcessing.processFinalCode(this.name, shaderType, code)\n : null,\n shaderLanguage: this.options.shaderLanguage,\n extraInitializationsAsync,\n }, this.options.engine);\n }\n else {\n this._drawWrapper.effect = new Effect(this._shaderPath, this.options.attributeNames, uniforms || this.options.uniforms, samplers || this.options.samplerNames, this.options.engine, defines, undefined, onCompiled || this.options.onCompiled, undefined, undefined, undefined, this.options.shaderLanguage, extraInitializationsAsync);\n }\n this.onEffectCreatedObservable.notifyObservers(this._drawWrapper.effect);\n }\n /**\n * Binds the data to the effect.\n */\n bind() {\n if (this.options.useAsPostProcess) {\n this.options.engine.setAlphaMode(this.alphaMode);\n this.drawWrapper.effect.setFloat2(\"scale\", 1, 1);\n }\n EffectWrapper._GetShaderCodeProcessing(this.name)?.bindCustomBindings?.(this.name, this._drawWrapper.effect);\n }\n /**\n * Disposes of the effect wrapper\n * @param _ignored kept for backward compatibility\n */\n dispose(_ignored = false) {\n if (this._onContextRestoredObserver) {\n this.effect.getEngine().onContextRestoredObservable.remove(this._onContextRestoredObserver);\n this._onContextRestoredObserver = null;\n }\n this.onEffectCreatedObservable.clear();\n this.effect.dispose();\n }\n}\n/**\n * Force code to compile to glsl even on WebGPU engines.\n * False by default. This is mostly meant for backward compatibility.\n */\nEffectWrapper.ForceGLSL = false;\nEffectWrapper._CustomShaderCodeProcessing = {};\n"],"mappings":";AAAA,SAASA,YAAY,QAAQ,sBAAsB;AACnD,SAASC,QAAQ,QAAQ,2BAA2B;AAEpD,SAASC,UAAU,QAAQ,uBAAuB;AAClD,SAASC,MAAM,QAAQ,aAAa;AACpC,SAASC,WAAW,QAAQ,kBAAkB;AAC9C;AACA,OAAO,kCAAkC;AACzC;AACA,MAAMC,cAAc,GAAG;EACnBC,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;EACvCC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AAC9B,CAAC;AACD;AACA;AACA;AACA;AACA,OAAO,MAAMC,cAAc,CAAC;EACxB;AACJ;AACA;AACA;AACA;EACIC,WAAWA,CAACC,MAAM,EAAEC,OAAO,GAAGN,cAAc,EAAE;IAAA,IAAAO,kBAAA,EAAAC,gBAAA;IAC1C,IAAI,CAACC,mBAAmB,GAAG,IAAIb,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE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