@babylonjs/core 7.54.1 → 7.54.2

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.
Files changed (81) hide show
  1. package/AudioV2/abstractAudio/staticSound.d.ts +11 -14
  2. package/AudioV2/abstractAudio/staticSound.js +6 -8
  3. package/AudioV2/abstractAudio/staticSound.js.map +1 -1
  4. package/AudioV2/webAudio/webAudioEngine.d.ts +2 -2
  5. package/AudioV2/webAudio/webAudioEngine.js.map +1 -1
  6. package/AudioV2/webAudio/webAudioStaticSound.js +2 -10
  7. package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -1
  8. package/Cameras/arcRotateCamera.js +1 -1
  9. package/Cameras/arcRotateCamera.js.map +1 -1
  10. package/Debug/debugLayer.d.ts +1 -1
  11. package/Debug/debugLayer.js.map +1 -1
  12. package/Engines/abstractEngine.js +2 -2
  13. package/Engines/abstractEngine.js.map +1 -1
  14. package/Engines/constants.d.ts +5 -1
  15. package/Engines/constants.js +5 -1
  16. package/Engines/constants.js.map +1 -1
  17. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.d.ts +3 -0
  18. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js +13 -0
  19. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js.map +1 -1
  20. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js +16 -0
  21. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js.map +1 -1
  22. package/FrameGraph/Node/Blocks/Rendering/objectRendererBlock.d.ts +0 -3
  23. package/FrameGraph/Node/Blocks/Rendering/objectRendererBlock.js +8 -14
  24. package/FrameGraph/Node/Blocks/Rendering/objectRendererBlock.js.map +1 -1
  25. package/FrameGraph/Node/Blocks/Textures/clearBlock.d.ts +3 -0
  26. package/FrameGraph/Node/Blocks/Textures/clearBlock.js +13 -0
  27. package/FrameGraph/Node/Blocks/Textures/clearBlock.js.map +1 -1
  28. package/FrameGraph/Node/nodeRenderGraph.js +2 -1
  29. package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
  30. package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +4 -0
  31. package/FrameGraph/Tasks/Rendering/objectRendererTask.js +6 -0
  32. package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
  33. package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js +1 -0
  34. package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js.map +1 -1
  35. package/FrameGraph/Tasks/Texture/clearTextureTask.d.ts +4 -0
  36. package/FrameGraph/Tasks/Texture/clearTextureTask.js +11 -2
  37. package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -1
  38. package/FrameGraph/frameGraph.d.ts +18 -2
  39. package/FrameGraph/frameGraph.js +26 -1
  40. package/FrameGraph/frameGraph.js.map +1 -1
  41. package/Materials/GreasedLine/greasedLineSimpleMaterial.js +5 -4
  42. package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
  43. package/Materials/Node/Blocks/PBR/clearCoatBlock.d.ts +2 -0
  44. package/Materials/Node/Blocks/PBR/clearCoatBlock.js +14 -7
  45. package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
  46. package/Materials/Node/Blocks/PBR/index.d.ts +1 -0
  47. package/Materials/Node/Blocks/PBR/index.js +1 -0
  48. package/Materials/Node/Blocks/PBR/index.js.map +1 -1
  49. package/Materials/Node/Blocks/PBR/iridescenceBlock.js +2 -1
  50. package/Materials/Node/Blocks/PBR/iridescenceBlock.js.map +1 -1
  51. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +3 -1
  52. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  53. package/Materials/Textures/renderTargetTexture.d.ts +5 -0
  54. package/Materials/Textures/renderTargetTexture.js +9 -0
  55. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  56. package/Materials/effect.js +1 -1
  57. package/Materials/material.d.ts +5 -1
  58. package/Materials/material.js +9 -2
  59. package/Materials/material.js.map +1 -1
  60. package/Materials/materialPluginBase.js +1 -1
  61. package/Maths/math.vector.d.ts +7 -0
  62. package/Maths/math.vector.js +17 -0
  63. package/Maths/math.vector.js.map +1 -1
  64. package/Rendering/depthPeelingSceneComponent.js +1 -1
  65. package/Rendering/objectRenderer.d.ts +7 -0
  66. package/Rendering/objectRenderer.js +19 -0
  67. package/Rendering/objectRenderer.js.map +1 -1
  68. package/Shaders/ShadersInclude/pbrBlockIridescence.js +1 -0
  69. package/Shaders/ShadersInclude/pbrBlockIridescence.js.map +1 -1
  70. package/Shaders/pbr.fragment.js +1 -0
  71. package/Shaders/pbr.fragment.js.map +1 -1
  72. package/ShadersWGSL/ShadersInclude/pbrBlockIridescence.js +3 -2
  73. package/ShadersWGSL/ShadersInclude/pbrBlockIridescence.js.map +1 -1
  74. package/ShadersWGSL/pbr.fragment.js +1 -0
  75. package/ShadersWGSL/pbr.fragment.js.map +1 -1
  76. package/Sprites/spriteManager.js +1 -1
  77. package/Sprites/spriteManager.js.map +1 -1
  78. package/package.json +1 -1
  79. package/scene.d.ts +10 -0
  80. package/scene.js +18 -1
  81. package/scene.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"nodeRenderGraph.js","sourceRoot":"","sources":["../../../../../dev/core/src/FrameGraph/Node/nodeRenderGraph.ts"],"names":[],"mappings":";AAcA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD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ACQ;AAMb;IADN,SAAS,CAAC,SAAS,CAAC;gDACE","sourcesContent":["/* eslint-disable import/no-internal-modules */\r\nimport type {\r\n Observer,\r\n Nullable,\r\n NodeRenderGraphBlock,\r\n NodeRenderGraphTeleportOutBlock,\r\n NodeRenderGraphTeleportInBlock,\r\n AbstractEngine,\r\n INodeRenderGraphCreateOptions,\r\n INodeRenderGraphEditorOptions,\r\n Scene,\r\n WritableObject,\r\n IShadowLight,\r\n} from \"core/index\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { NodeRenderGraphOutputBlock } from \"./Blocks/outputBlock\";\r\nimport { FrameGraph } from \"../frameGraph\";\r\nimport { GetClass } from \"../../Misc/typeStore\";\r\nimport { serialize } from \"../../Misc/decorators\";\r\nimport { SerializationHelper } from \"../../Misc/decorators.serialization\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport { WebRequest } from \"../../Misc/webRequest\";\r\nimport { NodeRenderGraphInputBlock } from \"./Blocks/inputBlock\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport { Engine } from \"../../Engines/engine\";\r\nimport { NodeRenderGraphBlockConnectionPointTypes } from \"./Types/nodeRenderGraphTypes\";\r\nimport { NodeRenderGraphClearBlock } from \"./Blocks/Textures/clearBlock\";\r\nimport { NodeRenderGraphObjectRendererBlock } from \"./Blocks/Rendering/objectRendererBlock\";\r\nimport { NodeRenderGraphBuildState } from \"./nodeRenderGraphBuildState\";\r\n\r\n// declare NODERENDERGRAPHEDITOR namespace for compilation issue\r\ndeclare let NODERENDERGRAPHEDITOR: any;\r\ndeclare let BABYLON: any;\r\n\r\n/**\r\n * Defines a node render graph\r\n */\r\nexport class NodeRenderGraph {\r\n private static _BuildIdGenerator: number = 0;\r\n\r\n private _buildId: number = NodeRenderGraph._BuildIdGenerator++;\r\n\r\n /** Define the Url to load node editor script */\r\n public static EditorURL = `${Tools._DefaultCdnUrl}/v${Engine.Version}/NodeRenderGraph/babylon.nodeRenderGraph.js`;\r\n\r\n /** Define the Url to load snippets */\r\n public static SnippetUrl = Constants.SnippetUrl;\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private BJSNODERENDERGRAPHEDITOR = this._getGlobalNodeRenderGraphEditor();\r\n\r\n /** @returns the inspector from bundle or global */\r\n private _getGlobalNodeRenderGraphEditor(): any {\r\n // UMD Global name detection from Webpack Bundle UMD Name.\r\n if (typeof NODERENDERGRAPHEDITOR !== \"undefined\") {\r\n return NODERENDERGRAPHEDITOR;\r\n }\r\n\r\n // In case of module let's check the global emitted from the editor entry point.\r\n if (typeof BABYLON !== \"undefined\" && typeof BABYLON.NodeRenderGraphEditor !== \"undefined\") {\r\n return BABYLON;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Gets or sets data used by visual editor\r\n * @see https://nrge.babylonjs.com\r\n */\r\n public editorData: any = null;\r\n\r\n /**\r\n * Gets an array of blocks that needs to be serialized even if they are not yet connected\r\n */\r\n public attachedBlocks: NodeRenderGraphBlock[] = [];\r\n\r\n /**\r\n * Observable raised when the node render graph is built\r\n */\r\n public onBuildObservable = new Observable<NodeRenderGraph>();\r\n\r\n /**\r\n * Observable raised when an error is detected\r\n */\r\n public onBuildErrorObservable = new Observable<string>();\r\n\r\n /** Gets or sets the RenderGraphOutputBlock used to gather the final node render graph data */\r\n public outputBlock: Nullable<NodeRenderGraphOutputBlock> = null;\r\n\r\n /**\r\n * Snippet ID if the graph was created from the snippet server\r\n */\r\n public snippetId: string;\r\n\r\n /**\r\n * The name of the node render graph\r\n */\r\n @serialize()\r\n public name: string;\r\n\r\n /**\r\n * A free comment about the graph\r\n */\r\n @serialize(\"comment\")\r\n public comment: string;\r\n\r\n private readonly _engine: AbstractEngine;\r\n private readonly _scene: Scene;\r\n private readonly _resizeObserver: Nullable<Observer<AbstractEngine>> = null;\r\n private readonly _frameGraph: FrameGraph;\r\n private readonly _options: INodeRenderGraphCreateOptions;\r\n\r\n /**\r\n * Gets the frame graph used by this node render graph\r\n */\r\n public get frameGraph() {\r\n return this._frameGraph;\r\n }\r\n\r\n /**\r\n * Gets the scene used by this node render graph\r\n * @returns the scene used by this node render graph\r\n */\r\n public getScene() {\r\n return this._scene;\r\n }\r\n\r\n /**\r\n * Creates a new node render graph\r\n * @param name defines the name of the node render graph\r\n * @param scene defines the scene to use to execute the graph\r\n * @param options defines the options to use when creating the graph\r\n */\r\n public constructor(name: string, scene: Scene, options?: INodeRenderGraphCreateOptions) {\r\n this.name = name;\r\n this._scene = scene;\r\n this._engine = scene.getEngine();\r\n\r\n options = {\r\n debugTextures: false,\r\n autoConfigure: false,\r\n verbose: false,\r\n rebuildGraphOnEngineResize: true,\r\n autoFillExternalInputs: true,\r\n ...options,\r\n };\r\n\r\n this._options = options;\r\n\r\n this._frameGraph = new FrameGraph(this._scene, options.debugTextures);\r\n\r\n if (options.rebuildGraphOnEngineResize) {\r\n this._resizeObserver = this._engine.onResizeObservable.add(() => {\r\n this.build();\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Gets the current class name (\"NodeRenderGraph\")\r\n * @returns the class name\r\n */\r\n public getClassName(): string {\r\n return \"NodeRenderGraph\";\r\n }\r\n\r\n /**\r\n * Gets a block by its name\r\n * @param name defines the name of the block to retrieve\r\n * @returns the required block or null if not found\r\n */\r\n public getBlockByName<T extends NodeRenderGraphBlock>(name: string): Nullable<T> {\r\n let result: Nullable<T> = null;\r\n for (const block of this.attachedBlocks) {\r\n if (block.name === name) {\r\n if (!result) {\r\n result = block as T;\r\n } else {\r\n Tools.Warn(\"More than one block was found with the name `\" + name + \"`\");\r\n return result;\r\n }\r\n }\r\n }\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Get a block using a predicate\r\n * @param predicate defines the predicate used to find the good candidate\r\n * @returns the required block or null if not found\r\n */\r\n public getBlockByPredicate<T extends NodeRenderGraphBlock>(predicate: (block: NodeRenderGraphBlock) => boolean): Nullable<T> {\r\n for (const block of this.attachedBlocks) {\r\n if (predicate(block)) {\r\n return block as T;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Get all blocks that match a predicate\r\n * @param predicate defines the predicate used to find the good candidate(s)\r\n * @returns the list of blocks found\r\n */\r\n public getBlocksByPredicate<T extends NodeRenderGraphBlock>(predicate: (block: NodeRenderGraphBlock) => boolean): T[] {\r\n const blocks: T[] = [];\r\n for (const block of this.attachedBlocks) {\r\n if (predicate(block)) {\r\n blocks.push(block as T);\r\n }\r\n }\r\n\r\n return blocks;\r\n }\r\n\r\n /**\r\n * Gets the list of input blocks attached to this material\r\n * @returns an array of InputBlocks\r\n */\r\n public getInputBlocks() {\r\n const blocks: NodeRenderGraphInputBlock[] = [];\r\n for (const block of this.attachedBlocks) {\r\n if (block.isInput) {\r\n blocks.push(block as NodeRenderGraphInputBlock);\r\n }\r\n }\r\n\r\n return blocks;\r\n }\r\n\r\n /**\r\n * Launch the node render graph editor\r\n * @param config Define the configuration of the editor\r\n * @returns a promise fulfilled when the node editor is visible\r\n */\r\n public edit(config?: INodeRenderGraphEditorOptions): Promise<void> {\r\n return new Promise((resolve) => {\r\n this.BJSNODERENDERGRAPHEDITOR = this.BJSNODERENDERGRAPHEDITOR || this._getGlobalNodeRenderGraphEditor();\r\n if (typeof this.BJSNODERENDERGRAPHEDITOR == \"undefined\") {\r\n const editorUrl = config && config.editorURL ? config.editorURL : NodeRenderGraph.EditorURL;\r\n\r\n // Load editor and add it to the DOM\r\n Tools.LoadBabylonScript(editorUrl, () => {\r\n this.BJSNODERENDERGRAPHEDITOR = this.BJSNODERENDERGRAPHEDITOR || this._getGlobalNodeRenderGraphEditor();\r\n this._createNodeEditor(config?.nodeRenderGraphEditorConfig);\r\n resolve();\r\n });\r\n } else {\r\n // Otherwise creates the editor\r\n this._createNodeEditor(config?.nodeRenderGraphEditorConfig);\r\n resolve();\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Creates the node editor window.\r\n * @param additionalConfig Additional configuration for the FGE\r\n */\r\n private _createNodeEditor(additionalConfig?: any) {\r\n const nodeEditorConfig: any = {\r\n nodeRenderGraph: this,\r\n ...additionalConfig,\r\n };\r\n this.BJSNODERENDERGRAPHEDITOR.NodeRenderGraphEditor.Show(nodeEditorConfig);\r\n }\r\n\r\n /**\r\n * Build the final list of blocks that will be executed by the \"execute\" method\r\n */\r\n public build() {\r\n if (!this.outputBlock) {\r\n throw new Error(\"You must define the outputBlock property before building the node render graph\");\r\n }\r\n\r\n this._initializeBlock(this.outputBlock);\r\n\r\n this._frameGraph.clear();\r\n\r\n const state = new NodeRenderGraphBuildState();\r\n\r\n state.buildId = this._buildId;\r\n state.verbose = this._options.verbose!;\r\n\r\n if (this._options.autoFillExternalInputs) {\r\n this._autoFillExternalInputs();\r\n }\r\n\r\n try {\r\n this.outputBlock.build(state);\r\n\r\n this._frameGraph.build();\r\n } finally {\r\n this._buildId = NodeRenderGraph._BuildIdGenerator++;\r\n\r\n if (state.emitErrors(this.onBuildErrorObservable)) {\r\n this.onBuildObservable.notifyObservers(this);\r\n }\r\n }\r\n }\r\n\r\n private _autoFillExternalInputs() {\r\n const allInputs = this.getInputBlocks();\r\n\r\n const shadowLights: IShadowLight[] = [];\r\n for (const light of this._scene.lights) {\r\n if ((light as IShadowLight).setShadowProjectionMatrix !== undefined) {\r\n shadowLights.push(light as IShadowLight);\r\n }\r\n }\r\n\r\n let cameraIndex = 0;\r\n let lightIndex = 0;\r\n for (const input of allInputs) {\r\n if (!input.isExternal) {\r\n continue;\r\n }\r\n if (!input.isAnAncestorOfType(\"NodeRenderGraphOutputBlock\")) {\r\n continue;\r\n }\r\n if ((input.type & NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBuffer) !== 0) {\r\n // nothing to do\r\n } else if (input.isCamera()) {\r\n const camera = this._scene.cameras[cameraIndex++] || this._scene.cameras[0];\r\n if (!this._scene.cameraToUseForPointers) {\r\n this._scene.cameraToUseForPointers = camera;\r\n }\r\n\r\n input.value = camera;\r\n } else if (input.isObjectList()) {\r\n input.value = { meshes: this._scene.meshes, particleSystems: this._scene.particleSystems };\r\n } else if (input.isShadowLight()) {\r\n if (lightIndex < shadowLights.length) {\r\n input.value = shadowLights[lightIndex++];\r\n lightIndex = lightIndex % shadowLights.length;\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Returns a promise that resolves when the node render graph is ready to be executed\r\n * This method must be called after the graph has been built (NodeRenderGraph.build called)!\r\n * @param timeStep Time step in ms between retries (default is 16)\r\n * @param maxTimeout Maximum time in ms to wait for the graph to be ready (default is 30000)\r\n * @returns The promise that resolves when the graph is ready\r\n */\r\n public whenReadyAsync(timeStep = 16, maxTimeout = 30000): Promise<void> {\r\n return this._frameGraph.whenReadyAsync(timeStep, maxTimeout);\r\n }\r\n\r\n /**\r\n * Execute the graph (the graph must have been built before!)\r\n */\r\n public execute() {\r\n this._frameGraph.execute();\r\n }\r\n\r\n private _initializeBlock(node: NodeRenderGraphBlock) {\r\n node.initialize();\r\n if (this._options.autoConfigure) {\r\n node.autoConfigure();\r\n }\r\n\r\n if (this.attachedBlocks.indexOf(node) === -1) {\r\n this.attachedBlocks.push(node);\r\n }\r\n\r\n for (const input of node.inputs) {\r\n const connectedPoint = input.connectedPoint;\r\n if (connectedPoint) {\r\n const block = connectedPoint.ownerBlock;\r\n if (block !== node) {\r\n this._initializeBlock(block);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Clear the current graph\r\n */\r\n public clear() {\r\n this.outputBlock = null;\r\n this.attachedBlocks.length = 0;\r\n }\r\n\r\n /**\r\n * Remove a block from the current graph\r\n * @param block defines the block to remove\r\n */\r\n public removeBlock(block: NodeRenderGraphBlock) {\r\n const attachedBlockIndex = this.attachedBlocks.indexOf(block);\r\n if (attachedBlockIndex > -1) {\r\n this.attachedBlocks.splice(attachedBlockIndex, 1);\r\n }\r\n\r\n if (block === this.outputBlock) {\r\n this.outputBlock = null;\r\n }\r\n }\r\n\r\n /**\r\n * Clear the current graph and load a new one from a serialization object\r\n * @param source defines the JSON representation of the graph\r\n * @param merge defines whether or not the source must be merged or replace the current content\r\n */\r\n public parseSerializedObject(source: any, merge = false) {\r\n if (!merge) {\r\n this.clear();\r\n }\r\n\r\n const map: { [key: number]: NodeRenderGraphBlock } = {};\r\n\r\n // Create blocks\r\n for (const parsedBlock of source.blocks) {\r\n const blockType: typeof NodeRenderGraphBlock = GetClass(parsedBlock.customType);\r\n if (blockType) {\r\n const additionalConstructionParameters = parsedBlock.additionalConstructionParameters;\r\n const block: NodeRenderGraphBlock = additionalConstructionParameters\r\n ? new blockType(\"\", this._frameGraph, this._scene, ...additionalConstructionParameters)\r\n : new blockType(\"\", this._frameGraph, this._scene);\r\n block._deserialize(parsedBlock);\r\n map[parsedBlock.id] = block;\r\n\r\n this.attachedBlocks.push(block);\r\n }\r\n }\r\n\r\n // Reconnect teleportation\r\n for (const block of this.attachedBlocks) {\r\n if (block.isTeleportOut) {\r\n const teleportOut = block as NodeRenderGraphTeleportOutBlock;\r\n const id = teleportOut._tempEntryPointUniqueId;\r\n if (id) {\r\n const source = map[id] as NodeRenderGraphTeleportInBlock;\r\n if (source) {\r\n source.attachToEndpoint(teleportOut);\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Connections - Starts with input blocks only (except if in \"merge\" mode where we scan all blocks)\r\n for (let blockIndex = 0; blockIndex < source.blocks.length; blockIndex++) {\r\n const parsedBlock = source.blocks[blockIndex];\r\n const block = map[parsedBlock.id];\r\n\r\n if (!block) {\r\n continue;\r\n }\r\n\r\n if (block.inputs.length && parsedBlock.inputs.some((i: any) => i.targetConnectionName) && !merge) {\r\n continue;\r\n }\r\n this._restoreConnections(block, source, map);\r\n }\r\n\r\n // Outputs\r\n if (source.outputNodeId) {\r\n this.outputBlock = map[source.outputNodeId] as NodeRenderGraphOutputBlock;\r\n }\r\n\r\n // UI related info\r\n if (source.locations || (source.editorData && source.editorData.locations)) {\r\n const locations: {\r\n blockId: number;\r\n x: number;\r\n y: number;\r\n isCollapsed: boolean;\r\n }[] = source.locations || source.editorData.locations;\r\n\r\n for (const location of locations) {\r\n if (map[location.blockId]) {\r\n location.blockId = map[location.blockId].uniqueId;\r\n }\r\n }\r\n\r\n if (merge && this.editorData && this.editorData.locations) {\r\n locations.concat(this.editorData.locations);\r\n }\r\n\r\n if (source.locations) {\r\n this.editorData = {\r\n locations: locations,\r\n };\r\n } else {\r\n this.editorData = source.editorData;\r\n this.editorData.locations = locations;\r\n }\r\n\r\n const blockMap: number[] = [];\r\n\r\n for (const key in map) {\r\n blockMap[key] = map[key].uniqueId;\r\n }\r\n\r\n this.editorData.map = blockMap;\r\n }\r\n\r\n this.comment = source.comment;\r\n }\r\n\r\n private _restoreConnections(block: NodeRenderGraphBlock, source: any, map: { [key: number]: NodeRenderGraphBlock }) {\r\n for (const outputPoint of block.outputs) {\r\n for (const candidate of source.blocks) {\r\n const target = map[candidate.id];\r\n\r\n if (!target) {\r\n continue;\r\n }\r\n\r\n for (const input of candidate.inputs) {\r\n if (map[input.targetBlockId] === block && input.targetConnectionName === outputPoint.name) {\r\n const inputPoint = target.getInputByName(input.inputName);\r\n if (!inputPoint || inputPoint.isConnected) {\r\n continue;\r\n }\r\n\r\n outputPoint.connectTo(inputPoint, true);\r\n this._restoreConnections(target, source, map);\r\n continue;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Generate a string containing the code declaration required to create an equivalent of this node render graph\r\n * @returns a string\r\n */\r\n public generateCode() {\r\n let alreadyDumped: NodeRenderGraphBlock[] = [];\r\n const blocks: NodeRenderGraphBlock[] = [];\r\n const uniqueNames: string[] = [\"const\", \"var\", \"let\"];\r\n // Gets active blocks\r\n if (this.outputBlock) {\r\n this._gatherBlocks(this.outputBlock, blocks);\r\n }\r\n\r\n // Generate\r\n const options = JSON.stringify(this._options);\r\n let codeString = `let nodeRenderGraph = new BABYLON.NodeRenderGraph(\"${this.name || \"render graph\"}\", scene, ${options});\\n`;\r\n for (const node of blocks) {\r\n if (node.isInput && alreadyDumped.indexOf(node) === -1) {\r\n codeString += node._dumpCode(uniqueNames, alreadyDumped) + \"\\n\";\r\n }\r\n }\r\n\r\n if (this.outputBlock) {\r\n // Connections\r\n alreadyDumped = [];\r\n codeString += \"// Connections\\n\";\r\n codeString += this.outputBlock._dumpCodeForOutputConnections(alreadyDumped);\r\n\r\n // Output nodes\r\n codeString += \"// Output nodes\\n\";\r\n codeString += `nodeRenderGraph.outputBlock = ${this.outputBlock._codeVariableName};\\n`;\r\n codeString += `nodeRenderGraph.build();\\n`;\r\n }\r\n\r\n return codeString;\r\n }\r\n\r\n private _gatherBlocks(rootNode: NodeRenderGraphBlock, list: NodeRenderGraphBlock[]) {\r\n if (list.indexOf(rootNode) !== -1) {\r\n return;\r\n }\r\n list.push(rootNode);\r\n\r\n for (const input of rootNode.inputs) {\r\n const connectedPoint = input.connectedPoint;\r\n if (connectedPoint) {\r\n const block = connectedPoint.ownerBlock;\r\n if (block !== rootNode) {\r\n this._gatherBlocks(block, list);\r\n }\r\n }\r\n }\r\n\r\n // Teleportation\r\n if (rootNode.isTeleportOut) {\r\n const block = rootNode as NodeRenderGraphTeleportOutBlock;\r\n if (block.entryPoint) {\r\n this._gatherBlocks(block.entryPoint, list);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Clear the current graph and set it to a default state\r\n */\r\n public setToDefault() {\r\n this.clear();\r\n\r\n this.editorData = null;\r\n\r\n // Source textures\r\n const colorTexture = new NodeRenderGraphInputBlock(\"Color Texture\", this._frameGraph, this._scene, NodeRenderGraphBlockConnectionPointTypes.Texture);\r\n colorTexture.creationOptions.options.samples = 4;\r\n\r\n const depthTexture = new NodeRenderGraphInputBlock(\"Depth Texture\", this._frameGraph, this._scene, NodeRenderGraphBlockConnectionPointTypes.TextureDepthStencilAttachment);\r\n depthTexture.creationOptions.options.samples = 4;\r\n\r\n // Clear texture\r\n const clear = new NodeRenderGraphClearBlock(\"Clear\", this._frameGraph, this._scene);\r\n clear.clearDepth = true;\r\n clear.clearStencil = true;\r\n\r\n colorTexture.output.connectTo(clear.target);\r\n depthTexture.output.connectTo(clear.depth);\r\n\r\n // Render objects\r\n const camera = new NodeRenderGraphInputBlock(\"Camera\", this._frameGraph, this._scene, NodeRenderGraphBlockConnectionPointTypes.Camera);\r\n const objectList = new NodeRenderGraphInputBlock(\"Object List\", this._frameGraph, this._scene, NodeRenderGraphBlockConnectionPointTypes.ObjectList);\r\n\r\n const mainRendering = new NodeRenderGraphObjectRendererBlock(\"Main Rendering\", this._frameGraph, this._scene);\r\n\r\n camera.output.connectTo(mainRendering.camera);\r\n objectList.output.connectTo(mainRendering.objects);\r\n clear.output.connectTo(mainRendering.target);\r\n clear.outputDepth.connectTo(mainRendering.depth);\r\n\r\n // Final output\r\n const output = new NodeRenderGraphOutputBlock(\"Output\", this._frameGraph, this._scene);\r\n mainRendering.output.connectTo(output.texture);\r\n\r\n this.outputBlock = output;\r\n }\r\n\r\n /**\r\n * Makes a duplicate of the current node render graph.\r\n * @param name defines the name to use for the new node render graph\r\n * @returns the new node render graph\r\n */\r\n public clone(name: string): NodeRenderGraph {\r\n const serializationObject = this.serialize();\r\n\r\n const clone = SerializationHelper.Clone(() => new NodeRenderGraph(name, this._scene), this);\r\n clone.name = name;\r\n\r\n clone.parseSerializedObject(serializationObject);\r\n clone._buildId = this._buildId;\r\n clone.build();\r\n\r\n return clone;\r\n }\r\n\r\n /**\r\n * Serializes this node render graph in a JSON representation\r\n * @param selectedBlocks defines the list of blocks to save (if null the whole node render graph will be saved)\r\n * @returns the serialized node render graph object\r\n */\r\n public serialize(selectedBlocks?: NodeRenderGraphBlock[]): any {\r\n const serializationObject = selectedBlocks ? {} : SerializationHelper.Serialize(this);\r\n serializationObject.editorData = JSON.parse(JSON.stringify(this.editorData)); // Copy\r\n\r\n let blocks: NodeRenderGraphBlock[] = [];\r\n\r\n if (selectedBlocks) {\r\n blocks = selectedBlocks;\r\n } else {\r\n serializationObject.customType = \"BABYLON.NodeRenderGraph\";\r\n if (this.outputBlock) {\r\n serializationObject.outputNodeId = this.outputBlock.uniqueId;\r\n }\r\n }\r\n\r\n // Blocks\r\n serializationObject.blocks = [];\r\n\r\n for (const block of blocks) {\r\n serializationObject.blocks.push(block.serialize());\r\n }\r\n\r\n if (!selectedBlocks) {\r\n for (const block of this.attachedBlocks) {\r\n if (blocks.indexOf(block) !== -1) {\r\n continue;\r\n }\r\n serializationObject.blocks.push(block.serialize());\r\n }\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Disposes the ressources\r\n */\r\n public dispose(): void {\r\n for (const block of this.attachedBlocks) {\r\n block.dispose();\r\n }\r\n\r\n this._frameGraph.dispose();\r\n (this._frameGraph as WritableObject<FrameGraph>) = undefined as any;\r\n\r\n this._engine.onResizeObservable.remove(this._resizeObserver);\r\n (this._resizeObserver as WritableObject<Nullable<Observer<AbstractEngine>>>) = null;\r\n\r\n this.attachedBlocks.length = 0;\r\n this.onBuildObservable.clear();\r\n this.onBuildErrorObservable.clear();\r\n }\r\n\r\n /**\r\n * Creates a new node render graph set to default basic configuration\r\n * @param name defines the name of the node render graph\r\n * @param scene defines the scene to use\r\n * @param nodeRenderGraphOptions defines options to use when creating the node render graph\r\n * @returns a new NodeRenderGraph\r\n */\r\n public static CreateDefault(name: string, scene: Scene, nodeRenderGraphOptions?: INodeRenderGraphCreateOptions): NodeRenderGraph {\r\n const renderGraph = new NodeRenderGraph(name, scene, nodeRenderGraphOptions);\r\n\r\n renderGraph.setToDefault();\r\n renderGraph.build();\r\n\r\n return renderGraph;\r\n }\r\n\r\n /**\r\n * Creates a node render graph from parsed graph data\r\n * @param source defines the JSON representation of the node render graph\r\n * @param scene defines the scene to use\r\n * @param nodeRenderGraphOptions defines options to use when creating the node render\r\n * @param skipBuild defines whether to skip building the node render graph (default is true)\r\n * @returns a new node render graph\r\n */\r\n public static Parse(source: any, scene: Scene, nodeRenderGraphOptions?: INodeRenderGraphCreateOptions, skipBuild: boolean = true): NodeRenderGraph {\r\n const renderGraph = SerializationHelper.Parse(() => new NodeRenderGraph(source.name, scene, nodeRenderGraphOptions), source, null);\r\n\r\n renderGraph.parseSerializedObject(source);\r\n if (!skipBuild) {\r\n renderGraph.build();\r\n }\r\n\r\n return renderGraph;\r\n }\r\n\r\n /**\r\n * Creates a node render graph from a snippet saved by the node render graph editor\r\n * @param snippetId defines the snippet to load\r\n * @param scene defines the scene to use\r\n * @param nodeRenderGraphOptions defines options to use when creating the node render graph\r\n * @param nodeRenderGraph defines a node render graph to update (instead of creating a new one)\r\n * @param skipBuild defines whether to skip building the node render graph (default is true)\r\n * @returns a promise that will resolve to the new node render graph\r\n */\r\n public static ParseFromSnippetAsync(\r\n snippetId: string,\r\n scene: Scene,\r\n nodeRenderGraphOptions?: INodeRenderGraphCreateOptions,\r\n nodeRenderGraph?: NodeRenderGraph,\r\n skipBuild: boolean = true\r\n ): Promise<NodeRenderGraph> {\r\n if (snippetId === \"_BLANK\") {\r\n return Promise.resolve(NodeRenderGraph.CreateDefault(\"blank\", scene, nodeRenderGraphOptions));\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n const request = new WebRequest();\r\n request.addEventListener(\"readystatechange\", () => {\r\n if (request.readyState == 4) {\r\n if (request.status == 200) {\r\n const snippet = JSON.parse(JSON.parse(request.responseText).jsonPayload);\r\n const serializationObject = JSON.parse(snippet.nodeRenderGraph);\r\n\r\n if (!nodeRenderGraph) {\r\n nodeRenderGraph = SerializationHelper.Parse(() => new NodeRenderGraph(snippetId, scene, nodeRenderGraphOptions), serializationObject, null);\r\n }\r\n\r\n nodeRenderGraph.parseSerializedObject(serializationObject);\r\n nodeRenderGraph.snippetId = snippetId;\r\n\r\n try {\r\n if (!skipBuild) {\r\n nodeRenderGraph.build();\r\n }\r\n resolve(nodeRenderGraph);\r\n } catch (err) {\r\n reject(err);\r\n }\r\n } else {\r\n reject(\"Unable to load the snippet \" + snippetId);\r\n }\r\n }\r\n });\r\n\r\n request.open(\"GET\", this.SnippetUrl + \"/\" + snippetId.replace(/#/g, \"/\"));\r\n request.send();\r\n });\r\n }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ACJ,MAAM,CAAC,6BAA6B,GAAG,SAAS,CAAC,CAAC;oBACtD,CAAC;gBACL,CAAC;YACL,CAAC,CAAC,CAAC;YAEH,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,GAAG,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;YAC1E,OAAO,CAAC,IAAI,EAAE,CAAC;QACnB,CAAC,CAAC,CAAC;IACP,CAAC;;AAzvBc,iCAAiB,GAAW,CAAC,AAAZ,CAAa;AAI7C,gDAAgD;AAClC,yBAAS,GAAG,GAAG,KAAK,CAAC,cAAc,KAAK,MAAM,CAAC,OAAO,6CAA6C,AAA1F,CAA2F;AAElH,sCAAsC;AACxB,0BAAU,GAAG,SAAS,CAAC,UAAU,AAAvB,CAAwB;AAqDzC;IADN,SAAS,EAAE;6CACQ;AAMb;IADN,SAAS,CAAC,SAAS,CAAC;gDACE","sourcesContent":["/* eslint-disable import/no-internal-modules */\r\nimport type {\r\n Observer,\r\n Nullable,\r\n NodeRenderGraphBlock,\r\n NodeRenderGraphTeleportOutBlock,\r\n NodeRenderGraphTeleportInBlock,\r\n AbstractEngine,\r\n INodeRenderGraphCreateOptions,\r\n INodeRenderGraphEditorOptions,\r\n Scene,\r\n WritableObject,\r\n IShadowLight,\r\n} from \"core/index\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { NodeRenderGraphOutputBlock } from \"./Blocks/outputBlock\";\r\nimport { FrameGraph } from \"../frameGraph\";\r\nimport { GetClass } from \"../../Misc/typeStore\";\r\nimport { serialize } from \"../../Misc/decorators\";\r\nimport { SerializationHelper } from \"../../Misc/decorators.serialization\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport { WebRequest } from \"../../Misc/webRequest\";\r\nimport { NodeRenderGraphInputBlock } from \"./Blocks/inputBlock\";\r\nimport { Tools } from \"../../Misc/tools\";\r\nimport { Engine } from \"../../Engines/engine\";\r\nimport { NodeRenderGraphBlockConnectionPointTypes } from \"./Types/nodeRenderGraphTypes\";\r\nimport { NodeRenderGraphClearBlock } from \"./Blocks/Textures/clearBlock\";\r\nimport { NodeRenderGraphObjectRendererBlock } from \"./Blocks/Rendering/objectRendererBlock\";\r\nimport { NodeRenderGraphBuildState } from \"./nodeRenderGraphBuildState\";\r\n\r\n// declare NODERENDERGRAPHEDITOR namespace for compilation issue\r\ndeclare let NODERENDERGRAPHEDITOR: any;\r\ndeclare let BABYLON: any;\r\n\r\n/**\r\n * Defines a node render graph\r\n */\r\nexport class NodeRenderGraph {\r\n private static _BuildIdGenerator: number = 0;\r\n\r\n private _buildId: number = NodeRenderGraph._BuildIdGenerator++;\r\n\r\n /** Define the Url to load node editor script */\r\n public static EditorURL = `${Tools._DefaultCdnUrl}/v${Engine.Version}/NodeRenderGraph/babylon.nodeRenderGraph.js`;\r\n\r\n /** Define the Url to load snippets */\r\n public static SnippetUrl = Constants.SnippetUrl;\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private BJSNODERENDERGRAPHEDITOR = this._getGlobalNodeRenderGraphEditor();\r\n\r\n /** @returns the inspector from bundle or global */\r\n private _getGlobalNodeRenderGraphEditor(): any {\r\n // UMD Global name detection from Webpack Bundle UMD Name.\r\n if (typeof NODERENDERGRAPHEDITOR !== \"undefined\") {\r\n return NODERENDERGRAPHEDITOR;\r\n }\r\n\r\n // In case of module let's check the global emitted from the editor entry point.\r\n if (typeof BABYLON !== \"undefined\" && typeof BABYLON.NodeRenderGraphEditor !== \"undefined\") {\r\n return BABYLON;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Gets or sets data used by visual editor\r\n * @see https://nrge.babylonjs.com\r\n */\r\n public editorData: any = null;\r\n\r\n /**\r\n * Gets an array of blocks that needs to be serialized even if they are not yet connected\r\n */\r\n public attachedBlocks: NodeRenderGraphBlock[] = [];\r\n\r\n /**\r\n * Observable raised when the node render graph is built\r\n */\r\n public onBuildObservable = new Observable<NodeRenderGraph>();\r\n\r\n /**\r\n * Observable raised when an error is detected\r\n */\r\n public onBuildErrorObservable = new Observable<string>();\r\n\r\n /** Gets or sets the RenderGraphOutputBlock used to gather the final node render graph data */\r\n public outputBlock: Nullable<NodeRenderGraphOutputBlock> = null;\r\n\r\n /**\r\n * Snippet ID if the graph was created from the snippet server\r\n */\r\n public snippetId: string;\r\n\r\n /**\r\n * The name of the node render graph\r\n */\r\n @serialize()\r\n public name: string;\r\n\r\n /**\r\n * A free comment about the graph\r\n */\r\n @serialize(\"comment\")\r\n public comment: string;\r\n\r\n private readonly _engine: AbstractEngine;\r\n private readonly _scene: Scene;\r\n private readonly _resizeObserver: Nullable<Observer<AbstractEngine>> = null;\r\n private readonly _frameGraph: FrameGraph;\r\n private readonly _options: INodeRenderGraphCreateOptions;\r\n\r\n /**\r\n * Gets the frame graph used by this node render graph\r\n */\r\n public get frameGraph() {\r\n return this._frameGraph;\r\n }\r\n\r\n /**\r\n * Gets the scene used by this node render graph\r\n * @returns the scene used by this node render graph\r\n */\r\n public getScene() {\r\n return this._scene;\r\n }\r\n\r\n /**\r\n * Creates a new node render graph\r\n * @param name defines the name of the node render graph\r\n * @param scene defines the scene to use to execute the graph\r\n * @param options defines the options to use when creating the graph\r\n */\r\n public constructor(name: string, scene: Scene, options?: INodeRenderGraphCreateOptions) {\r\n this.name = name;\r\n this._scene = scene;\r\n this._engine = scene.getEngine();\r\n\r\n options = {\r\n debugTextures: false,\r\n autoConfigure: false,\r\n verbose: false,\r\n rebuildGraphOnEngineResize: true,\r\n autoFillExternalInputs: true,\r\n ...options,\r\n };\r\n\r\n this._options = options;\r\n\r\n this._frameGraph = new FrameGraph(this._scene, options.debugTextures, this);\r\n this._frameGraph.name = name;\r\n\r\n if (options.rebuildGraphOnEngineResize) {\r\n this._resizeObserver = this._engine.onResizeObservable.add(() => {\r\n this.build();\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Gets the current class name (\"NodeRenderGraph\")\r\n * @returns the class name\r\n */\r\n public getClassName(): string {\r\n return \"NodeRenderGraph\";\r\n }\r\n\r\n /**\r\n * Gets a block by its name\r\n * @param name defines the name of the block to retrieve\r\n * @returns the required block or null if not found\r\n */\r\n public getBlockByName<T extends NodeRenderGraphBlock>(name: string): Nullable<T> {\r\n let result: Nullable<T> = null;\r\n for (const block of this.attachedBlocks) {\r\n if (block.name === name) {\r\n if (!result) {\r\n result = block as T;\r\n } else {\r\n Tools.Warn(\"More than one block was found with the name `\" + name + \"`\");\r\n return result;\r\n }\r\n }\r\n }\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Get a block using a predicate\r\n * @param predicate defines the predicate used to find the good candidate\r\n * @returns the required block or null if not found\r\n */\r\n public getBlockByPredicate<T extends NodeRenderGraphBlock>(predicate: (block: NodeRenderGraphBlock) => boolean): Nullable<T> {\r\n for (const block of this.attachedBlocks) {\r\n if (predicate(block)) {\r\n return block as T;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Get all blocks that match a predicate\r\n * @param predicate defines the predicate used to find the good candidate(s)\r\n * @returns the list of blocks found\r\n */\r\n public getBlocksByPredicate<T extends NodeRenderGraphBlock>(predicate: (block: NodeRenderGraphBlock) => boolean): T[] {\r\n const blocks: T[] = [];\r\n for (const block of this.attachedBlocks) {\r\n if (predicate(block)) {\r\n blocks.push(block as T);\r\n }\r\n }\r\n\r\n return blocks;\r\n }\r\n\r\n /**\r\n * Gets the list of input blocks attached to this material\r\n * @returns an array of InputBlocks\r\n */\r\n public getInputBlocks() {\r\n const blocks: NodeRenderGraphInputBlock[] = [];\r\n for (const block of this.attachedBlocks) {\r\n if (block.isInput) {\r\n blocks.push(block as NodeRenderGraphInputBlock);\r\n }\r\n }\r\n\r\n return blocks;\r\n }\r\n\r\n /**\r\n * Launch the node render graph editor\r\n * @param config Define the configuration of the editor\r\n * @returns a promise fulfilled when the node editor is visible\r\n */\r\n public edit(config?: INodeRenderGraphEditorOptions): Promise<void> {\r\n return new Promise((resolve) => {\r\n this.BJSNODERENDERGRAPHEDITOR = this.BJSNODERENDERGRAPHEDITOR || this._getGlobalNodeRenderGraphEditor();\r\n if (typeof this.BJSNODERENDERGRAPHEDITOR == \"undefined\") {\r\n const editorUrl = config && config.editorURL ? config.editorURL : NodeRenderGraph.EditorURL;\r\n\r\n // Load editor and add it to the DOM\r\n Tools.LoadBabylonScript(editorUrl, () => {\r\n this.BJSNODERENDERGRAPHEDITOR = this.BJSNODERENDERGRAPHEDITOR || this._getGlobalNodeRenderGraphEditor();\r\n this._createNodeEditor(config?.nodeRenderGraphEditorConfig);\r\n resolve();\r\n });\r\n } else {\r\n // Otherwise creates the editor\r\n this._createNodeEditor(config?.nodeRenderGraphEditorConfig);\r\n resolve();\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Creates the node editor window.\r\n * @param additionalConfig Additional configuration for the FGE\r\n */\r\n private _createNodeEditor(additionalConfig?: any) {\r\n const nodeEditorConfig: any = {\r\n nodeRenderGraph: this,\r\n ...additionalConfig,\r\n };\r\n this.BJSNODERENDERGRAPHEDITOR.NodeRenderGraphEditor.Show(nodeEditorConfig);\r\n }\r\n\r\n /**\r\n * Build the final list of blocks that will be executed by the \"execute\" method\r\n */\r\n public build() {\r\n if (!this.outputBlock) {\r\n throw new Error(\"You must define the outputBlock property before building the node render graph\");\r\n }\r\n\r\n this._initializeBlock(this.outputBlock);\r\n\r\n this._frameGraph.clear();\r\n\r\n const state = new NodeRenderGraphBuildState();\r\n\r\n state.buildId = this._buildId;\r\n state.verbose = this._options.verbose!;\r\n\r\n if (this._options.autoFillExternalInputs) {\r\n this._autoFillExternalInputs();\r\n }\r\n\r\n try {\r\n this.outputBlock.build(state);\r\n\r\n this._frameGraph.build();\r\n } finally {\r\n this._buildId = NodeRenderGraph._BuildIdGenerator++;\r\n\r\n if (state.emitErrors(this.onBuildErrorObservable)) {\r\n this.onBuildObservable.notifyObservers(this);\r\n }\r\n }\r\n }\r\n\r\n private _autoFillExternalInputs() {\r\n const allInputs = this.getInputBlocks();\r\n\r\n const shadowLights: IShadowLight[] = [];\r\n for (const light of this._scene.lights) {\r\n if ((light as IShadowLight).setShadowProjectionMatrix !== undefined) {\r\n shadowLights.push(light as IShadowLight);\r\n }\r\n }\r\n\r\n let cameraIndex = 0;\r\n let lightIndex = 0;\r\n for (const input of allInputs) {\r\n if (!input.isExternal) {\r\n continue;\r\n }\r\n if (!input.isAnAncestorOfType(\"NodeRenderGraphOutputBlock\")) {\r\n continue;\r\n }\r\n if ((input.type & NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBuffer) !== 0) {\r\n // nothing to do\r\n } else if (input.isCamera()) {\r\n const camera = this._scene.cameras[cameraIndex++] || this._scene.cameras[0];\r\n if (!this._scene.cameraToUseForPointers) {\r\n this._scene.cameraToUseForPointers = camera;\r\n }\r\n\r\n input.value = camera;\r\n } else if (input.isObjectList()) {\r\n input.value = { meshes: this._scene.meshes, particleSystems: this._scene.particleSystems };\r\n } else if (input.isShadowLight()) {\r\n if (lightIndex < shadowLights.length) {\r\n input.value = shadowLights[lightIndex++];\r\n lightIndex = lightIndex % shadowLights.length;\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Returns a promise that resolves when the node render graph is ready to be executed\r\n * This method must be called after the graph has been built (NodeRenderGraph.build called)!\r\n * @param timeStep Time step in ms between retries (default is 16)\r\n * @param maxTimeout Maximum time in ms to wait for the graph to be ready (default is 30000)\r\n * @returns The promise that resolves when the graph is ready\r\n */\r\n public whenReadyAsync(timeStep = 16, maxTimeout = 30000): Promise<void> {\r\n return this._frameGraph.whenReadyAsync(timeStep, maxTimeout);\r\n }\r\n\r\n /**\r\n * Execute the graph (the graph must have been built before!)\r\n */\r\n public execute() {\r\n this._frameGraph.execute();\r\n }\r\n\r\n private _initializeBlock(node: NodeRenderGraphBlock) {\r\n node.initialize();\r\n if (this._options.autoConfigure) {\r\n node.autoConfigure();\r\n }\r\n\r\n if (this.attachedBlocks.indexOf(node) === -1) {\r\n this.attachedBlocks.push(node);\r\n }\r\n\r\n for (const input of node.inputs) {\r\n const connectedPoint = input.connectedPoint;\r\n if (connectedPoint) {\r\n const block = connectedPoint.ownerBlock;\r\n if (block !== node) {\r\n this._initializeBlock(block);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Clear the current graph\r\n */\r\n public clear() {\r\n this.outputBlock = null;\r\n this.attachedBlocks.length = 0;\r\n }\r\n\r\n /**\r\n * Remove a block from the current graph\r\n * @param block defines the block to remove\r\n */\r\n public removeBlock(block: NodeRenderGraphBlock) {\r\n const attachedBlockIndex = this.attachedBlocks.indexOf(block);\r\n if (attachedBlockIndex > -1) {\r\n this.attachedBlocks.splice(attachedBlockIndex, 1);\r\n }\r\n\r\n if (block === this.outputBlock) {\r\n this.outputBlock = null;\r\n }\r\n }\r\n\r\n /**\r\n * Clear the current graph and load a new one from a serialization object\r\n * @param source defines the JSON representation of the graph\r\n * @param merge defines whether or not the source must be merged or replace the current content\r\n */\r\n public parseSerializedObject(source: any, merge = false) {\r\n if (!merge) {\r\n this.clear();\r\n }\r\n\r\n const map: { [key: number]: NodeRenderGraphBlock } = {};\r\n\r\n // Create blocks\r\n for (const parsedBlock of source.blocks) {\r\n const blockType: typeof NodeRenderGraphBlock = GetClass(parsedBlock.customType);\r\n if (blockType) {\r\n const additionalConstructionParameters = parsedBlock.additionalConstructionParameters;\r\n const block: NodeRenderGraphBlock = additionalConstructionParameters\r\n ? new blockType(\"\", this._frameGraph, this._scene, ...additionalConstructionParameters)\r\n : new blockType(\"\", this._frameGraph, this._scene);\r\n block._deserialize(parsedBlock);\r\n map[parsedBlock.id] = block;\r\n\r\n this.attachedBlocks.push(block);\r\n }\r\n }\r\n\r\n // Reconnect teleportation\r\n for (const block of this.attachedBlocks) {\r\n if (block.isTeleportOut) {\r\n const teleportOut = block as NodeRenderGraphTeleportOutBlock;\r\n const id = teleportOut._tempEntryPointUniqueId;\r\n if (id) {\r\n const source = map[id] as NodeRenderGraphTeleportInBlock;\r\n if (source) {\r\n source.attachToEndpoint(teleportOut);\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Connections - Starts with input blocks only (except if in \"merge\" mode where we scan all blocks)\r\n for (let blockIndex = 0; blockIndex < source.blocks.length; blockIndex++) {\r\n const parsedBlock = source.blocks[blockIndex];\r\n const block = map[parsedBlock.id];\r\n\r\n if (!block) {\r\n continue;\r\n }\r\n\r\n if (block.inputs.length && parsedBlock.inputs.some((i: any) => i.targetConnectionName) && !merge) {\r\n continue;\r\n }\r\n this._restoreConnections(block, source, map);\r\n }\r\n\r\n // Outputs\r\n if (source.outputNodeId) {\r\n this.outputBlock = map[source.outputNodeId] as NodeRenderGraphOutputBlock;\r\n }\r\n\r\n // UI related info\r\n if (source.locations || (source.editorData && source.editorData.locations)) {\r\n const locations: {\r\n blockId: number;\r\n x: number;\r\n y: number;\r\n isCollapsed: boolean;\r\n }[] = source.locations || source.editorData.locations;\r\n\r\n for (const location of locations) {\r\n if (map[location.blockId]) {\r\n location.blockId = map[location.blockId].uniqueId;\r\n }\r\n }\r\n\r\n if (merge && this.editorData && this.editorData.locations) {\r\n locations.concat(this.editorData.locations);\r\n }\r\n\r\n if (source.locations) {\r\n this.editorData = {\r\n locations: locations,\r\n };\r\n } else {\r\n this.editorData = source.editorData;\r\n this.editorData.locations = locations;\r\n }\r\n\r\n const blockMap: number[] = [];\r\n\r\n for (const key in map) {\r\n blockMap[key] = map[key].uniqueId;\r\n }\r\n\r\n this.editorData.map = blockMap;\r\n }\r\n\r\n this.comment = source.comment;\r\n }\r\n\r\n private _restoreConnections(block: NodeRenderGraphBlock, source: any, map: { [key: number]: NodeRenderGraphBlock }) {\r\n for (const outputPoint of block.outputs) {\r\n for (const candidate of source.blocks) {\r\n const target = map[candidate.id];\r\n\r\n if (!target) {\r\n continue;\r\n }\r\n\r\n for (const input of candidate.inputs) {\r\n if (map[input.targetBlockId] === block && input.targetConnectionName === outputPoint.name) {\r\n const inputPoint = target.getInputByName(input.inputName);\r\n if (!inputPoint || inputPoint.isConnected) {\r\n continue;\r\n }\r\n\r\n outputPoint.connectTo(inputPoint, true);\r\n this._restoreConnections(target, source, map);\r\n continue;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Generate a string containing the code declaration required to create an equivalent of this node render graph\r\n * @returns a string\r\n */\r\n public generateCode() {\r\n let alreadyDumped: NodeRenderGraphBlock[] = [];\r\n const blocks: NodeRenderGraphBlock[] = [];\r\n const uniqueNames: string[] = [\"const\", \"var\", \"let\"];\r\n // Gets active blocks\r\n if (this.outputBlock) {\r\n this._gatherBlocks(this.outputBlock, blocks);\r\n }\r\n\r\n // Generate\r\n const options = JSON.stringify(this._options);\r\n let codeString = `let nodeRenderGraph = new BABYLON.NodeRenderGraph(\"${this.name || \"render graph\"}\", scene, ${options});\\n`;\r\n for (const node of blocks) {\r\n if (node.isInput && alreadyDumped.indexOf(node) === -1) {\r\n codeString += node._dumpCode(uniqueNames, alreadyDumped) + \"\\n\";\r\n }\r\n }\r\n\r\n if (this.outputBlock) {\r\n // Connections\r\n alreadyDumped = [];\r\n codeString += \"// Connections\\n\";\r\n codeString += this.outputBlock._dumpCodeForOutputConnections(alreadyDumped);\r\n\r\n // Output nodes\r\n codeString += \"// Output nodes\\n\";\r\n codeString += `nodeRenderGraph.outputBlock = ${this.outputBlock._codeVariableName};\\n`;\r\n codeString += `nodeRenderGraph.build();\\n`;\r\n }\r\n\r\n return codeString;\r\n }\r\n\r\n private _gatherBlocks(rootNode: NodeRenderGraphBlock, list: NodeRenderGraphBlock[]) {\r\n if (list.indexOf(rootNode) !== -1) {\r\n return;\r\n }\r\n list.push(rootNode);\r\n\r\n for (const input of rootNode.inputs) {\r\n const connectedPoint = input.connectedPoint;\r\n if (connectedPoint) {\r\n const block = connectedPoint.ownerBlock;\r\n if (block !== rootNode) {\r\n this._gatherBlocks(block, list);\r\n }\r\n }\r\n }\r\n\r\n // Teleportation\r\n if (rootNode.isTeleportOut) {\r\n const block = rootNode as NodeRenderGraphTeleportOutBlock;\r\n if (block.entryPoint) {\r\n this._gatherBlocks(block.entryPoint, list);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Clear the current graph and set it to a default state\r\n */\r\n public setToDefault() {\r\n this.clear();\r\n\r\n this.editorData = null;\r\n\r\n // Source textures\r\n const colorTexture = new NodeRenderGraphInputBlock(\"Color Texture\", this._frameGraph, this._scene, NodeRenderGraphBlockConnectionPointTypes.Texture);\r\n colorTexture.creationOptions.options.samples = 4;\r\n\r\n const depthTexture = new NodeRenderGraphInputBlock(\"Depth Texture\", this._frameGraph, this._scene, NodeRenderGraphBlockConnectionPointTypes.TextureDepthStencilAttachment);\r\n depthTexture.creationOptions.options.samples = 4;\r\n\r\n // Clear texture\r\n const clear = new NodeRenderGraphClearBlock(\"Clear\", this._frameGraph, this._scene);\r\n clear.clearDepth = true;\r\n clear.clearStencil = true;\r\n\r\n colorTexture.output.connectTo(clear.target);\r\n depthTexture.output.connectTo(clear.depth);\r\n\r\n // Render objects\r\n const camera = new NodeRenderGraphInputBlock(\"Camera\", this._frameGraph, this._scene, NodeRenderGraphBlockConnectionPointTypes.Camera);\r\n const objectList = new NodeRenderGraphInputBlock(\"Object List\", this._frameGraph, this._scene, NodeRenderGraphBlockConnectionPointTypes.ObjectList);\r\n\r\n const mainRendering = new NodeRenderGraphObjectRendererBlock(\"Main Rendering\", this._frameGraph, this._scene);\r\n\r\n camera.output.connectTo(mainRendering.camera);\r\n objectList.output.connectTo(mainRendering.objects);\r\n clear.output.connectTo(mainRendering.target);\r\n clear.outputDepth.connectTo(mainRendering.depth);\r\n\r\n // Final output\r\n const output = new NodeRenderGraphOutputBlock(\"Output\", this._frameGraph, this._scene);\r\n mainRendering.output.connectTo(output.texture);\r\n\r\n this.outputBlock = output;\r\n }\r\n\r\n /**\r\n * Makes a duplicate of the current node render graph.\r\n * @param name defines the name to use for the new node render graph\r\n * @returns the new node render graph\r\n */\r\n public clone(name: string): NodeRenderGraph {\r\n const serializationObject = this.serialize();\r\n\r\n const clone = SerializationHelper.Clone(() => new NodeRenderGraph(name, this._scene), this);\r\n clone.name = name;\r\n\r\n clone.parseSerializedObject(serializationObject);\r\n clone._buildId = this._buildId;\r\n clone.build();\r\n\r\n return clone;\r\n }\r\n\r\n /**\r\n * Serializes this node render graph in a JSON representation\r\n * @param selectedBlocks defines the list of blocks to save (if null the whole node render graph will be saved)\r\n * @returns the serialized node render graph object\r\n */\r\n public serialize(selectedBlocks?: NodeRenderGraphBlock[]): any {\r\n const serializationObject = selectedBlocks ? {} : SerializationHelper.Serialize(this);\r\n serializationObject.editorData = JSON.parse(JSON.stringify(this.editorData)); // Copy\r\n\r\n let blocks: NodeRenderGraphBlock[] = [];\r\n\r\n if (selectedBlocks) {\r\n blocks = selectedBlocks;\r\n } else {\r\n serializationObject.customType = \"BABYLON.NodeRenderGraph\";\r\n if (this.outputBlock) {\r\n serializationObject.outputNodeId = this.outputBlock.uniqueId;\r\n }\r\n }\r\n\r\n // Blocks\r\n serializationObject.blocks = [];\r\n\r\n for (const block of blocks) {\r\n serializationObject.blocks.push(block.serialize());\r\n }\r\n\r\n if (!selectedBlocks) {\r\n for (const block of this.attachedBlocks) {\r\n if (blocks.indexOf(block) !== -1) {\r\n continue;\r\n }\r\n serializationObject.blocks.push(block.serialize());\r\n }\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Disposes the ressources\r\n */\r\n public dispose(): void {\r\n for (const block of this.attachedBlocks) {\r\n block.dispose();\r\n }\r\n\r\n this._frameGraph.dispose();\r\n (this._frameGraph as WritableObject<FrameGraph>) = undefined as any;\r\n\r\n this._engine.onResizeObservable.remove(this._resizeObserver);\r\n (this._resizeObserver as WritableObject<Nullable<Observer<AbstractEngine>>>) = null;\r\n\r\n this.attachedBlocks.length = 0;\r\n this.onBuildObservable.clear();\r\n this.onBuildErrorObservable.clear();\r\n }\r\n\r\n /**\r\n * Creates a new node render graph set to default basic configuration\r\n * @param name defines the name of the node render graph\r\n * @param scene defines the scene to use\r\n * @param nodeRenderGraphOptions defines options to use when creating the node render graph\r\n * @returns a new NodeRenderGraph\r\n */\r\n public static CreateDefault(name: string, scene: Scene, nodeRenderGraphOptions?: INodeRenderGraphCreateOptions): NodeRenderGraph {\r\n const renderGraph = new NodeRenderGraph(name, scene, nodeRenderGraphOptions);\r\n\r\n renderGraph.setToDefault();\r\n renderGraph.build();\r\n\r\n return renderGraph;\r\n }\r\n\r\n /**\r\n * Creates a node render graph from parsed graph data\r\n * @param source defines the JSON representation of the node render graph\r\n * @param scene defines the scene to use\r\n * @param nodeRenderGraphOptions defines options to use when creating the node render\r\n * @param skipBuild defines whether to skip building the node render graph (default is true)\r\n * @returns a new node render graph\r\n */\r\n public static Parse(source: any, scene: Scene, nodeRenderGraphOptions?: INodeRenderGraphCreateOptions, skipBuild: boolean = true): NodeRenderGraph {\r\n const renderGraph = SerializationHelper.Parse(() => new NodeRenderGraph(source.name, scene, nodeRenderGraphOptions), source, null);\r\n\r\n renderGraph.parseSerializedObject(source);\r\n if (!skipBuild) {\r\n renderGraph.build();\r\n }\r\n\r\n return renderGraph;\r\n }\r\n\r\n /**\r\n * Creates a node render graph from a snippet saved by the node render graph editor\r\n * @param snippetId defines the snippet to load\r\n * @param scene defines the scene to use\r\n * @param nodeRenderGraphOptions defines options to use when creating the node render graph\r\n * @param nodeRenderGraph defines a node render graph to update (instead of creating a new one)\r\n * @param skipBuild defines whether to skip building the node render graph (default is true)\r\n * @returns a promise that will resolve to the new node render graph\r\n */\r\n public static ParseFromSnippetAsync(\r\n snippetId: string,\r\n scene: Scene,\r\n nodeRenderGraphOptions?: INodeRenderGraphCreateOptions,\r\n nodeRenderGraph?: NodeRenderGraph,\r\n skipBuild: boolean = true\r\n ): Promise<NodeRenderGraph> {\r\n if (snippetId === \"_BLANK\") {\r\n return Promise.resolve(NodeRenderGraph.CreateDefault(\"blank\", scene, nodeRenderGraphOptions));\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n const request = new WebRequest();\r\n request.addEventListener(\"readystatechange\", () => {\r\n if (request.readyState == 4) {\r\n if (request.status == 200) {\r\n const snippet = JSON.parse(JSON.parse(request.responseText).jsonPayload);\r\n const serializationObject = JSON.parse(snippet.nodeRenderGraph);\r\n\r\n if (!nodeRenderGraph) {\r\n nodeRenderGraph = SerializationHelper.Parse(() => new NodeRenderGraph(snippetId, scene, nodeRenderGraphOptions), serializationObject, null);\r\n }\r\n\r\n nodeRenderGraph.parseSerializedObject(serializationObject);\r\n nodeRenderGraph.snippetId = snippetId;\r\n\r\n try {\r\n if (!skipBuild) {\r\n nodeRenderGraph.build();\r\n }\r\n resolve(nodeRenderGraph);\r\n } catch (err) {\r\n reject(err);\r\n }\r\n } else {\r\n reject(\"Unable to load the snippet \" + snippetId);\r\n }\r\n }\r\n });\r\n\r\n request.open(\"GET\", this.SnippetUrl + \"/\" + snippetId.replace(/#/g, \"/\"));\r\n request.send();\r\n });\r\n }\r\n}\r\n"]}
