d6aef938919424de1345416acb76547455fb2ff3a33aa0ecd4ff9c9a89cb5eae.json 65 KB

1
  1. {"ast":null,"code":"import { __decorate } from \"../../tslib.es6.js\";\nimport { Observable } from \"../../Misc/observable.js\";\nimport { NodeRenderGraphOutputBlock } from \"./Blocks/outputBlock.js\";\nimport { FrameGraph } from \"../frameGraph.js\";\nimport { GetClass } from \"../../Misc/typeStore.js\";\nimport { serialize } from \"../../Misc/decorators.js\";\nimport { SerializationHelper } from \"../../Misc/decorators.serialization.js\";\nimport { WebRequest } from \"../../Misc/webRequest.js\";\nimport { NodeRenderGraphInputBlock } from \"./Blocks/inputBlock.js\";\nimport { Tools } from \"../../Misc/tools.js\";\nimport { Engine } from \"../../Engines/engine.js\";\nimport { NodeRenderGraphBlockConnectionPointTypes } from \"./Types/nodeRenderGraphTypes.js\";\nimport { NodeRenderGraphClearBlock } from \"./Blocks/Textures/clearBlock.js\";\nimport { NodeRenderGraphBuildState } from \"./nodeRenderGraphBuildState.js\";\n/**\n * Defines a node render graph\n */\nexport class NodeRenderGraph {\n /** @returns the inspector from bundle or global */\n _getGlobalNodeRenderGraphEditor() {\n // UMD Global name detection from Webpack Bundle UMD Name.\n if (typeof NODERENDERGRAPHEDITOR !== \"undefined\") {\n return NODERENDERGRAPHEDITOR;\n }\n // In case of module let's check the global emitted from the editor entry point.\n if (typeof BABYLON !== \"undefined\" && typeof BABYLON.NodeRenderGraphEditor !== \"undefined\") {\n return BABYLON;\n }\n return undefined;\n }\n /**\n * Gets the frame graph used by this node render graph\n */\n get frameGraph() {\n return this._frameGraph;\n }\n /**\n * Gets the scene used by this node render graph\n * @returns the scene used by this node render graph\n */\n getScene() {\n return this._scene;\n }\n /**\n * Creates a new node render graph\n * @param name defines the name of the node render graph\n * @param scene defines the scene to use to execute the graph\n * @param options defines the options to use when creating the graph\n */\n constructor(name, scene, options) {\n this._buildId = NodeRenderGraph._BuildIdGenerator++;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n this.BJSNODERENDERGRAPHEDITOR = this._getGlobalNodeRenderGraphEditor();\n /**\n * Gets or sets data used by visual editor\n * @see https://nrge.babylonjs.com\n */\n this.editorData = null;\n /**\n * Gets an array of blocks that needs to be serialized even if they are not yet connected\n */\n this.attachedBlocks = [];\n /**\n * Observable raised when the node render graph is built\n */\n this.onBuildObservable = new Observable();\n /**\n * Observable raised when an error is detected\n */\n this.onBuildErrorObservable = new Observable();\n /** Gets or sets the RenderGraphOutputBlock used to gather the final node render graph data */\n this.outputBlock = null;\n this._resizeObserver = null;\n this.name = name;\n this._scene = scene;\n this._engine = scene.getEngine();\n options = {\n debugTextures: false,\n autoConfigure: false,\n verbose: false,\n rebuildGraphOnEngineResize: true,\n autoFillExternalInputs: true,\n ...options\n };\n this._options = options;\n this._frameGraph = new FrameGraph(this._engine, options.debugTextures, this._scene);\n if (options.rebuildGraphOnEngineResize) {\n this._resizeObserver = this._engine.onResizeObservable.add(() => {\n this.build();\n });\n }\n }\n /**\n * Gets the current class name (\"NodeRenderGraph\")\n * @returns the class name\n */\n getClassName() {\n return \"NodeRenderGraph\";\n }\n /**\n * Gets a block by its name\n * @param name defines the name of the block to retrieve\n * @returns the required block or null if not found\n */\n getBlockByName(name) {\n let result = null;\n for (const block of this.attachedBlocks) {\n if (block.name === name) {\n if (!result) {\n result = block;\n } else {\n Tools.Warn(\"More than one block was found with the name `\" + name + \"`\");\n return result;\n }\n }\n }\n return result;\n }\n /**\n * Get a block using a predicate\n * @param predicate defines the predicate used to find the good candidate\n * @returns the required block or null if not found\n */\n getBlockByPredicate(predicate) {\n for (const block of this.attachedBlocks) {\n if (predicate(block)) {\n return block;\n }\n }\n return null;\n }\n /**\n * Get all blocks that match a predicate\n * @param predicate defines the predicate used to find the good candidate(s)\n * @returns the list of blocks found\n */\n getBlocksByPredicate(predicate) {\n const blocks = [];\n for (const block of this.attachedBlocks) {\n if (predicate(block)) {\n blocks.push(block);\n }\n }\n return blocks;\n }\n /**\n * Gets the list of input blocks attached to this material\n * @returns an array of InputBlocks\n */\n getInputBlocks() {\n const blocks = [];\n for (const block of this.attachedBlocks) {\n if (block.isInput) {\n blocks.push(block);\n }\n }\n return blocks;\n }\n /**\n * Launch the node render graph editor\n * @param config Define the configuration of the editor\n * @returns a promise fulfilled when the node editor is visible\n */\n edit(config) {\n return new Promise(resolve => {\n this.BJSNODERENDERGRAPHEDITOR = this.BJSNODERENDERGRAPHEDITOR || this._getGlobalNodeRenderGraphEditor();\n if (typeof this.BJSNODERENDERGRAPHEDITOR == \"undefined\") {\n const editorUrl = config && config.editorURL ? config.editorURL : NodeRenderGraph.EditorURL;\n // Load editor and add it to the DOM\n Tools.LoadBabylonScript(editorUrl, () => {\n this.BJSNODERENDERGRAPHEDITOR = this.BJSNODERENDERGRAPHEDITOR || this._getGlobalNodeRenderGraphEditor();\n this._createNodeEditor(config === null || config === void 0 ? void 0 : config.nodeRenderGraphEditorConfig);\n resolve();\n });\n } else {\n // Otherwise creates the editor\n this._createNodeEditor(config === null || config === void 0 ? void 0 : config.nodeRenderGraphEditorConfig);\n resolve();\n }\n });\n }\n /**\n * Creates the node editor window.\n * @param additionalConfig Additional configuration for the FGE\n */\n _createNodeEditor(additionalConfig) {\n const nodeEditorConfig = {\n nodeRenderGraph: this,\n ...additionalConfig\n };\n this.BJSNODERENDERGRAPHEDITOR.NodeRenderGraphEditor.Show(nodeEditorConfig);\n }\n /**\n * Build the final list of blocks that will be executed by the \"execute\" method\n */\n build() {\n if (!this.outputBlock) {\n throw new Error(\"You must define the outputBlock property before building the node render graph\");\n }\n this._initializeBlock(this.outputBlock);\n this._frameGraph.clear();\n const state = new NodeRenderGraphBuildState();\n state.buildId = this._buildId;\n state.verbose = this._options.verbose;\n if (this._options.autoFillExternalInputs) {\n this._autoFillExternalInputs();\n }\n this.outputBlock.build(state);\n this._frameGraph.build();\n this._buildId = NodeRenderGraph._BuildIdGenerator++;\n if (state.emitErrors(this.onBuildErrorObservable)) {\n this.onBuildObservable.notifyObservers(this);\n }\n }\n _autoFillExternalInputs() {\n const allInputs = this.getInputBlocks();\n let cameraIndex = 0;\n for (const input of allInputs) {\n if (!input.isExternal) {\n continue;\n }\n if (!input.isAnAncestorOfType(\"NodeRenderGraphOutputBlock\")) {\n continue;\n }\n if ((input.type & NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBuffer) !== 0) {\n // nothing to do\n } else if (input.isCamera()) {\n const camera = this._scene.cameras[cameraIndex++] || this._scene.cameras[0];\n if (!this._scene.cameraToUseForPointers) {\n this._scene.cameraToUseForPointers = camera;\n }\n input.value = camera;\n } else if (input.isObjectList()) {\n input.value = {\n meshes: this._scene.meshes,\n particleSystems: this._scene.particleSystems\n };\n }\n }\n }\n /**\n * Returns a promise that resolves when the node render graph is ready to be executed\n * This method must be called after the graph has been built (NodeRenderGraph.build called)!\n * @param timeout Timeout in ms between retries (default is 16)\n * @returns The promise that resolves when the graph is ready\n */\n whenReadyAsync(timeout = 16) {\n return this._frameGraph.whenReadyAsync(timeout);\n }\n /**\n * Execute the graph (the graph must have been built before!)\n */\n execute() {\n this._frameGraph.execute();\n }\n _initializeBlock(node) {\n node.initialize();\n if (this._options.autoConfigure) {\n node.autoConfigure();\n }\n if (this.attachedBlocks.indexOf(node) === -1) {\n this.attachedBlocks.push(node);\n }\n for (const input of node.inputs) {\n const connectedPoint = input.connectedPoint;\n if (connectedPoint) {\n const block = connectedPoint.ownerBlock;\n if (block !== node) {\n this._initializeBlock(block);\n }\n }\n }\n }\n /**\n * Clear the current graph\n */\n clear() {\n this.outputBlock = null;\n this.attachedBlocks.length = 0;\n }\n /**\n * Remove a block from the current graph\n * @param block defines the block to remove\n */\n removeBlock(block) {\n const attachedBlockIndex = this.attachedBlocks.indexOf(block);\n if (attachedBlockIndex > -1) {\n this.attachedBlocks.splice(attachedBlockIndex, 1);\n }\n if (block === this.outputBlock) {\n this.outputBlock = null;\n }\n }\n /**\n * Clear the current graph and load a new one from a serialization object\n * @param source defines the JSON representation of the graph\n * @param merge defines whether or not the source must be merged or replace the current content\n */\n parseSerializedObject(source, merge = false) {\n if (!merge) {\n this.clear();\n }\n const map = {};\n // Create blocks\n for (const parsedBlock of source.blocks) {\n const blockType = GetClass(parsedBlock.customType);\n if (blockType) {\n const additionalConstructionParameters = parsedBlock.additionalConstructionParameters;\n const block = additionalConstructionParameters ? new blockType(\"\", this._frameGraph, this._scene, ...additionalConstructionParameters) : new blockType(\"\", this._frameGraph, this._scene);\n block._deserialize(parsedBlock);\n map[parsedBlock.id] = block;\n this.attachedBlocks.push(block);\n }\n }\n // Reconnect teleportation\n for (const block of this.attachedBlocks) {\n if (block.isTeleportOut) {\n const teleportOut = block;\n const id = teleportOut._tempEntryPointUniqueId;\n if (id) {\n const source = map[id];\n if (source) {\n source.attachToEndpoint(teleportOut);\n }\n }\n }\n }\n // Connections - Starts with input blocks only (except if in \"merge\" mode where we scan all blocks)\n for (let blockIndex = 0; blockIndex < source.blocks.length; blockIndex++) {\n const parsedBlock = source.blocks[blockIndex];\n const block = map[parsedBlock.id];\n if (!block) {\n continue;\n }\n if (block.inputs.length && parsedBlock.inputs.some(i => i.targetConnectionName) && !merge) {\n continue;\n }\n this._restoreConnections(block, source, map);\n }\n // Outputs\n if (source.outputNodeId) {\n this.outputBlock = map[source.outputNodeId];\n }\n // UI related info\n if (source.locations || source.editorData && source.editorData.locations) {\n const locations = source.locations || source.editorData.locations;\n for (const location of locations) {\n if (map[location.blockId]) {\n location.blockId = map[location.blockId].uniqueId;\n }\n }\n if (merge && this.editorData && this.editorData.locations) {\n locations.concat(this.editorData.locations);\n }\n if (source.locations) {\n this.editorData = {\n locations: locations\n };\n } else {\n this.editorData = source.editorData;\n this.editorData.locations = locations;\n }\n const blockMap = [];\n for (const key in map) {\n blockMap[key] = map[key].uniqueId;\n }\n this.editorData.map = blockMap;\n }\n this.comment = source.comment;\n }\n _restoreConnections(block, source, map) {\n for (const outputPoint of block.outputs) {\n for (const candidate of source.blocks) {\n const target = map[candidate.id];\n if (!target) {\n continue;\n }\n for (const input of candidate.inputs) {\n if (map[input.targetBlockId] === block && input.targetConnectionName === outputPoint.name) {\n const inputPoint = target.getInputByName(input.inputName);\n if (!inputPoint || inputPoint.isConnected) {\n continue;\n }\n outputPoint.connectTo(inputPoint, true);\n this._restoreConnections(target, source, map);\n continue;\n }\n }\n }\n }\n }\n /**\n * Generate a string containing the code declaration required to create an equivalent of this node render graph\n * @returns a string\n */\n generateCode() {\n let alreadyDumped = [];\n const blocks = [];\n const uniqueNames = [\"const\", \"var\", \"let\"];\n // Gets active blocks\n if (this.outputBlock) {\n this._gatherBlocks(this.outputBlock, blocks);\n }\n // Generate\n const options = JSON.stringify(this._options);\n let codeString = `let nodeRenderGraph = new BABYLON.NodeRenderGraph(\"${this.name || \"render graph\"}\", scene, ${options});\\n`;\n for (const node of blocks) {\n if (node.isInput && alreadyDumped.indexOf(node) === -1) {\n codeString += node._dumpCode(uniqueNames, alreadyDumped) + \"\\n\";\n }\n }\n if (this.outputBlock) {\n // Connections\n alreadyDumped = [];\n codeString += \"// Connections\\n\";\n codeString += this.outputBlock._dumpCodeForOutputConnections(alreadyDumped);\n // Output nodes\n codeString += \"// Output nodes\\n\";\n codeString += `nodeRenderGraph.outputBlock = ${this.outputBlock._codeVariableName};\\n`;\n codeString += `nodeRenderGraph.build();\\n`;\n }\n return codeString;\n }\n _gatherBlocks(rootNode, list) {\n if (list.indexOf(rootNode) !== -1) {\n return;\n }\n list.push(rootNode);\n for (const input of rootNode.inputs) {\n const connectedPoint = input.connectedPoint;\n if (connectedPoint) {\n const block = connectedPoint.ownerBlock;\n if (block !== rootNode) {\n this._gatherBlocks(block, list);\n }\n }\n }\n // Teleportation\n if (rootNode.isTeleportOut) {\n const block = rootNode;\n if (block.entryPoint) {\n this._gatherBlocks(block.entryPoint, list);\n }\n }\n }\n /**\n * Clear the current graph and set it to a default state\n */\n setToDefault() {\n this.clear();\n this.editorData = null;\n // Source\n const backBuffer = new NodeRenderGraphInputBlock(\"BackBuffer color\", this._frameGraph, this._scene, NodeRenderGraphBlockConnectionPointTypes.TextureBackBuffer);\n // Clear texture\n const clear = new NodeRenderGraphClearBlock(\"Clear\", this._frameGraph, this._scene);\n backBuffer.output.connectTo(clear.texture);\n // Final output\n const output = new NodeRenderGraphOutputBlock(\"Output\", this._frameGraph, this._scene);\n clear.output.connectTo(output.texture);\n this.outputBlock = output;\n }\n /**\n * Makes a duplicate of the current node render graph.\n * @param name defines the name to use for the new node render graph\n * @returns the new node render graph\n */\n clone(name) {\n const serializationObject = this.serialize();\n const clone = SerializationHelper.Clone(() => new NodeRenderGraph(name, this._scene), this);\n clone.name = name;\n clone.parseSerializedObject(serializationObject);\n clone._buildId = this._buildId;\n clone.build();\n return clone;\n }\n /**\n * Serializes this node render graph in a JSON representation\n * @param selectedBlocks defines the list of blocks to save (if null the whole node render graph will be saved)\n * @returns the serialized node render graph object\n */\n serialize(selectedBlocks) {\n const serializationObject = selectedBlocks ? {} : SerializationHelper.Serialize(this);\n serializationObject.editorData = JSON.parse(JSON.stringify(this.editorData)); // Copy\n let blocks = [];\n if (selectedBlocks) {\n blocks = selectedBlocks;\n } else {\n serializationObject.customType = \"BABYLON.NodeRenderGraph\";\n if (this.outputBlock) {\n serializationObject.outputNodeId = this.outputBlock.uniqueId;\n }\n }\n // Blocks\n serializationObject.blocks = [];\n for (const block of blocks) {\n serializationObject.blocks.push(block.serialize());\n }\n if (!selectedBlocks) {\n for (const block of this.attachedBlocks) {\n if (blocks.indexOf(block) !== -1) {\n continue;\n }\n serializationObject.blocks.push(block.serialize());\n }\n }\n return serializationObject;\n }\n /**\n * Disposes the ressources\n */\n dispose() {\n for (const block of this.attachedBlocks) {\n block.dispose();\n }\n this._frameGraph.dispose();\n this._frameGraph = undefined;\n this._engine.onResizeObservable.remove(this._resizeObserver);\n this._resizeObserver = null;\n this.attachedBlocks.length = 0;\n this.onBuildObservable.clear();\n this.onBuildErrorObservable.clear();\n }\n /**\n * Creates a new node render graph set to default basic configuration\n * @param name defines the name of the node render graph\n * @param scene defines the scene to use\n * @param nodeRenderGraphOptions defines options to use when creating the node render graph\n * @returns a new NodeRenderGraph\n */\n static CreateDefault(name, scene, nodeRenderGraphOptions) {\n const renderGraph = new NodeRenderGraph(name, scene, nodeRenderGraphOptions);\n renderGraph.setToDefault();\n renderGraph.build();\n return renderGraph;\n }\n /**\n * Creates a node render graph from parsed graph data\n * @param source defines the JSON representation of the node render graph\n * @param scene defines the scene to use\n * @param nodeRenderGraphOptions defines options to use when creating the node render\n * @param skipBuild defines whether to skip building the node render graph (default is true)\n * @returns a new node render graph\n */\n static Parse(source, scene, nodeRenderGraphOptions, skipBuild = true) {\n const renderGraph = SerializationHelper.Parse(() => new NodeRenderGraph(source.name, scene, nodeRenderGraphOptions), source, null);\n renderGraph.parseSerializedObject(source);\n if (!skipBuild) {\n renderGraph.build();\n }\n return renderGraph;\n }\n /**\n * Creates a node render graph from a snippet saved by the node render graph editor\n * @param snippetId defines the snippet to load\n * @param scene defines the scene to use\n * @param nodeRenderGraphOptions defines options to use when creating the node render graph\n * @param nodeRenderGraph defines a node render graph to update (instead of creating a new one)\n * @param skipBuild defines whether to skip building the node render graph (default is true)\n * @returns a promise that will resolve to the new node render graph\n */\n static ParseFromSnippetAsync(snippetId, scene, nodeRenderGraphOptions, nodeRenderGraph, skipBuild = true) {\n if (snippetId === \"_BLANK\") {\n return Promise.resolve(NodeRenderGraph.CreateDefault(\"blank\", scene, nodeRenderGraphOptions));\n }\n return new Promise((resolve, reject) => {\n const request = new WebRequest();\n request.addEventListener(\"readystatechange\", () => {\n if (request.readyState == 4) {\n if (request.status == 200) {\n const snippet = JSON.parse(JSON.parse(request.responseText).jsonPayload);\n const serializationObject = JSON.parse(snippet.nodeRenderGraph);\n if (!nodeRenderGraph) {\n nodeRenderGraph = SerializationHelper.Parse(() => new NodeRenderGraph(snippetId, scene, nodeRenderGraphOptions), serializationObject, null);\n }\n nodeRenderGraph.parseSerializedObject(serializationObject);\n nodeRenderGraph.snippetId = snippetId;\n try {\n if (!skipBuild) {\n nodeRenderGraph.build();\n }\n resolve(nodeRenderGraph);\n } catch (err) {\n reject(err);\n }\n } else {\n reject(\"Unable to load the snippet \" + snippetId);\n }\n }\n });\n request.open(\"GET\", this.SnippetUrl + \"/\" + snippetId.replace(/#/g, \"/\"));\n request.send();\n });\n }\n}\nNodeRenderGraph._BuildIdGenerator = 0;\n/** Define the Url to load node editor script */\nNodeRenderGraph.EditorURL = `${Tools._DefaultCdnUrl}/v${Engine.Version}/NodeRenderGraph/babylon.nodeRenderGraph.js`;\n/** Define the Url to load snippets */\nNodeRenderGraph.SnippetUrl = `https://snippet.babylonjs.com`;\n__decorate([serialize()], NodeRenderGraph.prototype, \"name\", void 0);\n__decorate([serialize(\"comment\")], NodeRenderGraph.prototype, \"comment\", void 0);","map":{"version":3,"names":["__decorate","Observable","NodeRenderGraphOutputBlock","FrameGraph","GetClass","serialize","SerializationHelper","WebRequest","NodeRenderGraphInputBlock","Tools","Engine","NodeRenderGraphBlockConnectionPointTypes","NodeRenderGraphClearBlock","NodeRenderGraphBuildState","NodeRenderGraph","_getGlobalNodeRenderGraphEditor","NODERENDERGRAPHEDITOR","BABYLON","NodeRenderGraphEditor","undefined","frameGraph","_frameGraph","getScene","_scene","constructor","name","scene","options","_buildId","_BuildIdGenerator","BJSNODERENDERGRAPHEDITOR","editorData","attachedBlocks","onBuildObservable","onBuildErrorObservable","outputBlock","_resizeObserver","_engine","getEngine","debugTextures","autoConfigure","verbose","rebuildGraphOnEngineResize","autoFillExternalInputs","_options","onResizeObservable","add","build","getClassName","getBlockByName","result","block","Warn","getBlockByPredicate","predicate","getBlocksByPredicate","blocks","push","getInputBlocks","isInput","edit","config","Promise","resolve","editorUrl","editorURL","EditorURL","LoadBabylonScript","_createNodeEditor","nodeRenderGraphEditorConfig","additionalConfig","nodeEditorConfig","nodeRenderGraph","Show","Error","_initializeBlock","clear","state","buildId","_autoFillExternalInputs","emitErrors","notifyObservers","allInputs","cameraIndex","input","isExternal","isAnAncestorOfType","type","TextureAllButBackBuffer","isCamera","camera","cameras","cameraToUseForPointers","value","isObjectList","meshes","particleSystems","whenReadyAsync","timeout","execute","node","initialize","indexOf","inputs","connectedPoint","ownerBlock","length","removeBlock","attachedBlockIndex","splice","parseSerializedObject","source","merge","map","parsedBlock","blockType","customType","additionalConstructionParameters","_deserialize","id","isTeleportOut","teleportOut","_tempEntryPointUniqueId","attachToEndpoint","blockIndex","some","i","targetConnectionName","_restoreConnections","outputNodeId","locations","location","blockId","uniqueId","concat","blockMap","key","comment","outputPoint","outputs","candidate","target","targetBlockId","inputPoint","getInputByName","inputName","isConnected","connectTo","generateCode","alreadyDumped","uniqueNames","_gatherBlocks","JSON","stringify","codeString","_dumpCode","_dumpCodeForOutputConnections","_codeVariableName","rootNode","list","entryPoint","setToDefault","backBuffer","TextureBackBuffer","output","texture","clone","serializationObject","Clone","selectedBlocks","Serialize","parse","dispose","remove","CreateDefault","nodeRenderGraphOptions","renderGraph","Parse","skipBuild","ParseFromSnippetAsync","snippetId","reject","request","addEventListener","readyState","status","snippet","responseText","jsonPayload","err","open","SnippetUrl","replace","send","_DefaultCdnUrl","Version","prototype"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/FrameGraph/Node/nodeRenderGraph.js"],"sourcesContent":["import { __decorate } from \"../../tslib.es6.js\";\nimport { Observable } from \"../../Misc/observable.js\";\nimport { NodeRenderGraphOutputBlock } from \"./Blocks/outputBlock.js\";\nimport { FrameGraph } from \"../frameGraph.js\";\nimport { GetClass } from \"../../Misc/typeStore.js\";\nimport { serialize } from \"../../Misc/decorators.js\";\nimport { SerializationHelper } from \"../../Misc/decorators.serialization.js\";\n\nimport { WebRequest } from \"../../Misc/webRequest.js\";\nimport { NodeRenderGraphInputBlock } from \"./Blocks/inputBlock.js\";\nimport { Tools } from \"../../Misc/tools.js\";\nimport { Engine } from \"../../Engines/engine.js\";\nimport { NodeRenderGraphBlockConnectionPointTypes } from \"./Types/nodeRenderGraphTypes.js\";\nimport { NodeRenderGraphClearBlock } from \"./Blocks/Textures/clearBlock.js\";\nimport { NodeRenderGraphBuildState } from \"./nodeRenderGraphBuildState.js\";\n/**\n * Defines a node render graph\n */\nexport class NodeRenderGraph {\n /** @returns the inspector from bundle or global */\n _getGlobalNodeRenderGraphEditor() {\n // UMD Global name detection from Webpack Bundle UMD Name.\n if (typeof NODERENDERGRAPHEDITOR !== \"undefined\") {\n return NODERENDERGRAPHEDITOR;\n }\n // In case of module let's check the global emitted from the editor entry point.\n if (typeof BABYLON !== \"undefined\" && typeof BABYLON.NodeRenderGraphEditor !== \"undefined\") {\n return BABYLON;\n }\n return undefined;\n }\n /**\n * Gets the frame graph used by this node render graph\n */\n get frameGraph() {\n return this._frameGraph;\n }\n /**\n * Gets the scene used by this node render graph\n * @returns the scene used by this node render graph\n */\n getScene() {\n return this._scene;\n }\n /**\n * Creates a new node render graph\n * @param name defines the name of the node render graph\n * @param scene defines the scene to use to execute the graph\n * @param options defines the options to use when creating the graph\n */\n constructor(name, scene, options) {\n this._buildId = NodeRenderGraph._BuildIdGenerator++;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n this.BJSNODERENDERGRAPHEDITOR = this._getGlobalNodeRenderGraphEditor();\n /**\n * Gets or sets data used by visual editor\n * @see https://nrge.babylonjs.com\n */\n this.editorData = null;\n /**\n * Gets an array of blocks that needs to be serialized even if they are not yet connected\n */\n this.attachedBlocks = [];\n /**\n * Observable raised when the node render graph is built\n */\n this.onBuildObservable = new Observable();\n /**\n * Observable raised when an error is detected\n */\n this.onBuildErrorObservable = new Observable();\n /** Gets or sets the RenderGraphOutputBlock used to gather the final node render graph data */\n this.outputBlock = null;\n this._resizeObserver = null;\n this.name = name;\n this._scene = scene;\n this._engine = scene.getEngine();\n options = {\n debugTextures: false,\n autoConfigure: false,\n verbose: false,\n rebuildGraphOnEngineResize: true,\n autoFillExternalInputs: true,\n ...options,\n };\n this._options = options;\n this._frameGraph = new FrameGraph(this._engine, options.debugTextures, this._scene);\n if (options.rebuildGraphOnEngineResize) {\n this._resizeObserver = this._engine.onResizeObservable.add(() => {\n this.build();\n });\n }\n }\n /**\n * Gets the current class name (\"NodeRenderGraph\")\n * @returns the class name\n */\n getClassName() {\n return \"NodeRenderGraph\";\n }\n /**\n * Gets a block by its name\n * @param name defines the name of the block to retrieve\n * @returns the required block or null if not found\n */\n getBlockByName(name) {\n let result = null;\n for (const block of this.attachedBlocks) {\n if (block.name === name) {\n if (!result) {\n result = block;\n }\n else {\n Tools.Warn(\"More than one block was found with the name `\" + name + \"`\");\n return result;\n }\n }\n }\n return result;\n }\n /**\n * Get a block using a predicate\n * @param predicate defines the predicate used to find the good candidate\n * @returns the required block or null if not found\n */\n getBlockByPredicate(predicate) {\n for (const block of this.attachedBlocks) {\n if (predicate(block)) {\n return block;\n }\n }\n return null;\n }\n /**\n * Get all blocks that match a predicate\n * @param predicate defines the predicate used to find the good candidate(s)\n * @returns the list of blocks found\n */\n getBlocksByPredicate(predicate) {\n const blocks = [];\n for (const block of this.attachedBlocks) {\n if (predicate(block)) {\n blocks.push(block);\n }\n }\n return blocks;\n }\n /**\n * Gets the list of input blocks attached to this material\n * @returns an array of InputBlocks\n */\n getInputBlocks() {\n const blocks = [];\n for (const block of this.attachedBlocks) {\n if (block.isInput) {\n blocks.push(block);\n }\n }\n return blocks;\n }\n /**\n * Launch the node render graph editor\n * @param config Define the configuration of the editor\n * @returns a promise fulfilled when the node editor is visible\n */\n edit(config) {\n return new Promise((resolve) => {\n this.BJSNODERENDERGRAPHEDITOR = this.BJSNODERENDERGRAPHEDITOR || this._getGlobalNodeRenderGraphEditor();\n if (typeof this.BJSNODERENDERGRAPHEDITOR == \"undefined\") {\n const editorUrl = config && config.editorURL ? config.editorURL : NodeRenderGraph.EditorURL;\n // Load editor and add it to the DOM\n Tools.LoadBabylonScript(editorUrl, () => {\n this.BJSNODERENDERGRAPHEDITOR = this.BJSNODERENDERGRAPHEDITOR || this._getGlobalNodeRenderGraphEditor();\n this._createNodeEditor(config?.nodeRenderGraphEditorConfig);\n resolve();\n });\n }\n else {\n // Otherwise creates the editor\n this._createNodeEditor(config?.nodeRenderGraphEditorConfig);\n resolve();\n }\n });\n }\n /**\n * Creates the node editor window.\n * @param additionalConfig Additional configuration for the FGE\n */\n _createNodeEditor(additionalConfig) {\n const nodeEditorConfig = {\n nodeRenderGraph: this,\n ...additionalConfig,\n };\n this.BJSNODERENDERGRAPHEDITOR.NodeRenderGraphEditor.Show(nodeEditorConfig);\n }\n /**\n * Build the final list of blocks that will be executed by the \"execute\" method\n */\n build() {\n if (!this.outputBlock) {\n throw new Error(\"You must define the outputBlock property before building the node render graph\");\n }\n this._initializeBlock(this.outputBlock);\n this._frameGraph.clear();\n const state = new NodeRenderGraphBuildState();\n state.buildId = this._buildId;\n state.verbose = this._options.verbose;\n if (this._options.autoFillExternalInputs) {\n this._autoFillExternalInputs();\n }\n this.outputBlock.build(state);\n this._frameGraph.build();\n this._buildId = NodeRenderGraph._BuildIdGenerator++;\n if (state.emitErrors(this.onBuildErrorObservable)) {\n this.onBuildObservable.notifyObservers(this);\n }\n }\n _autoFillExternalInputs() {\n const allInputs = this.getInputBlocks();\n let cameraIndex = 0;\n for (const input of allInputs) {\n if (!input.isExternal) {\n continue;\n }\n if (!input.isAnAncestorOfType(\"NodeRenderGraphOutputBlock\")) {\n continue;\n }\n if ((input.type & NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBuffer) !== 0) {\n // nothing to do\n }\n else if (input.isCamera()) {\n const camera = this._scene.cameras[cameraIndex++] || this._scene.cameras[0];\n if (!this._scene.cameraToUseForPointers) {\n this._scene.cameraToUseForPointers = camera;\n }\n input.value = camera;\n }\n else if (input.isObjectList()) {\n input.value = { meshes: this._scene.meshes, particleSystems: this._scene.particleSystems };\n }\n }\n }\n /**\n * Returns a promise that resolves when the node render graph is ready to be executed\n * This method must be called after the graph has been built (NodeRenderGraph.build called)!\n * @param timeout Timeout in ms between retries (default is 16)\n * @returns The promise that resolves when the graph is ready\n */\n whenReadyAsync(timeout = 16) {\n return this._frameGraph.whenReadyAsync(timeout);\n }\n /**\n * Execute the graph (the graph must have been built before!)\n */\n execute() {\n this._frameGraph.execute();\n }\n _initializeBlock(node) {\n node.initialize();\n if (this._options.autoConfigure) {\n node.autoConfigure();\n }\n if (this.attachedBlocks.indexOf(node) === -1) {\n this.attachedBlocks.push(node);\n }\n for (const input of node.inputs) {\n const connectedPoint = input.connectedPoint;\n if (connectedPoint) {\n const block = connectedPoint.ownerBlock;\n if (block !== node) {\n this._initializeBlock(block);\n }\n }\n }\n }\n /**\n * Clear the current graph\n */\n clear() {\n this.outputBlock = null;\n this.attachedBlocks.length = 0;\n }\n /**\n * Remove a block from the current graph\n * @param block defines the block to remove\n */\n removeBlock(block) {\n const attachedBlockIndex = this.attachedBlocks.indexOf(block);\n if (attachedBlockIndex > -1) {\n this.attachedBlocks.splice(attachedBlockIndex, 1);\n }\n if (block === this.outputBlock) {\n this.outputBlock = null;\n }\n }\n /**\n * Clear the current graph and load a new one from a serialization object\n * @param source defines the JSON representation of the graph\n * @param merge defines whether or not the source must be merged or replace the current content\n */\n parseSerializedObject(source, merge = false) {\n if (!merge) {\n this.clear();\n }\n const map = {};\n // Create blocks\n for (const parsedBlock of source.blocks) {\n const blockType = GetClass(parsedBlock.customType);\n if (blockType) {\n const additionalConstructionParameters = parsedBlock.additionalConstructionParameters;\n const block = additionalConstructionParameters\n ? new blockType(\"\", this._frameGraph, this._scene, ...additionalConstructionParameters)\n : new blockType(\"\", this._frameGraph, this._scene);\n block._deserialize(parsedBlock);\n map[parsedBlock.id] = block;\n this.attachedBlocks.push(block);\n }\n }\n // Reconnect teleportation\n for (const block of this.attachedBlocks) {\n if (block.isTeleportOut) {\n const teleportOut = block;\n const id = teleportOut._tempEntryPointUniqueId;\n if (id) {\n const source = map[id];\n if (source) {\n source.attachToEndpoint(teleportOut);\n }\n }\n }\n }\n // Connections - Starts with input blocks only (except if in \"merge\" mode where we scan all blocks)\n for (let blockIndex = 0; blockIndex < source.blocks.length; blockIndex++) {\n const parsedBlock = source.blocks[blockIndex];\n const block = map[parsedBlock.id];\n if (!block) {\n continue;\n }\n if (block.inputs.length && parsedBlock.inputs.some((i) => i.targetConnectionName) && !merge) {\n continue;\n }\n this._restoreConnections(block, source, map);\n }\n // Outputs\n if (source.outputNodeId) {\n this.outputBlock = map[source.outputNodeId];\n }\n // UI related info\n if (source.locations || (source.editorData && source.editorData.locations)) {\n const locations = source.locations || source.editorData.locations;\n for (const location of locations) {\n if (map[location.blockId]) {\n location.blockId = map[location.blockId].uniqueId;\n }\n }\n if (merge && this.editorData && this.editorData.locations) {\n locations.concat(this.editorData.locations);\n }\n if (source.locations) {\n this.editorData = {\n locations: locations,\n };\n }\n else {\n this.editorData = source.editorData;\n this.editorData.locations = locations;\n }\n const blockMap = [];\n for (const key in map) {\n blockMap[key] = map[key].uniqueId;\n }\n this.editorData.map = blockMap;\n }\n this.comment = source.comment;\n }\n _restoreConnections(block, source, map) {\n for (const outputPoint of block.outputs) {\n for (const candidate of source.blocks) {\n const target = map[candidate.id];\n if (!target) {\n continue;\n }\n for (const input of candidate.inputs) {\n if (map[input.targetBlockId] === block && input.targetConnectionName === outputPoint.name) {\n const inputPoint = target.getInputByName(input.inputName);\n if (!inputPoint || inputPoint.isConnected) {\n continue;\n }\n outputPoint.connectTo(inputPoint, true);\n this._restoreConnections(target, source, map);\n continue;\n }\n }\n }\n }\n }\n /**\n * Generate a string containing the code declaration required to create an equivalent of this node render graph\n * @returns a string\n */\n generateCode() {\n let alreadyDumped = [];\n const blocks = [];\n const uniqueNames = [\"const\", \"var\", \"let\"];\n // Gets active blocks\n if (this.outputBlock) {\n this._gatherBlocks(this.outputBlock, blocks);\n }\n // Generate\n const options = JSON.stringify(this._options);\n let codeString = `let nodeRenderGraph = new BABYLON.NodeRenderGraph(\"${this.name || \"render graph\"}\", scene, ${options});\\n`;\n for (const node of blocks) {\n if (node.isInput && alreadyDumped.indexOf(node) === -1) {\n codeString += node._dumpCode(uniqueNames, alreadyDumped) + \"\\n\";\n }\n }\n if (this.outputBlock) {\n // Connections\n alreadyDumped = [];\n codeString += \"// Connections\\n\";\n codeString += this.outputBlock._dumpCodeForOutputConnections(alreadyDumped);\n // Output nodes\n codeString += \"// Output nodes\\n\";\n codeString += `nodeRenderGraph.outputBlock = ${this.outputBlock._codeVariableName};\\n`;\n codeString += `nodeRenderGraph.build();\\n`;\n }\n return codeString;\n }\n _gatherBlocks(rootNode, list) {\n if (list.indexOf(rootNode) !== -1) {\n return;\n }\n list.push(rootNode);\n for (const input of rootNode.inputs) {\n const connectedPoint = input.connectedPoint;\n if (connectedPoint) {\n const block = connectedPoint.ownerBlock;\n if (block !== rootNode) {\n this._gatherBlocks(block, list);\n }\n }\n }\n // Teleportation\n if (rootNode.isTeleportOut) {\n const block = rootNode;\n if (block.entryPoint) {\n this._gatherBlocks(block.entryPoint, list);\n }\n }\n }\n /**\n * Clear the current graph and set it to a default state\n */\n setToDefault() {\n this.clear();\n this.editorData = null;\n // Source\n const backBuffer = new NodeRenderGraphInputBlock(\"BackBuffer color\", this._frameGraph, this._scene, NodeRenderGraphBlockConnectionPointTypes.TextureBackBuffer);\n // Clear texture\n const clear = new NodeRenderGraphClearBlock(\"Clear\", this._frameGraph, this._scene);\n backBuffer.output.connectTo(clear.texture);\n // Final output\n const output = new NodeRenderGraphOutputBlock(\"Output\", this._frameGraph, this._scene);\n clear.output.connectTo(output.texture);\n this.outputBlock = output;\n }\n /**\n * Makes a duplicate of the current node render graph.\n * @param name defines the name to use for the new node render graph\n * @returns the new node render graph\n */\n clone(name) {\n const serializationObject = this.serialize();\n const clone = SerializationHelper.Clone(() => new NodeRenderGraph(name, this._scene), this);\n clone.name = name;\n clone.parseSerializedObject(serializationObject);\n clone._buildId = this._buildId;\n clone.build();\n return clone;\n }\n /**\n * Serializes this node render graph in a JSON representation\n * @param selectedBlocks defines the list of blocks to save (if null the whole node render graph will be saved)\n * @returns the serialized node render graph object\n */\n serialize(selectedBlocks) {\n const serializationObject = selectedBlocks ? {} : SerializationHelper.Serialize(this);\n serializationObject.editorData = JSON.parse(JSON.stringify(this.editorData)); // Copy\n let blocks = [];\n if (selectedBlocks) {\n blocks = selectedBlocks;\n }\n else {\n serializationObject.customType = \"BABYLON.NodeRenderGraph\";\n if (this.outputBlock) {\n serializationObject.outputNodeId = this.outputBlock.uniqueId;\n }\n }\n // Blocks\n serializationObject.blocks = [];\n for (const block of blocks) {\n serializationObject.blocks.push(block.serialize());\n }\n if (!selectedBlocks) {\n for (const block of this.attachedBlocks) {\n if (blocks.indexOf(block) !== -1) {\n continue;\n }\n serializationObject.blocks.push(block.serialize());\n }\n }\n return serializationObject;\n }\n /**\n * Disposes the ressources\n */\n dispose() {\n for (const block of this.attachedBlocks) {\n block.dispose();\n }\n this._frameGraph.dispose();\n this._frameGraph = undefined;\n this._engine.onResizeObservable.remove(this._resizeObserver);\n this._resizeObserver = null;\n this.attachedBlocks.length = 0;\n this.onBuildObservable.clear();\n this.onBuildErrorObservable.clear();\n }\n /**\n * Creates a new node render graph set to default basic configuration\n * @param name defines the name of the node render graph\n * @param scene defines the scene to use\n * @param nodeRenderGraphOptions defines options to use when creating the node render graph\n * @returns a new NodeRenderGraph\n */\n static CreateDefault(name, scene, nodeRenderGraphOptions) {\n const renderGraph = new NodeRenderGraph(name, scene, nodeRenderGraphOptions);\n renderGraph.setToDefault();\n renderGraph.build();\n return renderGraph;\n }\n /**\n * Creates a node render graph from parsed graph data\n * @param source defines the JSON representation of the node render graph\n * @param scene defines the scene to use\n * @param nodeRenderGraphOptions defines options to use when creating the node render\n * @param skipBuild defines whether to skip building the node render graph (default is true)\n * @returns a new node render graph\n */\n static Parse(source, scene, nodeRenderGraphOptions, skipBuild = true) {\n const renderGraph = SerializationHelper.Parse(() => new NodeRenderGraph(source.name, scene, nodeRenderGraphOptions), source, null);\n renderGraph.parseSerializedObject(source);\n if (!skipBuild) {\n renderGraph.build();\n }\n return renderGraph;\n }\n /**\n * Creates a node render graph from a snippet saved by the node render graph editor\n * @param snippetId defines the snippet to load\n * @param scene defines the scene to use\n * @param nodeRenderGraphOptions defines options to use when creating the node render graph\n * @param nodeRenderGraph defines a node render graph to update (instead of creating a new one)\n * @param skipBuild defines whether to skip building the node render graph (default is true)\n * @returns a promise that will resolve to the new node render graph\n */\n static ParseFromSnippetAsync(snippetId, scene, nodeRenderGraphOptions, nodeRenderGraph, skipBuild = true) {\n if (snippetId === \"_BLANK\") {\n return Promise.resolve(NodeRenderGraph.CreateDefault(\"blank\", scene, nodeRenderGraphOptions));\n }\n return new Promise((resolve, reject) => {\n const request = new WebRequest();\n request.addEventListener(\"readystatechange\", () => {\n if (request.readyState == 4) {\n if (request.status == 200) {\n const snippet = JSON.parse(JSON.parse(request.responseText).jsonPayload);\n const serializationObject = JSON.parse(snippet.nodeRenderGraph);\n if (!nodeRenderGraph) {\n nodeRenderGraph = SerializationHelper.Parse(() => new NodeRenderGraph(snippetId, scene, nodeRenderGraphOptions), serializationObject, null);\n }\n nodeRenderGraph.parseSerializedObject(serializationObject);\n nodeRenderGraph.snippetId = snippetId;\n try {\n if (!skipBuild) {\n nodeRenderGraph.build();\n }\n resolve(nodeRenderGraph);\n }\n catch (err) {\n reject(err);\n }\n }\n else {\n reject(\"Unable to load the snippet \" + snippetId);\n }\n }\n });\n request.open(\"GET\", this.SnippetUrl + \"/\" + snippetId.replace(/#/g, \"/\"));\n request.send();\n });\n }\n}\nNodeRenderGraph._BuildIdGenerator = 0;\n/** Define the Url to load node editor script */\nNodeRenderGraph.EditorURL = `${Tools._DefaultCdnUrl}/v${Engine.Version}/NodeRenderGraph/babylon.nodeRenderGraph.js`;\n/** Define the Url to load snippets */\nNodeRenderGraph.SnippetUrl = `https://snippet.babylonjs.com`;\n__decorate([\n serialize()\n], NodeRenderGraph.prototype, \"name\", void 0);\n__decorate([\n serialize(\"comment\")\n], NodeRenderGraph.prototype, \"comment\", void 0);\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,oBAA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