@onerjs/core 8.30.6 → 8.30.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Debug/debugLayer.d.ts +1 -1
- package/Debug/debugLayer.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheSampler.js +4 -0
- package/Engines/WebGPU/webgpuCacheSampler.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.d.ts +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.js +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/baseWithPropertiesPostProcessBlock.d.ts +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/baseWithPropertiesPostProcessBlock.js +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/baseWithPropertiesPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/csmShadowGeneratorBlock.js +1 -1
- package/FrameGraph/Node/Blocks/Rendering/csmShadowGeneratorBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/shadowGeneratorBlock.js +1 -1
- package/FrameGraph/Node/Blocks/Rendering/shadowGeneratorBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.d.ts +3 -0
- package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.js +13 -0
- package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/index.d.ts +1 -0
- package/FrameGraph/Node/Blocks/index.js +1 -0
- package/FrameGraph/Node/Blocks/index.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.d.ts +4 -4
- package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.js +3 -4
- package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.d.ts +2 -3
- package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.js +1 -2
- package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.d.ts +3 -1
- package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.js +11 -1
- package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/copyToTextureTask.d.ts +4 -0
- package/FrameGraph/Tasks/Texture/copyToTextureTask.js +7 -1
- package/FrameGraph/Tasks/Texture/copyToTextureTask.js.map +1 -1
- package/FrameGraph/frameGraphRenderContext.d.ts +2 -1
- package/FrameGraph/frameGraphRenderContext.js +22 -3
- package/FrameGraph/frameGraphRenderContext.js.map +1 -1
- package/Materials/PBR/openpbrMaterial.js +2 -1
- package/Materials/PBR/openpbrMaterial.js.map +1 -1
- package/Meshes/Node/Blocks/randomBlock.js +11 -11
- package/Meshes/Node/Blocks/randomBlock.js.map +1 -1
- package/Misc/copyTextureToTexture.d.ts +8 -1
- package/Misc/copyTextureToTexture.js +16 -2
- package/Misc/copyTextureToTexture.js.map +1 -1
- package/Particles/Node/Blocks/particleRandomBlock.js +10 -10
- package/Particles/Node/Blocks/particleRandomBlock.js.map +1 -1
- package/Particles/Node/Blocks/systemBlock.d.ts +4 -0
- package/Particles/Node/Blocks/systemBlock.js +9 -0
- package/Particles/Node/Blocks/systemBlock.js.map +1 -1
- package/Particles/Node/nodeParticleSystemSet.helper.js +5 -4
- package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
- package/Particles/Node/nodeParticleSystemSet.js +1 -1
- package/Particles/Node/nodeParticleSystemSet.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +2 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
- package/Shaders/copyTextureToTexture.fragment.js +2 -2
- package/Shaders/copyTextureToTexture.fragment.js.map +1 -1
- package/ShadersWGSL/copyTextureToTexture.fragment.js +3 -3
- package/ShadersWGSL/copyTextureToTexture.fragment.js.map +1 -1
- package/XR/webXRSessionManager.js +4 -0
- package/XR/webXRSessionManager.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frameGraphRenderContext.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/frameGraphRenderContext.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD;;;GAGG;AACH,MAAM,OAAO,uBAAwB,SAAQ,iBAAiB;IASlD,MAAM,CAAC,iBAAiB,CAAC,KAAoD;QACjF,OAAQ,KAAwB,CAAC,UAAU,KAAK,SAAS,CAAC;IAC9D,CAAC;IAED,gBAAgB;IAChB,YAAY,MAAsB,EAAE,cAAwC,EAAE,KAAY;QACtF,KAAK,CAAC,MAAM,EAAE,cAAc,EAAE,KAAK,CAAC,CAAC;QAVjC,+BAA0B,GAAG,KAAK,CAAC;QACnC,yBAAoB,GAAG,IAAI,CAAC;QAUhC,IAAI,CAAC,eAAe,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxD,IAAI,CAAC,mBAAmB,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE;YACxD,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;YACvC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;SAC9B,CAAC,CAAC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or4Like,\r\n Layer,\r\n FrameGraphTextureHandle,\r\n Effect,\r\n FrameGraphTextureManager,\r\n ObjectRenderer,\r\n Scene,\r\n FrameGraphRenderTarget,\r\n InternalTexture,\r\n UtilityLayerRenderer,\r\n IStencilState,\r\n} from \"core/index\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { EffectRenderer } from \"../Materials/effectRenderer\";\r\nimport { CopyTextureToTexture } from \"../Misc/copyTextureToTexture\";\r\nimport { FrameGraphContext } from \"./frameGraphContext\";\r\n\r\n/**\r\n * Frame graph context used render passes.\r\n * @experimental\r\n */\r\nexport class FrameGraphRenderContext extends FrameGraphContext {\r\n private readonly _effectRenderer: EffectRenderer;\r\n private readonly _effectRendererBack: EffectRenderer;\r\n private _currentRenderTarget: FrameGraphRenderTarget | undefined;\r\n private _debugMessageWhenTargetBound: string | undefined;\r\n private _debugMessageHasBeenPushed = false;\r\n private _renderTargetIsBound = true;\r\n private readonly _copyTexture: CopyTextureToTexture;\r\n\r\n private static _IsObjectRenderer(value: Layer | ObjectRenderer | UtilityLayerRenderer): value is ObjectRenderer {\r\n return (value as ObjectRenderer).initRender !== undefined;\r\n }\r\n\r\n /** @internal */\r\n constructor(engine: AbstractEngine, textureManager: FrameGraphTextureManager, scene: Scene) {\r\n super(engine, textureManager, scene);\r\n this._effectRenderer = new EffectRenderer(this._engine);\r\n this._effectRendererBack = new EffectRenderer(this._engine, {\r\n positions: [1, 1, -1, 1, -1, -1, 1, -1],\r\n indices: [0, 2, 1, 0, 3, 2],\r\n });\r\n this._copyTexture = new CopyTextureToTexture(this._engine);\r\n }\r\n\r\n /**\r\n * Checks whether a texture handle points to the backbuffer's color or depth texture\r\n * @param handle The handle to check\r\n * @returns True if the handle points to the backbuffer's color or depth texture, otherwise false\r\n */\r\n public isBackbuffer(handle: FrameGraphTextureHandle): boolean {\r\n return this._textureManager._isBackbuffer(handle);\r\n }\r\n\r\n /**\r\n * Checks whether a texture handle points to the backbuffer's color texture\r\n * @param handle The handle to check\r\n * @returns True if the handle points to the backbuffer's color texture, otherwise false\r\n */\r\n public isBackbufferColor(handle: FrameGraphTextureHandle): boolean {\r\n return this._textureManager.isBackbufferColor(handle);\r\n }\r\n\r\n /**\r\n * Checks whether a texture handle points to the backbuffer's depth texture\r\n * @param handle The handle to check\r\n * @returns True if the handle points to the backbuffer's depth texture, otherwise false\r\n */\r\n public isBackbufferDepthStencil(handle: FrameGraphTextureHandle): boolean {\r\n return this._textureManager.isBackbufferDepthStencil(handle);\r\n }\r\n\r\n /**\r\n * Creates a (frame graph) render target wrapper\r\n * Note that renderTargets or renderTargetDepth can be undefined, but not both at the same time!\r\n * @param name Name of the render target wrapper\r\n * @param renderTargets Render target handles (textures) to use\r\n * @param renderTargetDepth Render target depth handle (texture) to use\r\n * @param depthReadOnly If true, the depth buffer will be read-only\r\n * @param stencilReadOnly If true, the stencil buffer will be read-only\r\n * @returns The created render target wrapper\r\n */\r\n public createRenderTarget(\r\n name: string,\r\n renderTargets?: FrameGraphTextureHandle | FrameGraphTextureHandle[],\r\n renderTargetDepth?: FrameGraphTextureHandle,\r\n depthReadOnly?: boolean,\r\n stencilReadOnly?: boolean\r\n ): FrameGraphRenderTarget {\r\n return this._textureManager.createRenderTarget(name, renderTargets, renderTargetDepth, depthReadOnly, stencilReadOnly);\r\n }\r\n\r\n /**\r\n * Clears the current render buffer or the current render target (if any is set up)\r\n * @param color Defines the color to use\r\n * @param backBuffer Defines if the back buffer must be cleared\r\n * @param depth Defines if the depth buffer must be cleared\r\n * @param stencil Defines if the stencil buffer must be cleared\r\n * @param stencilClearValue Defines the value to use to clear the stencil buffer (default is 0)\r\n */\r\n public clear(color: Nullable<IColor4Like>, backBuffer: boolean, depth: boolean, stencil?: boolean, stencilClearValue = 0): void {\r\n this._applyRenderTarget();\r\n this._engine.clear(color, backBuffer, depth, stencil, stencilClearValue);\r\n }\r\n\r\n /**\r\n * Clears the color attachments of the current render target\r\n * @param color Defines the color to use\r\n * @param attachments The attachments to clear\r\n */\r\n public clearColorAttachments(color: Nullable<IColor4Like>, attachments: number[]): void {\r\n this._applyRenderTarget();\r\n this._engine.bindAttachments(attachments);\r\n this._engine.clear(color, true, false, false);\r\n }\r\n\r\n /**\r\n * Clears all attachments (color(s) + depth/stencil) of the current render target\r\n * @param color Defines the color to use\r\n * @param attachments The attachments to clear\r\n * @param backBuffer Defines if the back buffer must be cleared\r\n * @param depth Defines if the depth buffer must be cleared\r\n * @param stencil Defines if the stencil buffer must be cleared\r\n * @param stencilClearValue Defines the value to use to clear the stencil buffer (default is 0)\r\n */\r\n public clearAttachments(color: Nullable<IColor4Like>, attachments: number[], backBuffer: boolean, depth: boolean, stencil?: boolean, stencilClearValue = 0): void {\r\n this._applyRenderTarget();\r\n this._engine.bindAttachments(attachments);\r\n this._engine.clear(color, backBuffer, depth, stencil, stencilClearValue);\r\n }\r\n\r\n /**\r\n * Binds the attachments to the current render target\r\n * @param attachments The attachments to bind\r\n */\r\n public bindAttachments(attachments: number[]): void {\r\n this._applyRenderTarget();\r\n this._engine.bindAttachments(attachments);\r\n }\r\n\r\n /**\r\n * Generates mipmaps for the current render target\r\n */\r\n public generateMipMaps(): void {\r\n if (this._currentRenderTarget?.renderTargetWrapper === undefined) {\r\n return;\r\n }\r\n\r\n if (this._renderTargetIsBound && this._engine._currentRenderTarget) {\r\n // we can't generate the mipmaps if the render target is bound\r\n this._flushDebugMessages();\r\n this._engine.unBindFramebuffer(this._engine._currentRenderTarget);\r\n this._renderTargetIsBound = false;\r\n }\r\n\r\n const textures = this._currentRenderTarget.renderTargetWrapper.textures;\r\n if (textures) {\r\n for (const texture of textures) {\r\n this._engine.generateMipmaps(texture);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Sets the texture sampling mode for a given texture handle\r\n * @param handle Handle of the texture to set the sampling mode for\r\n * @param samplingMode Sampling mode to set\r\n */\r\n public setTextureSamplingMode(handle: FrameGraphTextureHandle, samplingMode: number): void {\r\n const internalTexture = this._textureManager.getTextureFromHandle(handle);\r\n if (internalTexture && internalTexture.samplingMode !== samplingMode) {\r\n this._engine.updateTextureSamplingMode(samplingMode, internalTexture);\r\n }\r\n }\r\n\r\n /**\r\n * Binds a texture handle to a given effect (resolves the handle to a texture and binds it to the effect)\r\n * @param effect The effect to bind the texture to\r\n * @param name The name of the texture in the effect\r\n * @param handle The handle of the texture to bind\r\n */\r\n public bindTextureHandle(effect: Effect, name: string, handle: FrameGraphTextureHandle): void {\r\n let texture: Nullable<InternalTexture>;\r\n\r\n const historyEntry = this._textureManager._historyTextures.get(handle);\r\n if (historyEntry) {\r\n texture = historyEntry.textures[historyEntry.index]; // texture we write to in this frame\r\n if (\r\n this._currentRenderTarget !== undefined &&\r\n this._currentRenderTarget.renderTargetWrapper !== undefined &&\r\n this._currentRenderTarget.renderTargetWrapper.textures!.includes(texture!)\r\n ) {\r\n // If the current render target renders to the history write texture, we bind the read texture instead\r\n texture = historyEntry.textures[historyEntry.index ^ 1];\r\n }\r\n } else {\r\n texture = this._textureManager._textures.get(handle)!.texture;\r\n }\r\n\r\n effect._bindTexture(name, texture);\r\n }\r\n\r\n /**\r\n * Applies a full-screen effect to the current render target\r\n * @param drawWrapper The draw wrapper containing the effect to apply\r\n * @param customBindings The custom bindings to use when applying the effect (optional)\r\n * @param stencilState The stencil state to use when applying the effect (optional)\r\n * @param disableColorWrite If true, color write will be disabled when applying the effect (optional)\r\n * @param drawBackFace If true, the fullscreen quad will be drawn as a back face (in CW - optional)\r\n * @param depthTest If true, depth testing will be enabled when applying the effect (default is false)\r\n * @param noViewport If true, the current viewport will be left unchanged (optional). If false or undefined, the viewport will be set to the full render target size.\r\n * @returns True if the effect was applied, otherwise false (effect not ready)\r\n */\r\n public applyFullScreenEffect(\r\n drawWrapper: DrawWrapper,\r\n customBindings?: () => void,\r\n stencilState?: IStencilState,\r\n disableColorWrite?: boolean,\r\n drawBackFace?: boolean,\r\n depthTest?: boolean,\r\n noViewport?: boolean\r\n ): boolean {\r\n if (!drawWrapper.effect?.isReady()) {\r\n return false;\r\n }\r\n\r\n this._applyRenderTarget();\r\n\r\n const engineDepthMask = this._engine.getDepthWrite(); // for some reasons, depthWrite is not restored by EffectRenderer.restoreStates\r\n\r\n const effectRenderer = drawBackFace ? this._effectRendererBack : this._effectRenderer;\r\n\r\n effectRenderer.saveStates();\r\n if (!noViewport) {\r\n effectRenderer.setViewport();\r\n }\r\n\r\n this._engine.enableEffect(drawWrapper);\r\n this._engine.setState(false, undefined, undefined, undefined, undefined, stencilState);\r\n this._engine.setDepthBuffer(!!depthTest);\r\n if (disableColorWrite) {\r\n this._engine.setColorWrite(false);\r\n }\r\n this._engine.setDepthWrite(false);\r\n\r\n effectRenderer.bindBuffers(drawWrapper.effect);\r\n customBindings?.();\r\n effectRenderer.draw();\r\n effectRenderer.restoreStates();\r\n if (disableColorWrite) {\r\n this._engine.setColorWrite(true);\r\n }\r\n this._engine.setDepthWrite(engineDepthMask);\r\n this._engine.setAlphaMode(Constants.ALPHA_DISABLE);\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Copies a texture to the current render target\r\n * @param sourceTexture The source texture to copy from\r\n * @param forceCopyToBackbuffer If true, the copy will be done to the back buffer regardless of the current render target\r\n * @param noViewport If true, the current viewport will be left unchanged (optional). If false or undefined, the viewport will be set to the full render target size.\r\n */\r\n public copyTexture(sourceTexture: FrameGraphTextureHandle, forceCopyToBackbuffer = false, noViewport?: boolean): void {\r\n if (forceCopyToBackbuffer) {\r\n this.bindRenderTarget();\r\n }\r\n\r\n this._copyTexture.source = this._textureManager.getTextureFromHandle(sourceTexture, true)!;\r\n\r\n this.applyFullScreenEffect(\r\n this._copyTexture.effectWrapper.drawWrapper,\r\n () => {\r\n this._copyTexture.effectWrapper.onApplyObservable.notifyObservers({});\r\n },\r\n undefined,\r\n undefined,\r\n undefined,\r\n undefined,\r\n noViewport\r\n );\r\n }\r\n\r\n /**\r\n * Renders a RenderTargetTexture or a layer\r\n * @param object The RenderTargetTexture/Layer to render\r\n * @param viewportWidth The width of the viewport (optional for Layer, but mandatory for ObjectRenderer)\r\n * @param viewportHeight The height of the viewport (optional for Layer, but mandatory for ObjectRenderer)\r\n */\r\n public render(object: Layer | ObjectRenderer | UtilityLayerRenderer, viewportWidth?: number, viewportHeight?: number): void {\r\n if (FrameGraphRenderContext._IsObjectRenderer(object)) {\r\n this._scene._intermediateRendering = true;\r\n if (object.shouldRender()) {\r\n this._scene.incrementRenderId();\r\n this._scene.resetCachedMaterial();\r\n\r\n this._applyRenderTarget();\r\n\r\n object.prepareRenderList();\r\n\r\n object.initRender(viewportWidth!, viewportHeight!);\r\n\r\n object.render();\r\n\r\n object.finishRender();\r\n }\r\n this._scene._intermediateRendering = false;\r\n } else {\r\n this._applyRenderTarget();\r\n object.render();\r\n }\r\n }\r\n\r\n /**\r\n * Binds a render target texture so that upcoming draw calls will render to it\r\n * Note: it is a lazy operation, so the render target will only be bound when needed. This way, it is possible to call\r\n * this method several times with different render targets without incurring the cost of binding if no draw calls are made\r\n * @param renderTarget The handle of the render target texture to bind (default: undefined, meaning \"back buffer\"). Pass an array for MRT rendering.\r\n * @param debugMessage Optional debug message to display when the render target is bound (visible in PIX, for example)\r\n * @param applyImmediately If true, the render target will be applied immediately (otherwise it will be applied at first use). Default is false (delayed application).\r\n */\r\n public bindRenderTarget(renderTarget?: FrameGraphRenderTarget, debugMessage?: string, applyImmediately = false): void {\r\n if (\r\n (renderTarget?.renderTargetWrapper === undefined && this._currentRenderTarget === undefined) ||\r\n (renderTarget && this._currentRenderTarget && renderTarget.equals(this._currentRenderTarget))\r\n ) {\r\n this._flushDebugMessages();\r\n if (debugMessage !== undefined) {\r\n this._engine._debugPushGroup?.(debugMessage, 2);\r\n this._debugMessageWhenTargetBound = undefined;\r\n this._debugMessageHasBeenPushed = true;\r\n }\r\n if (applyImmediately) {\r\n this._applyRenderTarget();\r\n }\r\n return;\r\n }\r\n this._currentRenderTarget = renderTarget?.renderTargetWrapper === undefined ? undefined : renderTarget;\r\n this._debugMessageWhenTargetBound = debugMessage;\r\n this._renderTargetIsBound = false;\r\n if (applyImmediately) {\r\n this._applyRenderTarget();\r\n }\r\n }\r\n\r\n /** @internal */\r\n public _flushDebugMessages() {\r\n if (this._debugMessageHasBeenPushed) {\r\n this._engine._debugPopGroup?.(2);\r\n this._debugMessageHasBeenPushed = false;\r\n }\r\n }\r\n\r\n /** @internal */\r\n public _applyRenderTarget() {\r\n if (this._renderTargetIsBound) {\r\n return;\r\n }\r\n\r\n this._flushDebugMessages();\r\n\r\n const renderTargetWrapper = this._currentRenderTarget?.renderTargetWrapper;\r\n\r\n if (renderTargetWrapper === undefined) {\r\n this._engine.restoreDefaultFramebuffer();\r\n } else {\r\n if (this._engine._currentRenderTarget) {\r\n this._engine.unBindFramebuffer(this._engine._currentRenderTarget);\r\n }\r\n this._engine.bindFramebuffer(renderTargetWrapper);\r\n }\r\n\r\n if (this._debugMessageWhenTargetBound !== undefined) {\r\n this._engine._debugPushGroup?.(this._debugMessageWhenTargetBound, 2);\r\n this._debugMessageWhenTargetBound = undefined;\r\n this._debugMessageHasBeenPushed = true;\r\n }\r\n\r\n this._renderTargetIsBound = true;\r\n }\r\n\r\n /** @internal */\r\n public _isReady(): boolean {\r\n return this._copyTexture.isReady();\r\n }\r\n\r\n /** @internal */\r\n public _dispose() {\r\n this._effectRenderer.dispose();\r\n this._effectRendererBack.dispose();\r\n this._copyTexture.dispose();\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"frameGraphRenderContext.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/frameGraphRenderContext.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,8BAA8B,GAAG;IACnC,KAA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EAAE,CAAC;IAChC,CAAC;CACJ","sourcesContent":["import type {\r\n Nullable,\r\n AbstractEngine,\r\n DrawWrapper,\r\n IColor4Like,\r\n Layer,\r\n FrameGraphTextureHandle,\r\n Effect,\r\n FrameGraphTextureManager,\r\n ObjectRenderer,\r\n Scene,\r\n FrameGraphRenderTarget,\r\n InternalTexture,\r\n UtilityLayerRenderer,\r\n IStencilState,\r\n} from \"core/index\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { EffectRenderer } from \"../Materials/effectRenderer\";\r\nimport { CopyTextureToTexture } from \"../Misc/copyTextureToTexture\";\r\nimport { FrameGraphContext } from \"./frameGraphContext\";\r\n\r\nconst SamplingModeHasMipMapFiltering = [\r\n false, // not used\r\n false, // TEXTURE_NEAREST_SAMPLINGMODE / TEXTURE_NEAREST_NEAREST\r\n false, // TEXTURE_BILINEAR_SAMPLINGMODE / TEXTURE_LINEAR_LINEAR\r\n true, // TEXTURE_TRILINEAR_SAMPLINGMODE / TEXTURE_LINEAR_LINEAR_MIPLINEAR\r\n true, // TEXTURE_NEAREST_NEAREST_MIPNEAREST\r\n true, // TEXTURE_NEAREST_LINEAR_MIPNEAREST\r\n true, // TEXTURE_NEAREST_LINEAR_MIPLINEAR\r\n false, // TEXTURE_NEAREST_LINEAR\r\n true, // TEXTURE_NEAREST_NEAREST_MIPLINEAR\r\n true, // TEXTURE_LINEAR_NEAREST_MIPNEAREST\r\n true, // TEXTURE_LINEAR_NEAREST_MIPLINEAR\r\n true, // TEXTURE_LINEAR_LINEAR_MIPNEAREST\r\n false, // TEXTURE_LINEAR_NEAREST\r\n];\r\n\r\n/**\r\n * Frame graph context used render passes.\r\n * @experimental\r\n */\r\nexport class FrameGraphRenderContext extends FrameGraphContext {\r\n private readonly _effectRenderer: EffectRenderer;\r\n private readonly _effectRendererBack: EffectRenderer;\r\n private _currentRenderTarget: FrameGraphRenderTarget | undefined;\r\n private _debugMessageWhenTargetBound: string | undefined;\r\n private _debugMessageHasBeenPushed = false;\r\n private _renderTargetIsBound = true;\r\n private readonly _copyTexture: CopyTextureToTexture;\r\n\r\n private static _IsObjectRenderer(value: Layer | ObjectRenderer | UtilityLayerRenderer): value is ObjectRenderer {\r\n return (value as ObjectRenderer).initRender !== undefined;\r\n }\r\n\r\n /** @internal */\r\n constructor(engine: AbstractEngine, textureManager: FrameGraphTextureManager, scene: Scene) {\r\n super(engine, textureManager, scene);\r\n this._effectRenderer = new EffectRenderer(this._engine);\r\n this._effectRendererBack = new EffectRenderer(this._engine, {\r\n positions: [1, 1, -1, 1, -1, -1, 1, -1],\r\n indices: [0, 2, 1, 0, 3, 2],\r\n });\r\n this._copyTexture = new CopyTextureToTexture(this._engine);\r\n }\r\n\r\n /**\r\n * Checks whether a texture handle points to the backbuffer's color or depth texture\r\n * @param handle The handle to check\r\n * @returns True if the handle points to the backbuffer's color or depth texture, otherwise false\r\n */\r\n public isBackbuffer(handle: FrameGraphTextureHandle): boolean {\r\n return this._textureManager._isBackbuffer(handle);\r\n }\r\n\r\n /**\r\n * Checks whether a texture handle points to the backbuffer's color texture\r\n * @param handle The handle to check\r\n * @returns True if the handle points to the backbuffer's color texture, otherwise false\r\n */\r\n public isBackbufferColor(handle: FrameGraphTextureHandle): boolean {\r\n return this._textureManager.isBackbufferColor(handle);\r\n }\r\n\r\n /**\r\n * Checks whether a texture handle points to the backbuffer's depth texture\r\n * @param handle The handle to check\r\n * @returns True if the handle points to the backbuffer's depth texture, otherwise false\r\n */\r\n public isBackbufferDepthStencil(handle: FrameGraphTextureHandle): boolean {\r\n return this._textureManager.isBackbufferDepthStencil(handle);\r\n }\r\n\r\n /**\r\n * Creates a (frame graph) render target wrapper\r\n * Note that renderTargets or renderTargetDepth can be undefined, but not both at the same time!\r\n * @param name Name of the render target wrapper\r\n * @param renderTargets Render target handles (textures) to use\r\n * @param renderTargetDepth Render target depth handle (texture) to use\r\n * @param depthReadOnly If true, the depth buffer will be read-only\r\n * @param stencilReadOnly If true, the stencil buffer will be read-only\r\n * @returns The created render target wrapper\r\n */\r\n public createRenderTarget(\r\n name: string,\r\n renderTargets?: FrameGraphTextureHandle | FrameGraphTextureHandle[],\r\n renderTargetDepth?: FrameGraphTextureHandle,\r\n depthReadOnly?: boolean,\r\n stencilReadOnly?: boolean\r\n ): FrameGraphRenderTarget {\r\n return this._textureManager.createRenderTarget(name, renderTargets, renderTargetDepth, depthReadOnly, stencilReadOnly);\r\n }\r\n\r\n /**\r\n * Clears the current render buffer or the current render target (if any is set up)\r\n * @param color Defines the color to use\r\n * @param backBuffer Defines if the back buffer must be cleared\r\n * @param depth Defines if the depth buffer must be cleared\r\n * @param stencil Defines if the stencil buffer must be cleared\r\n * @param stencilClearValue Defines the value to use to clear the stencil buffer (default is 0)\r\n */\r\n public clear(color: Nullable<IColor4Like>, backBuffer: boolean, depth: boolean, stencil?: boolean, stencilClearValue = 0): void {\r\n this._applyRenderTarget();\r\n this._engine.clear(color, backBuffer, depth, stencil, stencilClearValue);\r\n }\r\n\r\n /**\r\n * Clears the color attachments of the current render target\r\n * @param color Defines the color to use\r\n * @param attachments The attachments to clear\r\n */\r\n public clearColorAttachments(color: Nullable<IColor4Like>, attachments: number[]): void {\r\n this._applyRenderTarget();\r\n this._engine.bindAttachments(attachments);\r\n this._engine.clear(color, true, false, false);\r\n }\r\n\r\n /**\r\n * Clears all attachments (color(s) + depth/stencil) of the current render target\r\n * @param color Defines the color to use\r\n * @param attachments The attachments to clear\r\n * @param backBuffer Defines if the back buffer must be cleared\r\n * @param depth Defines if the depth buffer must be cleared\r\n * @param stencil Defines if the stencil buffer must be cleared\r\n * @param stencilClearValue Defines the value to use to clear the stencil buffer (default is 0)\r\n */\r\n public clearAttachments(color: Nullable<IColor4Like>, attachments: number[], backBuffer: boolean, depth: boolean, stencil?: boolean, stencilClearValue = 0): void {\r\n this._applyRenderTarget();\r\n this._engine.bindAttachments(attachments);\r\n this._engine.clear(color, backBuffer, depth, stencil, stencilClearValue);\r\n }\r\n\r\n /**\r\n * Binds the attachments to the current render target\r\n * @param attachments The attachments to bind\r\n */\r\n public bindAttachments(attachments: number[]): void {\r\n this._applyRenderTarget();\r\n this._engine.bindAttachments(attachments);\r\n }\r\n\r\n /**\r\n * Generates mipmaps for the current render target\r\n */\r\n public generateMipMaps(): void {\r\n if (this._currentRenderTarget?.renderTargetWrapper === undefined) {\r\n return;\r\n }\r\n\r\n if (this._engine._currentRenderTarget && (!this._engine.isWebGPU || this._renderTargetIsBound)) {\r\n // we can't generate the mipmaps if the render target (which is the texture we want to generate mipmaps for) is bound\r\n // Also, for some reasons, on WebGL2, generating mipmaps doesn't work if a render target is bound, even if it's not the texture we want to generate mipmaps for...\r\n this._flushDebugMessages();\r\n this._engine.unBindFramebuffer(this._engine._currentRenderTarget);\r\n this._renderTargetIsBound = false;\r\n }\r\n\r\n const textures = this._currentRenderTarget.renderTargetWrapper.textures;\r\n if (textures) {\r\n for (const texture of textures) {\r\n this._engine.generateMipmaps(texture);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Sets the texture sampling mode for a given texture handle\r\n * @param handle Handle of the texture to set the sampling mode for\r\n * @param samplingMode Sampling mode to set\r\n */\r\n public setTextureSamplingMode(handle: FrameGraphTextureHandle, samplingMode: number): void {\r\n const internalTexture = this._textureManager.getTextureFromHandle(handle);\r\n if (internalTexture && internalTexture.samplingMode !== samplingMode) {\r\n internalTexture.useMipMaps = SamplingModeHasMipMapFiltering[samplingMode];\r\n this._engine.updateTextureSamplingMode(samplingMode, internalTexture);\r\n }\r\n }\r\n\r\n /**\r\n * Binds a texture handle to a given effect (resolves the handle to a texture and binds it to the effect)\r\n * @param effect The effect to bind the texture to\r\n * @param name The name of the texture in the effect\r\n * @param handle The handle of the texture to bind\r\n */\r\n public bindTextureHandle(effect: Effect, name: string, handle: FrameGraphTextureHandle): void {\r\n let texture: Nullable<InternalTexture>;\r\n\r\n const historyEntry = this._textureManager._historyTextures.get(handle);\r\n if (historyEntry) {\r\n texture = historyEntry.textures[historyEntry.index]; // texture we write to in this frame\r\n if (\r\n this._currentRenderTarget !== undefined &&\r\n this._currentRenderTarget.renderTargetWrapper !== undefined &&\r\n this._currentRenderTarget.renderTargetWrapper.textures!.includes(texture!)\r\n ) {\r\n // If the current render target renders to the history write texture, we bind the read texture instead\r\n texture = historyEntry.textures[historyEntry.index ^ 1];\r\n }\r\n } else {\r\n texture = this._textureManager._textures.get(handle)!.texture;\r\n }\r\n\r\n effect._bindTexture(name, texture);\r\n }\r\n\r\n /**\r\n * Applies a full-screen effect to the current render target\r\n * @param drawWrapper The draw wrapper containing the effect to apply\r\n * @param customBindings The custom bindings to use when applying the effect (optional)\r\n * @param stencilState The stencil state to use when applying the effect (optional)\r\n * @param disableColorWrite If true, color write will be disabled when applying the effect (optional)\r\n * @param drawBackFace If true, the fullscreen quad will be drawn as a back face (in CW - optional)\r\n * @param depthTest If true, depth testing will be enabled when applying the effect (default is false)\r\n * @param noViewport If true, the current viewport will be left unchanged (optional). If false or undefined, the viewport will be set to the full render target size.\r\n * @returns True if the effect was applied, otherwise false (effect not ready)\r\n */\r\n public applyFullScreenEffect(\r\n drawWrapper: DrawWrapper,\r\n customBindings?: () => void,\r\n stencilState?: IStencilState,\r\n disableColorWrite?: boolean,\r\n drawBackFace?: boolean,\r\n depthTest?: boolean,\r\n noViewport?: boolean\r\n ): boolean {\r\n if (!drawWrapper.effect?.isReady()) {\r\n return false;\r\n }\r\n\r\n this._applyRenderTarget();\r\n\r\n const engineDepthMask = this._engine.getDepthWrite(); // for some reasons, depthWrite is not restored by EffectRenderer.restoreStates\r\n\r\n const effectRenderer = drawBackFace ? this._effectRendererBack : this._effectRenderer;\r\n\r\n effectRenderer.saveStates();\r\n if (!noViewport) {\r\n effectRenderer.setViewport();\r\n }\r\n\r\n this._engine.enableEffect(drawWrapper);\r\n this._engine.setState(false, undefined, undefined, undefined, undefined, stencilState);\r\n this._engine.setDepthBuffer(!!depthTest);\r\n if (disableColorWrite) {\r\n this._engine.setColorWrite(false);\r\n }\r\n this._engine.setDepthWrite(false);\r\n\r\n effectRenderer.bindBuffers(drawWrapper.effect);\r\n customBindings?.();\r\n effectRenderer.draw();\r\n effectRenderer.restoreStates();\r\n if (disableColorWrite) {\r\n this._engine.setColorWrite(true);\r\n }\r\n this._engine.setDepthWrite(engineDepthMask);\r\n this._engine.setAlphaMode(Constants.ALPHA_DISABLE);\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Copies a texture to the current render target\r\n * @param sourceTexture The source texture to copy from\r\n * @param forceCopyToBackbuffer If true, the copy will be done to the back buffer regardless of the current render target\r\n * @param noViewport If true, the current viewport will be left unchanged (optional). If false or undefined, the viewport will be set to the full render target size.\r\n * @param lodLevel The LOD level to use when copying the texture (default: 0).\r\n */\r\n public copyTexture(sourceTexture: FrameGraphTextureHandle, forceCopyToBackbuffer = false, noViewport?: boolean, lodLevel = 0): void {\r\n if (forceCopyToBackbuffer) {\r\n this.bindRenderTarget();\r\n }\r\n\r\n this._copyTexture.source = this._textureManager.getTextureFromHandle(sourceTexture, true)!;\r\n this._copyTexture.lodLevel = lodLevel;\r\n\r\n this.applyFullScreenEffect(\r\n this._copyTexture.effectWrapper.drawWrapper,\r\n () => {\r\n this._copyTexture.effectWrapper.onApplyObservable.notifyObservers({});\r\n },\r\n undefined,\r\n undefined,\r\n undefined,\r\n undefined,\r\n noViewport\r\n );\r\n }\r\n\r\n /**\r\n * Renders a RenderTargetTexture or a layer\r\n * @param object The RenderTargetTexture/Layer to render\r\n * @param viewportWidth The width of the viewport (optional for Layer, but mandatory for ObjectRenderer)\r\n * @param viewportHeight The height of the viewport (optional for Layer, but mandatory for ObjectRenderer)\r\n */\r\n public render(object: Layer | ObjectRenderer | UtilityLayerRenderer, viewportWidth?: number, viewportHeight?: number): void {\r\n if (FrameGraphRenderContext._IsObjectRenderer(object)) {\r\n this._scene._intermediateRendering = true;\r\n if (object.shouldRender()) {\r\n this._scene.incrementRenderId();\r\n this._scene.resetCachedMaterial();\r\n\r\n this._applyRenderTarget();\r\n\r\n object.prepareRenderList();\r\n\r\n object.initRender(viewportWidth!, viewportHeight!);\r\n\r\n object.render();\r\n\r\n object.finishRender();\r\n }\r\n this._scene._intermediateRendering = false;\r\n } else {\r\n this._applyRenderTarget();\r\n object.render();\r\n }\r\n }\r\n\r\n /**\r\n * Binds a render target texture so that upcoming draw calls will render to it\r\n * Note: it is a lazy operation, so the render target will only be bound when needed. This way, it is possible to call\r\n * this method several times with different render targets without incurring the cost of binding if no draw calls are made\r\n * @param renderTarget The handle of the render target texture to bind (default: undefined, meaning \"back buffer\"). Pass an array for MRT rendering.\r\n * @param debugMessage Optional debug message to display when the render target is bound (visible in PIX, for example)\r\n * @param applyImmediately If true, the render target will be applied immediately (otherwise it will be applied at first use). Default is false (delayed application).\r\n */\r\n public bindRenderTarget(renderTarget?: FrameGraphRenderTarget, debugMessage?: string, applyImmediately = false): void {\r\n if (\r\n (renderTarget?.renderTargetWrapper === undefined && this._currentRenderTarget === undefined) ||\r\n (renderTarget && this._currentRenderTarget && renderTarget.equals(this._currentRenderTarget))\r\n ) {\r\n this._flushDebugMessages();\r\n if (debugMessage !== undefined) {\r\n this._engine._debugPushGroup?.(debugMessage, 2);\r\n this._debugMessageWhenTargetBound = undefined;\r\n this._debugMessageHasBeenPushed = true;\r\n }\r\n if (applyImmediately) {\r\n this._applyRenderTarget();\r\n }\r\n return;\r\n }\r\n this._currentRenderTarget = renderTarget?.renderTargetWrapper === undefined ? undefined : renderTarget;\r\n this._debugMessageWhenTargetBound = debugMessage;\r\n this._renderTargetIsBound = false;\r\n if (applyImmediately) {\r\n this._applyRenderTarget();\r\n }\r\n }\r\n\r\n /** @internal */\r\n public _flushDebugMessages() {\r\n if (this._debugMessageHasBeenPushed) {\r\n this._engine._debugPopGroup?.(2);\r\n this._debugMessageHasBeenPushed = false;\r\n }\r\n }\r\n\r\n /** @internal */\r\n public _applyRenderTarget() {\r\n if (this._renderTargetIsBound) {\r\n return;\r\n }\r\n\r\n this._flushDebugMessages();\r\n\r\n const renderTargetWrapper = this._currentRenderTarget?.renderTargetWrapper;\r\n\r\n if (renderTargetWrapper === undefined) {\r\n this._engine.restoreDefaultFramebuffer();\r\n } else {\r\n if (this._engine._currentRenderTarget) {\r\n this._engine.unBindFramebuffer(this._engine._currentRenderTarget);\r\n }\r\n this._engine.bindFramebuffer(renderTargetWrapper);\r\n }\r\n\r\n if (this._debugMessageWhenTargetBound !== undefined) {\r\n this._engine._debugPushGroup?.(this._debugMessageWhenTargetBound, 2);\r\n this._debugMessageWhenTargetBound = undefined;\r\n this._debugMessageHasBeenPushed = true;\r\n }\r\n\r\n this._renderTargetIsBound = true;\r\n }\r\n\r\n /** @internal */\r\n public _isReady(): boolean {\r\n return this._copyTexture.isReady();\r\n }\r\n\r\n /** @internal */\r\n public _dispose() {\r\n this._effectRenderer.dispose();\r\n this._effectRendererBack.dispose();\r\n this._copyTexture.dispose();\r\n }\r\n}\r\n"]}
|
|
@@ -25,6 +25,7 @@ import { Vector2, Vector4, TmpVectors } from "../../Maths/math.vector.js";
|
|
|
25
25
|
import { ImageProcessingMixin } from "../imageProcessing.js";
|
|
26
26
|
import { PushMaterial } from "../pushMaterial.js";
|
|
27
27
|
import { SmartArray } from "../../Misc/smartArray.js";
|
|
28
|
+
import { Tools } from "../../Misc/tools.js";
|
|
28
29
|
const onCreatedEffectParameters = { effect: null, subMesh: null };
|
|
29
30
|
class Uniform {
|
|
30
31
|
populateVectorFromLinkedProperties(vector) {
|
|
@@ -906,7 +907,7 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase {
|
|
|
906
907
|
Logger.Error("OpenPBRMaterial: WebGL 2.0 or above is required for this material.");
|
|
907
908
|
}
|
|
908
909
|
if (!OpenPBRMaterial._noiseTextures[this.getScene().uniqueId]) {
|
|
909
|
-
OpenPBRMaterial._noiseTextures[this.getScene().uniqueId] = new Texture("https://assets.babylonjs.com/
|
|
910
|
+
OpenPBRMaterial._noiseTextures[this.getScene().uniqueId] = new Texture(Tools.GetAssetUrl("https://assets.babylonjs.com/core/blue_noise/blue_noise_rgb.png"), this.getScene(), false, true, 1);
|
|
910
911
|
this.getScene().onDisposeObservable.addOnce(() => {
|
|
911
912
|
OpenPBRMaterial._noiseTextures[this.getScene().uniqueId]?.dispose();
|
|
912
913
|
delete OpenPBRMaterial._noiseTextures[this.getScene().uniqueId];
|