@@ -39,6 +39,10 @@ export declare class FrameGraphObjectRendererTask extends FrameGraphTask {
39
39
  * If shadows should be disabled (default is false).
40
40
  */
41
41
  disableShadows: boolean;
42
+ /**
43
+ * If the rendering should be done in linear space (default is false).
44
+ */
45
+ renderInLinearSpace: boolean;
42
46
  /**
43
47
  * The output texture.
44
48
  * This texture will point to the same texture than the targetTexture property if it is set.
@@ -57,6 +57,10 @@ export class FrameGraphObjectRendererTask extends FrameGraphTask {
57
57
  * If shadows should be disabled (default is false).
58
58
  */
59
59
  this.disableShadows = false;
60
+ /**
61
+ * If the rendering should be done in linear space (default is false).
62
+ */
63
+ this.renderInLinearSpace = false;
60
64
  this._onBeforeRenderObservable = null;
61
65
  this._onAfterRenderObservable = null;
62
66
  this._externalObjectRenderer = false;
@@ -84,6 +88,7 @@ export class FrameGraphObjectRendererTask extends FrameGraphTask {
84
88
  // Make sure the renderList / particleSystemList are set when FrameGraphObjectRendererTask.isReady() is called!
85
89
  this._renderer.renderList = this.objectList.meshes;
86
90
  this._renderer.particleSystemList = this.objectList.particleSystems;
91
+ this._renderer.renderInLinearSpace = this.renderInLinearSpace;
87
92
  const outputTextureDescription = this._frameGraph.textureManager.getTextureDescription(this.targetTexture);
88
93
  let depthEnabled = false;
89
94
  if (this.depthTexture !== undefined) {
@@ -112,6 +117,7 @@ export class FrameGraphObjectRendererTask extends FrameGraphTask {
112
117
  pass.setExecuteFunc((context) => {
113
118
  this._renderer.renderList = this.objectList.meshes;
114
119
  this._renderer.particleSystemList = this.objectList.particleSystems;
120
+ this._renderer.renderInLinearSpace = this.renderInLinearSpace;
115
121
  context.setDepthStates(this.depthTest && depthEnabled, this.depthWrite && depthEnabled);
116
122
  context.render(this._renderer, this._textureWidth, this._textureHeight);
117
123
  additionalExecute?.(context);
@@ -1 +1 @@
1
- {"version":3,"file":"objectRendererTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Rendering/objectRendererTask.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,4BAA4B,EAAE,mCAAmC,EAAE,MAAM,uBAAuB,CAAC;AAC1G,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,qCAAqC,EAAE,MAAM,0BAA0B,CAAC;AAEjF;;GAEG;AACH,MAAM,OAAO,4BAA6B,SAAQ,cAAc;IAkB5D;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,IAAW,MAAM,CAAC,MAAc;QAC5B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,SAAS,CAAC,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC;IAC9C,CAAC;IAoCD;;OAEG;IACH,IAAW,cAAc;QACrB,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED,IAAoB,IAAI;QACpB,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;I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wB,CAAC,CAAC;QAC7E,IAAI,CAAC,wBAAwB,GAAG,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC,GAAG,CAAC,GAAG,EAAE;YAC5E,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBACjD,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;gBACpC,KAAK,CAAC,aAAa,GAAG,aAAa,CAAC,GAAG,CAAC,KAAK,CAAE,CAAC;YACpD,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ","sourcesContent":["import type {\r\n FrameGraph,\r\n FrameGraphTextureHandle,\r\n Scene,\r\n Camera,\r\n FrameGraphObjectList,\r\n FrameGraphRenderContext,\r\n ObjectRendererOptions,\r\n Light,\r\n Nullable,\r\n Observer,\r\n FrameGraphShadowGeneratorTask,\r\n FrameGraphRenderPass,\r\n // eslint-disable-next-line import/no-internal-modules\r\n} from \"core/index\";\r\nimport { backbufferColorTextureHandle, backbufferDepthStencilTextureHandle } from \"../../frameGraphTypes\";\r\nimport { FrameGraphTask } from \"../../frameGraphTask\";\r\nimport { ObjectRenderer } from \"../../../Rendering/objectRenderer\";\r\nimport { FrameGraphCascadedShadowGeneratorTask } from \"./csmShadowGeneratorTask\";\r\n\r\n/**\r\n * Task used to render objects to a texture.\r\n */\r\nexport class FrameGraphObjectRendererTask extends FrameGraphTask {\r\n /**\r\n * The target texture where the objects will be rendered.\r\n */\r\n public targetTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The depth attachment texture where the objects will be rendered (optional).\r\n */\r\n public depthTexture?: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The shadow generators used to render the objects (optional).\r\n */\r\n public shadowGenerators?: FrameGraphShadowGeneratorTask[] = [];\r\n\r\n private _camera: Camera;\r\n\r\n /**\r\n * Gets or sets the camera used to render the objects.\r\n */\r\n public get camera() {\r\n return this._camera;\r\n }\r\n\r\n public set camera(camera: Camera) {\r\n this._camera = camera;\r\n this._renderer.activeCamera = this.camera;\r\n }\r\n\r\n /**\r\n * The list of objects to render.\r\n */\r\n public objectList: FrameGraphObjectList;\r\n\r\n /**\r\n * If depth testing should be enabled (default is true).\r\n */\r\n public depthTest = true;\r\n\r\n /**\r\n * If depth writing should be enabled (default is true).\r\n */\r\n public depthWrite = true;\r\n\r\n /**\r\n * If shadows should be disabled (default is false).\r\n */\r\n public disableShadows = false;\r\n\r\n /**\r\n * The output texture.\r\n * This texture will point to the same texture than the targetTexture property if it is set.\r\n * Note, however, that the handle itself will be different!\r\n */\r\n public readonly outputTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The output depth attachment texture.\r\n * This texture will point to the same texture than the depthTexture property if it is set.\r\n * Note, however, that the handle itself will be different!\r\n */\r\n public readonly outputDepthTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The object renderer used to render the objects.\r\n */\r\n public get objectRenderer() {\r\n return this._renderer;\r\n }\r\n\r\n public override get name() {\r\n return this._name;\r\n }\r\n\r\n public override set name(value: string) {\r\n this._name = value;\r\n if (this._renderer) {\r\n this._renderer.name = value;\r\n }\r\n }\r\n\r\n protected readonly _scene: Scene;\r\n protected readonly _renderer: ObjectRenderer;\r\n protected _textureWidth: number;\r\n protected _textureHeight: number;\r\n protected _onBeforeRenderObservable: Nullable<Observer<number>> = null;\r\n protected _onAfterRenderObservable: Nullable<Observer<number>> = null;\r\n protected _externalObjectRenderer = false;\r\n\r\n /**\r\n * Constructs a new object renderer task.\r\n * @param name The name of the task.\r\n * @param frameGraph The frame graph the task belongs to.\r\n * @param scene The scene the frame graph is associated with.\r\n * @param options The options of the object renderer.\r\n * @param existingObjectRenderer An existing object renderer to use (optional). If provided, the options parameter will be ignored.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, scene: Scene, options?: ObjectRendererOptions, existingObjectRenderer?: ObjectRenderer) {\r\n super(name, frameGraph);\r\n\r\n this._scene = scene;\r\n this._externalObjectRenderer = !!existingObjectRenderer;\r\n this._renderer = existingObjectRenderer ?? new ObjectRenderer(name, scene, options);\r\n this.name = name;\r\n\r\n if (!this._externalObjectRenderer) {\r\n this._renderer.onBeforeRenderingManagerRenderObservable.add(() => {\r\n if (!this._renderer.options.doNotChangeAspectRatio) {\r\n scene.updateTransformMatrix(true);\r\n }\r\n });\r\n }\r\n\r\n this.outputTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.outputDepthTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n }\r\n\r\n public override isReady() {\r\n return this._renderer.isReadyForRendering(this._textureWidth, this._textureHeight);\r\n }\r\n\r\n public record(skipCreationOfDisabledPasses = false, additionalExecute?: (context: FrameGraphRenderContext) => void): FrameGraphRenderPass {\r\n if (this.targetTexture === undefined || this.objectList === undefined) {\r\n throw new Error(`FrameGraphObjectRendererTask ${this.name}: targetTexture and objectList are required`);\r\n }\r\n\r\n // Make sure the renderList / particleSystemList are set when FrameGraphObjectRendererTask.isReady() is called!\r\n this._renderer.renderList = this.objectList.meshes;\r\n this._renderer.particleSystemList = this.objectList.particleSystems;\r\n\r\n const outputTextureDescription = this._frameGraph.textureManager.getTextureDescription(this.targetTexture);\r\n\r\n let depthEnabled = false;\r\n\r\n if (this.depthTexture !== undefined) {\r\n if (this.depthTexture === backbufferDepthStencilTextureHandle && this.targetTexture !== backbufferColorTextureHandle) {\r\n throw new Error(\r\n `FrameGraphObjectRendererTask ${this.name}: the back buffer color texture is the only color texture allowed when the depth is the back buffer depth/stencil`\r\n );\r\n }\r\n if (this.depthTexture !== backbufferDepthStencilTextureHandle && this.targetTexture === backbufferColorTextureHandle) {\r\n throw new Error(\r\n `FrameGraphObjectRendererTask ${this.name}: the back buffer depth/stencil texture is the only depth texture allowed when the target is the back buffer color`\r\n );\r\n }\r\n\r\n const depthTextureDescription = this._frameGraph.textureManager.getTextureDescription(this.depthTexture);\r\n if (depthTextureDescription.options.samples !== outputTextureDescription.options.samples) {\r\n throw new Error(`FrameGraphObjectRendererTask ${this.name}: the depth texture and the output texture must have the same number of samples`);\r\n }\r\n\r\n depthEnabled = true;\r\n }\r\n\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, this.targetTexture);\r\n if (this.depthTexture !== undefined) {\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputDepthTexture, this.depthTexture);\r\n }\r\n\r\n this._textureWidth = outputTextureDescription.size.width;\r\n this._textureHeight = outputTextureDescription.size.height;\r\n\r\n this._setLightsForShadow();\r\n\r\n const pass = this._frameGraph.addRenderPass(this.name);\r\n\r\n pass.setRenderTarget(this.targetTexture);\r\n pass.setRenderTargetDepth(this.depthTexture);\r\n pass.setExecuteFunc((context) => {\r\n this._renderer.renderList = this.objectList.meshes;\r\n this._renderer.particleSystemList = this.objectList.particleSystems;\r\n\r\n context.setDepthStates(this.depthTest && depthEnabled, this.depthWrite && depthEnabled);\r\n context.render(this._renderer, this._textureWidth, this._textureHeight);\r\n\r\n additionalExecute?.(context);\r\n });\r\n\r\n if (!skipCreationOfDisabledPasses) {\r\n const passDisabled = this._frameGraph.addRenderPass(this.name + \"_disabled\", true);\r\n\r\n passDisabled.setRenderTarget(this.targetTexture);\r\n passDisabled.setRenderTargetDepth(this.depthTexture);\r\n passDisabled.setExecuteFunc((_context) => {});\r\n }\r\n\r\n return pass;\r\n }\r\n\r\n public override dispose(): void {\r\n this._renderer.onBeforeRenderObservable.remove(this._onBeforeRenderObservable);\r\n this._renderer.onAfterRenderObservable.remove(this._onAfterRenderObservable);\r\n if (!this._externalObjectRenderer) {\r\n this._renderer.dispose();\r\n }\r\n super.dispose();\r\n }\r\n\r\n protected _setLightsForShadow() {\r\n const lightsForShadow: Set<Light> = new Set();\r\n const shadowEnabled: Map<Light, boolean> = new Map();\r\n\r\n if (this.shadowGenerators) {\r\n for (const shadowGeneratorTask of this.shadowGenerators) {\r\n const shadowGenerator = shadowGeneratorTask.shadowGenerator;\r\n const light = shadowGenerator.getLight();\r\n if (light.isEnabled() && light.shadowEnabled) {\r\n lightsForShadow.add(light);\r\n if (FrameGraphCascadedShadowGeneratorTask.IsCascadedShadowGenerator(shadowGeneratorTask)) {\r\n light._shadowGenerators!.set(shadowGeneratorTask.camera, shadowGenerator);\r\n } else {\r\n light._shadowGenerators!.set(null, shadowGenerator);\r\n }\r\n }\r\n }\r\n }\r\n\r\n this._renderer.onBeforeRenderObservable.remove(this._onBeforeRenderObservable);\r\n this._onBeforeRenderObservable = this._renderer.onBeforeRenderObservable.add(() => {\r\n for (let i = 0; i < this._scene.lights.length; i++) {\r\n const light = this._scene.lights[i];\r\n shadowEnabled.set(light, light.shadowEnabled);\r\n light.shadowEnabled = !this.disableShadows && lightsForShadow.has(light);\r\n }\r\n });\r\n\r\n this._renderer.onAfterRenderObservable.remove(this._onAfterRenderObservable);\r\n this._onAfterRenderObservable = this._renderer.onAfterRenderObservable.add(() => {\r\n for (let i = 0; i < this._scene.lights.length; i++) {\r\n const light = this._scene.lights[i];\r\n light.shadowEnabled = shadowEnabled.get(light)!;\r\n }\r\n });\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"objectRendererTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Rendering/objectRendererTask.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,4BAA4B,EAAE,mCAAmC,EAAE,MAAM,uBAAuB,CAAC;AAC1G,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,qCAAqC,EAAE,MAAM,0BAA0B,CAAC;AAEjF;;GAEG;AACH,MAAM,OAAO,4BAA6B,SAAQ,cAAc;IAkB5D;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,IAAW,MAAM,CAAC,MAAc;QAC5B,IAAI,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GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBACjD,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;gBACpC,aAAa,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;gBAC9C,KAAK,CAAC,aAAa,GAAG,CAAC,IAAI,CAAC,cAAc,IAAI,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAC7E,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC,MAAM,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QAC7E,IAAI,CAAC,wBAAwB,GAAG,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC,GAAG,CAAC,GAAG,EAAE;YAC5E,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBACjD,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;gBACpC,KAAK,CAAC,aAAa,GAAG,aAAa,CAAC,GAAG,CAAC,KAAK,CAAE,CAAC;YACpD,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ","sourcesContent":["import type {\r\n FrameGraph,\r\n FrameGraphTextureHandle,\r\n Scene,\r\n Camera,\r\n FrameGraphObjectList,\r\n FrameGraphRenderContext,\r\n ObjectRendererOptions,\r\n Light,\r\n Nullable,\r\n Observer,\r\n FrameGraphShadowGeneratorTask,\r\n FrameGraphRenderPass,\r\n // eslint-disable-next-line import/no-internal-modules\r\n} from \"core/index\";\r\nimport { backbufferColorTextureHandle, backbufferDepthStencilTextureHandle } from \"../../frameGraphTypes\";\r\nimport { FrameGraphTask } from \"../../frameGraphTask\";\r\nimport { ObjectRenderer } from \"../../../Rendering/objectRenderer\";\r\nimport { FrameGraphCascadedShadowGeneratorTask } from \"./csmShadowGeneratorTask\";\r\n\r\n/**\r\n * Task used to render objects to a texture.\r\n */\r\nexport class FrameGraphObjectRendererTask extends FrameGraphTask {\r\n /**\r\n * The target texture where the objects will be rendered.\r\n */\r\n public targetTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The depth attachment texture where the objects will be rendered (optional).\r\n */\r\n public depthTexture?: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The shadow generators used to render the objects (optional).\r\n */\r\n public shadowGenerators?: FrameGraphShadowGeneratorTask[] = [];\r\n\r\n private _camera: Camera;\r\n\r\n /**\r\n * Gets or sets the camera used to render the objects.\r\n */\r\n public get camera() {\r\n return this._camera;\r\n }\r\n\r\n public set camera(camera: Camera) {\r\n this._camera = camera;\r\n this._renderer.activeCamera = this.camera;\r\n }\r\n\r\n /**\r\n * The list of objects to render.\r\n */\r\n public objectList: FrameGraphObjectList;\r\n\r\n /**\r\n * If depth testing should be enabled (default is true).\r\n */\r\n public depthTest = true;\r\n\r\n /**\r\n * If depth writing should be enabled (default is true).\r\n */\r\n public depthWrite = true;\r\n\r\n /**\r\n * If shadows should be disabled (default is false).\r\n */\r\n public disableShadows = false;\r\n\r\n /**\r\n * If the rendering should be done in linear space (default is false).\r\n */\r\n public renderInLinearSpace = false;\r\n\r\n /**\r\n * The output texture.\r\n * This texture will point to the same texture than the targetTexture property if it is set.\r\n * Note, however, that the handle itself will be different!\r\n */\r\n public readonly outputTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The output depth attachment texture.\r\n * This texture will point to the same texture than the depthTexture property if it is set.\r\n * Note, however, that the handle itself will be different!\r\n */\r\n public readonly outputDepthTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The object renderer used to render the objects.\r\n */\r\n public get objectRenderer() {\r\n return this._renderer;\r\n }\r\n\r\n public override get name() {\r\n return this._name;\r\n }\r\n\r\n public override set name(value: string) {\r\n this._name = value;\r\n if (this._renderer) {\r\n this._renderer.name = value;\r\n }\r\n }\r\n\r\n protected readonly _scene: Scene;\r\n protected readonly _renderer: ObjectRenderer;\r\n protected _textureWidth: number;\r\n protected _textureHeight: number;\r\n protected _onBeforeRenderObservable: Nullable<Observer<number>> = null;\r\n protected _onAfterRenderObservable: Nullable<Observer<number>> = null;\r\n protected _externalObjectRenderer = false;\r\n\r\n /**\r\n * Constructs a new object renderer task.\r\n * @param name The name of the task.\r\n * @param frameGraph The frame graph the task belongs to.\r\n * @param scene The scene the frame graph is associated with.\r\n * @param options The options of the object renderer.\r\n * @param existingObjectRenderer An existing object renderer to use (optional). If provided, the options parameter will be ignored.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, scene: Scene, options?: ObjectRendererOptions, existingObjectRenderer?: ObjectRenderer) {\r\n super(name, frameGraph);\r\n\r\n this._scene = scene;\r\n this._externalObjectRenderer = !!existingObjectRenderer;\r\n this._renderer = existingObjectRenderer ?? new ObjectRenderer(name, scene, options);\r\n this.name = name;\r\n\r\n if (!this._externalObjectRenderer) {\r\n this._renderer.onBeforeRenderingManagerRenderObservable.add(() => {\r\n if (!this._renderer.options.doNotChangeAspectRatio) {\r\n scene.updateTransformMatrix(true);\r\n }\r\n });\r\n }\r\n\r\n this.outputTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.outputDepthTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n }\r\n\r\n public override isReady() {\r\n return this._renderer.isReadyForRendering(this._textureWidth, this._textureHeight);\r\n }\r\n\r\n public record(skipCreationOfDisabledPasses = false, additionalExecute?: (context: FrameGraphRenderContext) => void): FrameGraphRenderPass {\r\n if (this.targetTexture === undefined || this.objectList === undefined) {\r\n throw new Error(`FrameGraphObjectRendererTask ${this.name}: targetTexture and objectList are required`);\r\n }\r\n\r\n // Make sure the renderList / particleSystemList are set when FrameGraphObjectRendererTask.isReady() is called!\r\n this._renderer.renderList = this.objectList.meshes;\r\n this._renderer.particleSystemList = this.objectList.particleSystems;\r\n this._renderer.renderInLinearSpace = this.renderInLinearSpace;\r\n\r\n const outputTextureDescription = this._frameGraph.textureManager.getTextureDescription(this.targetTexture);\r\n\r\n let depthEnabled = false;\r\n\r\n if (this.depthTexture !== undefined) {\r\n if (this.depthTexture === backbufferDepthStencilTextureHandle && this.targetTexture !== backbufferColorTextureHandle) {\r\n throw new Error(\r\n `FrameGraphObjectRendererTask ${this.name}: the back buffer color texture is the only color texture allowed when the depth is the back buffer depth/stencil`\r\n );\r\n }\r\n if (this.depthTexture !== backbufferDepthStencilTextureHandle && this.targetTexture === backbufferColorTextureHandle) {\r\n throw new Error(\r\n `FrameGraphObjectRendererTask ${this.name}: the back buffer depth/stencil texture is the only depth texture allowed when the target is the back buffer color`\r\n );\r\n }\r\n\r\n const depthTextureDescription = this._frameGraph.textureManager.getTextureDescription(this.depthTexture);\r\n if (depthTextureDescription.options.samples !== outputTextureDescription.options.samples) {\r\n throw new Error(`FrameGraphObjectRendererTask ${this.name}: the depth texture and the output texture must have the same number of samples`);\r\n }\r\n\r\n depthEnabled = true;\r\n }\r\n\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, this.targetTexture);\r\n if (this.depthTexture !== undefined) {\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputDepthTexture, this.depthTexture);\r\n }\r\n\r\n this._textureWidth = outputTextureDescription.size.width;\r\n this._textureHeight = outputTextureDescription.size.height;\r\n\r\n this._setLightsForShadow();\r\n\r\n const pass = this._frameGraph.addRenderPass(this.name);\r\n\r\n pass.setRenderTarget(this.targetTexture);\r\n pass.setRenderTargetDepth(this.depthTexture);\r\n pass.setExecuteFunc((context) => {\r\n this._renderer.renderList = this.objectList.meshes;\r\n this._renderer.particleSystemList = this.objectList.particleSystems;\r\n this._renderer.renderInLinearSpace = this.renderInLinearSpace;\r\n\r\n context.setDepthStates(this.depthTest && depthEnabled, this.depthWrite && depthEnabled);\r\n context.render(this._renderer, this._textureWidth, this._textureHeight);\r\n\r\n additionalExecute?.(context);\r\n });\r\n\r\n if (!skipCreationOfDisabledPasses) {\r\n const passDisabled = this._frameGraph.addRenderPass(this.name + \"_disabled\", true);\r\n\r\n passDisabled.setRenderTarget(this.targetTexture);\r\n passDisabled.setRenderTargetDepth(this.depthTexture);\r\n passDisabled.setExecuteFunc((_context) => {});\r\n }\r\n\r\n return pass;\r\n }\r\n\r\n public override dispose(): void {\r\n this._renderer.onBeforeRenderObservable.remove(this._onBeforeRenderObservable);\r\n this._renderer.onAfterRenderObservable.remove(this._onAfterRenderObservable);\r\n if (!this._externalObjectRenderer) {\r\n this._renderer.dispose();\r\n }\r\n super.dispose();\r\n }\r\n\r\n protected _setLightsForShadow() {\r\n const lightsForShadow: Set<Light> = new Set();\r\n const shadowEnabled: Map<Light, boolean> = new Map();\r\n\r\n if (this.shadowGenerators) {\r\n for (const shadowGeneratorTask of this.shadowGenerators) {\r\n const shadowGenerator = shadowGeneratorTask.shadowGenerator;\r\n const light = shadowGenerator.getLight();\r\n if (light.isEnabled() && light.shadowEnabled) {\r\n lightsForShadow.add(light);\r\n if (FrameGraphCascadedShadowGeneratorTask.IsCascadedShadowGenerator(shadowGeneratorTask)) {\r\n light._shadowGenerators!.set(shadowGeneratorTask.camera, shadowGenerator);\r\n } else {\r\n light._shadowGenerators!.set(null, shadowGenerator);\r\n }\r\n }\r\n }\r\n }\r\n\r\n this._renderer.onBeforeRenderObservable.remove(this._onBeforeRenderObservable);\r\n this._onBeforeRenderObservable = this._renderer.onBeforeRenderObservable.add(() => {\r\n for (let i = 0; i < this._scene.lights.length; i++) {\r\n const light = this._scene.lights[i];\r\n shadowEnabled.set(light, light.shadowEnabled);\r\n light.shadowEnabled = !this.disableShadows && lightsForShadow.has(light);\r\n }\r\n });\r\n\r\n this._renderer.onAfterRenderObservable.remove(this._onAfterRenderObservable);\r\n this._onAfterRenderObservable = this._renderer.onAfterRenderObservable.add(() => {\r\n for (let i = 0; i < this._scene.lights.length; i++) {\r\n const light = this._scene.lights[i];\r\n light.shadowEnabled = shadowEnabled.get(light)!;\r\n }\r\n });\r\n }\r\n}\r\n"]}
@@ -69,6 +69,7 @@ export class FrameGraphTAAObjectRendererTask extends FrameGraphObjectRendererTas
69
69
  pass.setExecuteFunc((context) => {
70
70
  this._renderer.renderList = this.objectList.meshes;
71
71
  this._renderer.particleSystemList = this.objectList.particleSystems;
72
+ this._renderer.renderInLinearSpace = this.renderInLinearSpace;
72
73
  this.postProcess.updateProjectionMatrix();
73
74
  context.setDepthStates(this.depthTest && depthEnabled, this.depthWrite && depthEnabled);
74
75
  // We define the active camera and transformation matrices ourselves, otherwise this will be done by calling context.render, in which case
@@ -1 +1 @@
1
- {"version":3,"file":"taaObjectRendererTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Rendering/taaObjectRendererTask.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,4BAA4B,EAAE,mCAAmC,EAAE,MAAM,uBAAuB,CAAC;AAC1G,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,qDAA8C;AAC3E,OAAO,EAAE,SAAS,EAAE,sCAA+B;AAEnD;;GAEG;AACH,MAAM,OAAO,+BAAgC,SAAQ,4BAA4B;IAQ7E;;;;;;OAMG;IACH,YAAY,IAAY,EAAE,UAAsB,EAAE,KAAY,EAAE,OAA+B;QAC3F,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAExC,IAAI,CAAC,WAAW,GAAG,IAAI,kBAAkB,CAAC,GAAG,IAAI,eAAe,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC;QACrF,IAAI,CAAC,uBAAuB,GAAG,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;IAChE,CAAC;IAEe,MAAM;QAClB,IAAI,IAAI,CAAC,aAAa,KAAK,SAAS,IAAI,IAAI,CAAC,UAAU,KAAK,SAAS,EA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AAI,EAAE,CAAC;oBACxB,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,uBAAuB,CAAC,MAAO,EAAE,gBAAgB,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;oBACtG,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,uBAAuB,CAAC,MAAO,EAAE,gBAAgB,EAAE,cAAc,CAAC,CAAC;gBACtG,CAAC,CAAC,CAAC;YACP,CAAC;iBAAM,CAAC;gBACJ,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YAC5C,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,GAAG,WAAW,EAAE,IAAI,CAAC,CAAC;QAEnF,YAAY,CAAC,eAAe,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACjD,YAAY,CAAC,oBAAoB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACrD,YAAY,CAAC,cAAc,CAAC,CAAC,OAAO,EAAE,EAAE;YACpC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ","sourcesContent":["// eslint-disable-next-line import/no-internal-modules\r\nimport type { FrameGraph, Scene, DrawWrapper, FrameGraphTextureCreationOptions, ObjectRendererOptions, FrameGraphRenderTarget, FrameGraphRenderPass } from \"core/index\";\r\nimport { backbufferColorTextureHandle, backbufferDepthStencilTextureHandle } from \"../../frameGraphTypes\";\r\nimport { FrameGraphObjectRendererTask } from \"./objectRendererTask\";\r\nimport { ThinTAAPostProcess } from \"core/PostProcesses/thinTAAPostProcess\";\r\nimport { Constants } from \"core/Engines/constants\";\r\n\r\n/**\r\n * Task used to render objects to a texture with Temporal Anti-Aliasing (TAA).\r\n */\r\nexport class FrameGraphTAAObjectRendererTask extends FrameGraphObjectRendererTask {\r\n /**\r\n * The TAA post process.\r\n */\r\n public readonly postProcess: ThinTAAPostProcess;\r\n\r\n protected readonly _postProcessDrawWrapper: DrawWrapper;\r\n\r\n /**\r\n * Constructs a new TAA object renderer task.\r\n * @param name The name of the task\r\n * @param frameGraph The frame graph the task belongs to.\r\n * @param scene The scene the frame graph is associated with.\r\n * @param options The options of the object renderer.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, scene: Scene, options?: ObjectRendererOptions) {\r\n super(name, frameGraph, scene, options);\r\n\r\n this.postProcess = new ThinTAAPostProcess(`${name} post-process`, scene.getEngine());\r\n this._postProcessDrawWrapper = this.postProcess.drawWrapper;\r\n }\r\n\r\n public override record(): FrameGraphRenderPass {\r\n if (this.targetTexture === undefined || this.objectList === undefined) {\r\n throw new Error(`FrameGraphTAAObjectRendererTask ${this.name}: destinationTexture and objectList are required`);\r\n }\r\n\r\n if (this.targetTexture === backbufferColorTextureHandle || this.depthTexture === backbufferDepthStencilTextureHandle) {\r\n throw new Error(`FrameGraphTAAObjectRendererTask ${this.name}: the back buffer color/depth textures are not allowed. Use regular textures instead.`);\r\n }\r\n\r\n // Make sure the renderList / particleSystemList are set when FrameGraphObjectRendererTask.isReady() is called!\r\n this._renderer.renderList = this.objectList.meshes;\r\n this._renderer.particleSystemList = this.objectList.particleSystems;\r\n\r\n const outputTextureDescription = this._frameGraph.textureManager.getTextureDescription(this.targetTexture);\r\n\r\n let depthEnabled = false;\r\n\r\n if (this.depthTexture !== undefined) {\r\n const depthTextureDescription = this._frameGraph.textureManager.getTextureDescription(this.depthTexture);\r\n if (depthTextureDescription.options.samples !== outputTextureDescription.options.samples) {\r\n throw new Error(`FrameGraphTAAObjectRendererTask ${this.name}: the depth texture and the output texture must have the same number of samples`);\r\n }\r\n\r\n depthEnabled = true;\r\n }\r\n\r\n this.postProcess.camera = this.camera;\r\n this.postProcess.textureWidth = outputTextureDescription.size.width;\r\n this.postProcess.textureHeight = outputTextureDescription.size.height;\r\n\r\n const textureCreationOptions: FrameGraphTextureCreationOptions = {\r\n size: outputTextureDescription.size,\r\n options: {\r\n createMipMaps: outputTextureDescription.options.createMipMaps,\r\n types: [Constants.TEXTURETYPE_HALF_FLOAT],\r\n formats: [Constants.TEXTUREFORMAT_RGBA],\r\n samples: 1,\r\n useSRGBBuffers: [false],\r\n creationFlags: [0],\r\n labels: [\"\"],\r\n },\r\n sizeIsPercentage: false,\r\n isHistoryTexture: true,\r\n };\r\n\r\n const pingPongHandle = this._frameGraph.textureManager.createRenderTargetTexture(`${this.name} history`, textureCreationOptions);\r\n\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, pingPongHandle);\r\n if (this.depthTexture !== undefined) {\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputDepthTexture, this.depthTexture);\r\n }\r\n\r\n this._textureWidth = outputTextureDescription.size.width;\r\n this._textureHeight = outputTextureDescription.size.height;\r\n\r\n let pingPongRenderTargetWrapper: FrameGraphRenderTarget | undefined;\r\n\r\n this._setLightsForShadow();\r\n\r\n const pass = this._frameGraph.addRenderPass(this.name);\r\n\r\n pass.setRenderTarget(this.targetTexture);\r\n pass.setRenderTargetDepth(this.depthTexture);\r\n pass.setExecuteFunc((context) => {\r\n this._renderer.renderList = this.objectList.meshes;\r\n this._renderer.particleSystemList = this.objectList.particleSystems;\r\n\r\n this.postProcess.updateProjectionMatrix();\r\n\r\n context.setDepthStates(this.depthTest && depthEnabled, this.depthWrite && depthEnabled);\r\n\r\n // We define the active camera and transformation matrices ourselves, otherwise this will be done by calling context.render, in which case\r\n // getProjectionMatrix will be called with a \"true\" parameter, forcing recalculation of the projection matrix and losing our changes.\r\n if (!this.postProcess.disabled) {\r\n this._scene.activeCamera = this.camera;\r\n this._scene.setTransformMatrix(this.camera.getViewMatrix(), this.camera.getProjectionMatrix());\r\n }\r\n\r\n context.render(this._renderer, this._textureWidth, this._textureHeight);\r\n\r\n this._scene.activeCamera = null;\r\n\r\n pingPongRenderTargetWrapper = pingPongRenderTargetWrapper || context.createRenderTarget(`${this.name} ping/pong`, pingPongHandle);\r\n\r\n context.bindRenderTarget(pingPongRenderTargetWrapper, \"frame graph - TAA merge with history texture\");\r\n\r\n if (!this.postProcess.disabled) {\r\n context.applyFullScreenEffect(this._postProcessDrawWrapper, () => {\r\n this.postProcess.bind();\r\n context.bindTextureHandle(this._postProcessDrawWrapper.effect!, \"textureSampler\", this.targetTexture);\r\n context.bindTextureHandle(this._postProcessDrawWrapper.effect!, \"historySampler\", pingPongHandle);\r\n });\r\n } else {\r\n context.copyTexture(this.targetTexture);\r\n }\r\n });\r\n\r\n const passDisabled = this._frameGraph.addRenderPass(this.name + \"_disabled\", true);\r\n\r\n passDisabled.setRenderTarget(this.outputTexture);\r\n passDisabled.setRenderTargetDepth(this.depthTexture);\r\n passDisabled.setExecuteFunc((context) => {\r\n context.copyTexture(this.targetTexture);\r\n });\r\n\r\n return pass;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"taaObjectRendererTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Rendering/taaObjectRendererTask.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,4BAA4B,EAAE,mCAAmC,EAAE,MAAM,uBAAuB,CAAC;AAC1G,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,qDAA8C;AAC3E,OAAO,EAAE,SAAS,EAAE,sCAA+B;AAEnD;;GAEG;AACH,MAAM,OAAO,+BAAgC,SAAQ,4BAA4B;IAQ7E;;;;;;OAMG;IACH,YAAY,IAAY,EAAE,UAAsB,EAAE,KAAY,EAAE,OAA+B;QAC3F,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAExC,IAAI,CAAC,WAAW,GAAG,IAAI,kBAAkB,CAAC,GAAG,IAAI,eAAe,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC;QACrF,IAAI,CAAC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O,CAAC,gBAAgB,CAAC,2BAA2B,EAAE,8CAA8C,CAAC,CAAC;YAEtG,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;gBAC7B,OAAO,CAAC,qBAAqB,CAAC,IAAI,CAAC,uBAAuB,EAAE,GAAG,EAAE;oBAC7D,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;oBACxB,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,uBAAuB,CAAC,MAAO,EAAE,gBAAgB,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;oBACtG,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,uBAAuB,CAAC,MAAO,EAAE,gBAAgB,EAAE,cAAc,CAAC,CAAC;gBACtG,CAAC,CAAC,CAAC;YACP,CAAC;iBAAM,CAAC;gBACJ,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YAC5C,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,GAAG,WAAW,EAAE,IAAI,CAAC,CAAC;QAEnF,YAAY,CAAC,eAAe,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACjD,YAAY,CAAC,oBAAoB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACrD,YAAY,CAAC,cAAc,CAAC,CAAC,OAAO,EAAE,EAAE;YACpC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ","sourcesContent":["// eslint-disable-next-line import/no-internal-modules\r\nimport type { FrameGraph, Scene, DrawWrapper, FrameGraphTextureCreationOptions, ObjectRendererOptions, FrameGraphRenderTarget, FrameGraphRenderPass } from \"core/index\";\r\nimport { backbufferColorTextureHandle, backbufferDepthStencilTextureHandle } from \"../../frameGraphTypes\";\r\nimport { FrameGraphObjectRendererTask } from \"./objectRendererTask\";\r\nimport { ThinTAAPostProcess } from \"core/PostProcesses/thinTAAPostProcess\";\r\nimport { Constants } from \"core/Engines/constants\";\r\n\r\n/**\r\n * Task used to render objects to a texture with Temporal Anti-Aliasing (TAA).\r\n */\r\nexport class FrameGraphTAAObjectRendererTask extends FrameGraphObjectRendererTask {\r\n /**\r\n * The TAA post process.\r\n */\r\n public readonly postProcess: ThinTAAPostProcess;\r\n\r\n protected readonly _postProcessDrawWrapper: DrawWrapper;\r\n\r\n /**\r\n * Constructs a new TAA object renderer task.\r\n * @param name The name of the task\r\n * @param frameGraph The frame graph the task belongs to.\r\n * @param scene The scene the frame graph is associated with.\r\n * @param options The options of the object renderer.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, scene: Scene, options?: ObjectRendererOptions) {\r\n super(name, frameGraph, scene, options);\r\n\r\n this.postProcess = new ThinTAAPostProcess(`${name} post-process`, scene.getEngine());\r\n this._postProcessDrawWrapper = this.postProcess.drawWrapper;\r\n }\r\n\r\n public override record(): FrameGraphRenderPass {\r\n if (this.targetTexture === undefined || this.objectList === undefined) {\r\n throw new Error(`FrameGraphTAAObjectRendererTask ${this.name}: destinationTexture and objectList are required`);\r\n }\r\n\r\n if (this.targetTexture === backbufferColorTextureHandle || this.depthTexture === backbufferDepthStencilTextureHandle) {\r\n throw new Error(`FrameGraphTAAObjectRendererTask ${this.name}: the back buffer color/depth textures are not allowed. Use regular textures instead.`);\r\n }\r\n\r\n // Make sure the renderList / particleSystemList are set when FrameGraphObjectRendererTask.isReady() is called!\r\n this._renderer.renderList = this.objectList.meshes;\r\n this._renderer.particleSystemList = this.objectList.particleSystems;\r\n\r\n const outputTextureDescription = this._frameGraph.textureManager.getTextureDescription(this.targetTexture);\r\n\r\n let depthEnabled = false;\r\n\r\n if (this.depthTexture !== undefined) {\r\n const depthTextureDescription = this._frameGraph.textureManager.getTextureDescription(this.depthTexture);\r\n if (depthTextureDescription.options.samples !== outputTextureDescription.options.samples) {\r\n throw new Error(`FrameGraphTAAObjectRendererTask ${this.name}: the depth texture and the output texture must have the same number of samples`);\r\n }\r\n\r\n depthEnabled = true;\r\n }\r\n\r\n this.postProcess.camera = this.camera;\r\n this.postProcess.textureWidth = outputTextureDescription.size.width;\r\n this.postProcess.textureHeight = outputTextureDescription.size.height;\r\n\r\n const textureCreationOptions: FrameGraphTextureCreationOptions = {\r\n size: outputTextureDescription.size,\r\n options: {\r\n createMipMaps: outputTextureDescription.options.createMipMaps,\r\n types: [Constants.TEXTURETYPE_HALF_FLOAT],\r\n formats: [Constants.TEXTUREFORMAT_RGBA],\r\n samples: 1,\r\n useSRGBBuffers: [false],\r\n creationFlags: [0],\r\n labels: [\"\"],\r\n },\r\n sizeIsPercentage: false,\r\n isHistoryTexture: true,\r\n };\r\n\r\n const pingPongHandle = this._frameGraph.textureManager.createRenderTargetTexture(`${this.name} history`, textureCreationOptions);\r\n\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, pingPongHandle);\r\n if (this.depthTexture !== undefined) {\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputDepthTexture, this.depthTexture);\r\n }\r\n\r\n this._textureWidth = outputTextureDescription.size.width;\r\n this._textureHeight = outputTextureDescription.size.height;\r\n\r\n let pingPongRenderTargetWrapper: FrameGraphRenderTarget | undefined;\r\n\r\n this._setLightsForShadow();\r\n\r\n const pass = this._frameGraph.addRenderPass(this.name);\r\n\r\n pass.setRenderTarget(this.targetTexture);\r\n pass.setRenderTargetDepth(this.depthTexture);\r\n pass.setExecuteFunc((context) => {\r\n this._renderer.renderList = this.objectList.meshes;\r\n this._renderer.particleSystemList = this.objectList.particleSystems;\r\n this._renderer.renderInLinearSpace = this.renderInLinearSpace;\r\n\r\n this.postProcess.updateProjectionMatrix();\r\n\r\n context.setDepthStates(this.depthTest && depthEnabled, this.depthWrite && depthEnabled);\r\n\r\n // We define the active camera and transformation matrices ourselves, otherwise this will be done by calling context.render, in which case\r\n // getProjectionMatrix will be called with a \"true\" parameter, forcing recalculation of the projection matrix and losing our changes.\r\n if (!this.postProcess.disabled) {\r\n this._scene.activeCamera = this.camera;\r\n this._scene.setTransformMatrix(this.camera.getViewMatrix(), this.camera.getProjectionMatrix());\r\n }\r\n\r\n context.render(this._renderer, this._textureWidth, this._textureHeight);\r\n\r\n this._scene.activeCamera = null;\r\n\r\n pingPongRenderTargetWrapper = pingPongRenderTargetWrapper || context.createRenderTarget(`${this.name} ping/pong`, pingPongHandle);\r\n\r\n context.bindRenderTarget(pingPongRenderTargetWrapper, \"frame graph - TAA merge with history texture\");\r\n\r\n if (!this.postProcess.disabled) {\r\n context.applyFullScreenEffect(this._postProcessDrawWrapper, () => {\r\n this.postProcess.bind();\r\n context.bindTextureHandle(this._postProcessDrawWrapper.effect!, \"textureSampler\", this.targetTexture);\r\n context.bindTextureHandle(this._postProcessDrawWrapper.effect!, \"historySampler\", pingPongHandle);\r\n });\r\n } else {\r\n context.copyTexture(this.targetTexture);\r\n }\r\n });\r\n\r\n const passDisabled = this._frameGraph.addRenderPass(this.name + \"_disabled\", true);\r\n\r\n passDisabled.setRenderTarget(this.outputTexture);\r\n passDisabled.setRenderTargetDepth(this.depthTexture);\r\n passDisabled.setExecuteFunc((context) => {\r\n context.copyTexture(this.targetTexture);\r\n });\r\n\r\n return pass;\r\n }\r\n}\r\n"]}
@@ -13,6 +13,10 @@ export declare class FrameGraphClearTextureTask extends FrameGraphTask {
13
13
  * If the color should be cleared.
14
14
  */
15
15
  clearColor: boolean;
16
+ /**
17
+ * If the color should be converted to linear space (default: false).
18
+ */
19
+ convertColorToLinearSpace: boolean;
16
20
  /**
17
21
  * If the depth should be cleared.
18
22
  */
@@ -1,4 +1,4 @@
1
- import { Color4 } from "../../../Maths/math.color.js";
1
+ import { Color4, TmpColors } from "../../../Maths/math.color.js";
2
2
  import { FrameGraphTask } from "../../frameGraphTask.js";
3
3
  /**
4
4
  * Task used to clear a texture.
@@ -19,6 +19,10 @@ export class FrameGraphClearTextureTask extends FrameGraphTask {
19
19
  * If the color should be cleared.
20
20
  */
21
21
  this.clearColor = true;
22
+ /**
23
+ * If the color should be converted to linear space (default: false).
24
+ */
25
+ this.convertColorToLinearSpace = false;
22
26
  /**
23
27
  * If the depth should be cleared.
24
28
  */
@@ -47,11 +51,16 @@ export class FrameGraphClearTextureTask extends FrameGraphTask {
47
51
  if (textureSamples !== depthSamples && textureSamples !== 0 && depthSamples !== 0) {
48
52
  throw new Error(`FrameGraphClearTextureTask ${this.name}: the depth texture and the target texture must have the same number of samples.`);
49
53
  }
54
+ const color = TmpColors.Color4[0];
50
55
  const pass = this._frameGraph.addRenderPass(this.name);
51
56
  pass.setRenderTarget(this.targetTexture);
52
57
  pass.setRenderTargetDepth(this.depthTexture);
53
58
  pass.setExecuteFunc((context) => {
54
- context.clear(this.color, !!this.clearColor, !!this.clearDepth, !!this.clearStencil);
59
+ color.copyFrom(this.color);
60
+ if (this.convertColorToLinearSpace) {
61
+ color.toLinearSpaceToRef(color);
62
+ }
63
+ context.clear(color, !!this.clearColor, !!this.clearDepth, !!this.clearStencil);
55
64
  });
56
65
  const passDisabled = this._frameGraph.addRenderPass(this.name + "_disabled", true);
57
66
  passDisabled.setRenderTarget(this.targetTexture);
@@ -1 +1 @@
1
- {"version":3,"file":"clearTextureTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Texture/clearTextureTask.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,cAAc;IAyC1D;;;;OAIG;IACH,YAAY,IAAY,EAAE,UAAsB;QAC5C,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QA9C5B;;WAEG;QACI,UAAK,GAAG,IAAI,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EA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AED,IAAI,cAAc,KAAK,YAAY,IAAI,cAAc,KAAK,CAAC,IAAI,YAAY,KAAK,CAAC,EAAE,CAAC;YAChF,MAAM,IAAI,KAAK,CAAC,8BAA8B,IAAI,CAAC,IAAI,kFAAkF,CAAC,CAAC;QAC/I,CAAC;QAED,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEvD,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACzC,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC7C,IAAI,CAAC,cAAc,CAAC,CAAC,OAAO,EAAE,EAAE;YAC5B,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACzF,CAAC,CAAC,CAAC;QAEH,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,GAAG,WAAW,EAAE,IAAI,CAAC,CAAC;QAEnF,YAAY,CAAC,eAAe,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACjD,YAAY,CAAC,oBAAoB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACrD,YAAY,CAAC,cAAc,CAAC,CAAC,QAAQ,EAAE,EAAE,GAAE,CAAC,CAAC,CAAC;QAE9C,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ","sourcesContent":["// eslint-disable-next-line import/no-internal-modules\r\nimport type { FrameGraph, FrameGraphTextureHandle, FrameGraphRenderPass } from \"core/index\";\r\nimport { Color4 } from \"../../../Maths/math.color\";\r\nimport { FrameGraphTask } from \"../../frameGraphTask\";\r\n\r\n/**\r\n * Task used to clear a texture.\r\n */\r\nexport class FrameGraphClearTextureTask extends FrameGraphTask {\r\n /**\r\n * The color to clear the texture with.\r\n */\r\n public color = new Color4(0.2, 0.2, 0.3, 1);\r\n\r\n /**\r\n * If the color should be cleared.\r\n */\r\n public clearColor = true;\r\n\r\n /**\r\n * If the depth should be cleared.\r\n */\r\n public clearDepth = false;\r\n\r\n /**\r\n * If the stencil should be cleared.\r\n */\r\n public clearStencil = false;\r\n\r\n /**\r\n * The color texture to clear.\r\n */\r\n public targetTexture?: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The depth attachment texture to clear.\r\n */\r\n public depthTexture?: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The output texture (same as targetTexture, but the handle will be different).\r\n */\r\n public readonly outputTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The output depth texture (same as depthTexture, but the handle will be different).\r\n */\r\n public readonly outputDepthTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * Constructs a new clear task.\r\n * @param name The name of the task.\r\n * @param frameGraph The frame graph the task belongs to.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph) {\r\n super(name, frameGraph);\r\n\r\n this.outputTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.outputDepthTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n }\r\n\r\n public record(): FrameGraphRenderPass {\r\n if (this.targetTexture === undefined && this.depthTexture === undefined) {\r\n throw new Error(`FrameGraphClearTextureTask ${this.name}: targetTexture and depthTexture can't both be undefined.`);\r\n }\r\n\r\n let textureSamples = 0;\r\n let depthSamples = 0;\r\n\r\n if (this.targetTexture !== undefined) {\r\n textureSamples = this._frameGraph.textureManager.getTextureDescription(this.targetTexture).options.samples || 1;\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, this.targetTexture);\r\n }\r\n if (this.depthTexture !== undefined) {\r\n depthSamples = this._frameGraph.textureManager.getTextureDescription(this.depthTexture).options.samples || 1;\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputDepthTexture, this.depthTexture);\r\n }\r\n\r\n if (textureSamples !== depthSamples && textureSamples !== 0 && depthSamples !== 0) {\r\n throw new Error(`FrameGraphClearTextureTask ${this.name}: the depth texture and the target texture must have the same number of samples.`);\r\n }\r\n\r\n const pass = this._frameGraph.addRenderPass(this.name);\r\n\r\n pass.setRenderTarget(this.targetTexture);\r\n pass.setRenderTargetDepth(this.depthTexture);\r\n pass.setExecuteFunc((context) => {\r\n context.clear(this.color, !!this.clearColor, !!this.clearDepth, !!this.clearStencil);\r\n });\r\n\r\n const passDisabled = this._frameGraph.addRenderPass(this.name + \"_disabled\", true);\r\n\r\n passDisabled.setRenderTarget(this.targetTexture);\r\n passDisabled.setRenderTargetDepth(this.depthTexture);\r\n passDisabled.setExecuteFunc((_context) => {});\r\n\r\n return pass;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"clearTextureTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Texture/clearTextureTask.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,cAAc;IA8C1D;;;;OAIG;IACH,YAAY,IAAY,EAAE,UAAsB;QAC5C,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAnD5B;;WAEG;QACI,UAAK,GAAG,IAAI,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;QAE5C;;WAEG;QACI,eAAU,GAAG,IAAI,CAAC;QAEzB;;WAEG;QACI,8BAAyB,GAAG,KAAK,CAAC;QAEzC;;WAEG;QACI,eAAU,GAAG,KAAK,CAAC;QAE1B;;WAEG;QACI,iBAAY,GAAG,KAAK,CAAC;QA8BxB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,oBAAoB,EAAE,CAAC;QAC5E,IAAI,CA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AI,GAAG,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEvD,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACzC,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC7C,IAAI,CAAC,cAAc,CAAC,CAAC,OAAO,EAAE,EAAE;YAC5B,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC3B,IAAI,IAAI,CAAC,yBAAyB,EAAE,CAAC;gBACjC,KAAK,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;YACpC,CAAC;YAED,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACpF,CAAC,CAAC,CAAC;QAEH,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,GAAG,WAAW,EAAE,IAAI,CAAC,CAAC;QAEnF,YAAY,CAAC,eAAe,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACjD,YAAY,CAAC,oBAAoB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACrD,YAAY,CAAC,cAAc,CAAC,CAAC,QAAQ,EAAE,EAAE,GAAE,CAAC,CAAC,CAAC;QAE9C,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ","sourcesContent":["// eslint-disable-next-line import/no-internal-modules\r\nimport type { FrameGraph, FrameGraphTextureHandle, FrameGraphRenderPass } from \"core/index\";\r\nimport { Color4, TmpColors } from \"../../../Maths/math.color\";\r\nimport { FrameGraphTask } from \"../../frameGraphTask\";\r\n\r\n/**\r\n * Task used to clear a texture.\r\n */\r\nexport class FrameGraphClearTextureTask extends FrameGraphTask {\r\n /**\r\n * The color to clear the texture with.\r\n */\r\n public color = new Color4(0.2, 0.2, 0.3, 1);\r\n\r\n /**\r\n * If the color should be cleared.\r\n */\r\n public clearColor = true;\r\n\r\n /**\r\n * If the color should be converted to linear space (default: false).\r\n */\r\n public convertColorToLinearSpace = false;\r\n\r\n /**\r\n * If the depth should be cleared.\r\n */\r\n public clearDepth = false;\r\n\r\n /**\r\n * If the stencil should be cleared.\r\n */\r\n public clearStencil = false;\r\n\r\n /**\r\n * The color texture to clear.\r\n */\r\n public targetTexture?: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The depth attachment texture to clear.\r\n */\r\n public depthTexture?: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The output texture (same as targetTexture, but the handle will be different).\r\n */\r\n public readonly outputTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The output depth texture (same as depthTexture, but the handle will be different).\r\n */\r\n public readonly outputDepthTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * Constructs a new clear task.\r\n * @param name The name of the task.\r\n * @param frameGraph The frame graph the task belongs to.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph) {\r\n super(name, frameGraph);\r\n\r\n this.outputTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.outputDepthTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n }\r\n\r\n public record(): FrameGraphRenderPass {\r\n if (this.targetTexture === undefined && this.depthTexture === undefined) {\r\n throw new Error(`FrameGraphClearTextureTask ${this.name}: targetTexture and depthTexture can't both be undefined.`);\r\n }\r\n\r\n let textureSamples = 0;\r\n let depthSamples = 0;\r\n\r\n if (this.targetTexture !== undefined) {\r\n textureSamples = this._frameGraph.textureManager.getTextureDescription(this.targetTexture).options.samples || 1;\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, this.targetTexture);\r\n }\r\n if (this.depthTexture !== undefined) {\r\n depthSamples = this._frameGraph.textureManager.getTextureDescription(this.depthTexture).options.samples || 1;\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputDepthTexture, this.depthTexture);\r\n }\r\n\r\n if (textureSamples !== depthSamples && textureSamples !== 0 && depthSamples !== 0) {\r\n throw new Error(`FrameGraphClearTextureTask ${this.name}: the depth texture and the target texture must have the same number of samples.`);\r\n }\r\n\r\n const color = TmpColors.Color4[0];\r\n\r\n const pass = this._frameGraph.addRenderPass(this.name);\r\n\r\n pass.setRenderTarget(this.targetTexture);\r\n pass.setRenderTargetDepth(this.depthTexture);\r\n pass.setExecuteFunc((context) => {\r\n color.copyFrom(this.color);\r\n if (this.convertColorToLinearSpace) {\r\n color.toLinearSpaceToRef(color);\r\n }\r\n\r\n context.clear(color, !!this.clearColor, !!this.clearDepth, !!this.clearStencil);\r\n });\r\n\r\n const passDisabled = this._frameGraph.addRenderPass(this.name + \"_disabled\", true);\r\n\r\n passDisabled.setRenderTarget(this.targetTexture);\r\n passDisabled.setRenderTargetDepth(this.depthTexture);\r\n passDisabled.setExecuteFunc((_context) => {});\r\n\r\n return pass;\r\n }\r\n}\r\n"]}
@@ -1,4 +1,4 @@
1
- import type { Scene, AbstractEngine, FrameGraphTask } from "../index.js";
1
+ import type { Scene, AbstractEngine, FrameGraphTask, Nullable, NodeRenderGraph } from "../index.js";
2
2
  import { FrameGraphPass } from "./Passes/pass";
3
3
  import { FrameGraphRenderPass } from "./Passes/renderPass";
4
4
  import { FrameGraphCullPass } from "./Passes/cullPass";
@@ -10,6 +10,7 @@ import { Observable } from "../Misc/observable.js";
10
10
  * @experimental
11
11
  */
12
12
  export declare class FrameGraph {
13
+ private readonly _linkedNodeRenderGraph;
13
14
  /**
14
15
  * Gets the texture manager used by the frame graph
15
16
  */
@@ -21,6 +22,10 @@ export declare class FrameGraph {
21
22
  private readonly _renderContext;
22
23
  private _currentProcessedTask;
23
24
  private _whenReadyAsyncCancel;
25
+ /**
26
+ * Name of the frame graph
27
+ */
28
+ name: string;
24
29
  /**
25
30
  * Gets or sets a boolean indicating that texture allocation should be optimized (that is, reuse existing textures when possible to limit GPU memory usage) (default: true)
26
31
  */
@@ -41,12 +46,23 @@ export declare class FrameGraph {
41
46
  * Gets the list of tasks in the frame graph
42
47
  */
43
48
  get tasks(): FrameGraphTask[];
49
+ /**
50
+ * Gets the node render graph linked to the frame graph (if any)
51
+ * @returns the linked node render graph or null if none
52
+ */
53
+ getLinkedNodeRenderGraph(): Nullable<NodeRenderGraph>;
44
54
  /**
45
55
  * Constructs the frame graph
46
56
  * @param scene defines the scene the frame graph is associated with
47
57
  * @param debugTextures defines a boolean indicating that textures created by the frame graph should be visible in the inspector (default is false)
58
+ * @param _linkedNodeRenderGraph defines the linked node render graph (if any)
59
+ */
60
+ constructor(scene: Scene, debugTextures?: boolean, _linkedNodeRenderGraph?: Nullable<NodeRenderGraph>);
61
+ /**
62
+ * Gets the class name of the frame graph
63
+ * @returns the class name
48
64
  */
49
- constructor(scene: Scene, debugTextures?: boolean);
65
+ getClassName(): string;
50
66
  /**
51
67
  * Gets a task by name
52
68
  * @param name Name of the task to get