@babylonjs/core 7.32.5 → 7.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.d.ts +16 -0
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +40 -7
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/effectRenderer.d.ts +1 -1
- package/Materials/effectRenderer.js +2 -2
- package/Materials/effectRenderer.js.map +1 -1
- package/Meshes/Node/nodeGeometry.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsAccumulationPass.js +1 -1
- package/Rendering/IBLShadows/iblShadowsAccumulationPass.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.d.ts +12 -12
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
- package/Shaders/iblShadowAccumulation.fragment.js +2 -1
- package/Shaders/iblShadowAccumulation.fragment.js.map +1 -1
- package/ShadersWGSL/iblShadowAccumulation.fragment.js +2 -1
- package/ShadersWGSL/iblShadowAccumulation.fragment.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeRenderGraph.js","sourceRoot":"","sources":["../../../../../dev/core/src/FrameGraph/Node/nodeRenderGraph.ts"],"names":[],"mappings":";AAaA,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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C;wBAEhE,IAAI,CAAC,eAAe,EAAE;4BAClB,eAAe,GAAG,mBAAmB,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,eAAe,CAAC,SAAS,EAAE,KAAK,EAAE,sBAAsB,CAAC,EAAE,mBAAmB,EAAE,IAAI,CAAC,CAAC;yBAC/I;wBAED,eAAe,CAAC,qBAAqB,CAAC,mBAAmB,CAAC,CAAC;wBAC3D,eAAe,CAAC,SAAS,GAAG,SAAS,CAAC;wBAEtC,IAAI;4BACA,IAAI,CAAC,SAAS,EAAE;gCACZ,eAAe,CAAC,KAAK,EAAE,CAAC;6BAC3B;4BACD,OAAO,CAAC,eAAe,CAAC,CAAC;yBAC5B;wBAAC,OAAO,GAAG,EAAE;4BACV,MAAM,CAAC,GAAG,CAAC,CAAC;yBACf;qBACJ;yBAAM;wBACH,MAAM,CAAC,6BAA6B,GAAG,SAAS,CAAC,CAAC;qBACrD;iBACJ;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;;AAptBc,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} 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 { 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._engine, options.debugTextures, this._scene);\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 this.outputBlock.build(state);\r\n\r\n this._frameGraph.build();\r\n\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 private _autoFillExternalInputs() {\r\n const allInputs = this.getInputBlocks();\r\n let cameraIndex = 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 }\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 timeout Timeout in ms between retries (default is 16)\r\n * @returns The promise that resolves when the graph is ready\r\n */\r\n public whenReadyAsync(timeout = 16): Promise<void> {\r\n return this._frameGraph.whenReadyAsync(timeout);\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 }[] = 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\r\n const backBuffer = new NodeRenderGraphInputBlock(\"BackBuffer color\", this._frameGraph, this._scene, NodeRenderGraphBlockConnectionPointTypes.TextureBackBuffer);\r\n\r\n // Clear texture\r\n const clear = new NodeRenderGraphClearBlock(\"Clear\", this._frameGraph, this._scene);\r\n\r\n backBuffer.output.connectTo(clear.texture);\r\n\r\n // Final output\r\n const output = new NodeRenderGraphOutputBlock(\"Output\", this._frameGraph, this._scene);\r\n clear.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"]}
|
|
1
|
+
{"version":3,"file":"nodeRenderGraph.js","sourceRoot":"","sources":["../../../../../dev/core/src/FrameGraph/Node/nodeRenderGraph.ts"],"names":[],"mappings":";AAaA,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,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,wCAAwC,EAAE,MAAM,8BAA8B,CAAC;AACxF,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAMxE;;GAEG;AACH,MAAM,OAAO,eAAe;IAcxB,mDAAmD;IAC3C,+BAA+B;QACnC,0DAA0D;QAC1D,IAAI,OAAO,qBAAqB,KAAK,WAAW,EAAE;YAC9C,OAAO,qBAAqB,CAAC;SAChC;QAED,gFAAgF;QAChF,IAAI,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,OAAO,CAAC,qBAAqB,KAAK,WAAW,EAAE;YACxF,OAAO,OAAO,CAAC;SAClB;QAED,OAAO,SAAS,CAAC;IACrB,CAAC;IAiDD;;OAEG;IACH,IAAW,UAAU;QACjB,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W,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} 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 { 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._engine, options.debugTextures, this._scene);\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 this.outputBlock.build(state);\r\n\r\n this._frameGraph.build();\r\n\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 private _autoFillExternalInputs() {\r\n const allInputs = this.getInputBlocks();\r\n let cameraIndex = 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 }\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 timeout Timeout in ms between retries (default is 16)\r\n * @returns The promise that resolves when the graph is ready\r\n */\r\n public whenReadyAsync(timeout = 16): Promise<void> {\r\n return this._frameGraph.whenReadyAsync(timeout);\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\r\n const backBuffer = new NodeRenderGraphInputBlock(\"BackBuffer color\", this._frameGraph, this._scene, NodeRenderGraphBlockConnectionPointTypes.TextureBackBuffer);\r\n\r\n // Clear texture\r\n const clear = new NodeRenderGraphClearBlock(\"Clear\", this._frameGraph, this._scene);\r\n\r\n backBuffer.output.connectTo(clear.texture);\r\n\r\n // Final output\r\n const output = new NodeRenderGraphOutputBlock(\"Output\", this._frameGraph, this._scene);\r\n clear.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"]}
|
|
@@ -6,6 +6,17 @@ import type { AbstractMesh } from "../../../../Meshes/abstractMesh";
|
|
|
6
6
|
import type { NodeMaterialDefines, NodeMaterial } from "../../nodeMaterial";
|
|
7
7
|
import type { Effect } from "../../../effect";
|
|
8
8
|
import type { Mesh } from "../../../../Meshes/mesh";
|
|
9
|
+
/**
|
|
10
|
+
* Color spaces supported by the fragment output block
|
|
11
|
+
*/
|
|
12
|
+
export declare enum FragmentOutputBlockColorSpace {
|
|
13
|
+
/** Unspecified */
|
|
14
|
+
NoColorSpace = 0,
|
|
15
|
+
/** Gamma */
|
|
16
|
+
Gamma = 1,
|
|
17
|
+
/** Linear */
|
|
18
|
+
Linear = 2
|
|
19
|
+
}
|
|
9
20
|
/**
|
|
10
21
|
* Block used to output the final color
|
|
11
22
|
*/
|
|
@@ -23,6 +34,11 @@ export declare class FragmentOutputBlock extends NodeMaterialBlock {
|
|
|
23
34
|
convertToLinearSpace: boolean;
|
|
24
35
|
/** Gets or sets a boolean indicating if logarithmic depth should be used */
|
|
25
36
|
useLogarithmicDepth: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Gets or sets the color space used for the block
|
|
39
|
+
*/
|
|
40
|
+
get colorSpace(): FragmentOutputBlockColorSpace;
|
|
41
|
+
set colorSpace(value: FragmentOutputBlockColorSpace);
|
|
26
42
|
/**
|
|
27
43
|
* Gets the current class name
|
|
28
44
|
* @returns the class name
|
|
@@ -5,6 +5,18 @@ import { NodeMaterialBlockTargets } from "../../Enums/nodeMaterialBlockTargets.j
|
|
|
5
5
|
import { RegisterClass } from "../../../../Misc/typeStore.js";
|
|
6
6
|
import { editableInPropertyPage } from "../../../../Decorators/nodeDecorator.js";
|
|
7
7
|
import { BindLogDepth } from "../../../materialHelper.functions.js";
|
|
8
|
+
/**
|
|
9
|
+
* Color spaces supported by the fragment output block
|
|
10
|
+
*/
|
|
11
|
+
export var FragmentOutputBlockColorSpace;
|
|
12
|
+
(function (FragmentOutputBlockColorSpace) {
|
|
13
|
+
/** Unspecified */
|
|
14
|
+
FragmentOutputBlockColorSpace[FragmentOutputBlockColorSpace["NoColorSpace"] = 0] = "NoColorSpace";
|
|
15
|
+
/** Gamma */
|
|
16
|
+
FragmentOutputBlockColorSpace[FragmentOutputBlockColorSpace["Gamma"] = 1] = "Gamma";
|
|
17
|
+
/** Linear */
|
|
18
|
+
FragmentOutputBlockColorSpace[FragmentOutputBlockColorSpace["Linear"] = 2] = "Linear";
|
|
19
|
+
})(FragmentOutputBlockColorSpace || (FragmentOutputBlockColorSpace = {}));
|
|
8
20
|
/**
|
|
9
21
|
* Block used to output the final color
|
|
10
22
|
*/
|
|
@@ -26,6 +38,22 @@ export class FragmentOutputBlock extends NodeMaterialBlock {
|
|
|
26
38
|
this.registerInput("a", NodeMaterialBlockConnectionPointTypes.Float, true);
|
|
27
39
|
this.rgb.addExcludedConnectionPointFromAllowedTypes(NodeMaterialBlockConnectionPointTypes.Color3 | NodeMaterialBlockConnectionPointTypes.Vector3 | NodeMaterialBlockConnectionPointTypes.Float);
|
|
28
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Gets or sets the color space used for the block
|
|
43
|
+
*/
|
|
44
|
+
get colorSpace() {
|
|
45
|
+
if (this.convertToGammaSpace) {
|
|
46
|
+
return FragmentOutputBlockColorSpace.Gamma;
|
|
47
|
+
}
|
|
48
|
+
if (this.convertToLinearSpace) {
|
|
49
|
+
return FragmentOutputBlockColorSpace.Linear;
|
|
50
|
+
}
|
|
51
|
+
return FragmentOutputBlockColorSpace.NoColorSpace;
|
|
52
|
+
}
|
|
53
|
+
set colorSpace(value) {
|
|
54
|
+
this.convertToGammaSpace = value === FragmentOutputBlockColorSpace.Gamma;
|
|
55
|
+
this.convertToLinearSpace = value === FragmentOutputBlockColorSpace.Linear;
|
|
56
|
+
}
|
|
29
57
|
/**
|
|
30
58
|
* Gets the current class name
|
|
31
59
|
* @returns the class name
|
|
@@ -158,13 +186,18 @@ export class FragmentOutputBlock extends NodeMaterialBlock {
|
|
|
158
186
|
}
|
|
159
187
|
}
|
|
160
188
|
__decorate([
|
|
161
|
-
editableInPropertyPage("
|
|
162
|
-
], FragmentOutputBlock.prototype, "convertToGammaSpace", void 0);
|
|
163
|
-
__decorate([
|
|
164
|
-
editableInPropertyPage("Convert to linear space", 0 /* PropertyTypeForEdition.Boolean */, "PROPERTIES", { notifiers: { update: true } })
|
|
165
|
-
], FragmentOutputBlock.prototype, "convertToLinearSpace", void 0);
|
|
166
|
-
__decorate([
|
|
167
|
-
editableInPropertyPage("Use logarithmic depth", 0 /* PropertyTypeForEdition.Boolean */, "PROPERTIES")
|
|
189
|
+
editableInPropertyPage("Use logarithmic depth", 0 /* PropertyTypeForEdition.Boolean */, "PROPERTIES", { embedded: true })
|
|
168
190
|
], FragmentOutputBlock.prototype, "useLogarithmicDepth", void 0);
|
|
191
|
+
__decorate([
|
|
192
|
+
editableInPropertyPage("Color space", 4 /* PropertyTypeForEdition.List */, "ADVANCED", {
|
|
193
|
+
notifiers: { rebuild: true },
|
|
194
|
+
embedded: true,
|
|
195
|
+
options: [
|
|
196
|
+
{ label: "No color space", value: FragmentOutputBlockColorSpace.NoColorSpace },
|
|
197
|
+
{ label: "Gamma", value: FragmentOutputBlockColorSpace.Gamma },
|
|
198
|
+
{ label: "Linear", value: FragmentOutputBlockColorSpace.Linear },
|
|
199
|
+
],
|
|
200
|
+
})
|
|
201
|
+
], FragmentOutputBlock.prototype, "colorSpace", null);
|
|
169
202
|
RegisterClass("BABYLON.FragmentOutputBlock", FragmentOutputBlock);
|
|
170
203
|
//# sourceMappingURL=fragmentOutputBlock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fragmentOutputBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Materials/Node/Blocks/Fragment/fragmentOutputBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,qCAAqC,EAAE,MAAM,mDAAmD,CAAC;AAE1G,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAEhF,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAI3D,OAAO,EAAE,sBAAsB,EAA0B,MAAM,sCAAsC,CAAC;AAGtG,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAGjE;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,iBAAiB;IAItD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,EAAE,wBAAwB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAUzD,wFAAwF;QAEjF,wBAAmB,GAAG,KAAK,CAAC;QAEnC,yFAAyF;QAElF,yBAAoB,GAAG,KAAK,CAAC;QAEpC,4EAA4E;QAErE,wBAAmB,GAAG,KAAK,CAAC;QAlB/B,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,qCAAqC,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC/E,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,qCAAqC,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAClF,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,qCAAqC,CAAC,KAAK,EAAE,IAAI,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from \"../../Enums/nodeMaterialBlockConnectionPointTypes\";\r\nimport type { NodeMaterialBuildState } from \"../../nodeMaterialBuildState\";\r\nimport { NodeMaterialBlockTargets } from \"../../Enums/nodeMaterialBlockTargets\";\r\nimport type { NodeMaterialConnectionPoint } from \"../../nodeMaterialBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport type { Scene } from \"../../../../scene\";\r\nimport type { AbstractMesh } from \"../../../../Meshes/abstractMesh\";\r\nimport type { NodeMaterialDefines, NodeMaterial } from \"../../nodeMaterial\";\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"../../../../Decorators/nodeDecorator\";\r\nimport type { Effect } from \"../../../effect\";\r\nimport type { Mesh } from \"../../../../Meshes/mesh\";\r\nimport { BindLogDepth } from \"../../../materialHelper.functions\";\r\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\r\n\r\n/**\r\n * Block used to output the final color\r\n */\r\nexport class FragmentOutputBlock extends NodeMaterialBlock {\r\n private _linearDefineName: string;\r\n private _gammaDefineName: string;\r\n\r\n /**\r\n * Create a new FragmentOutputBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name, NodeMaterialBlockTargets.Fragment, true);\r\n\r\n this.registerInput(\"rgba\", NodeMaterialBlockConnectionPointTypes.Color4, true);\r\n this.registerInput(\"rgb\", NodeMaterialBlockConnectionPointTypes.AutoDetect, true);\r\n this.registerInput(\"a\", NodeMaterialBlockConnectionPointTypes.Float, true);\r\n this.rgb.addExcludedConnectionPointFromAllowedTypes(\r\n NodeMaterialBlockConnectionPointTypes.Color3 | NodeMaterialBlockConnectionPointTypes.Vector3 | NodeMaterialBlockConnectionPointTypes.Float\r\n );\r\n }\r\n\r\n /** Gets or sets a boolean indicating if content needs to be converted to gamma space */\r\n @editableInPropertyPage(\"Convert to gamma space\", PropertyTypeForEdition.Boolean, \"PROPERTIES\", { notifiers: { update: true } })\r\n public convertToGammaSpace = false;\r\n\r\n /** Gets or sets a boolean indicating if content needs to be converted to linear space */\r\n @editableInPropertyPage(\"Convert to linear space\", PropertyTypeForEdition.Boolean, \"PROPERTIES\", { notifiers: { update: true } })\r\n public convertToLinearSpace = false;\r\n\r\n /** Gets or sets a boolean indicating if logarithmic depth should be used */\r\n @editableInPropertyPage(\"Use logarithmic depth\", PropertyTypeForEdition.Boolean, \"PROPERTIES\")\r\n public useLogarithmicDepth = false;\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"FragmentOutputBlock\";\r\n }\r\n\r\n /**\r\n * Initialize the block and prepare the context for build\r\n * @param state defines the state that will be used for the build\r\n */\r\n public override initialize(state: NodeMaterialBuildState) {\r\n state._excludeVariableName(\"logarithmicDepthConstant\");\r\n state._excludeVariableName(\"vFragmentDepth\");\r\n }\r\n\r\n /**\r\n * Gets the rgba input component\r\n */\r\n public get rgba(): NodeMaterialConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the rgb input component\r\n */\r\n public get rgb(): NodeMaterialConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the a input component\r\n */\r\n public get a(): NodeMaterialConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n public override prepareDefines(mesh: AbstractMesh, nodeMaterial: NodeMaterial, defines: NodeMaterialDefines) {\r\n defines.setValue(this._linearDefineName, this.convertToLinearSpace, true);\r\n defines.setValue(this._gammaDefineName, this.convertToGammaSpace, true);\r\n }\r\n\r\n public override bind(effect: Effect, nodeMaterial: NodeMaterial, mesh?: Mesh) {\r\n if ((this.useLogarithmicDepth || nodeMaterial.useLogarithmicDepth) && mesh) {\r\n BindLogDepth(undefined, effect, mesh.getScene());\r\n }\r\n }\r\n\r\n protected override _buildBlock(state: NodeMaterialBuildState) {\r\n super._buildBlock(state);\r\n\r\n const rgba = this.rgba;\r\n const rgb = this.rgb;\r\n const a = this.a;\r\n\r\n const isWebGPU = state.shaderLanguage === ShaderLanguage.WGSL;\r\n state.sharedData.hints.needAlphaBlending = rgba.isConnected || a.isConnected;\r\n state.sharedData.blocksWithDefines.push(this);\r\n if (this.useLogarithmicDepth || state.sharedData.nodeMaterial.useLogarithmicDepth) {\r\n state._emitUniformFromString(\"logarithmicDepthConstant\", NodeMaterialBlockConnectionPointTypes.Float);\r\n state._emitVaryingFromString(\"vFragmentDepth\", NodeMaterialBlockConnectionPointTypes.Float);\r\n state.sharedData.bindableBlocks.push(this);\r\n }\r\n this._linearDefineName = state._getFreeDefineName(\"CONVERTTOLINEAR\");\r\n this._gammaDefineName = state._getFreeDefineName(\"CONVERTTOGAMMA\");\r\n\r\n const comments = `//${this.name}`;\r\n state._emitFunctionFromInclude(\"helperFunctions\", comments);\r\n\r\n let outputString = \"gl_FragColor\";\r\n if (state.shaderLanguage === ShaderLanguage.WGSL) {\r\n state.compilationString += `var fragmentOutputsColor : vec4<f32>;\\r\\n`;\r\n outputString = \"fragmentOutputsColor\";\r\n }\r\n\r\n const vec4 = state._getShaderType(NodeMaterialBlockConnectionPointTypes.Vector4);\r\n\r\n if (rgba.connectedPoint) {\r\n if (a.isConnected) {\r\n state.compilationString += `${outputString} = ${vec4}(${rgba.associatedVariableName}.rgb, ${a.associatedVariableName});\\n`;\r\n } else {\r\n state.compilationString += `${outputString} = ${rgba.associatedVariableName};\\n`;\r\n }\r\n } else if (rgb.connectedPoint) {\r\n let aValue = \"1.0\";\r\n\r\n if (a.connectedPoint) {\r\n aValue = a.associatedVariableName;\r\n }\r\n\r\n if (rgb.connectedPoint.type === NodeMaterialBlockConnectionPointTypes.Float) {\r\n state.compilationString += `${outputString} = ${vec4}(${rgb.associatedVariableName}, ${rgb.associatedVariableName}, ${rgb.associatedVariableName}, ${aValue});\\n`;\r\n } else {\r\n state.compilationString += `${outputString} = ${vec4}(${rgb.associatedVariableName}, ${aValue});\\n`;\r\n }\r\n } else {\r\n state.sharedData.checks.notConnectedNonOptionalInputs.push(rgba);\r\n }\r\n\r\n state.compilationString += `#ifdef ${this._linearDefineName}\\n`;\r\n state.compilationString += `${outputString} = toLinearSpace(${outputString});\\n`;\r\n state.compilationString += `#endif\\n`;\r\n\r\n state.compilationString += `#ifdef ${this._gammaDefineName}\\n`;\r\n state.compilationString += `${outputString} = toGammaSpace(${outputString});\\n`;\r\n state.compilationString += `#endif\\n`;\r\n\r\n if (state.shaderLanguage === ShaderLanguage.WGSL) {\r\n state.compilationString += `#if !defined(PREPASS)\\r\\n`;\r\n state.compilationString += `fragmentOutputs.color = fragmentOutputsColor;\\r\\n`;\r\n state.compilationString += `#endif\\r\\n`;\r\n }\r\n\r\n if (this.useLogarithmicDepth || state.sharedData.nodeMaterial.useLogarithmicDepth) {\r\n const fragDepth = isWebGPU ? \"input.vFragmentDepth\" : \"vFragmentDepth\";\r\n const uniformP = isWebGPU ? \"uniforms.\" : \"\";\r\n const output = isWebGPU ? \"fragmentOutputs.fragDepth\" : \"gl_FragDepthEXT\";\r\n\r\n state.compilationString += `${output} = log2(${fragDepth}) * ${uniformP}logarithmicDepthConstant * 0.5;\\n`;\r\n }\r\n\r\n state.compilationString += `#if defined(PREPASS)\\r\\n`;\r\n state.compilationString += `${isWebGPU ? \"fragmentOutputs.fragData0\" : \"gl_FragData[0]\"} = ${outputString};\\r\\n`;\r\n state.compilationString += `#endif\\r\\n`;\r\n\r\n return this;\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n let codeString = super._dumpPropertiesCode();\r\n codeString += `${this._codeVariableName}.convertToGammaSpace = ${this.convertToGammaSpace};\\n`;\r\n codeString += `${this._codeVariableName}.convertToLinearSpace = ${this.convertToLinearSpace};\\n`;\r\n codeString += `${this._codeVariableName}.useLogarithmicDepth = ${this.useLogarithmicDepth};\\n`;\r\n\r\n return codeString;\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.convertToGammaSpace = this.convertToGammaSpace;\r\n serializationObject.convertToLinearSpace = this.convertToLinearSpace;\r\n serializationObject.useLogarithmicDepth = this.useLogarithmicDepth;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any, scene: Scene, rootUrl: string) {\r\n super._deserialize(serializationObject, scene, rootUrl);\r\n\r\n this.convertToGammaSpace = !!serializationObject.convertToGammaSpace;\r\n this.convertToLinearSpace = !!serializationObject.convertToLinearSpace;\r\n this.useLogarithmicDepth = serializationObject.useLogarithmicDepth ?? false;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.FragmentOutputBlock\", FragmentOutputBlock);\r\n"]}
|
|
1
|
+
{"version":3,"file":"fragmentOutputBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Materials/Node/Blocks/Fragment/fragmentOutputBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,qCAAqC,EAAE,MAAM,mDAAmD,CAAC;AAE1G,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAEhF,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAI3D,OAAO,EAAE,sBAAsB,EAA0B,MAAM,sCAAsC,CAAC;AAGtG,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAGjE;;GAEG;AACH,MAAM,CAAN,IAAY,6BAOX;AAPD,WAAY,6BAA6B;IACrC,kBAAkB;IAClB,iGAAY,CAAA;IACZ,YAAY;IACZ,mFAAK,CAAA;IACL,aAAa;IACb,qFAAM,CAAA;AACV,CAAC,EAPW,6BAA6B,KAA7B,6BAA6B,QAOxC;AAED;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,iBAAiB;IAItD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,EAAE,wBAAwB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAUzD,wFAAwF;QACjF,wBAAmB,GAAG,KAAK,CAAC;QAEnC,yFAAyF;QAClF,yBA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QAChF,KAAK,CAAC,YAAY,CAAC,mBAAmB,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAExD,IAAI,CAAC,mBAAmB,GAAG,CAAC,CAAC,mBAAmB,CAAC,mBAAmB,CAAC;QACrE,IAAI,CAAC,oBAAoB,GAAG,CAAC,CAAC,mBAAmB,CAAC,oBAAoB,CAAC;QACvE,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC,mBAAmB,IAAI,KAAK,CAAC;IAChF,CAAC;CACJ;AAxLU;IADN,sBAAsB,CAAC,uBAAuB,0CAAkC,YAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;gEAC/E;AAcnC;IATC,sBAAsB,CAAC,aAAa,uCAA+B,UAAU,EAAE;QAC5E,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;QAC5B,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE;YACL,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,6BAA6B,CAAC,YAAY,EAAE;YAC9E,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,6BAA6B,CAAC,KAAK,EAAE;YAC9D,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,6BAA6B,CAAC,MAAM,EAAE;SACnE;KACJ,CAAC;qDASD;AAoKL,aAAa,CAAC,6BAA6B,EAAE,mBAAmB,CAAC,CAAC","sourcesContent":["import { NodeMaterialBlock } from \"../../nodeMaterialBlock\";\r\nimport { NodeMaterialBlockConnectionPointTypes } from \"../../Enums/nodeMaterialBlockConnectionPointTypes\";\r\nimport type { NodeMaterialBuildState } from \"../../nodeMaterialBuildState\";\r\nimport { NodeMaterialBlockTargets } from \"../../Enums/nodeMaterialBlockTargets\";\r\nimport type { NodeMaterialConnectionPoint } from \"../../nodeMaterialBlockConnectionPoint\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport type { Scene } from \"../../../../scene\";\r\nimport type { AbstractMesh } from \"../../../../Meshes/abstractMesh\";\r\nimport type { NodeMaterialDefines, NodeMaterial } from \"../../nodeMaterial\";\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"../../../../Decorators/nodeDecorator\";\r\nimport type { Effect } from \"../../../effect\";\r\nimport type { Mesh } from \"../../../../Meshes/mesh\";\r\nimport { BindLogDepth } from \"../../../materialHelper.functions\";\r\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\r\n\r\n/**\r\n * Color spaces supported by the fragment output block\r\n */\r\nexport enum FragmentOutputBlockColorSpace {\r\n /** Unspecified */\r\n NoColorSpace,\r\n /** Gamma */\r\n Gamma,\r\n /** Linear */\r\n Linear,\r\n}\r\n\r\n/**\r\n * Block used to output the final color\r\n */\r\nexport class FragmentOutputBlock extends NodeMaterialBlock {\r\n private _linearDefineName: string;\r\n private _gammaDefineName: string;\r\n\r\n /**\r\n * Create a new FragmentOutputBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name, NodeMaterialBlockTargets.Fragment, true);\r\n\r\n this.registerInput(\"rgba\", NodeMaterialBlockConnectionPointTypes.Color4, true);\r\n this.registerInput(\"rgb\", NodeMaterialBlockConnectionPointTypes.AutoDetect, true);\r\n this.registerInput(\"a\", NodeMaterialBlockConnectionPointTypes.Float, true);\r\n this.rgb.addExcludedConnectionPointFromAllowedTypes(\r\n NodeMaterialBlockConnectionPointTypes.Color3 | NodeMaterialBlockConnectionPointTypes.Vector3 | NodeMaterialBlockConnectionPointTypes.Float\r\n );\r\n }\r\n\r\n /** Gets or sets a boolean indicating if content needs to be converted to gamma space */\r\n public convertToGammaSpace = false;\r\n\r\n /** Gets or sets a boolean indicating if content needs to be converted to linear space */\r\n public convertToLinearSpace = false;\r\n\r\n /** Gets or sets a boolean indicating if logarithmic depth should be used */\r\n @editableInPropertyPage(\"Use logarithmic depth\", PropertyTypeForEdition.Boolean, \"PROPERTIES\", { embedded: true })\r\n public useLogarithmicDepth = false;\r\n\r\n /**\r\n * Gets or sets the color space used for the block\r\n */\r\n @editableInPropertyPage(\"Color space\", PropertyTypeForEdition.List, \"ADVANCED\", {\r\n notifiers: { rebuild: true },\r\n embedded: true,\r\n options: [\r\n { label: \"No color space\", value: FragmentOutputBlockColorSpace.NoColorSpace },\r\n { label: \"Gamma\", value: FragmentOutputBlockColorSpace.Gamma },\r\n { label: \"Linear\", value: FragmentOutputBlockColorSpace.Linear },\r\n ],\r\n })\r\n public get colorSpace() {\r\n if (this.convertToGammaSpace) {\r\n return FragmentOutputBlockColorSpace.Gamma;\r\n }\r\n if (this.convertToLinearSpace) {\r\n return FragmentOutputBlockColorSpace.Linear;\r\n }\r\n return FragmentOutputBlockColorSpace.NoColorSpace;\r\n }\r\n\r\n public set colorSpace(value: FragmentOutputBlockColorSpace) {\r\n this.convertToGammaSpace = value === FragmentOutputBlockColorSpace.Gamma;\r\n this.convertToLinearSpace = value === FragmentOutputBlockColorSpace.Linear;\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"FragmentOutputBlock\";\r\n }\r\n\r\n /**\r\n * Initialize the block and prepare the context for build\r\n * @param state defines the state that will be used for the build\r\n */\r\n public override initialize(state: NodeMaterialBuildState) {\r\n state._excludeVariableName(\"logarithmicDepthConstant\");\r\n state._excludeVariableName(\"vFragmentDepth\");\r\n }\r\n\r\n /**\r\n * Gets the rgba input component\r\n */\r\n public get rgba(): NodeMaterialConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the rgb input component\r\n */\r\n public get rgb(): NodeMaterialConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the a input component\r\n */\r\n public get a(): NodeMaterialConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n public override prepareDefines(mesh: AbstractMesh, nodeMaterial: NodeMaterial, defines: NodeMaterialDefines) {\r\n defines.setValue(this._linearDefineName, this.convertToLinearSpace, true);\r\n defines.setValue(this._gammaDefineName, this.convertToGammaSpace, true);\r\n }\r\n\r\n public override bind(effect: Effect, nodeMaterial: NodeMaterial, mesh?: Mesh) {\r\n if ((this.useLogarithmicDepth || nodeMaterial.useLogarithmicDepth) && mesh) {\r\n BindLogDepth(undefined, effect, mesh.getScene());\r\n }\r\n }\r\n\r\n protected override _buildBlock(state: NodeMaterialBuildState) {\r\n super._buildBlock(state);\r\n\r\n const rgba = this.rgba;\r\n const rgb = this.rgb;\r\n const a = this.a;\r\n\r\n const isWebGPU = state.shaderLanguage === ShaderLanguage.WGSL;\r\n state.sharedData.hints.needAlphaBlending = rgba.isConnected || a.isConnected;\r\n state.sharedData.blocksWithDefines.push(this);\r\n if (this.useLogarithmicDepth || state.sharedData.nodeMaterial.useLogarithmicDepth) {\r\n state._emitUniformFromString(\"logarithmicDepthConstant\", NodeMaterialBlockConnectionPointTypes.Float);\r\n state._emitVaryingFromString(\"vFragmentDepth\", NodeMaterialBlockConnectionPointTypes.Float);\r\n state.sharedData.bindableBlocks.push(this);\r\n }\r\n this._linearDefineName = state._getFreeDefineName(\"CONVERTTOLINEAR\");\r\n this._gammaDefineName = state._getFreeDefineName(\"CONVERTTOGAMMA\");\r\n\r\n const comments = `//${this.name}`;\r\n state._emitFunctionFromInclude(\"helperFunctions\", comments);\r\n\r\n let outputString = \"gl_FragColor\";\r\n if (state.shaderLanguage === ShaderLanguage.WGSL) {\r\n state.compilationString += `var fragmentOutputsColor : vec4<f32>;\\r\\n`;\r\n outputString = \"fragmentOutputsColor\";\r\n }\r\n\r\n const vec4 = state._getShaderType(NodeMaterialBlockConnectionPointTypes.Vector4);\r\n\r\n if (rgba.connectedPoint) {\r\n if (a.isConnected) {\r\n state.compilationString += `${outputString} = ${vec4}(${rgba.associatedVariableName}.rgb, ${a.associatedVariableName});\\n`;\r\n } else {\r\n state.compilationString += `${outputString} = ${rgba.associatedVariableName};\\n`;\r\n }\r\n } else if (rgb.connectedPoint) {\r\n let aValue = \"1.0\";\r\n\r\n if (a.connectedPoint) {\r\n aValue = a.associatedVariableName;\r\n }\r\n\r\n if (rgb.connectedPoint.type === NodeMaterialBlockConnectionPointTypes.Float) {\r\n state.compilationString += `${outputString} = ${vec4}(${rgb.associatedVariableName}, ${rgb.associatedVariableName}, ${rgb.associatedVariableName}, ${aValue});\\n`;\r\n } else {\r\n state.compilationString += `${outputString} = ${vec4}(${rgb.associatedVariableName}, ${aValue});\\n`;\r\n }\r\n } else {\r\n state.sharedData.checks.notConnectedNonOptionalInputs.push(rgba);\r\n }\r\n\r\n state.compilationString += `#ifdef ${this._linearDefineName}\\n`;\r\n state.compilationString += `${outputString} = toLinearSpace(${outputString});\\n`;\r\n state.compilationString += `#endif\\n`;\r\n\r\n state.compilationString += `#ifdef ${this._gammaDefineName}\\n`;\r\n state.compilationString += `${outputString} = toGammaSpace(${outputString});\\n`;\r\n state.compilationString += `#endif\\n`;\r\n\r\n if (state.shaderLanguage === ShaderLanguage.WGSL) {\r\n state.compilationString += `#if !defined(PREPASS)\\r\\n`;\r\n state.compilationString += `fragmentOutputs.color = fragmentOutputsColor;\\r\\n`;\r\n state.compilationString += `#endif\\r\\n`;\r\n }\r\n\r\n if (this.useLogarithmicDepth || state.sharedData.nodeMaterial.useLogarithmicDepth) {\r\n const fragDepth = isWebGPU ? \"input.vFragmentDepth\" : \"vFragmentDepth\";\r\n const uniformP = isWebGPU ? \"uniforms.\" : \"\";\r\n const output = isWebGPU ? \"fragmentOutputs.fragDepth\" : \"gl_FragDepthEXT\";\r\n\r\n state.compilationString += `${output} = log2(${fragDepth}) * ${uniformP}logarithmicDepthConstant * 0.5;\\n`;\r\n }\r\n\r\n state.compilationString += `#if defined(PREPASS)\\r\\n`;\r\n state.compilationString += `${isWebGPU ? \"fragmentOutputs.fragData0\" : \"gl_FragData[0]\"} = ${outputString};\\r\\n`;\r\n state.compilationString += `#endif\\r\\n`;\r\n\r\n return this;\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n let codeString = super._dumpPropertiesCode();\r\n codeString += `${this._codeVariableName}.convertToGammaSpace = ${this.convertToGammaSpace};\\n`;\r\n codeString += `${this._codeVariableName}.convertToLinearSpace = ${this.convertToLinearSpace};\\n`;\r\n codeString += `${this._codeVariableName}.useLogarithmicDepth = ${this.useLogarithmicDepth};\\n`;\r\n\r\n return codeString;\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.convertToGammaSpace = this.convertToGammaSpace;\r\n serializationObject.convertToLinearSpace = this.convertToLinearSpace;\r\n serializationObject.useLogarithmicDepth = this.useLogarithmicDepth;\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any, scene: Scene, rootUrl: string) {\r\n super._deserialize(serializationObject, scene, rootUrl);\r\n\r\n this.convertToGammaSpace = !!serializationObject.convertToGammaSpace;\r\n this.convertToLinearSpace = !!serializationObject.convertToLinearSpace;\r\n this.useLogarithmicDepth = serializationObject.useLogarithmicDepth ?? false;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.FragmentOutputBlock\", FragmentOutputBlock);\r\n"]}
|