@babylonjs/core 8.0.1 → 8.0.3
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/Audio/audioEngine.js +2 -0
- package/Audio/audioEngine.js.map +1 -1
- package/AudioV2/abstractAudio/subNodes/audioAnalyzerSubNode.d.ts +0 -2
- package/AudioV2/abstractAudio/subNodes/audioAnalyzerSubNode.js +0 -4
- package/AudioV2/abstractAudio/subNodes/audioAnalyzerSubNode.js.map +1 -1
- package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.d.ts +0 -2
- package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.js +0 -4
- package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.js.map +1 -1
- package/AudioV2/abstractAudio/subNodes/stereoAudioSubNode.d.ts +0 -2
- package/AudioV2/abstractAudio/subNodes/stereoAudioSubNode.js +0 -4
- package/AudioV2/abstractAudio/subNodes/stereoAudioSubNode.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/audioAnalyzer.d.ts +4 -0
- package/AudioV2/abstractAudio/subProperties/audioAnalyzer.js +14 -6
- package/AudioV2/abstractAudio/subProperties/audioAnalyzer.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/spatialAudio.d.ts +8 -0
- package/AudioV2/abstractAudio/subProperties/spatialAudio.js +25 -9
- package/AudioV2/abstractAudio/subProperties/spatialAudio.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/stereoAudio.d.ts +1 -0
- package/AudioV2/abstractAudio/subProperties/stereoAudio.js +5 -3
- package/AudioV2/abstractAudio/subProperties/stereoAudio.js.map +1 -1
- package/Cameras/arcRotateCamera.d.ts +13 -3
- package/Cameras/arcRotateCamera.js +121 -46
- package/Cameras/arcRotateCamera.js.map +1 -1
- package/Engines/ICanvas.d.ts +4 -0
- package/Engines/ICanvas.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheBindGroups.js +1 -1
- package/Engines/WebGPU/webgpuCacheBindGroups.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/thinEngine.d.ts +1 -0
- package/Engines/thinEngine.js +7 -1
- package/Engines/thinEngine.js.map +1 -1
- package/FlowGraph/flowGraphCoordinator.d.ts +1 -0
- package/FlowGraph/flowGraphCoordinator.js +11 -4
- package/FlowGraph/flowGraphCoordinator.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraphBlock.js +1 -1
- package/FrameGraph/Node/nodeRenderGraphBlock.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.js +1 -1
- package/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.js.map +1 -1
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.js +2 -1
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.js.map +1 -1
- package/Materials/Node/Blocks/colorConverterBlock.d.ts +1 -0
- package/Materials/Node/Blocks/colorConverterBlock.js +9 -0
- package/Materials/Node/Blocks/colorConverterBlock.js.map +1 -1
- package/Materials/Node/Blocks/colorMergerBlock.d.ts +1 -0
- package/Materials/Node/Blocks/colorMergerBlock.js +6 -0
- package/Materials/Node/Blocks/colorMergerBlock.js.map +1 -1
- package/Materials/Node/nodeMaterialBlockConnectionPoint.js +1 -1
- package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.d.ts +1 -0
- package/Materials/PBR/pbrBaseMaterial.js +4 -0
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/PBR/pbrSubSurfaceConfiguration.d.ts +8 -0
- package/Materials/PBR/pbrSubSurfaceConfiguration.js +9 -1
- package/Materials/PBR/pbrSubSurfaceConfiguration.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.d.ts +2 -2
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/Textures/thinTexture.js +1 -1
- package/Materials/Textures/thinTexture.js.map +1 -1
- package/Materials/uniformBuffer.js +3 -0
- package/Materials/uniformBuffer.js.map +1 -1
- package/Meshes/Node/nodeGeometryBlockConnectionPoint.js +1 -1
- package/Meshes/Node/nodeGeometryBlockConnectionPoint.js.map +1 -1
- package/Meshes/instancedMesh.js +1 -0
- package/Meshes/instancedMesh.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsPluginMaterial.js +2 -2
- package/Rendering/IBLShadows/iblShadowsPluginMaterial.js.map +1 -1
- package/Rendering/objectRenderer.d.ts +4 -3
- package/Rendering/objectRenderer.js +15 -6
- package/Rendering/objectRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/lightFragment.js +12 -2
- package/Shaders/ShadersInclude/lightFragment.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockDirectLighting.js +3 -0
- package/Shaders/ShadersInclude/pbrBlockDirectLighting.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockFinalUnlitComponents.js +3 -3
- package/Shaders/ShadersInclude/pbrBlockFinalUnlitComponents.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBlockNormalFinal.js +4 -0
- package/Shaders/ShadersInclude/pbrBlockNormalFinal.js.map +1 -1
- package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js +5 -2
- package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
- package/Shaders/iblVoxelGrid.vertex.d.ts +10 -0
- package/Shaders/iblVoxelGrid.vertex.js +23 -1
- package/Shaders/iblVoxelGrid.vertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/lightFragment.js +13 -3
- package/ShadersWGSL/ShadersInclude/lightFragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockDirectLighting.js +3 -0
- package/ShadersWGSL/ShadersInclude/pbrBlockDirectLighting.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockFinalUnlitComponents.js +3 -3
- package/ShadersWGSL/ShadersInclude/pbrBlockFinalUnlitComponents.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockNormalFinal.js +4 -0
- package/ShadersWGSL/ShadersInclude/pbrBlockNormalFinal.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockReflection.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrBlockReflection.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js +5 -2
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
- package/ShadersWGSL/iblVoxelGrid.vertex.d.ts +10 -0
- package/ShadersWGSL/iblVoxelGrid.vertex.js +26 -3
- package/ShadersWGSL/iblVoxelGrid.vertex.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -23,6 +23,7 @@ export class FlowGraphCoordinator {
|
|
|
23
23
|
this._customEventsMap = new Map();
|
|
24
24
|
this._eventExecutionCounter = new Map();
|
|
25
25
|
this._executeOnNextFrame = [];
|
|
26
|
+
this._eventUniqueId = 0;
|
|
26
27
|
// When the scene is disposed, dispose all graphs currently running on it.
|
|
27
28
|
this._disposeObserver = this.config.scene.onDisposeObservable.add(() => {
|
|
28
29
|
this.dispose();
|
|
@@ -30,12 +31,18 @@ export class FlowGraphCoordinator {
|
|
|
30
31
|
this._onBeforeRenderObserver = this.config.scene.onBeforeRenderObservable.add(() => {
|
|
31
32
|
// Reset the event execution counter at the beginning of each frame.
|
|
32
33
|
this._eventExecutionCounter.clear();
|
|
33
|
-
|
|
34
|
+
// duplicate the _executeOnNextFrame array to avoid modifying it while iterating over it
|
|
35
|
+
const executeOnNextFrame = this._executeOnNextFrame.slice(0);
|
|
36
|
+
if (executeOnNextFrame.length) {
|
|
34
37
|
// Execute the events that were triggered on the next frame.
|
|
35
|
-
|
|
38
|
+
executeOnNextFrame.forEach((event) => {
|
|
36
39
|
this.notifyCustomEvent(event.id, event.data, false);
|
|
40
|
+
// remove the event from the array
|
|
41
|
+
const index = this._executeOnNextFrame.findIndex((e) => e.uniqueId === event.uniqueId);
|
|
42
|
+
if (index !== -1) {
|
|
43
|
+
this._executeOnNextFrame.splice(index, 1);
|
|
44
|
+
}
|
|
37
45
|
});
|
|
38
|
-
this._executeOnNextFrame.length = 0;
|
|
39
46
|
}
|
|
40
47
|
});
|
|
41
48
|
// Add itself to the SceneCoordinators list for the Inspector.
|
|
@@ -125,7 +132,7 @@ export class FlowGraphCoordinator {
|
|
|
125
132
|
*/
|
|
126
133
|
notifyCustomEvent(id, data, async = !this.dispatchEventsSynchronously) {
|
|
127
134
|
if (async) {
|
|
128
|
-
this._executeOnNextFrame.push({ id, data });
|
|
135
|
+
this._executeOnNextFrame.push({ id, data, uniqueId: this._eventUniqueId++ });
|
|
129
136
|
return;
|
|
130
137
|
}
|
|
131
138
|
// check if we are not exceeding the max number of events
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphCoordinator.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphCoordinator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,8BAA6B;AAElD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC,OAAO,EAAE,MAAM,EAAE,0BAAyB;AAgC1C;;;;;GAKG;AACH,MAAM,OAAO,oBAAoB;IAkC7B;IACI;;OAEG;IACI,MAA0C;QAA1C,WAAM,GAAN,MAAM,CAAoC;QApBrD;;;WAGG;QACI,gCAA2B,GAAY,IAAI,CAAC;QAElC,gBAAW,GAAgB,EAAE,CAAC;QAEvC,qBAAgB,GAAiC,IAAI,GAAG,EAAE,CAAC;QAE3D,2BAAsB,GAAwB,IAAI,GAAG,EAAE,CAAC;QAIxD,wBAAmB,GAAiC,EAAE,CAAC;QAQ3D,0EAA0E;QAC1E,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,GAAG,CAAC,GAAG,EAAE;YACnE,IAAI,CAAC,OAAO,EAAE,CAAC;QACnB,CAAC,CAAC,C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AM,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACjD,IAAI,UAAU,EAAE,CAAC;YACb,UAAU,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QACrC,CAAC;IACL,CAAC;;AA1KD;;;;GAIG;AACW,qCAAgB,GAAW,EAAE,AAAb,CAAc;AAE5C;;GAEG;AACW,kDAA6B,GAAW,EAAE,AAAb,CAAc;AACzD;;;GAGG;AACoB,sCAAiB,GAAuC,IAAI,GAAG,EAAE,AAAhD,CAAiD","sourcesContent":["import type { Observer } from \"core/Misc/observable\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport type { Scene } from \"../scene\";\r\nimport { FlowGraph } from \"./flowGraph\";\r\nimport type { IPathToObjectConverter } from \"../ObjectModel/objectModelInterfaces\";\r\nimport type { IObjectAccessor } from \"./typeDefinitions\";\r\nimport type { IAssetContainer } from \"core/IAssetContainer\";\r\nimport { Logger } from \"core/Misc/logger\";\r\n\r\n/**\r\n * Parameters used to create a flow graph engine.\r\n */\r\nexport interface IFlowGraphCoordinatorConfiguration {\r\n /**\r\n * The scene that the flow graph engine belongs to.\r\n */\r\n scene: Scene;\r\n}\r\n\r\n/**\r\n * Parameters used to parse a flow graph coordinator.\r\n */\r\nexport interface FlowGraphCoordinatorParseOptions {\r\n /**\r\n * A function that will be called to parse the value of a property.\r\n * @param key the key of the property\r\n * @param serializationObject the serialization object where the property is located\r\n * @param scene the scene that the block is being parsed in\r\n */\r\n valueParseFunction?: (key: string, serializationObject: any, assetsContainer: IAssetContainer, scene: Scene) => any;\r\n /**\r\n * The path converter to use to convert the path to an object accessor.\r\n */\r\n pathConverter: IPathToObjectConverter<IObjectAccessor>;\r\n /**\r\n * The scene that the flow graph coordinator belongs to.\r\n */\r\n scene: Scene;\r\n}\r\n/**\r\n * This class holds all of the existing flow graphs and is responsible for creating new ones.\r\n * It also handles starting/stopping multiple graphs and communication between them through an Event Coordinator\r\n * This is the entry point for the flow graph system.\r\n * @experimental This class is still in development and is subject to change.\r\n */\r\nexport class FlowGraphCoordinator {\r\n /**\r\n * The maximum number of events per type.\r\n * This is used to limit the number of events that can be created in a single scene.\r\n * This is to prevent infinite loops.\r\n */\r\n public static MaxEventsPerType: number = 30;\r\n\r\n /**\r\n * The maximum number of execution of a specific event in a single frame.\r\n */\r\n public static MaxEventTypeExecutionPerFrame: number = 30;\r\n /**\r\n * @internal\r\n * A list of all the coordinators per scene. Will be used by the inspector\r\n */\r\n public static readonly SceneCoordinators: Map<Scene, FlowGraphCoordinator[]> = new Map();\r\n\r\n /**\r\n * When set to true (default) custom events will be dispatched synchronously.\r\n * This means that the events will be dispatched immediately when they are triggered.\r\n */\r\n public dispatchEventsSynchronously: boolean = true;\r\n\r\n private readonly _flowGraphs: FlowGraph[] = [];\r\n\r\n private _customEventsMap: Map<string, Observable<any>> = new Map();\r\n\r\n private _eventExecutionCounter: Map<string, number> = new Map();\r\n\r\n private _disposeObserver: Observer<Scene>;\r\n private _onBeforeRenderObserver: Observer<Scene>;\r\n private _executeOnNextFrame: { id: string; data?: any }[] = [];\r\n\r\n public constructor(\r\n /**\r\n * the configuration of the block\r\n */\r\n public config: IFlowGraphCoordinatorConfiguration\r\n ) {\r\n // When the scene is disposed, dispose all graphs currently running on it.\r\n this._disposeObserver = this.config.scene.onDisposeObservable.add(() => {\r\n this.dispose();\r\n });\r\n\r\n this._onBeforeRenderObserver = this.config.scene.onBeforeRenderObservable.add(() => {\r\n // Reset the event execution counter at the beginning of each frame.\r\n this._eventExecutionCounter.clear();\r\n if (this._executeOnNextFrame.length) {\r\n // Execute the events that were triggered on the next frame.\r\n this._executeOnNextFrame.forEach((event) => {\r\n this.notifyCustomEvent(event.id, event.data, false);\r\n });\r\n this._executeOnNextFrame.length = 0;\r\n }\r\n });\r\n\r\n // Add itself to the SceneCoordinators list for the Inspector.\r\n const coordinators = FlowGraphCoordinator.SceneCoordinators.get(this.config.scene) ?? [];\r\n coordinators.push(this);\r\n }\r\n\r\n /**\r\n * Creates a new flow graph and adds it to the list of existing flow graphs\r\n * @returns a new flow graph\r\n */\r\n public createGraph(): FlowGraph {\r\n const graph = new FlowGraph({ scene: this.config.scene, coordinator: this });\r\n this._flowGraphs.push(graph);\r\n return graph;\r\n }\r\n\r\n /**\r\n * Removes a flow graph from the list of existing flow graphs and disposes it\r\n * @param graph the graph to remove\r\n */\r\n public removeGraph(graph: FlowGraph) {\r\n const index = this._flowGraphs.indexOf(graph);\r\n if (index !== -1) {\r\n graph.dispose();\r\n this._flowGraphs.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Starts all graphs\r\n */\r\n public start() {\r\n this._flowGraphs.forEach((graph) => graph.start());\r\n }\r\n\r\n /**\r\n * Disposes all graphs\r\n */\r\n public dispose() {\r\n this._flowGraphs.forEach((graph) => graph.dispose());\r\n this._flowGraphs.length = 0;\r\n this._disposeObserver?.remove();\r\n this._onBeforeRenderObserver?.remove();\r\n\r\n // Remove itself from the SceneCoordinators list for the Inspector.\r\n const coordinators = FlowGraphCoordinator.SceneCoordinators.get(this.config.scene) ?? [];\r\n const index = coordinators.indexOf(this);\r\n if (index !== -1) {\r\n coordinators.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Serializes this coordinator to a JSON object.\r\n * @param serializationObject the object to serialize to\r\n * @param valueSerializeFunction the function to use to serialize the value\r\n */\r\n public serialize(serializationObject: any, valueSerializeFunction?: (key: string, value: any, serializationObject: any) => void) {\r\n serializationObject._flowGraphs = [];\r\n this._flowGraphs.forEach((graph) => {\r\n const serializedGraph = {};\r\n graph.serialize(serializedGraph, valueSerializeFunction);\r\n serializationObject._flowGraphs.push(serializedGraph);\r\n });\r\n serializationObject.dispatchEventsSynchronously = this.dispatchEventsSynchronously;\r\n }\r\n\r\n /**\r\n * Gets the list of flow graphs\r\n */\r\n public get flowGraphs() {\r\n return this._flowGraphs;\r\n }\r\n\r\n /**\r\n * Get an observable that will be notified when the event with the given id is fired.\r\n * @param id the id of the event\r\n * @returns the observable for the event\r\n */\r\n public getCustomEventObservable(id: string): Observable<any> {\r\n let observable = this._customEventsMap.get(id);\r\n if (!observable) {\r\n // receive event is initialized before scene start, so no need to notify if triggered. but possible!\r\n observable = new Observable<any>(/*undefined, true*/);\r\n this._customEventsMap.set(id, observable);\r\n }\r\n return observable;\r\n }\r\n\r\n /**\r\n * Notifies the observable for the given event id with the given data.\r\n * @param id the id of the event\r\n * @param data the data to send with the event\r\n * @param async if true, the event will be dispatched asynchronously\r\n */\r\n public notifyCustomEvent(id: string, data: any, async: boolean = !this.dispatchEventsSynchronously) {\r\n if (async) {\r\n this._executeOnNextFrame.push({ id, data });\r\n return;\r\n }\r\n // check if we are not exceeding the max number of events\r\n if (this._eventExecutionCounter.has(id)) {\r\n const count = this._eventExecutionCounter.get(id)!;\r\n this._eventExecutionCounter.set(id, count + 1);\r\n if (count >= FlowGraphCoordinator.MaxEventTypeExecutionPerFrame) {\r\n count === FlowGraphCoordinator.MaxEventTypeExecutionPerFrame && Logger.Warn(`FlowGraphCoordinator: Too many executions of event \"${id}\".`);\r\n return;\r\n }\r\n } else {\r\n this._eventExecutionCounter.set(id, 1);\r\n }\r\n const observable = this._customEventsMap.get(id);\r\n if (observable) {\r\n observable.notifyObservers(data);\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"flowGraphCoordinator.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphCoordinator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,8BAA6B;AAElD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC,OAAO,EAAE,MAAM,EAAE,0BAAyB;AAgC1C;;;;;GAKG;AACH,MAAM,OAAO,oBAAoB;IAmC7B;IACI;;OAEG;IACI,MAA0C;QAA1C,WAAM,GAAN,MAAM,CAAoC;QArBrD;;;WAGG;QACI,gCAA2B,GAAY,IAAI,CAAC;QAElC,gBAAW,GAAgB,EAAE,CAA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,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;YAC7E,OAAO;QACX,CAAC;QACD,yDAAyD;QACzD,IAAI,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;YACtC,MAAM,KAAK,GAAG,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,EAAE,CAAE,CAAC;YACnD,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;YAC/C,IAAI,KAAK,IAAI,oBAAoB,CAAC,6BAA6B,EAAE,CAAC;gBAC9D,KAAK,KAAK,oBAAoB,CAAC,6BAA6B,IAAI,MAAM,CAAC,IAAI,CAAC,uDAAuD,EAAE,IAAI,CAAC,CAAC;gBAC3I,OAAO;YACX,CAAC;QACL,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QAC3C,CAAC;QACD,MAAM,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACjD,IAAI,UAAU,EAAE,CAAC;YACb,UAAU,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QACrC,CAAC;IACL,CAAC;;AAjLD;;;;GAIG;AACW,qCAAgB,GAAW,EAAE,AAAb,CAAc;AAE5C;;GAEG;AACW,kDAA6B,GAAW,EAAE,AAAb,CAAc;AACzD;;;GAGG;AACoB,sCAAiB,GAAuC,IAAI,GAAG,EAAE,AAAhD,CAAiD","sourcesContent":["import type { Observer } from \"core/Misc/observable\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport type { Scene } from \"../scene\";\r\nimport { FlowGraph } from \"./flowGraph\";\r\nimport type { IPathToObjectConverter } from \"../ObjectModel/objectModelInterfaces\";\r\nimport type { IObjectAccessor } from \"./typeDefinitions\";\r\nimport type { IAssetContainer } from \"core/IAssetContainer\";\r\nimport { Logger } from \"core/Misc/logger\";\r\n\r\n/**\r\n * Parameters used to create a flow graph engine.\r\n */\r\nexport interface IFlowGraphCoordinatorConfiguration {\r\n /**\r\n * The scene that the flow graph engine belongs to.\r\n */\r\n scene: Scene;\r\n}\r\n\r\n/**\r\n * Parameters used to parse a flow graph coordinator.\r\n */\r\nexport interface FlowGraphCoordinatorParseOptions {\r\n /**\r\n * A function that will be called to parse the value of a property.\r\n * @param key the key of the property\r\n * @param serializationObject the serialization object where the property is located\r\n * @param scene the scene that the block is being parsed in\r\n */\r\n valueParseFunction?: (key: string, serializationObject: any, assetsContainer: IAssetContainer, scene: Scene) => any;\r\n /**\r\n * The path converter to use to convert the path to an object accessor.\r\n */\r\n pathConverter: IPathToObjectConverter<IObjectAccessor>;\r\n /**\r\n * The scene that the flow graph coordinator belongs to.\r\n */\r\n scene: Scene;\r\n}\r\n/**\r\n * This class holds all of the existing flow graphs and is responsible for creating new ones.\r\n * It also handles starting/stopping multiple graphs and communication between them through an Event Coordinator\r\n * This is the entry point for the flow graph system.\r\n * @experimental This class is still in development and is subject to change.\r\n */\r\nexport class FlowGraphCoordinator {\r\n /**\r\n * The maximum number of events per type.\r\n * This is used to limit the number of events that can be created in a single scene.\r\n * This is to prevent infinite loops.\r\n */\r\n public static MaxEventsPerType: number = 30;\r\n\r\n /**\r\n * The maximum number of execution of a specific event in a single frame.\r\n */\r\n public static MaxEventTypeExecutionPerFrame: number = 30;\r\n /**\r\n * @internal\r\n * A list of all the coordinators per scene. Will be used by the inspector\r\n */\r\n public static readonly SceneCoordinators: Map<Scene, FlowGraphCoordinator[]> = new Map();\r\n\r\n /**\r\n * When set to true (default) custom events will be dispatched synchronously.\r\n * This means that the events will be dispatched immediately when they are triggered.\r\n */\r\n public dispatchEventsSynchronously: boolean = true;\r\n\r\n private readonly _flowGraphs: FlowGraph[] = [];\r\n\r\n private _customEventsMap: Map<string, Observable<any>> = new Map();\r\n\r\n private _eventExecutionCounter: Map<string, number> = new Map();\r\n\r\n private _disposeObserver: Observer<Scene>;\r\n private _onBeforeRenderObserver: Observer<Scene>;\r\n private _executeOnNextFrame: { id: string; data?: any; uniqueId: number }[] = [];\r\n private _eventUniqueId: number = 0;\r\n\r\n public constructor(\r\n /**\r\n * the configuration of the block\r\n */\r\n public config: IFlowGraphCoordinatorConfiguration\r\n ) {\r\n // When the scene is disposed, dispose all graphs currently running on it.\r\n this._disposeObserver = this.config.scene.onDisposeObservable.add(() => {\r\n this.dispose();\r\n });\r\n\r\n this._onBeforeRenderObserver = this.config.scene.onBeforeRenderObservable.add(() => {\r\n // Reset the event execution counter at the beginning of each frame.\r\n this._eventExecutionCounter.clear();\r\n // duplicate the _executeOnNextFrame array to avoid modifying it while iterating over it\r\n const executeOnNextFrame = this._executeOnNextFrame.slice(0);\r\n if (executeOnNextFrame.length) {\r\n // Execute the events that were triggered on the next frame.\r\n executeOnNextFrame.forEach((event) => {\r\n this.notifyCustomEvent(event.id, event.data, false);\r\n // remove the event from the array\r\n const index = this._executeOnNextFrame.findIndex((e) => e.uniqueId === event.uniqueId);\r\n if (index !== -1) {\r\n this._executeOnNextFrame.splice(index, 1);\r\n }\r\n });\r\n }\r\n });\r\n\r\n // Add itself to the SceneCoordinators list for the Inspector.\r\n const coordinators = FlowGraphCoordinator.SceneCoordinators.get(this.config.scene) ?? [];\r\n coordinators.push(this);\r\n }\r\n\r\n /**\r\n * Creates a new flow graph and adds it to the list of existing flow graphs\r\n * @returns a new flow graph\r\n */\r\n public createGraph(): FlowGraph {\r\n const graph = new FlowGraph({ scene: this.config.scene, coordinator: this });\r\n this._flowGraphs.push(graph);\r\n return graph;\r\n }\r\n\r\n /**\r\n * Removes a flow graph from the list of existing flow graphs and disposes it\r\n * @param graph the graph to remove\r\n */\r\n public removeGraph(graph: FlowGraph) {\r\n const index = this._flowGraphs.indexOf(graph);\r\n if (index !== -1) {\r\n graph.dispose();\r\n this._flowGraphs.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Starts all graphs\r\n */\r\n public start() {\r\n this._flowGraphs.forEach((graph) => graph.start());\r\n }\r\n\r\n /**\r\n * Disposes all graphs\r\n */\r\n public dispose() {\r\n this._flowGraphs.forEach((graph) => graph.dispose());\r\n this._flowGraphs.length = 0;\r\n this._disposeObserver?.remove();\r\n this._onBeforeRenderObserver?.remove();\r\n\r\n // Remove itself from the SceneCoordinators list for the Inspector.\r\n const coordinators = FlowGraphCoordinator.SceneCoordinators.get(this.config.scene) ?? [];\r\n const index = coordinators.indexOf(this);\r\n if (index !== -1) {\r\n coordinators.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Serializes this coordinator to a JSON object.\r\n * @param serializationObject the object to serialize to\r\n * @param valueSerializeFunction the function to use to serialize the value\r\n */\r\n public serialize(serializationObject: any, valueSerializeFunction?: (key: string, value: any, serializationObject: any) => void) {\r\n serializationObject._flowGraphs = [];\r\n this._flowGraphs.forEach((graph) => {\r\n const serializedGraph = {};\r\n graph.serialize(serializedGraph, valueSerializeFunction);\r\n serializationObject._flowGraphs.push(serializedGraph);\r\n });\r\n serializationObject.dispatchEventsSynchronously = this.dispatchEventsSynchronously;\r\n }\r\n\r\n /**\r\n * Gets the list of flow graphs\r\n */\r\n public get flowGraphs() {\r\n return this._flowGraphs;\r\n }\r\n\r\n /**\r\n * Get an observable that will be notified when the event with the given id is fired.\r\n * @param id the id of the event\r\n * @returns the observable for the event\r\n */\r\n public getCustomEventObservable(id: string): Observable<any> {\r\n let observable = this._customEventsMap.get(id);\r\n if (!observable) {\r\n // receive event is initialized before scene start, so no need to notify if triggered. but possible!\r\n observable = new Observable<any>(/*undefined, true*/);\r\n this._customEventsMap.set(id, observable);\r\n }\r\n return observable;\r\n }\r\n\r\n /**\r\n * Notifies the observable for the given event id with the given data.\r\n * @param id the id of the event\r\n * @param data the data to send with the event\r\n * @param async if true, the event will be dispatched asynchronously\r\n */\r\n public notifyCustomEvent(id: string, data: any, async: boolean = !this.dispatchEventsSynchronously) {\r\n if (async) {\r\n this._executeOnNextFrame.push({ id, data, uniqueId: this._eventUniqueId++ });\r\n return;\r\n }\r\n // check if we are not exceeding the max number of events\r\n if (this._eventExecutionCounter.has(id)) {\r\n const count = this._eventExecutionCounter.get(id)!;\r\n this._eventExecutionCounter.set(id, count + 1);\r\n if (count >= FlowGraphCoordinator.MaxEventTypeExecutionPerFrame) {\r\n count === FlowGraphCoordinator.MaxEventTypeExecutionPerFrame && Logger.Warn(`FlowGraphCoordinator: Too many executions of event \"${id}\".`);\r\n return;\r\n }\r\n } else {\r\n this._eventExecutionCounter.set(id, 1);\r\n }\r\n const observable = this._customEventsMap.get(id);\r\n if (observable) {\r\n observable.notifyObservers(data);\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -448,7 +448,7 @@ export class NodeRenderGraphBlock {
|
|
|
448
448
|
codeString += `// ${this.comments}\n`;
|
|
449
449
|
}
|
|
450
450
|
const className = this.getClassName();
|
|
451
|
-
if (className === "
|
|
451
|
+
if (className === "NodeRenderGraphInputBlock") {
|
|
452
452
|
const block = this;
|
|
453
453
|
const blockType = block.type;
|
|
454
454
|
codeString += `var ${this._codeVariableName} = new BABYLON.NodeRenderGraphInputBlock("${this.name}", nodeRenderGraph.frameGraph, scene, BABYLON.NodeRenderGraphBlockConnectionPointTypes.${NodeRenderGraphBlockConnectionPointTypes[blockType]});\n`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeRenderGraphBlock.js","sourceRoot":"","sources":["../../../../../dev/core/src/FrameGraph/Node/nodeRenderGraphBlock.ts"],"names":[],"mappings":";AAYA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,wCAAwC,EAA2C,MAAM,8BAA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ameGraphTask,\r\n FrameGraph,\r\n NodeRenderGraphResourceContainerBlock,\r\n FrameGraphTextureHandle,\r\n // eslint-disable-next-line import/no-internal-modules\r\n} from \"core/index\";\r\nimport { GetClass } from \"../../Misc/typeStore\";\r\nimport { serialize } from \"../../Misc/decorators\";\r\nimport { UniqueIdGenerator } from \"../../Misc/uniqueIdGenerator\";\r\nimport { NodeRenderGraphBlockConnectionPointTypes, NodeRenderGraphConnectionPointDirection } from \"./Types/nodeRenderGraphTypes\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport { NodeRenderGraphConnectionPoint } from \"./nodeRenderGraphBlockConnectionPoint\";\r\n\r\n/**\r\n * Defines a block that can be used inside a node render graph\r\n */\r\nexport class NodeRenderGraphBlock {\r\n private _name = \"\";\r\n private _buildId: number;\r\n protected _isInput = false;\r\n protected _isTeleportOut = false;\r\n protected _isTeleportIn = false;\r\n protected _isDebug = false;\r\n protected _isUnique = false;\r\n protected _scene: Scene;\r\n protected _engine: AbstractEngine;\r\n protected _frameGraph: FrameGraph;\r\n protected _frameGraphTask?: FrameGraphTask;\r\n\r\n /**\r\n * Gets or sets the disable flag of the task associated with this block\r\n */\r\n public get disabled() {\r\n return !!this._frameGraphTask?.disabled;\r\n }\r\n\r\n public set disabled(value: boolean) {\r\n if (this._frameGraphTask) {\r\n this._frameGraphTask.disabled = value;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the frame graph task associated with this block\r\n */\r\n public get task() {\r\n return this._frameGraphTask;\r\n }\r\n\r\n /**\r\n * Gets an observable raised when the block is built\r\n */\r\n public onBuildObservable = new Observable<NodeRenderGraphBlock>();\r\n\r\n /** @internal */\r\n public _inputs = new Array<NodeRenderGraphConnectionPoint>();\r\n\r\n /** @internal */\r\n public _outputs = new Array<NodeRenderGraphConnectionPoint>();\r\n\r\n /** @internal */\r\n public _codeVariableName = \"\";\r\n\r\n /** @internal */\r\n public _additionalConstructionParameters: Nullable<unknown[]> = null;\r\n\r\n /**\r\n * Gets the list of input points\r\n */\r\n public get inputs(): NodeRenderGraphConnectionPoint[] {\r\n return this._inputs;\r\n }\r\n\r\n /** Gets the list of output points */\r\n public get outputs(): NodeRenderGraphConnectionPoint[] {\r\n return this._outputs;\r\n }\r\n\r\n /**\r\n * Gets or sets the unique id of the node\r\n */\r\n public uniqueId: number;\r\n\r\n /**\r\n * Gets or set the name of the block\r\n */\r\n public get name(): string {\r\n return this._name;\r\n }\r\n\r\n public set name(value: string) {\r\n this._name = value;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this block is an input\r\n */\r\n public get isInput(): boolean {\r\n return this._isInput;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this block is a teleport out\r\n */\r\n public get isTeleportOut(): boolean {\r\n return this._isTeleportOut;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this block is a teleport in\r\n */\r\n public get isTeleportIn(): boolean {\r\n return this._isTeleportIn;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this block is a debug block\r\n */\r\n public get isDebug(): boolean {\r\n return this._isDebug;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating that this block can only be used once per node render graph\r\n */\r\n public get isUnique() {\r\n return this._isUnique;\r\n }\r\n\r\n /**\r\n * A free comment about the block\r\n */\r\n @serialize(\"comment\")\r\n public comments: string;\r\n\r\n /** Gets or sets a boolean indicating that this input can be edited from a collapsed frame */\r\n public visibleOnFrame = false;\r\n\r\n /**\r\n * Gets the current class name e.g. \"NodeRenderGraphBlock\"\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"NodeRenderGraphBlock\";\r\n }\r\n\r\n protected _inputRename(name: string) {\r\n return name;\r\n }\r\n\r\n protected _outputRename(name: string) {\r\n return name;\r\n }\r\n\r\n /**\r\n * Checks if the current block is an ancestor of a given block\r\n * @param block defines the potential descendant block to check\r\n * @returns true if block is a descendant\r\n */\r\n public isAnAncestorOf(block: NodeRenderGraphBlock): boolean {\r\n for (const output of this._outputs) {\r\n if (!output.hasEndpoints) {\r\n continue;\r\n }\r\n\r\n for (const endpoint of output.endpoints) {\r\n if (endpoint.ownerBlock === block) {\r\n return true;\r\n }\r\n\r\n if (endpoint.ownerBlock.isAnAncestorOf(block)) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Checks if the current block is an ancestor of a given type\r\n * @param type defines the potential type to check\r\n * @returns true if block is a descendant\r\n */\r\n public isAnAncestorOfType(type: string): boolean {\r\n if (this.getClassName() === type) {\r\n return true;\r\n }\r\n\r\n for (const output of this._outputs) {\r\n if (!output.hasEndpoints) {\r\n continue;\r\n }\r\n\r\n for (const endpoint of output.endpoints) {\r\n if (endpoint.ownerBlock.isAnAncestorOfType(type)) {\r\n return true;\r\n }\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Get the first descendant using a predicate\r\n * @param predicate defines the predicate to check\r\n * @returns descendant or null if none found\r\n */\r\n public getDescendantOfPredicate(predicate: (block: NodeRenderGraphBlock) => boolean): Nullable<NodeRenderGraphBlock> {\r\n if (predicate(this)) {\r\n return this;\r\n }\r\n\r\n for (const output of this._outputs) {\r\n if (!output.hasEndpoints) {\r\n continue;\r\n }\r\n\r\n for (const endpoint of output.endpoints) {\r\n const descendant = endpoint.ownerBlock.getDescendantOfPredicate(predicate);\r\n if (descendant) {\r\n return descendant;\r\n }\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Creates a new NodeRenderGraphBlock\r\n * @param name defines the block name\r\n * @param frameGraph defines the hosting frame graph\r\n * @param scene defines the hosting scene\r\n * @param _additionalConstructionParameters defines additional parameters to pass to the block constructor\r\n */\r\n public constructor(name: string, frameGraph: FrameGraph, scene: Scene, ..._additionalConstructionParameters: unknown[]) {\r\n this._name = name;\r\n this._frameGraph = frameGraph;\r\n this._scene = scene;\r\n this._engine = scene.getEngine();\r\n this.uniqueId = UniqueIdGenerator.UniqueId;\r\n }\r\n\r\n /**\r\n * Register a new input. Must be called inside a block constructor\r\n * @param name defines the connection point name\r\n * @param type defines the connection point type\r\n * @param isOptional defines a boolean indicating that this input can be omitted\r\n * @param point an already created connection point. If not provided, create a new one\r\n * @returns the current block\r\n */\r\n public registerInput(name: string, type: NodeRenderGraphBlockConnectionPointTypes, isOptional: boolean = false, point?: NodeRenderGraphConnectionPoint) {\r\n point = point ?? new NodeRenderGraphConnectionPoint(name, this, NodeRenderGraphConnectionPointDirection.Input);\r\n point.type = type;\r\n point.isOptional = isOptional;\r\n\r\n this._inputs.push(point);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Register a new output. Must be called inside a block constructor\r\n * @param name defines the connection point name\r\n * @param type defines the connection point type\r\n * @param point an already created connection point. If not provided, create a new one\r\n * @returns the current block\r\n */\r\n public registerOutput(name: string, type: NodeRenderGraphBlockConnectionPointTypes, point?: NodeRenderGraphConnectionPoint) {\r\n point = point ?? new NodeRenderGraphConnectionPoint(name, this, NodeRenderGraphConnectionPointDirection.Output);\r\n point.type = type;\r\n\r\n this._outputs.push(point);\r\n\r\n return this;\r\n }\r\n\r\n protected _addDependenciesInput(additionalAllowedTypes = 0) {\r\n this.registerInput(\"dependencies\", NodeRenderGraphBlockConnectionPointTypes.AutoDetect, true);\r\n\r\n const dependencies = this.getInputByName(\"dependencies\")!;\r\n\r\n dependencies.addExcludedConnectionPointFromAllowedTypes(\r\n NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBuffer |\r\n NodeRenderGraphBlockConnectionPointTypes.ResourceContainer |\r\n NodeRenderGraphBlockConnectionPointTypes.ShadowGenerator |\r\n additionalAllowedTypes\r\n );\r\n\r\n return dependencies;\r\n }\r\n\r\n protected _buildBlock(_state: NodeRenderGraphBuildState) {\r\n // Empty. Must be defined by child nodes\r\n }\r\n\r\n protected _customBuildStep(_state: NodeRenderGraphBuildState): void {\r\n // Must be implemented by children\r\n }\r\n\r\n protected _propagateInputValueToOutput(inputConnectionPoint: NodeRenderGraphConnectionPoint, outputConnectionPoint: NodeRenderGraphConnectionPoint) {\r\n if (inputConnectionPoint.connectedPoint) {\r\n outputConnectionPoint.value = inputConnectionPoint.connectedPoint.value;\r\n }\r\n }\r\n\r\n /**\r\n * Build the current node and generate the vertex data\r\n * @param state defines the current generation state\r\n * @returns true if already built\r\n */\r\n public build(state: NodeRenderGraphBuildState): boolean {\r\n if (this._buildId === state.buildId) {\r\n return true;\r\n }\r\n\r\n this._buildId = state.buildId;\r\n\r\n // Check if \"parent\" blocks are compiled\r\n for (const input of this._inputs) {\r\n if (!input.connectedPoint) {\r\n if (!input.isOptional) {\r\n // Emit a warning\r\n state._notConnectedNonOptionalInputs.push(input);\r\n }\r\n continue;\r\n }\r\n\r\n const block = input.connectedPoint.ownerBlock;\r\n if (block && block !== this) {\r\n block.build(state);\r\n }\r\n }\r\n\r\n this._customBuildStep(state);\r\n\r\n // Logs\r\n if (state.verbose) {\r\n Logger.Log(`Building ${this.name} [${this.getClassName()}]`);\r\n }\r\n\r\n if (this._frameGraphTask) {\r\n this._frameGraphTask.name = this.name;\r\n }\r\n\r\n this._buildBlock(state);\r\n\r\n if (this._frameGraphTask) {\r\n this._frameGraphTask.dependencies = undefined;\r\n\r\n const dependenciesConnectedPoint = this.getInputByName(\"dependencies\")?.connectedPoint;\r\n if (dependenciesConnectedPoint) {\r\n if (dependenciesConnectedPoint.type === NodeRenderGraphBlockConnectionPointTypes.ResourceContainer) {\r\n const container = dependenciesConnectedPoint.ownerBlock as NodeRenderGraphResourceContainerBlock;\r\n for (let i = 0; i < container.inputs.length; i++) {\r\n const input = container.inputs[i];\r\n if (input.connectedPoint && input.connectedPoint.value !== undefined && NodeRenderGraphConnectionPoint.IsTextureHandle(input.connectedPoint.value)) {\r\n this._frameGraphTask.dependencies = this._frameGraphTask.dependencies || new Set();\r\n this._frameGraphTask.dependencies.add(input.connectedPoint.value as FrameGraphTextureHandle);\r\n }\r\n }\r\n } else if (NodeRenderGraphConnectionPoint.IsTextureHandle(dependenciesConnectedPoint.value)) {\r\n this._frameGraphTask.dependencies = this._frameGraphTask.dependencies || new Set();\r\n this._frameGraphTask.dependencies.add(dependenciesConnectedPoint.value as FrameGraphTextureHandle);\r\n }\r\n }\r\n this._frameGraph.addTask(this._frameGraphTask);\r\n }\r\n\r\n this.onBuildObservable.notifyObservers(this);\r\n\r\n return false;\r\n }\r\n\r\n protected _linkConnectionTypes(inputIndex0: number, inputIndex1: number, looseCoupling = false) {\r\n if (looseCoupling) {\r\n this._inputs[inputIndex1]._acceptedConnectionPointType = this._inputs[inputIndex0];\r\n } else {\r\n this._inputs[inputIndex0]._linkedConnectionSource = this._inputs[inputIndex1];\r\n this._inputs[inputIndex0]._isMainLinkSource = true;\r\n }\r\n\r\n this._inputs[inputIndex1]._linkedConnectionSource = this._inputs[inputIndex0];\r\n }\r\n\r\n /**\r\n * Initialize the block and prepare the context for build\r\n */\r\n public initialize() {\r\n // Do nothing\r\n }\r\n\r\n /**\r\n * Lets the block try to connect some inputs automatically\r\n */\r\n public autoConfigure() {\r\n // Do nothing\r\n }\r\n\r\n /**\r\n * Find an input by its name\r\n * @param name defines the name of the input to look for\r\n * @returns the input or null if not found\r\n */\r\n public getInputByName(name: string) {\r\n const filter = this._inputs.filter((e) => e.name === name);\r\n\r\n if (filter.length) {\r\n return filter[0];\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Find an output by its name\r\n * @param name defines the name of the output to look for\r\n * @returns the output or null if not found\r\n */\r\n public getOutputByName(name: string) {\r\n const filter = this._outputs.filter((e) => e.name === name);\r\n\r\n if (filter.length) {\r\n return filter[0];\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public serialize(): any {\r\n const serializationObject: any = {};\r\n\r\n serializationObject.customType = \"BABYLON.\" + this.getClassName();\r\n serializationObject.id = this.uniqueId;\r\n serializationObject.name = this.name;\r\n serializationObject.visibleOnFrame = this.visibleOnFrame;\r\n serializationObject.disabled = this.disabled;\r\n if (this._additionalConstructionParameters) {\r\n serializationObject.additionalConstructionParameters = this._additionalConstructionParameters;\r\n }\r\n\r\n serializationObject.inputs = [];\r\n serializationObject.outputs = [];\r\n\r\n for (const input of this.inputs) {\r\n serializationObject.inputs.push(input.serialize());\r\n }\r\n\r\n for (const output of this.outputs) {\r\n serializationObject.outputs.push(output.serialize(false));\r\n }\r\n\r\n return serializationObject;\r\n }\r\n /**\r\n * @internal\r\n */\r\n public _deserialize(serializationObject: any) {\r\n this._name = serializationObject.name;\r\n this.comments = serializationObject.comments;\r\n this.visibleOnFrame = serializationObject.visibleOnFrame;\r\n this.disabled = serializationObject.disabled;\r\n\r\n this._deserializePortDisplayNamesAndExposedOnFrame(serializationObject);\r\n }\r\n\r\n private _deserializePortDisplayNamesAndExposedOnFrame(serializationObject: any) {\r\n const serializedInputs = serializationObject.inputs;\r\n const serializedOutputs = serializationObject.outputs;\r\n\r\n if (serializedInputs) {\r\n serializedInputs.forEach((port: any) => {\r\n const input = this.inputs.find((i) => i.name === port.name);\r\n if (!input) {\r\n return;\r\n }\r\n if (port.displayName) {\r\n input.displayName = port.displayName;\r\n }\r\n if (port.isExposedOnFrame) {\r\n input.isExposedOnFrame = port.isExposedOnFrame;\r\n input.exposedPortPosition = port.exposedPortPosition;\r\n }\r\n });\r\n }\r\n\r\n if (serializedOutputs) {\r\n serializedOutputs.forEach((port: any, i: number) => {\r\n if (port.displayName) {\r\n this.outputs[i].displayName = port.displayName;\r\n }\r\n if (port.isExposedOnFrame) {\r\n this.outputs[i].isExposedOnFrame = port.isExposedOnFrame;\r\n this.outputs[i].exposedPortPosition = port.exposedPortPosition;\r\n }\r\n });\r\n }\r\n }\r\n\r\n protected _dumpPropertiesCode() {\r\n const variableName = this._codeVariableName;\r\n return `${variableName}.visibleOnFrame = ${this.visibleOnFrame};\\n${variableName}.disabled = ${this.disabled};\\n`;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _dumpCodeForOutputConnections(alreadyDumped: NodeRenderGraphBlock[]) {\r\n let codeString = \"\";\r\n\r\n if (alreadyDumped.indexOf(this) !== -1) {\r\n return codeString;\r\n }\r\n\r\n alreadyDumped.push(this);\r\n\r\n for (const input of this.inputs) {\r\n if (!input.isConnected) {\r\n continue;\r\n }\r\n\r\n const connectedOutput = input.connectedPoint!;\r\n const connectedBlock = connectedOutput.ownerBlock;\r\n\r\n codeString += connectedBlock._dumpCodeForOutputConnections(alreadyDumped);\r\n codeString += `${connectedBlock._codeVariableName}.${connectedBlock._outputRename(connectedOutput.name)}.connectTo(${this._codeVariableName}.${this._inputRename(\r\n input.name\r\n )});\\n`;\r\n }\r\n\r\n return codeString;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _dumpCode(uniqueNames: string[], alreadyDumped: NodeRenderGraphBlock[]) {\r\n alreadyDumped.push(this);\r\n\r\n // Get unique name\r\n const nameAsVariableName = this.name.replace(/[^A-Za-z_]+/g, \"\");\r\n this._codeVariableName = nameAsVariableName || `${this.getClassName()}_${this.uniqueId}`;\r\n\r\n if (uniqueNames.indexOf(this._codeVariableName) !== -1) {\r\n let index = 0;\r\n do {\r\n index++;\r\n this._codeVariableName = nameAsVariableName + index;\r\n } while (uniqueNames.indexOf(this._codeVariableName) !== -1);\r\n }\r\n\r\n uniqueNames.push(this._codeVariableName);\r\n\r\n // Declaration\r\n let codeString = `\\n// ${this.getClassName()}\\n`;\r\n if (this.comments) {\r\n codeString += `// ${this.comments}\\n`;\r\n }\r\n const className = this.getClassName();\r\n if (className === \"RenderGraphInputBlock\") {\r\n const block = this as unknown as NodeRenderGraphInputBlock;\r\n const blockType = block.type;\r\n\r\n codeString += `var ${this._codeVariableName} = new BABYLON.NodeRenderGraphInputBlock(\"${this.name}\", nodeRenderGraph.frameGraph, scene, BABYLON.NodeRenderGraphBlockConnectionPointTypes.${NodeRenderGraphBlockConnectionPointTypes[blockType]});\\n`;\r\n } else {\r\n if (this._additionalConstructionParameters) {\r\n codeString += `var ${this._codeVariableName} = new BABYLON.${className}(\"${this.name}\", nodeRenderGraph.frameGraph, scene, ...${JSON.stringify(this._additionalConstructionParameters)});\\n`;\r\n } else {\r\n codeString += `var ${this._codeVariableName} = new BABYLON.${className}(\"${this.name}\", nodeRenderGraph.frameGraph, scene);\\n`;\r\n }\r\n }\r\n\r\n // Properties\r\n codeString += this._dumpPropertiesCode() + \"\\n\";\r\n\r\n // Inputs\r\n for (const input of this.inputs) {\r\n if (!input.isConnected) {\r\n continue;\r\n }\r\n\r\n const connectedOutput = input.connectedPoint!;\r\n const connectedBlock = connectedOutput.ownerBlock;\r\n\r\n if (alreadyDumped.indexOf(connectedBlock) === -1) {\r\n codeString += connectedBlock._dumpCode(uniqueNames, alreadyDumped);\r\n }\r\n }\r\n\r\n // Outputs\r\n for (const output of this.outputs) {\r\n if (!output.hasEndpoints) {\r\n continue;\r\n }\r\n\r\n for (const endpoint of output.endpoints) {\r\n const connectedBlock = endpoint.ownerBlock;\r\n if (connectedBlock && alreadyDumped.indexOf(connectedBlock) === -1) {\r\n codeString += connectedBlock._dumpCode(uniqueNames, alreadyDumped);\r\n }\r\n }\r\n }\r\n\r\n return codeString;\r\n }\r\n\r\n /**\r\n * Clone the current block to a new identical block\r\n * @returns a copy of the current block\r\n */\r\n public clone() {\r\n const serializationObject = this.serialize();\r\n const blockType: typeof NodeRenderGraphBlock = GetClass(serializationObject.customType);\r\n\r\n if (blockType) {\r\n const additionalConstructionParameters = serializationObject.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(serializationObject);\r\n return block;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Release resources\r\n */\r\n public dispose() {\r\n for (const input of this.inputs) {\r\n input.dispose();\r\n }\r\n\r\n for (const output of this.outputs) {\r\n output.dispose();\r\n }\r\n\r\n this._frameGraphTask?.dispose();\r\n this._frameGraphTask = undefined as any;\r\n\r\n this.onBuildObservable.clear();\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"nodeRenderGraphBlock.js","sourceRoot":"","sources":["../../../../../dev/core/src/FrameGraph/Node/nodeRenderGraphBlock.ts"],"names":[],"mappings":";AAYA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,wCAAwC,EAA2C,MAAM,8BAA8B,CAAC;AACjI,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,8BAA8B,EAAE,MAAM,uCAAuC,CAAC;AAEvF;;GAEG;AACH,MAAM,OAAO,oBAAoB;IAa7B;;OAEG;IACH,IAAW,QAAQ;QACf,OAAO,CAAC,CAAC,IAAI,CAAC,eAAe,EAAE,QAAQ,CAAC;IAC5C,CAAC;IAED,IAAW,QAAQ,CAAC,KAAc;QAC9B,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YACvB,IAAI,CAAC,eAAe,CAAC,QAAQ,GAAG,KAAK,CAAC;QAC1C,CAAC;IACL,CAAC;IAED;;OAEG;IACH,IAAW,IAAI;QACX,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAmBD;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,qCAAqC;IACrC,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAOD;;OAEG;IACH,IAAW,IAAI;QACX,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAED,IAAW,IAAI,CAAC,KAAa;QACzB,IAAI,CAAC,KAAK,GAAG,KAAK,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AM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAChC,MAAM,CAAC,OAAO,EAAE,CAAC;QACrB,CAAC;QAED,IAAI,CAAC,eAAe,EAAE,OAAO,EAAE,CAAC;QAChC,IAAI,CAAC,eAAe,GAAG,SAAgB,CAAC;QAExC,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;IACnC,CAAC;CACJ;AAngBU;IADN,SAAS,CAAC,SAAS,CAAC;sDACG","sourcesContent":["import type {\r\n NodeRenderGraphBuildState,\r\n Nullable,\r\n NodeRenderGraphInputBlock,\r\n AbstractEngine,\r\n Scene,\r\n FrameGraphTask,\r\n FrameGraph,\r\n NodeRenderGraphResourceContainerBlock,\r\n FrameGraphTextureHandle,\r\n // eslint-disable-next-line import/no-internal-modules\r\n} from \"core/index\";\r\nimport { GetClass } from \"../../Misc/typeStore\";\r\nimport { serialize } from \"../../Misc/decorators\";\r\nimport { UniqueIdGenerator } from \"../../Misc/uniqueIdGenerator\";\r\nimport { NodeRenderGraphBlockConnectionPointTypes, NodeRenderGraphConnectionPointDirection } from \"./Types/nodeRenderGraphTypes\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport { NodeRenderGraphConnectionPoint } from \"./nodeRenderGraphBlockConnectionPoint\";\r\n\r\n/**\r\n * Defines a block that can be used inside a node render graph\r\n */\r\nexport class NodeRenderGraphBlock {\r\n private _name = \"\";\r\n private _buildId: number;\r\n protected _isInput = false;\r\n protected _isTeleportOut = false;\r\n protected _isTeleportIn = false;\r\n protected _isDebug = false;\r\n protected _isUnique = false;\r\n protected _scene: Scene;\r\n protected _engine: AbstractEngine;\r\n protected _frameGraph: FrameGraph;\r\n protected _frameGraphTask?: FrameGraphTask;\r\n\r\n /**\r\n * Gets or sets the disable flag of the task associated with this block\r\n */\r\n public get disabled() {\r\n return !!this._frameGraphTask?.disabled;\r\n }\r\n\r\n public set disabled(value: boolean) {\r\n if (this._frameGraphTask) {\r\n this._frameGraphTask.disabled = value;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the frame graph task associated with this block\r\n */\r\n public get task() {\r\n return this._frameGraphTask;\r\n }\r\n\r\n /**\r\n * Gets an observable raised when the block is built\r\n */\r\n public onBuildObservable = new Observable<NodeRenderGraphBlock>();\r\n\r\n /** @internal */\r\n public _inputs = new Array<NodeRenderGraphConnectionPoint>();\r\n\r\n /** @internal */\r\n public _outputs = new Array<NodeRenderGraphConnectionPoint>();\r\n\r\n /** @internal */\r\n public _codeVariableName = \"\";\r\n\r\n /** @internal */\r\n public _additionalConstructionParameters: Nullable<unknown[]> = null;\r\n\r\n /**\r\n * Gets the list of input points\r\n */\r\n public get inputs(): NodeRenderGraphConnectionPoint[] {\r\n return this._inputs;\r\n }\r\n\r\n /** Gets the list of output points */\r\n public get outputs(): NodeRenderGraphConnectionPoint[] {\r\n return this._outputs;\r\n }\r\n\r\n /**\r\n * Gets or sets the unique id of the node\r\n */\r\n public uniqueId: number;\r\n\r\n /**\r\n * Gets or set the name of the block\r\n */\r\n public get name(): string {\r\n return this._name;\r\n }\r\n\r\n public set name(value: string) {\r\n this._name = value;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this block is an input\r\n */\r\n public get isInput(): boolean {\r\n return this._isInput;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this block is a teleport out\r\n */\r\n public get isTeleportOut(): boolean {\r\n return this._isTeleportOut;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this block is a teleport in\r\n */\r\n public get isTeleportIn(): boolean {\r\n return this._isTeleportIn;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this block is a debug block\r\n */\r\n public get isDebug(): boolean {\r\n return this._isDebug;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating that this block can only be used once per node render graph\r\n */\r\n public get isUnique() {\r\n return this._isUnique;\r\n }\r\n\r\n /**\r\n * A free comment about the block\r\n */\r\n @serialize(\"comment\")\r\n public comments: string;\r\n\r\n /** Gets or sets a boolean indicating that this input can be edited from a collapsed frame */\r\n public visibleOnFrame = false;\r\n\r\n /**\r\n * Gets the current class name e.g. \"NodeRenderGraphBlock\"\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"NodeRenderGraphBlock\";\r\n }\r\n\r\n protected _inputRename(name: string) {\r\n return name;\r\n }\r\n\r\n protected _outputRename(name: string) {\r\n return name;\r\n }\r\n\r\n /**\r\n * Checks if the current block is an ancestor of a given block\r\n * @param block defines the potential descendant block to check\r\n * @returns true if block is a descendant\r\n */\r\n public isAnAncestorOf(block: NodeRenderGraphBlock): boolean {\r\n for (const output of this._outputs) {\r\n if (!output.hasEndpoints) {\r\n continue;\r\n }\r\n\r\n for (const endpoint of output.endpoints) {\r\n if (endpoint.ownerBlock === block) {\r\n return true;\r\n }\r\n\r\n if (endpoint.ownerBlock.isAnAncestorOf(block)) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Checks if the current block is an ancestor of a given type\r\n * @param type defines the potential type to check\r\n * @returns true if block is a descendant\r\n */\r\n public isAnAncestorOfType(type: string): boolean {\r\n if (this.getClassName() === type) {\r\n return true;\r\n }\r\n\r\n for (const output of this._outputs) {\r\n if (!output.hasEndpoints) {\r\n continue;\r\n }\r\n\r\n for (const endpoint of output.endpoints) {\r\n if (endpoint.ownerBlock.isAnAncestorOfType(type)) {\r\n return true;\r\n }\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Get the first descendant using a predicate\r\n * @param predicate defines the predicate to check\r\n * @returns descendant or null if none found\r\n */\r\n public getDescendantOfPredicate(predicate: (block: NodeRenderGraphBlock) => boolean): Nullable<NodeRenderGraphBlock> {\r\n if (predicate(this)) {\r\n return this;\r\n }\r\n\r\n for (const output of this._outputs) {\r\n if (!output.hasEndpoints) {\r\n continue;\r\n }\r\n\r\n for (const endpoint of output.endpoints) {\r\n const descendant = endpoint.ownerBlock.getDescendantOfPredicate(predicate);\r\n if (descendant) {\r\n return descendant;\r\n }\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Creates a new NodeRenderGraphBlock\r\n * @param name defines the block name\r\n * @param frameGraph defines the hosting frame graph\r\n * @param scene defines the hosting scene\r\n * @param _additionalConstructionParameters defines additional parameters to pass to the block constructor\r\n */\r\n public constructor(name: string, frameGraph: FrameGraph, scene: Scene, ..._additionalConstructionParameters: unknown[]) {\r\n this._name = name;\r\n this._frameGraph = frameGraph;\r\n this._scene = scene;\r\n this._engine = scene.getEngine();\r\n this.uniqueId = UniqueIdGenerator.UniqueId;\r\n }\r\n\r\n /**\r\n * Register a new input. Must be called inside a block constructor\r\n * @param name defines the connection point name\r\n * @param type defines the connection point type\r\n * @param isOptional defines a boolean indicating that this input can be omitted\r\n * @param point an already created connection point. If not provided, create a new one\r\n * @returns the current block\r\n */\r\n public registerInput(name: string, type: NodeRenderGraphBlockConnectionPointTypes, isOptional: boolean = false, point?: NodeRenderGraphConnectionPoint) {\r\n point = point ?? new NodeRenderGraphConnectionPoint(name, this, NodeRenderGraphConnectionPointDirection.Input);\r\n point.type = type;\r\n point.isOptional = isOptional;\r\n\r\n this._inputs.push(point);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Register a new output. Must be called inside a block constructor\r\n * @param name defines the connection point name\r\n * @param type defines the connection point type\r\n * @param point an already created connection point. If not provided, create a new one\r\n * @returns the current block\r\n */\r\n public registerOutput(name: string, type: NodeRenderGraphBlockConnectionPointTypes, point?: NodeRenderGraphConnectionPoint) {\r\n point = point ?? new NodeRenderGraphConnectionPoint(name, this, NodeRenderGraphConnectionPointDirection.Output);\r\n point.type = type;\r\n\r\n this._outputs.push(point);\r\n\r\n return this;\r\n }\r\n\r\n protected _addDependenciesInput(additionalAllowedTypes = 0) {\r\n this.registerInput(\"dependencies\", NodeRenderGraphBlockConnectionPointTypes.AutoDetect, true);\r\n\r\n const dependencies = this.getInputByName(\"dependencies\")!;\r\n\r\n dependencies.addExcludedConnectionPointFromAllowedTypes(\r\n NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBuffer |\r\n NodeRenderGraphBlockConnectionPointTypes.ResourceContainer |\r\n NodeRenderGraphBlockConnectionPointTypes.ShadowGenerator |\r\n additionalAllowedTypes\r\n );\r\n\r\n return dependencies;\r\n }\r\n\r\n protected _buildBlock(_state: NodeRenderGraphBuildState) {\r\n // Empty. Must be defined by child nodes\r\n }\r\n\r\n protected _customBuildStep(_state: NodeRenderGraphBuildState): void {\r\n // Must be implemented by children\r\n }\r\n\r\n protected _propagateInputValueToOutput(inputConnectionPoint: NodeRenderGraphConnectionPoint, outputConnectionPoint: NodeRenderGraphConnectionPoint) {\r\n if (inputConnectionPoint.connectedPoint) {\r\n outputConnectionPoint.value = inputConnectionPoint.connectedPoint.value;\r\n }\r\n }\r\n\r\n /**\r\n * Build the current node and generate the vertex data\r\n * @param state defines the current generation state\r\n * @returns true if already built\r\n */\r\n public build(state: NodeRenderGraphBuildState): boolean {\r\n if (this._buildId === state.buildId) {\r\n return true;\r\n }\r\n\r\n this._buildId = state.buildId;\r\n\r\n // Check if \"parent\" blocks are compiled\r\n for (const input of this._inputs) {\r\n if (!input.connectedPoint) {\r\n if (!input.isOptional) {\r\n // Emit a warning\r\n state._notConnectedNonOptionalInputs.push(input);\r\n }\r\n continue;\r\n }\r\n\r\n const block = input.connectedPoint.ownerBlock;\r\n if (block && block !== this) {\r\n block.build(state);\r\n }\r\n }\r\n\r\n this._customBuildStep(state);\r\n\r\n // Logs\r\n if (state.verbose) {\r\n Logger.Log(`Building ${this.name} [${this.getClassName()}]`);\r\n }\r\n\r\n if (this._frameGraphTask) {\r\n this._frameGraphTask.name = this.name;\r\n }\r\n\r\n this._buildBlock(state);\r\n\r\n if (this._frameGraphTask) {\r\n this._frameGraphTask.dependencies = undefined;\r\n\r\n const dependenciesConnectedPoint = this.getInputByName(\"dependencies\")?.connectedPoint;\r\n if (dependenciesConnectedPoint) {\r\n if (dependenciesConnectedPoint.type === NodeRenderGraphBlockConnectionPointTypes.ResourceContainer) {\r\n const container = dependenciesConnectedPoint.ownerBlock as NodeRenderGraphResourceContainerBlock;\r\n for (let i = 0; i < container.inputs.length; i++) {\r\n const input = container.inputs[i];\r\n if (input.connectedPoint && input.connectedPoint.value !== undefined && NodeRenderGraphConnectionPoint.IsTextureHandle(input.connectedPoint.value)) {\r\n this._frameGraphTask.dependencies = this._frameGraphTask.dependencies || new Set();\r\n this._frameGraphTask.dependencies.add(input.connectedPoint.value as FrameGraphTextureHandle);\r\n }\r\n }\r\n } else if (NodeRenderGraphConnectionPoint.IsTextureHandle(dependenciesConnectedPoint.value)) {\r\n this._frameGraphTask.dependencies = this._frameGraphTask.dependencies || new Set();\r\n this._frameGraphTask.dependencies.add(dependenciesConnectedPoint.value as FrameGraphTextureHandle);\r\n }\r\n }\r\n this._frameGraph.addTask(this._frameGraphTask);\r\n }\r\n\r\n this.onBuildObservable.notifyObservers(this);\r\n\r\n return false;\r\n }\r\n\r\n protected _linkConnectionTypes(inputIndex0: number, inputIndex1: number, looseCoupling = false) {\r\n if (looseCoupling) {\r\n this._inputs[inputIndex1]._acceptedConnectionPointType = this._inputs[inputIndex0];\r\n } else {\r\n this._inputs[inputIndex0]._linkedConnectionSource = this._inputs[inputIndex1];\r\n this._inputs[inputIndex0]._isMainLinkSource = true;\r\n }\r\n\r\n this._inputs[inputIndex1]._linkedConnectionSource = this._inputs[inputIndex0];\r\n }\r\n\r\n /**\r\n * Initialize the block and prepare the context for build\r\n */\r\n public initialize() {\r\n // Do nothing\r\n }\r\n\r\n /**\r\n * Lets the block try to connect some inputs automatically\r\n */\r\n public autoConfigure() {\r\n // Do nothing\r\n }\r\n\r\n /**\r\n * Find an input by its name\r\n * @param name defines the name of the input to look for\r\n * @returns the input or null if not found\r\n */\r\n public getInputByName(name: string) {\r\n const filter = this._inputs.filter((e) => e.name === name);\r\n\r\n if (filter.length) {\r\n return filter[0];\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Find an output by its name\r\n * @param name defines the name of the output to look for\r\n * @returns the output or null if not found\r\n */\r\n public getOutputByName(name: string) {\r\n const filter = this._outputs.filter((e) => e.name === name);\r\n\r\n if (filter.length) {\r\n return filter[0];\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Serializes this block in a JSON representation\r\n * @returns the serialized block object\r\n */\r\n public serialize(): any {\r\n const serializationObject: any = {};\r\n\r\n serializationObject.customType = \"BABYLON.\" + this.getClassName();\r\n serializationObject.id = this.uniqueId;\r\n serializationObject.name = this.name;\r\n serializationObject.visibleOnFrame = this.visibleOnFrame;\r\n serializationObject.disabled = this.disabled;\r\n if (this._additionalConstructionParameters) {\r\n serializationObject.additionalConstructionParameters = this._additionalConstructionParameters;\r\n }\r\n\r\n serializationObject.inputs = [];\r\n serializationObject.outputs = [];\r\n\r\n for (const input of this.inputs) {\r\n serializationObject.inputs.push(input.serialize());\r\n }\r\n\r\n for (const output of this.outputs) {\r\n serializationObject.outputs.push(output.serialize(false));\r\n }\r\n\r\n return serializationObject;\r\n }\r\n /**\r\n * @internal\r\n */\r\n public _deserialize(serializationObject: any) {\r\n this._name = serializationObject.name;\r\n this.comments = serializationObject.comments;\r\n this.visibleOnFrame = serializationObject.visibleOnFrame;\r\n this.disabled = serializationObject.disabled;\r\n\r\n this._deserializePortDisplayNamesAndExposedOnFrame(serializationObject);\r\n }\r\n\r\n private _deserializePortDisplayNamesAndExposedOnFrame(serializationObject: any) {\r\n const serializedInputs = serializationObject.inputs;\r\n const serializedOutputs = serializationObject.outputs;\r\n\r\n if (serializedInputs) {\r\n serializedInputs.forEach((port: any) => {\r\n const input = this.inputs.find((i) => i.name === port.name);\r\n if (!input) {\r\n return;\r\n }\r\n if (port.displayName) {\r\n input.displayName = port.displayName;\r\n }\r\n if (port.isExposedOnFrame) {\r\n input.isExposedOnFrame = port.isExposedOnFrame;\r\n input.exposedPortPosition = port.exposedPortPosition;\r\n }\r\n });\r\n }\r\n\r\n if (serializedOutputs) {\r\n serializedOutputs.forEach((port: any, i: number) => {\r\n if (port.displayName) {\r\n this.outputs[i].displayName = port.displayName;\r\n }\r\n if (port.isExposedOnFrame) {\r\n this.outputs[i].isExposedOnFrame = port.isExposedOnFrame;\r\n this.outputs[i].exposedPortPosition = port.exposedPortPosition;\r\n }\r\n });\r\n }\r\n }\r\n\r\n protected _dumpPropertiesCode() {\r\n const variableName = this._codeVariableName;\r\n return `${variableName}.visibleOnFrame = ${this.visibleOnFrame};\\n${variableName}.disabled = ${this.disabled};\\n`;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _dumpCodeForOutputConnections(alreadyDumped: NodeRenderGraphBlock[]) {\r\n let codeString = \"\";\r\n\r\n if (alreadyDumped.indexOf(this) !== -1) {\r\n return codeString;\r\n }\r\n\r\n alreadyDumped.push(this);\r\n\r\n for (const input of this.inputs) {\r\n if (!input.isConnected) {\r\n continue;\r\n }\r\n\r\n const connectedOutput = input.connectedPoint!;\r\n const connectedBlock = connectedOutput.ownerBlock;\r\n\r\n codeString += connectedBlock._dumpCodeForOutputConnections(alreadyDumped);\r\n codeString += `${connectedBlock._codeVariableName}.${connectedBlock._outputRename(connectedOutput.name)}.connectTo(${this._codeVariableName}.${this._inputRename(\r\n input.name\r\n )});\\n`;\r\n }\r\n\r\n return codeString;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _dumpCode(uniqueNames: string[], alreadyDumped: NodeRenderGraphBlock[]) {\r\n alreadyDumped.push(this);\r\n\r\n // Get unique name\r\n const nameAsVariableName = this.name.replace(/[^A-Za-z_]+/g, \"\");\r\n this._codeVariableName = nameAsVariableName || `${this.getClassName()}_${this.uniqueId}`;\r\n\r\n if (uniqueNames.indexOf(this._codeVariableName) !== -1) {\r\n let index = 0;\r\n do {\r\n index++;\r\n this._codeVariableName = nameAsVariableName + index;\r\n } while (uniqueNames.indexOf(this._codeVariableName) !== -1);\r\n }\r\n\r\n uniqueNames.push(this._codeVariableName);\r\n\r\n // Declaration\r\n let codeString = `\\n// ${this.getClassName()}\\n`;\r\n if (this.comments) {\r\n codeString += `// ${this.comments}\\n`;\r\n }\r\n const className = this.getClassName();\r\n if (className === \"NodeRenderGraphInputBlock\") {\r\n const block = this as unknown as NodeRenderGraphInputBlock;\r\n const blockType = block.type;\r\n\r\n codeString += `var ${this._codeVariableName} = new BABYLON.NodeRenderGraphInputBlock(\"${this.name}\", nodeRenderGraph.frameGraph, scene, BABYLON.NodeRenderGraphBlockConnectionPointTypes.${NodeRenderGraphBlockConnectionPointTypes[blockType]});\\n`;\r\n } else {\r\n if (this._additionalConstructionParameters) {\r\n codeString += `var ${this._codeVariableName} = new BABYLON.${className}(\"${this.name}\", nodeRenderGraph.frameGraph, scene, ...${JSON.stringify(this._additionalConstructionParameters)});\\n`;\r\n } else {\r\n codeString += `var ${this._codeVariableName} = new BABYLON.${className}(\"${this.name}\", nodeRenderGraph.frameGraph, scene);\\n`;\r\n }\r\n }\r\n\r\n // Properties\r\n codeString += this._dumpPropertiesCode() + \"\\n\";\r\n\r\n // Inputs\r\n for (const input of this.inputs) {\r\n if (!input.isConnected) {\r\n continue;\r\n }\r\n\r\n const connectedOutput = input.connectedPoint!;\r\n const connectedBlock = connectedOutput.ownerBlock;\r\n\r\n if (alreadyDumped.indexOf(connectedBlock) === -1) {\r\n codeString += connectedBlock._dumpCode(uniqueNames, alreadyDumped);\r\n }\r\n }\r\n\r\n // Outputs\r\n for (const output of this.outputs) {\r\n if (!output.hasEndpoints) {\r\n continue;\r\n }\r\n\r\n for (const endpoint of output.endpoints) {\r\n const connectedBlock = endpoint.ownerBlock;\r\n if (connectedBlock && alreadyDumped.indexOf(connectedBlock) === -1) {\r\n codeString += connectedBlock._dumpCode(uniqueNames, alreadyDumped);\r\n }\r\n }\r\n }\r\n\r\n return codeString;\r\n }\r\n\r\n /**\r\n * Clone the current block to a new identical block\r\n * @returns a copy of the current block\r\n */\r\n public clone() {\r\n const serializationObject = this.serialize();\r\n const blockType: typeof NodeRenderGraphBlock = GetClass(serializationObject.customType);\r\n\r\n if (blockType) {\r\n const additionalConstructionParameters = serializationObject.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(serializationObject);\r\n return block;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Release resources\r\n */\r\n public dispose() {\r\n for (const input of this.inputs) {\r\n input.dispose();\r\n }\r\n\r\n for (const output of this.outputs) {\r\n output.dispose();\r\n }\r\n\r\n this._frameGraphTask?.dispose();\r\n this._frameGraphTask = undefined as any;\r\n\r\n this.onBuildObservable.clear();\r\n }\r\n}\r\n"]}
|
|
@@ -230,7 +230,7 @@ export class NodeRenderGraphConnectionPoint {
|
|
|
230
230
|
connectTo(connectionPoint, ignoreConstraints = false) {
|
|
231
231
|
if (!ignoreConstraints && !this.canConnectTo(connectionPoint)) {
|
|
232
232
|
// eslint-disable-next-line no-throw-literal
|
|
233
|
-
throw
|
|
233
|
+
throw `Cannot connect these two connectors. source: "${this.ownerBlock.name}".${this.name}, target: "${connectionPoint.ownerBlock.name}".${connectionPoint.name}`;
|
|
234
234
|
}
|
|
235
235
|
this._endpoints.push(connectionPoint);
|
|
236
236
|
connectionPoint._connectedPoint = this;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeRenderGraphBlockConnectionPoint.js","sourceRoot":"","sources":["../../../../../dev/core/src/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,wCAAwC,EAA8F,MAAM,8BAA8B,CAAC;AAEpL;;GAEG;AACH,MAAM,OAAO,8BAA8B;IAuBvC,sCAAsC;IACtC,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED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AAC,QAAQ,CAAC;YAC5E,mBAAmB,CAAC,oBAAoB,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC;YACpE,mBAAmB,CAAC,gBAAgB,GAAG,IAAI,CAAC;YAC5C,mBAAmB,CAAC,mBAAmB,GAAG,IAAI,CAAC,mBAAmB,CAAC;QACvE,CAAC;QAED,IAAI,IAAI,CAAC,gBAAgB,IAAI,IAAI,CAAC,mBAAmB,IAAI,CAAC,EAAE,CAAC;YACzD,mBAAmB,CAAC,gBAAgB,GAAG,IAAI,CAAC;YAC5C,mBAAmB,CAAC,mBAAmB,GAAG,IAAI,CAAC,mBAAmB,CAAC;QACvE,CAAC;QAED,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,CAAC;QACpC,IAAI,CAAC,yBAAyB,CAAC,KAAK,EAAE,CAAC;IAC3C,CAAC;CACJ","sourcesContent":["import type {\r\n Nullable,\r\n NodeRenderGraphBlock,\r\n NodeRenderGraphBlockConnectionPointValueType,\r\n NodeRenderGraphInputBlock,\r\n IShadowLight,\r\n FrameGraphShadowGeneratorTask,\r\n // eslint-disable-next-line import/no-internal-modules\r\n} from \"core/index\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { NodeRenderGraphBlockConnectionPointTypes, NodeRenderGraphConnectionPointCompatibilityStates, NodeRenderGraphConnectionPointDirection } from \"./Types/nodeRenderGraphTypes\";\r\n\r\n/**\r\n * Defines a connection point for a block\r\n */\r\nexport class NodeRenderGraphConnectionPoint {\r\n private readonly _ownerBlock: NodeRenderGraphBlock;\r\n private _connectedPoint: Nullable<NodeRenderGraphConnectionPoint> = null;\r\n\r\n /** @internal */\r\n public _acceptedConnectionPointType: Nullable<NodeRenderGraphConnectionPoint> = null;\r\n\r\n private _endpoints = new Array<NodeRenderGraphConnectionPoint>();\r\n private readonly _direction: NodeRenderGraphConnectionPointDirection;\r\n private _type = NodeRenderGraphBlockConnectionPointTypes.Undefined;\r\n\r\n /** @internal */\r\n public _linkedConnectionSource: Nullable<NodeRenderGraphConnectionPoint> = null;\r\n\r\n /** @internal */\r\n public _isMainLinkSource = false;\r\n\r\n /** @internal */\r\n public _typeConnectionSource: Nullable<NodeRenderGraphConnectionPoint | (() => NodeRenderGraphConnectionPoint)> = null;\r\n\r\n /** @internal */\r\n public _defaultConnectionPointType: Nullable<NodeRenderGraphBlockConnectionPointTypes> = null;\r\n\r\n /** Gets the direction of the point */\r\n public get direction() {\r\n return this._direction;\r\n }\r\n\r\n /**\r\n * Checks if the value is a texture handle\r\n * @param value The value to check\r\n * @returns True if the value is a texture handle\r\n */\r\n public static IsTextureHandle(value: NodeRenderGraphBlockConnectionPointValueType | undefined): boolean {\r\n return value !== undefined && Number.isFinite(value);\r\n }\r\n\r\n /**\r\n * Checks if the value is a shadow generator task\r\n * @param value The value to check\r\n * @returns True if the value is a shadow generator\r\n */\r\n public static IsShadowGenerator(value: NodeRenderGraphBlockConnectionPointValueType | undefined): boolean {\r\n return value !== undefined && (value as FrameGraphShadowGeneratorTask).mapSize !== undefined;\r\n }\r\n\r\n /**\r\n * Checks if the value is a shadow light\r\n * @param value The value to check\r\n * @returns True if the value is a shadow light\r\n */\r\n public static IsShadowLight(value: NodeRenderGraphBlockConnectionPointValueType | undefined): boolean {\r\n return value !== undefined && (value as IShadowLight).setShadowProjectionMatrix !== undefined;\r\n }\r\n\r\n /**\r\n * The value stored in this connection point\r\n */\r\n public value: NodeRenderGraphBlockConnectionPointValueType | undefined;\r\n\r\n /** Indicates that this connection point needs dual validation before being connected to another point */\r\n public needDualDirectionValidation: boolean = false;\r\n\r\n /**\r\n * Gets or sets the additional types supported by this connection point\r\n */\r\n public acceptedConnectionPointTypes: NodeRenderGraphBlockConnectionPointTypes[] = [];\r\n\r\n /**\r\n * Gets or sets the additional types excluded by this connection point\r\n */\r\n public excludedConnectionPointTypes: NodeRenderGraphBlockConnectionPointTypes[] = [];\r\n\r\n /**\r\n * Observable triggered when this point is connected\r\n */\r\n public onConnectionObservable = new Observable<NodeRenderGraphConnectionPoint>();\r\n\r\n /**\r\n * Observable triggered when this point is disconnected\r\n */\r\n public onDisconnectionObservable = new Observable<NodeRenderGraphConnectionPoint>();\r\n\r\n /**\r\n * Gets or sets a boolean indicating that this connection point is exposed on a frame\r\n */\r\n public isExposedOnFrame: boolean = false;\r\n\r\n /**\r\n * Gets or sets number indicating the position that the port is exposed to on a frame\r\n */\r\n public exposedPortPosition: number = -1;\r\n\r\n /**\r\n * Gets or sets the connection point type (default is Undefined)\r\n */\r\n public get type(): NodeRenderGraphBlockConnectionPointTypes {\r\n if (this._type === NodeRenderGraphBlockConnectionPointTypes.AutoDetect) {\r\n if (this._ownerBlock.isInput) {\r\n return (this._ownerBlock as NodeRenderGraphInputBlock).type;\r\n }\r\n\r\n if (this._connectedPoint) {\r\n return this._connectedPoint.type;\r\n }\r\n\r\n if (this._linkedConnectionSource) {\r\n if (this._linkedConnectionSource.isConnected) {\r\n return this._linkedConnectionSource.type;\r\n }\r\n if (this._linkedConnectionSource._defaultConnectionPointType) {\r\n return this._linkedConnectionSource._defaultConnectionPointType;\r\n }\r\n }\r\n\r\n if (this._defaultConnectionPointType) {\r\n return this._defaultConnectionPointType;\r\n }\r\n }\r\n\r\n if (this._type === NodeRenderGraphBlockConnectionPointTypes.BasedOnInput) {\r\n if (this._typeConnectionSource) {\r\n const typeConnectionSource = typeof this._typeConnectionSource === \"function\" ? this._typeConnectionSource() : this._typeConnectionSource;\r\n if (!typeConnectionSource.isConnected) {\r\n return this._defaultConnectionPointType ?? typeConnectionSource.type;\r\n }\r\n return typeConnectionSource._connectedPoint!.type;\r\n } else if (this._defaultConnectionPointType) {\r\n return this._defaultConnectionPointType;\r\n }\r\n }\r\n\r\n return this._type;\r\n }\r\n\r\n public set type(value: NodeRenderGraphBlockConnectionPointTypes) {\r\n this._type = value;\r\n }\r\n\r\n /**\r\n * Gets or sets the connection point name\r\n */\r\n public name: string;\r\n\r\n /**\r\n * Gets or sets the connection point display name\r\n */\r\n public displayName: string;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that this connection point can be omitted\r\n */\r\n public isOptional: boolean;\r\n\r\n /**\r\n * Gets a boolean indicating that the current point is connected to another NodeRenderGraphBlock\r\n */\r\n public get isConnected(): boolean {\r\n return this.connectedPoint !== null || this.hasEndpoints;\r\n }\r\n\r\n /** Get the other side of the connection (if any) */\r\n public get connectedPoint(): Nullable<NodeRenderGraphConnectionPoint> {\r\n return this._connectedPoint;\r\n }\r\n\r\n /** Get the block that owns this connection point */\r\n public get ownerBlock(): NodeRenderGraphBlock {\r\n return this._ownerBlock;\r\n }\r\n\r\n /** Get the block connected on the other side of this connection (if any) */\r\n public get sourceBlock(): Nullable<NodeRenderGraphBlock> {\r\n if (!this._connectedPoint) {\r\n return null;\r\n }\r\n\r\n return this._connectedPoint.ownerBlock;\r\n }\r\n\r\n /** Get the block connected on the endpoints of this connection (if any) */\r\n public get connectedBlocks(): Array<NodeRenderGraphBlock> {\r\n if (this._endpoints.length === 0) {\r\n return [];\r\n }\r\n\r\n return this._endpoints.map((e) => e.ownerBlock);\r\n }\r\n\r\n /** Gets the list of connected endpoints */\r\n public get endpoints() {\r\n return this._endpoints;\r\n }\r\n\r\n /** Gets a boolean indicating if that output point is connected to at least one input */\r\n public get hasEndpoints(): boolean {\r\n return this._endpoints && this._endpoints.length > 0;\r\n }\r\n\r\n /** Get the inner type (ie AutoDetect for instance instead of the inferred one) */\r\n public get innerType() {\r\n if (this._linkedConnectionSource && !this._isMainLinkSource && this._linkedConnectionSource.isConnected) {\r\n return this.type;\r\n }\r\n return this._type;\r\n }\r\n\r\n /**\r\n * Creates a block suitable to be used as an input for this input point.\r\n * If null is returned, a block based on the point type will be created.\r\n * @returns The returned string parameter is the name of the output point of NodeRenderGraphBlock (first parameter of the returned array) that can be connected to the input\r\n */\r\n public createCustomInputBlock(): Nullable<[NodeRenderGraphBlock, string]> {\r\n return null;\r\n }\r\n\r\n /**\r\n * Creates a new connection point\r\n * @param name defines the connection point name\r\n * @param ownerBlock defines the block hosting this connection point\r\n * @param direction defines the direction of the connection point\r\n */\r\n public constructor(name: string, ownerBlock: NodeRenderGraphBlock, direction: NodeRenderGraphConnectionPointDirection) {\r\n this._ownerBlock = ownerBlock;\r\n this.name = name;\r\n this._direction = direction;\r\n }\r\n\r\n /**\r\n * Gets the current class name e.g. \"NodeRenderGraphConnectionPoint\"\r\n * @returns the class name\r\n */\r\n public getClassName(): string {\r\n return \"NodeRenderGraphConnectionPoint\";\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if the current point can be connected to another point\r\n * @param connectionPoint defines the other connection point\r\n * @returns a boolean\r\n */\r\n public canConnectTo(connectionPoint: NodeRenderGraphConnectionPoint) {\r\n return this.checkCompatibilityState(connectionPoint) === NodeRenderGraphConnectionPointCompatibilityStates.Compatible;\r\n }\r\n\r\n /**\r\n * Gets a number indicating if the current point can be connected to another point\r\n * @param connectionPoint defines the other connection point\r\n * @returns a number defining the compatibility state\r\n */\r\n public checkCompatibilityState(connectionPoint: NodeRenderGraphConnectionPoint): NodeRenderGraphConnectionPointCompatibilityStates {\r\n const ownerBlock = this._ownerBlock;\r\n const otherBlock = connectionPoint.ownerBlock;\r\n\r\n if (this.type !== connectionPoint.type && connectionPoint.innerType !== NodeRenderGraphBlockConnectionPointTypes.AutoDetect) {\r\n // Accepted types\r\n if (connectionPoint.acceptedConnectionPointTypes && connectionPoint.acceptedConnectionPointTypes.indexOf(this.type) !== -1) {\r\n return NodeRenderGraphConnectionPointCompatibilityStates.Compatible;\r\n } else {\r\n return NodeRenderGraphConnectionPointCompatibilityStates.TypeIncompatible;\r\n }\r\n }\r\n\r\n // Excluded\r\n if (connectionPoint.excludedConnectionPointTypes && connectionPoint.excludedConnectionPointTypes.indexOf(this.type) !== -1) {\r\n return NodeRenderGraphConnectionPointCompatibilityStates.TypeIncompatible;\r\n }\r\n\r\n // Check hierarchy\r\n let targetBlock = otherBlock;\r\n let sourceBlock = ownerBlock;\r\n if (this.direction === NodeRenderGraphConnectionPointDirection.Input) {\r\n targetBlock = ownerBlock;\r\n sourceBlock = otherBlock;\r\n }\r\n\r\n if (targetBlock.isAnAncestorOf(sourceBlock)) {\r\n return NodeRenderGraphConnectionPointCompatibilityStates.HierarchyIssue;\r\n }\r\n\r\n return NodeRenderGraphConnectionPointCompatibilityStates.Compatible;\r\n }\r\n\r\n /**\r\n * Connect this point to another connection point\r\n * @param connectionPoint defines the other connection point\r\n * @param ignoreConstraints defines if the system will ignore connection type constraints (default is false)\r\n * @returns the current connection point\r\n */\r\n public connectTo(connectionPoint: NodeRenderGraphConnectionPoint, ignoreConstraints = false): NodeRenderGraphConnectionPoint {\r\n if (!ignoreConstraints && !this.canConnectTo(connectionPoint)) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"Cannot connect these two connectors.\";\r\n }\r\n\r\n this._endpoints.push(connectionPoint);\r\n connectionPoint._connectedPoint = this;\r\n\r\n this.onConnectionObservable.notifyObservers(connectionPoint);\r\n connectionPoint.onConnectionObservable.notifyObservers(this);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Disconnect this point from one of his endpoint\r\n * @param endpoint defines the other connection point\r\n * @returns the current connection point\r\n */\r\n public disconnectFrom(endpoint: NodeRenderGraphConnectionPoint): NodeRenderGraphConnectionPoint {\r\n const index = this._endpoints.indexOf(endpoint);\r\n\r\n if (index === -1) {\r\n return this;\r\n }\r\n\r\n this._endpoints.splice(index, 1);\r\n endpoint._connectedPoint = null;\r\n\r\n this.onDisconnectionObservable.notifyObservers(endpoint);\r\n endpoint.onDisconnectionObservable.notifyObservers(this);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Fills the list of excluded connection point types with all types other than those passed in the parameter\r\n * @param mask Types (ORed values of NodeRenderGraphBlockConnectionPointTypes) that are allowed, and thus will not be pushed to the excluded list\r\n */\r\n public addExcludedConnectionPointFromAllowedTypes(mask: number): void {\r\n let bitmask = 0;\r\n let val = 2 ** bitmask;\r\n // Note: don't use 1 << bitmask instead of 2 ** bitmask, as it will cause an infinite loop because 1 << 31 is negative!\r\n while (val < NodeRenderGraphBlockConnectionPointTypes.All) {\r\n if (!(mask & val)) {\r\n this.excludedConnectionPointTypes.push(val);\r\n }\r\n bitmask++;\r\n val = 2 ** bitmask;\r\n }\r\n }\r\n\r\n /**\r\n * Adds accepted connection point types\r\n * @param mask Types (ORed values of NodeRenderGraphBlockConnectionPointTypes) that are allowed to connect to this point\r\n */\r\n public addAcceptedConnectionPointTypes(mask: number): void {\r\n let bitmask = 0;\r\n let val = 2 ** bitmask;\r\n // Note: don't use 1 << bitmask instead of 2 ** bitmask, as it will cause an infinite loop because 1 << 31 is negative!\r\n while (val < NodeRenderGraphBlockConnectionPointTypes.All) {\r\n if (mask & val && this.acceptedConnectionPointTypes.indexOf(val) === -1) {\r\n this.acceptedConnectionPointTypes.push(val);\r\n }\r\n bitmask++;\r\n val = 2 ** bitmask;\r\n }\r\n }\r\n\r\n /**\r\n * Serializes this point in a JSON representation\r\n * @param isInput defines if the connection point is an input (default is true)\r\n * @returns the serialized point object\r\n */\r\n public serialize(isInput = true): any {\r\n const serializationObject: any = {};\r\n\r\n serializationObject.name = this.name;\r\n serializationObject.displayName = this.displayName;\r\n\r\n if (isInput && this.connectedPoint) {\r\n serializationObject.inputName = this.name;\r\n serializationObject.targetBlockId = this.connectedPoint.ownerBlock.uniqueId;\r\n serializationObject.targetConnectionName = this.connectedPoint.name;\r\n serializationObject.isExposedOnFrame = true;\r\n serializationObject.exposedPortPosition = this.exposedPortPosition;\r\n }\r\n\r\n if (this.isExposedOnFrame || this.exposedPortPosition >= 0) {\r\n serializationObject.isExposedOnFrame = true;\r\n serializationObject.exposedPortPosition = this.exposedPortPosition;\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Release resources\r\n */\r\n public dispose() {\r\n this.onConnectionObservable.clear();\r\n this.onDisconnectionObservable.clear();\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"nodeRenderGraphBlockConnectionPoint.js","sourceRoot":"","sources":["../../../../../dev/core/src/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,wCAAwC,EAA8F,MAAM,8BAA8B,CAAC;AAEpL;;GAEG;AACH,MAAM,OAAO,8BAA8B;IAuBvC,sCAAsC;IACtC,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,eAAe,CAAC,KAA+D;QACzF,OAAO,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACzD,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,iBAAiB,CAAC,KAA+D;QAC3F,OAAO,KAAK,KAAK,SAAS,IAAK,KAAuC,CAAC,OAAO,KAAK,SAAS,CAAC;IACjG,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,aAAa,CAAC,KAA+D;QACvF,OAAO,KAAK,KAAK,SAAS,IAAK,KAAsB,CAAC,yBAAyB,KAAK,SAAS,CAAC;IAClG,CAAC;IAwCD;;OAEG;IACH,IAAW,IAAI;QACX,IAAI,IAAI,CAAC,KAAK,KAAK,wCAAwC,CAAC,UAAU,EAAE,CAAC;YACrE,IAAI,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;gBAC3B,OAAQ,IAAI,CAAC,WAAyC,CAAC,IAAI,CAAC;YAChE,CAAC;YAED,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;gBACvB,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC;YACrC,CAAC;YAED,IAAI,IAAI,CAAC,uBAAuB,EAAE,CAAC;gBAC/B,IAAI,IAAI,CAAC,uBAAuB,CAAC,WAAW,EAAE,CAAC;oBAC3C,OAAO,IAAI,C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CAAC,CAAC;YAChD,CAAC;YACD,OAAO,EAAE,CAAC;YACV,GAAG,GAAG,CAAC,IAAI,OAAO,CAAC;QACvB,CAAC;IACL,CAAC;IAED;;;;OAIG;IACI,SAAS,CAAC,OAAO,GAAG,IAAI;QAC3B,MAAM,mBAAmB,GAAQ,EAAE,CAAC;QAEpC,mBAAmB,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACrC,mBAAmB,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QAEnD,IAAI,OAAO,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACjC,mBAAmB,CAAC,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC;YAC1C,mBAAmB,CAAC,aAAa,GAAG,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,QAAQ,CAAC;YAC5E,mBAAmB,CAAC,oBAAoB,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC;YACpE,mBAAmB,CAAC,gBAAgB,GAAG,IAAI,CAAC;YAC5C,mBAAmB,CAAC,mBAAmB,GAAG,IAAI,CAAC,mBAAmB,CAAC;QACvE,CAAC;QAED,IAAI,IAAI,CAAC,gBAAgB,IAAI,IAAI,CAAC,mBAAmB,IAAI,CAAC,EAAE,CAAC;YACzD,mBAAmB,CAAC,gBAAgB,GAAG,IAAI,CAAC;YAC5C,mBAAmB,CAAC,mBAAmB,GAAG,IAAI,CAAC,mBAAmB,CAAC;QACvE,CAAC;QAED,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,CAAC;QACpC,IAAI,CAAC,yBAAyB,CAAC,KAAK,EAAE,CAAC;IAC3C,CAAC;CACJ","sourcesContent":["import type {\r\n Nullable,\r\n NodeRenderGraphBlock,\r\n NodeRenderGraphBlockConnectionPointValueType,\r\n NodeRenderGraphInputBlock,\r\n IShadowLight,\r\n FrameGraphShadowGeneratorTask,\r\n // eslint-disable-next-line import/no-internal-modules\r\n} from \"core/index\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { NodeRenderGraphBlockConnectionPointTypes, NodeRenderGraphConnectionPointCompatibilityStates, NodeRenderGraphConnectionPointDirection } from \"./Types/nodeRenderGraphTypes\";\r\n\r\n/**\r\n * Defines a connection point for a block\r\n */\r\nexport class NodeRenderGraphConnectionPoint {\r\n private readonly _ownerBlock: NodeRenderGraphBlock;\r\n private _connectedPoint: Nullable<NodeRenderGraphConnectionPoint> = null;\r\n\r\n /** @internal */\r\n public _acceptedConnectionPointType: Nullable<NodeRenderGraphConnectionPoint> = null;\r\n\r\n private _endpoints = new Array<NodeRenderGraphConnectionPoint>();\r\n private readonly _direction: NodeRenderGraphConnectionPointDirection;\r\n private _type = NodeRenderGraphBlockConnectionPointTypes.Undefined;\r\n\r\n /** @internal */\r\n public _linkedConnectionSource: Nullable<NodeRenderGraphConnectionPoint> = null;\r\n\r\n /** @internal */\r\n public _isMainLinkSource = false;\r\n\r\n /** @internal */\r\n public _typeConnectionSource: Nullable<NodeRenderGraphConnectionPoint | (() => NodeRenderGraphConnectionPoint)> = null;\r\n\r\n /** @internal */\r\n public _defaultConnectionPointType: Nullable<NodeRenderGraphBlockConnectionPointTypes> = null;\r\n\r\n /** Gets the direction of the point */\r\n public get direction() {\r\n return this._direction;\r\n }\r\n\r\n /**\r\n * Checks if the value is a texture handle\r\n * @param value The value to check\r\n * @returns True if the value is a texture handle\r\n */\r\n public static IsTextureHandle(value: NodeRenderGraphBlockConnectionPointValueType | undefined): boolean {\r\n return value !== undefined && Number.isFinite(value);\r\n }\r\n\r\n /**\r\n * Checks if the value is a shadow generator task\r\n * @param value The value to check\r\n * @returns True if the value is a shadow generator\r\n */\r\n public static IsShadowGenerator(value: NodeRenderGraphBlockConnectionPointValueType | undefined): boolean {\r\n return value !== undefined && (value as FrameGraphShadowGeneratorTask).mapSize !== undefined;\r\n }\r\n\r\n /**\r\n * Checks if the value is a shadow light\r\n * @param value The value to check\r\n * @returns True if the value is a shadow light\r\n */\r\n public static IsShadowLight(value: NodeRenderGraphBlockConnectionPointValueType | undefined): boolean {\r\n return value !== undefined && (value as IShadowLight).setShadowProjectionMatrix !== undefined;\r\n }\r\n\r\n /**\r\n * The value stored in this connection point\r\n */\r\n public value: NodeRenderGraphBlockConnectionPointValueType | undefined;\r\n\r\n /** Indicates that this connection point needs dual validation before being connected to another point */\r\n public needDualDirectionValidation: boolean = false;\r\n\r\n /**\r\n * Gets or sets the additional types supported by this connection point\r\n */\r\n public acceptedConnectionPointTypes: NodeRenderGraphBlockConnectionPointTypes[] = [];\r\n\r\n /**\r\n * Gets or sets the additional types excluded by this connection point\r\n */\r\n public excludedConnectionPointTypes: NodeRenderGraphBlockConnectionPointTypes[] = [];\r\n\r\n /**\r\n * Observable triggered when this point is connected\r\n */\r\n public onConnectionObservable = new Observable<NodeRenderGraphConnectionPoint>();\r\n\r\n /**\r\n * Observable triggered when this point is disconnected\r\n */\r\n public onDisconnectionObservable = new Observable<NodeRenderGraphConnectionPoint>();\r\n\r\n /**\r\n * Gets or sets a boolean indicating that this connection point is exposed on a frame\r\n */\r\n public isExposedOnFrame: boolean = false;\r\n\r\n /**\r\n * Gets or sets number indicating the position that the port is exposed to on a frame\r\n */\r\n public exposedPortPosition: number = -1;\r\n\r\n /**\r\n * Gets or sets the connection point type (default is Undefined)\r\n */\r\n public get type(): NodeRenderGraphBlockConnectionPointTypes {\r\n if (this._type === NodeRenderGraphBlockConnectionPointTypes.AutoDetect) {\r\n if (this._ownerBlock.isInput) {\r\n return (this._ownerBlock as NodeRenderGraphInputBlock).type;\r\n }\r\n\r\n if (this._connectedPoint) {\r\n return this._connectedPoint.type;\r\n }\r\n\r\n if (this._linkedConnectionSource) {\r\n if (this._linkedConnectionSource.isConnected) {\r\n return this._linkedConnectionSource.type;\r\n }\r\n if (this._linkedConnectionSource._defaultConnectionPointType) {\r\n return this._linkedConnectionSource._defaultConnectionPointType;\r\n }\r\n }\r\n\r\n if (this._defaultConnectionPointType) {\r\n return this._defaultConnectionPointType;\r\n }\r\n }\r\n\r\n if (this._type === NodeRenderGraphBlockConnectionPointTypes.BasedOnInput) {\r\n if (this._typeConnectionSource) {\r\n const typeConnectionSource = typeof this._typeConnectionSource === \"function\" ? this._typeConnectionSource() : this._typeConnectionSource;\r\n if (!typeConnectionSource.isConnected) {\r\n return this._defaultConnectionPointType ?? typeConnectionSource.type;\r\n }\r\n return typeConnectionSource._connectedPoint!.type;\r\n } else if (this._defaultConnectionPointType) {\r\n return this._defaultConnectionPointType;\r\n }\r\n }\r\n\r\n return this._type;\r\n }\r\n\r\n public set type(value: NodeRenderGraphBlockConnectionPointTypes) {\r\n this._type = value;\r\n }\r\n\r\n /**\r\n * Gets or sets the connection point name\r\n */\r\n public name: string;\r\n\r\n /**\r\n * Gets or sets the connection point display name\r\n */\r\n public displayName: string;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that this connection point can be omitted\r\n */\r\n public isOptional: boolean;\r\n\r\n /**\r\n * Gets a boolean indicating that the current point is connected to another NodeRenderGraphBlock\r\n */\r\n public get isConnected(): boolean {\r\n return this.connectedPoint !== null || this.hasEndpoints;\r\n }\r\n\r\n /** Get the other side of the connection (if any) */\r\n public get connectedPoint(): Nullable<NodeRenderGraphConnectionPoint> {\r\n return this._connectedPoint;\r\n }\r\n\r\n /** Get the block that owns this connection point */\r\n public get ownerBlock(): NodeRenderGraphBlock {\r\n return this._ownerBlock;\r\n }\r\n\r\n /** Get the block connected on the other side of this connection (if any) */\r\n public get sourceBlock(): Nullable<NodeRenderGraphBlock> {\r\n if (!this._connectedPoint) {\r\n return null;\r\n }\r\n\r\n return this._connectedPoint.ownerBlock;\r\n }\r\n\r\n /** Get the block connected on the endpoints of this connection (if any) */\r\n public get connectedBlocks(): Array<NodeRenderGraphBlock> {\r\n if (this._endpoints.length === 0) {\r\n return [];\r\n }\r\n\r\n return this._endpoints.map((e) => e.ownerBlock);\r\n }\r\n\r\n /** Gets the list of connected endpoints */\r\n public get endpoints() {\r\n return this._endpoints;\r\n }\r\n\r\n /** Gets a boolean indicating if that output point is connected to at least one input */\r\n public get hasEndpoints(): boolean {\r\n return this._endpoints && this._endpoints.length > 0;\r\n }\r\n\r\n /** Get the inner type (ie AutoDetect for instance instead of the inferred one) */\r\n public get innerType() {\r\n if (this._linkedConnectionSource && !this._isMainLinkSource && this._linkedConnectionSource.isConnected) {\r\n return this.type;\r\n }\r\n return this._type;\r\n }\r\n\r\n /**\r\n * Creates a block suitable to be used as an input for this input point.\r\n * If null is returned, a block based on the point type will be created.\r\n * @returns The returned string parameter is the name of the output point of NodeRenderGraphBlock (first parameter of the returned array) that can be connected to the input\r\n */\r\n public createCustomInputBlock(): Nullable<[NodeRenderGraphBlock, string]> {\r\n return null;\r\n }\r\n\r\n /**\r\n * Creates a new connection point\r\n * @param name defines the connection point name\r\n * @param ownerBlock defines the block hosting this connection point\r\n * @param direction defines the direction of the connection point\r\n */\r\n public constructor(name: string, ownerBlock: NodeRenderGraphBlock, direction: NodeRenderGraphConnectionPointDirection) {\r\n this._ownerBlock = ownerBlock;\r\n this.name = name;\r\n this._direction = direction;\r\n }\r\n\r\n /**\r\n * Gets the current class name e.g. \"NodeRenderGraphConnectionPoint\"\r\n * @returns the class name\r\n */\r\n public getClassName(): string {\r\n return \"NodeRenderGraphConnectionPoint\";\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if the current point can be connected to another point\r\n * @param connectionPoint defines the other connection point\r\n * @returns a boolean\r\n */\r\n public canConnectTo(connectionPoint: NodeRenderGraphConnectionPoint) {\r\n return this.checkCompatibilityState(connectionPoint) === NodeRenderGraphConnectionPointCompatibilityStates.Compatible;\r\n }\r\n\r\n /**\r\n * Gets a number indicating if the current point can be connected to another point\r\n * @param connectionPoint defines the other connection point\r\n * @returns a number defining the compatibility state\r\n */\r\n public checkCompatibilityState(connectionPoint: NodeRenderGraphConnectionPoint): NodeRenderGraphConnectionPointCompatibilityStates {\r\n const ownerBlock = this._ownerBlock;\r\n const otherBlock = connectionPoint.ownerBlock;\r\n\r\n if (this.type !== connectionPoint.type && connectionPoint.innerType !== NodeRenderGraphBlockConnectionPointTypes.AutoDetect) {\r\n // Accepted types\r\n if (connectionPoint.acceptedConnectionPointTypes && connectionPoint.acceptedConnectionPointTypes.indexOf(this.type) !== -1) {\r\n return NodeRenderGraphConnectionPointCompatibilityStates.Compatible;\r\n } else {\r\n return NodeRenderGraphConnectionPointCompatibilityStates.TypeIncompatible;\r\n }\r\n }\r\n\r\n // Excluded\r\n if (connectionPoint.excludedConnectionPointTypes && connectionPoint.excludedConnectionPointTypes.indexOf(this.type) !== -1) {\r\n return NodeRenderGraphConnectionPointCompatibilityStates.TypeIncompatible;\r\n }\r\n\r\n // Check hierarchy\r\n let targetBlock = otherBlock;\r\n let sourceBlock = ownerBlock;\r\n if (this.direction === NodeRenderGraphConnectionPointDirection.Input) {\r\n targetBlock = ownerBlock;\r\n sourceBlock = otherBlock;\r\n }\r\n\r\n if (targetBlock.isAnAncestorOf(sourceBlock)) {\r\n return NodeRenderGraphConnectionPointCompatibilityStates.HierarchyIssue;\r\n }\r\n\r\n return NodeRenderGraphConnectionPointCompatibilityStates.Compatible;\r\n }\r\n\r\n /**\r\n * Connect this point to another connection point\r\n * @param connectionPoint defines the other connection point\r\n * @param ignoreConstraints defines if the system will ignore connection type constraints (default is false)\r\n * @returns the current connection point\r\n */\r\n public connectTo(connectionPoint: NodeRenderGraphConnectionPoint, ignoreConstraints = false): NodeRenderGraphConnectionPoint {\r\n if (!ignoreConstraints && !this.canConnectTo(connectionPoint)) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw `Cannot connect these two connectors. source: \"${this.ownerBlock.name}\".${this.name}, target: \"${connectionPoint.ownerBlock.name}\".${connectionPoint.name}`;\r\n }\r\n\r\n this._endpoints.push(connectionPoint);\r\n connectionPoint._connectedPoint = this;\r\n\r\n this.onConnectionObservable.notifyObservers(connectionPoint);\r\n connectionPoint.onConnectionObservable.notifyObservers(this);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Disconnect this point from one of his endpoint\r\n * @param endpoint defines the other connection point\r\n * @returns the current connection point\r\n */\r\n public disconnectFrom(endpoint: NodeRenderGraphConnectionPoint): NodeRenderGraphConnectionPoint {\r\n const index = this._endpoints.indexOf(endpoint);\r\n\r\n if (index === -1) {\r\n return this;\r\n }\r\n\r\n this._endpoints.splice(index, 1);\r\n endpoint._connectedPoint = null;\r\n\r\n this.onDisconnectionObservable.notifyObservers(endpoint);\r\n endpoint.onDisconnectionObservable.notifyObservers(this);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Fills the list of excluded connection point types with all types other than those passed in the parameter\r\n * @param mask Types (ORed values of NodeRenderGraphBlockConnectionPointTypes) that are allowed, and thus will not be pushed to the excluded list\r\n */\r\n public addExcludedConnectionPointFromAllowedTypes(mask: number): void {\r\n let bitmask = 0;\r\n let val = 2 ** bitmask;\r\n // Note: don't use 1 << bitmask instead of 2 ** bitmask, as it will cause an infinite loop because 1 << 31 is negative!\r\n while (val < NodeRenderGraphBlockConnectionPointTypes.All) {\r\n if (!(mask & val)) {\r\n this.excludedConnectionPointTypes.push(val);\r\n }\r\n bitmask++;\r\n val = 2 ** bitmask;\r\n }\r\n }\r\n\r\n /**\r\n * Adds accepted connection point types\r\n * @param mask Types (ORed values of NodeRenderGraphBlockConnectionPointTypes) that are allowed to connect to this point\r\n */\r\n public addAcceptedConnectionPointTypes(mask: number): void {\r\n let bitmask = 0;\r\n let val = 2 ** bitmask;\r\n // Note: don't use 1 << bitmask instead of 2 ** bitmask, as it will cause an infinite loop because 1 << 31 is negative!\r\n while (val < NodeRenderGraphBlockConnectionPointTypes.All) {\r\n if (mask & val && this.acceptedConnectionPointTypes.indexOf(val) === -1) {\r\n this.acceptedConnectionPointTypes.push(val);\r\n }\r\n bitmask++;\r\n val = 2 ** bitmask;\r\n }\r\n }\r\n\r\n /**\r\n * Serializes this point in a JSON representation\r\n * @param isInput defines if the connection point is an input (default is true)\r\n * @returns the serialized point object\r\n */\r\n public serialize(isInput = true): any {\r\n const serializationObject: any = {};\r\n\r\n serializationObject.name = this.name;\r\n serializationObject.displayName = this.displayName;\r\n\r\n if (isInput && this.connectedPoint) {\r\n serializationObject.inputName = this.name;\r\n serializationObject.targetBlockId = this.connectedPoint.ownerBlock.uniqueId;\r\n serializationObject.targetConnectionName = this.connectedPoint.name;\r\n serializationObject.isExposedOnFrame = true;\r\n serializationObject.exposedPortPosition = this.exposedPortPosition;\r\n }\r\n\r\n if (this.isExposedOnFrame || this.exposedPortPosition >= 0) {\r\n serializationObject.isExposedOnFrame = true;\r\n serializationObject.exposedPortPosition = this.exposedPortPosition;\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Release resources\r\n */\r\n public dispose() {\r\n this.onConnectionObservable.clear();\r\n this.onDisconnectionObservable.clear();\r\n }\r\n}\r\n"]}
|
|
@@ -7,6 +7,7 @@ import { InputBlock } from "../Input/inputBlock.js";
|
|
|
7
7
|
import { NodeMaterialConnectionPointCustomObject } from "../../nodeMaterialConnectionPointCustomObject.js";
|
|
8
8
|
import { RefractionBlock } from "./refractionBlock.js";
|
|
9
9
|
import { editableInPropertyPage } from "../../../../Decorators/nodeDecorator.js";
|
|
10
|
+
import { PBRSubSurfaceConfiguration } from "../../../PBR/pbrSubSurfaceConfiguration.js";
|
|
10
11
|
/**
|
|
11
12
|
* Block used to implement the sub surface module of the PBR material
|
|
12
13
|
*/
|
|
@@ -20,7 +21,7 @@ export class SubSurfaceBlock extends NodeMaterialBlock {
|
|
|
20
21
|
/**
|
|
21
22
|
* Set it to true if your rendering in 8.0+ is different from that in 7 when you use sub-surface properties (transmission, refraction, etc.)
|
|
22
23
|
*/
|
|
23
|
-
this.applyAlbedoAfterSubSurface =
|
|
24
|
+
this.applyAlbedoAfterSubSurface = PBRSubSurfaceConfiguration.DEFAULT_APPLY_ALBEDO_AFTERSUBSURFACE;
|
|
24
25
|
this._isUnique = true;
|
|
25
26
|
this.registerInput("thickness", NodeMaterialBlockConnectionPointTypes.Float, false, NodeMaterialBlockTargets.Fragment);
|
|
26
27
|
this.registerInput("tintColor", NodeMaterialBlockConnectionPointTypes.Color3, true, NodeMaterialBlockTargets.Fragment);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subSurfaceBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Materials/Node/Blocks/PBR/subSurfaceBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,qCAAqC,EAAE,MAAM,mDAAmD,CAAC;AAI1G,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,uCAAuC,EAAE,MAAM,+CAA+C,CAAC;AAKxG,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,sBAAsB,EAA0B,MAAM,sCAAsC,CAAC;AAEtG;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,iBAAiB;IAClD;;;OAGG;IACH,YAAmB,IAAY;QAC3B,KAAK,CAAC,IAAI,EAAE,wBAAwB,CAAC,QAAQ,CAAC,CAAC;QAyBnD;;WAEG;QAEI,+BAA0B,GAAY,KAAK,CAAC;QA3B/C,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QAEtB,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,qCAAqC,CAAC,KAAK,EAAE,KAAK,EAAE,wBAAwB,CAAC,QAAQ,CAAC,CAAC;QACvH,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,qCAAqC,CAAC,MAAM,EAAE,IAAI,EAAE,wBAAwB,CAAC,QAAQ,CAAC,CAAC;QACvH,IAAI,CAAC,aAAa,CAAC,uBAA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cesContent":["import { NodeMaterialBlock } from \"../../nodeMaterialBlock\";\r\nimport { NodeMaterialBlockConnectionPointTypes } from \"../../Enums/nodeMaterialBlockConnectionPointTypes\";\r\nimport type { NodeMaterialBuildState } from \"../../nodeMaterialBuildState\";\r\nimport type { NodeMaterialConnectionPoint } from \"../../nodeMaterialBlockConnectionPoint\";\r\nimport { NodeMaterialConnectionPointDirection } from \"../../nodeMaterialBlockConnectionPoint\";\r\nimport { NodeMaterialBlockTargets } from \"../../Enums/nodeMaterialBlockTargets\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { InputBlock } from \"../Input/inputBlock\";\r\nimport { NodeMaterialConnectionPointCustomObject } from \"../../nodeMaterialConnectionPointCustomObject\";\r\nimport type { NodeMaterial, NodeMaterialDefines } from \"../../nodeMaterial\";\r\nimport type { AbstractMesh } from \"../../../../Meshes/abstractMesh\";\r\nimport type { ReflectionBlock } from \"./reflectionBlock\";\r\nimport type { Nullable } from \"../../../../types\";\r\nimport { RefractionBlock } from \"./refractionBlock\";\r\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"../../../../Decorators/nodeDecorator\";\r\n\r\n/**\r\n * Block used to implement the sub surface module of the PBR material\r\n */\r\nexport class SubSurfaceBlock extends NodeMaterialBlock {\r\n /**\r\n * Create a new SubSurfaceBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name, NodeMaterialBlockTargets.Fragment);\r\n\r\n this._isUnique = true;\r\n\r\n this.registerInput(\"thickness\", NodeMaterialBlockConnectionPointTypes.Float, false, NodeMaterialBlockTargets.Fragment);\r\n this.registerInput(\"tintColor\", NodeMaterialBlockConnectionPointTypes.Color3, true, NodeMaterialBlockTargets.Fragment);\r\n this.registerInput(\"translucencyIntensity\", NodeMaterialBlockConnectionPointTypes.Float, true, NodeMaterialBlockTargets.Fragment);\r\n this.registerInput(\"translucencyDiffusionDist\", NodeMaterialBlockConnectionPointTypes.Color3, true, NodeMaterialBlockTargets.Fragment);\r\n this.registerInput(\r\n \"refraction\",\r\n NodeMaterialBlockConnectionPointTypes.Object,\r\n true,\r\n NodeMaterialBlockTargets.Fragment,\r\n new NodeMaterialConnectionPointCustomObject(\"refraction\", this, NodeMaterialConnectionPointDirection.Input, RefractionBlock, \"RefractionBlock\")\r\n );\r\n this.registerInput(\"dispersion\", NodeMaterialBlockConnectionPointTypes.Float, true, NodeMaterialBlockTargets.Fragment);\r\n\r\n this.registerOutput(\r\n \"subsurface\",\r\n NodeMaterialBlockConnectionPointTypes.Object,\r\n NodeMaterialBlockTargets.Fragment,\r\n new NodeMaterialConnectionPointCustomObject(\"subsurface\", this, NodeMaterialConnectionPointDirection.Output, SubSurfaceBlock, \"SubSurfaceBlock\")\r\n );\r\n }\r\n\r\n /**\r\n * Set it to true if your rendering in 8.0+ is different from that in 7 when you use sub-surface properties (transmission, refraction, etc.)\r\n */\r\n @editableInPropertyPage(\"Apply albedo after sub-surface\", PropertyTypeForEdition.Boolean, \"ADVANCED\")\r\n public applyAlbedoAfterSubSurface: boolean = false;\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(\"subSurfaceOut\");\r\n state._excludeVariableName(\"vThicknessParam\");\r\n state._excludeVariableName(\"vTintColor\");\r\n state._excludeVariableName(\"vTranslucencyColor\");\r\n state._excludeVariableName(\"vSubSurfaceIntensity\");\r\n state._excludeVariableName(\"dispersion\");\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 \"SubSurfaceBlock\";\r\n }\r\n\r\n /**\r\n * Gets the thickness component\r\n */\r\n public get thickness(): NodeMaterialConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the tint color input component\r\n */\r\n public get tintColor(): NodeMaterialConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the translucency intensity input component\r\n */\r\n public get translucencyIntensity(): NodeMaterialConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the translucency diffusion distance input component\r\n */\r\n public get translucencyDiffusionDist(): NodeMaterialConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the refraction object parameters\r\n */\r\n public get refraction(): NodeMaterialConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the dispersion input component\r\n */\r\n public get dispersion(): NodeMaterialConnectionPoint {\r\n return this._inputs[5];\r\n }\r\n\r\n /**\r\n * Gets the sub surface object output component\r\n */\r\n public get subsurface(): NodeMaterialConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n public override autoConfigure() {\r\n if (!this.thickness.isConnected) {\r\n const thicknessInput = new InputBlock(\"SubSurface thickness\", NodeMaterialBlockTargets.Fragment, NodeMaterialBlockConnectionPointTypes.Float);\r\n thicknessInput.value = 0;\r\n thicknessInput.output.connectTo(this.thickness);\r\n }\r\n }\r\n\r\n public override prepareDefines(mesh: AbstractMesh, nodeMaterial: NodeMaterial, defines: NodeMaterialDefines) {\r\n super.prepareDefines(mesh, nodeMaterial, defines);\r\n\r\n const translucencyEnabled = this.translucencyDiffusionDist.isConnected || this.translucencyIntensity.isConnected;\r\n\r\n defines.setValue(\"SUBSURFACE\", translucencyEnabled || this.refraction.isConnected, true);\r\n defines.setValue(\"SS_TRANSLUCENCY\", translucencyEnabled, true);\r\n defines.setValue(\"SS_THICKNESSANDMASK_TEXTURE\", false, true);\r\n defines.setValue(\"SS_REFRACTIONINTENSITY_TEXTURE\", false, true);\r\n defines.setValue(\"SS_TRANSLUCENCYINTENSITY_TEXTURE\", false, true);\r\n defines.setValue(\"SS_USE_GLTF_TEXTURES\", false, true);\r\n defines.setValue(\"SS_DISPERSION\", this.dispersion.isConnected, true);\r\n defines.setValue(\"SS_APPLY_ALBEDO_AFTER_SUBSURFACE\", this.applyAlbedoAfterSubSurface, true);\r\n }\r\n\r\n /**\r\n * Gets the main code of the block (fragment side)\r\n * @param state current state of the node material building\r\n * @param ssBlock instance of a SubSurfaceBlock or null if the code must be generated without an active sub surface module\r\n * @param reflectionBlock instance of a ReflectionBlock null if the code must be generated without an active reflection module\r\n * @param worldPosVarName name of the variable holding the world position\r\n * @returns the shader code\r\n */\r\n public static GetCode(state: NodeMaterialBuildState, ssBlock: Nullable<SubSurfaceBlock>, reflectionBlock: Nullable<ReflectionBlock>, worldPosVarName: string): string {\r\n let code = \"\";\r\n\r\n const thickness = ssBlock?.thickness.isConnected ? ssBlock.thickness.associatedVariableName : \"0.\";\r\n const tintColor = ssBlock?.tintColor.isConnected ? ssBlock.tintColor.associatedVariableName : \"vec3(1.)\";\r\n const translucencyIntensity = ssBlock?.translucencyIntensity.isConnected ? ssBlock?.translucencyIntensity.associatedVariableName : \"1.\";\r\n const translucencyDiffusionDistance = ssBlock?.translucencyDiffusionDist.isConnected ? ssBlock?.translucencyDiffusionDist.associatedVariableName : \"vec3(1.)\";\r\n\r\n const refractionBlock: Nullable<RefractionBlock> = (ssBlock?.refraction.isConnected ? ssBlock?.refraction.connectedPoint?.ownerBlock : null) as Nullable<RefractionBlock>;\r\n\r\n const refractionTintAtDistance = refractionBlock?.tintAtDistance.isConnected ? refractionBlock.tintAtDistance.associatedVariableName : \"1.\";\r\n const refractionIntensity = refractionBlock?.intensity.isConnected ? refractionBlock.intensity.associatedVariableName : \"1.\";\r\n const refractionView = refractionBlock?.view.isConnected ? refractionBlock.view.associatedVariableName : \"\";\r\n\r\n const dispersion = ssBlock?.dispersion.isConnected ? ssBlock?.dispersion.associatedVariableName : \"0.0\";\r\n const isWebGPU = state.shaderLanguage === ShaderLanguage.WGSL;\r\n\r\n code += refractionBlock?.getCode(state) ?? \"\";\r\n\r\n code += `${isWebGPU ? \"var subSurfaceOut: subSurfaceOutParams\" : \"subSurfaceOutParams subSurfaceOut\"};\r\n\r\n #ifdef SUBSURFACE\r\n ${state._declareLocalVar(\"vThicknessParam\", NodeMaterialBlockConnectionPointTypes.Vector2)} = vec2${state.fSuffix}(0., ${thickness});\r\n ${state._declareLocalVar(\"vTintColor\", NodeMaterialBlockConnectionPointTypes.Vector4)} = vec4${state.fSuffix}(${tintColor}, ${refractionTintAtDistance});\r\n ${state._declareLocalVar(\"vSubSurfaceIntensity\", NodeMaterialBlockConnectionPointTypes.Vector3)} = vec3(${refractionIntensity}, ${translucencyIntensity}, 0.);\r\n ${state._declareLocalVar(\"dispersion\", NodeMaterialBlockConnectionPointTypes.Float)} = ${dispersion};\r\n subSurfaceOut = subSurfaceBlock(\r\n vSubSurfaceIntensity\r\n , vThicknessParam\r\n , vTintColor\r\n , normalW\r\n , specularEnvironmentReflectance\r\n #ifdef SS_THICKNESSANDMASK_TEXTURE\r\n , vec4${state.fSuffix}(0.)\r\n #endif\r\n #ifdef REFLECTION\r\n #ifdef SS_TRANSLUCENCY\r\n , ${(isWebGPU ? \"uniforms.\" : \"\") + reflectionBlock?._reflectionMatrixName}\r\n #ifdef USESPHERICALFROMREFLECTIONMAP\r\n #if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\r\n , reflectionOut.irradianceVector\r\n #endif\r\n #if defined(REALTIME_FILTERING)\r\n , ${reflectionBlock?._cubeSamplerName}\r\n ${isWebGPU ? `, ${reflectionBlock?._cubeSamplerName}Sampler` : \"\"}\r\n , ${reflectionBlock?._vReflectionFilteringInfoName}\r\n #endif\r\n #endif\r\n #ifdef USEIRRADIANCEMAP\r\n , irradianceSampler\r\n ${isWebGPU ? `, irradianceSamplerSampler` : \"\"}\r\n #endif\r\n #endif\r\n #endif\r\n #if defined(SS_REFRACTION) || defined(SS_TRANSLUCENCY)\r\n , surfaceAlbedo\r\n #endif\r\n #ifdef SS_REFRACTION\r\n , ${worldPosVarName}.xyz\r\n , viewDirectionW\r\n , ${refractionView}\r\n , ${(isWebGPU ? \"uniforms.\" : \"\") + (refractionBlock?._vRefractionInfosName ?? \"\")}\r\n , ${(isWebGPU ? \"uniforms.\" : \"\") + (refractionBlock?._refractionMatrixName ?? \"\")}\r\n , ${(isWebGPU ? \"uniforms.\" : \"\") + (refractionBlock?._vRefractionMicrosurfaceInfosName ?? \"\")}\r\n , ${isWebGPU ? \"uniforms.\" : \"\"}vLightingIntensity\r\n #ifdef SS_LINKREFRACTIONTOTRANSPARENCY\r\n , alpha\r\n #endif\r\n #ifdef ${refractionBlock?._defineLODRefractionAlpha ?? \"IGNORE\"}\r\n , NdotVUnclamped\r\n #endif\r\n #ifdef ${refractionBlock?._defineLinearSpecularRefraction ?? \"IGNORE\"}\r\n , roughness\r\n #endif\r\n , alphaG\r\n #ifdef ${refractionBlock?._define3DName ?? \"IGNORE\"}\r\n , ${refractionBlock?._cubeSamplerName ?? \"\"}\r\n ${isWebGPU ? `, ${refractionBlock?._cubeSamplerName}Sampler` : \"\"}\r\n #else\r\n , ${refractionBlock?._2DSamplerName ?? \"\"}\r\n ${isWebGPU ? `, ${refractionBlock?._2DSamplerName}Sampler` : \"\"}\r\n #endif\r\n #ifndef LODBASEDMICROSFURACE\r\n #ifdef ${refractionBlock?._define3DName ?? \"IGNORE\"}\r\n , ${refractionBlock?._cubeSamplerName ?? \"\"} \r\n ${isWebGPU ? `, ${refractionBlock?._cubeSamplerName}Sampler` : \"\"}\r\n , ${refractionBlock?._cubeSamplerName ?? \"\"} \r\n ${isWebGPU ? `, ${refractionBlock?._cubeSamplerName}Sampler` : \"\"}\r\n #else\r\n , ${refractionBlock?._2DSamplerName ?? \"\"}\r\n ${isWebGPU ? `, ${refractionBlock?._2DSamplerName}Sampler` : \"\"}\r\n , ${refractionBlock?._2DSamplerName ?? \"\"}\r\n ${isWebGPU ? `, ${refractionBlock?._2DSamplerName}Sampler` : \"\"}\r\n #endif\r\n #endif\r\n #ifdef ANISOTROPIC\r\n , anisotropicOut\r\n #endif\r\n #ifdef REALTIME_FILTERING\r\n , ${refractionBlock?._vRefractionFilteringInfoName ?? \"\"}\r\n #endif\r\n #ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC\r\n , vRefractionPosition\r\n , vRefractionSize\r\n #endif\r\n #ifdef SS_DISPERSION\r\n , dispersion\r\n #endif\r\n #endif\r\n #ifdef SS_TRANSLUCENCY\r\n , ${translucencyDiffusionDistance}\r\n , vTintColor\r\n #ifdef SS_TRANSLUCENCYCOLOR_TEXTURE\r\n , vec4${state.fSuffix}(0.)\r\n #endif\r\n #endif \r\n );\r\n\r\n #ifdef SS_REFRACTION\r\n surfaceAlbedo = subSurfaceOut.surfaceAlbedo;\r\n #ifdef SS_LINKREFRACTIONTOTRANSPARENCY\r\n alpha = subSurfaceOut.alpha;\r\n #endif\r\n #endif\r\n #else\r\n subSurfaceOut.specularEnvironmentReflectance = specularEnvironmentReflectance;\r\n #endif\\n`;\r\n\r\n return code;\r\n }\r\n\r\n protected override _buildBlock(state: NodeMaterialBuildState) {\r\n if (state.target === NodeMaterialBlockTargets.Fragment) {\r\n state.sharedData.blocksWithDefines.push(this);\r\n }\r\n\r\n return this;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.SubSurfaceBlock\", SubSurfaceBlock);\r\n"]}
|
|
1
|
+
{"version":3,"file":"subSurfaceBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/Materials/Node/Blocks/PBR/subSurfaceBlock.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,qCAAqC,EAAE,MAAM,mDAAmD,CAAC;AAI1G,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,uCAAuC,EAAE,MAAM,+CAA+C,CAAC;AAKxG,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEp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cAAc,IAAI,EAAE;0BACvC,QAAQ,CAAC,CAAC,CAAC,KAAK,eAAe,EAAE,cAAc,SAAS,CAAC,CAAC,CAAC,EAAE;;;;;;;wBAO/D,eAAe,EAAE,6BAA6B,IAAI,EAAE;;;;;;;;;;;oBAWxD,6BAA6B;;;4BAGrB,KAAK,CAAC,OAAO;;;;;;;;;;;;;iBAaxB,CAAC;QAEV,OAAO,IAAI,CAAC;IAChB,CAAC;IAEkB,WAAW,CAAC,KAA6B;QACxD,IAAI,KAAK,CAAC,MAAM,KAAK,wBAAwB,CAAC,QAAQ,EAAE,CAAC;YACrD,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClD,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAjPU;IADN,sBAAsB,CAAC,gCAAgC,0CAAkC,UAAU,CAAC;mEACQ;AAmPjH,aAAa,CAAC,yBAAyB,EAAE,eAAe,CAAC,CAAC","sourcesContent":["import { NodeMaterialBlock } from \"../../nodeMaterialBlock\";\r\nimport { NodeMaterialBlockConnectionPointTypes } from \"../../Enums/nodeMaterialBlockConnectionPointTypes\";\r\nimport type { NodeMaterialBuildState } from \"../../nodeMaterialBuildState\";\r\nimport type { NodeMaterialConnectionPoint } from \"../../nodeMaterialBlockConnectionPoint\";\r\nimport { NodeMaterialConnectionPointDirection } from \"../../nodeMaterialBlockConnectionPoint\";\r\nimport { NodeMaterialBlockTargets } from \"../../Enums/nodeMaterialBlockTargets\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { InputBlock } from \"../Input/inputBlock\";\r\nimport { NodeMaterialConnectionPointCustomObject } from \"../../nodeMaterialConnectionPointCustomObject\";\r\nimport type { NodeMaterial, NodeMaterialDefines } from \"../../nodeMaterial\";\r\nimport type { AbstractMesh } from \"../../../../Meshes/abstractMesh\";\r\nimport type { ReflectionBlock } from \"./reflectionBlock\";\r\nimport type { Nullable } from \"../../../../types\";\r\nimport { RefractionBlock } from \"./refractionBlock\";\r\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"../../../../Decorators/nodeDecorator\";\r\nimport { PBRSubSurfaceConfiguration } from \"core/Materials/PBR/pbrSubSurfaceConfiguration\";\r\n\r\n/**\r\n * Block used to implement the sub surface module of the PBR material\r\n */\r\nexport class SubSurfaceBlock extends NodeMaterialBlock {\r\n /**\r\n * Create a new SubSurfaceBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name, NodeMaterialBlockTargets.Fragment);\r\n\r\n this._isUnique = true;\r\n\r\n this.registerInput(\"thickness\", NodeMaterialBlockConnectionPointTypes.Float, false, NodeMaterialBlockTargets.Fragment);\r\n this.registerInput(\"tintColor\", NodeMaterialBlockConnectionPointTypes.Color3, true, NodeMaterialBlockTargets.Fragment);\r\n this.registerInput(\"translucencyIntensity\", NodeMaterialBlockConnectionPointTypes.Float, true, NodeMaterialBlockTargets.Fragment);\r\n this.registerInput(\"translucencyDiffusionDist\", NodeMaterialBlockConnectionPointTypes.Color3, true, NodeMaterialBlockTargets.Fragment);\r\n this.registerInput(\r\n \"refraction\",\r\n NodeMaterialBlockConnectionPointTypes.Object,\r\n true,\r\n NodeMaterialBlockTargets.Fragment,\r\n new NodeMaterialConnectionPointCustomObject(\"refraction\", this, NodeMaterialConnectionPointDirection.Input, RefractionBlock, \"RefractionBlock\")\r\n );\r\n this.registerInput(\"dispersion\", NodeMaterialBlockConnectionPointTypes.Float, true, NodeMaterialBlockTargets.Fragment);\r\n\r\n this.registerOutput(\r\n \"subsurface\",\r\n NodeMaterialBlockConnectionPointTypes.Object,\r\n NodeMaterialBlockTargets.Fragment,\r\n new NodeMaterialConnectionPointCustomObject(\"subsurface\", this, NodeMaterialConnectionPointDirection.Output, SubSurfaceBlock, \"SubSurfaceBlock\")\r\n );\r\n }\r\n\r\n /**\r\n * Set it to true if your rendering in 8.0+ is different from that in 7 when you use sub-surface properties (transmission, refraction, etc.)\r\n */\r\n @editableInPropertyPage(\"Apply albedo after sub-surface\", PropertyTypeForEdition.Boolean, \"ADVANCED\")\r\n public applyAlbedoAfterSubSurface: boolean = PBRSubSurfaceConfiguration.DEFAULT_APPLY_ALBEDO_AFTERSUBSURFACE;\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(\"subSurfaceOut\");\r\n state._excludeVariableName(\"vThicknessParam\");\r\n state._excludeVariableName(\"vTintColor\");\r\n state._excludeVariableName(\"vTranslucencyColor\");\r\n state._excludeVariableName(\"vSubSurfaceIntensity\");\r\n state._excludeVariableName(\"dispersion\");\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 \"SubSurfaceBlock\";\r\n }\r\n\r\n /**\r\n * Gets the thickness component\r\n */\r\n public get thickness(): NodeMaterialConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the tint color input component\r\n */\r\n public get tintColor(): NodeMaterialConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the translucency intensity input component\r\n */\r\n public get translucencyIntensity(): NodeMaterialConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the translucency diffusion distance input component\r\n */\r\n public get translucencyDiffusionDist(): NodeMaterialConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the refraction object parameters\r\n */\r\n public get refraction(): NodeMaterialConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the dispersion input component\r\n */\r\n public get dispersion(): NodeMaterialConnectionPoint {\r\n return this._inputs[5];\r\n }\r\n\r\n /**\r\n * Gets the sub surface object output component\r\n */\r\n public get subsurface(): NodeMaterialConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n public override autoConfigure() {\r\n if (!this.thickness.isConnected) {\r\n const thicknessInput = new InputBlock(\"SubSurface thickness\", NodeMaterialBlockTargets.Fragment, NodeMaterialBlockConnectionPointTypes.Float);\r\n thicknessInput.value = 0;\r\n thicknessInput.output.connectTo(this.thickness);\r\n }\r\n }\r\n\r\n public override prepareDefines(mesh: AbstractMesh, nodeMaterial: NodeMaterial, defines: NodeMaterialDefines) {\r\n super.prepareDefines(mesh, nodeMaterial, defines);\r\n\r\n const translucencyEnabled = this.translucencyDiffusionDist.isConnected || this.translucencyIntensity.isConnected;\r\n\r\n defines.setValue(\"SUBSURFACE\", translucencyEnabled || this.refraction.isConnected, true);\r\n defines.setValue(\"SS_TRANSLUCENCY\", translucencyEnabled, true);\r\n defines.setValue(\"SS_THICKNESSANDMASK_TEXTURE\", false, true);\r\n defines.setValue(\"SS_REFRACTIONINTENSITY_TEXTURE\", false, true);\r\n defines.setValue(\"SS_TRANSLUCENCYINTENSITY_TEXTURE\", false, true);\r\n defines.setValue(\"SS_USE_GLTF_TEXTURES\", false, true);\r\n defines.setValue(\"SS_DISPERSION\", this.dispersion.isConnected, true);\r\n defines.setValue(\"SS_APPLY_ALBEDO_AFTER_SUBSURFACE\", this.applyAlbedoAfterSubSurface, true);\r\n }\r\n\r\n /**\r\n * Gets the main code of the block (fragment side)\r\n * @param state current state of the node material building\r\n * @param ssBlock instance of a SubSurfaceBlock or null if the code must be generated without an active sub surface module\r\n * @param reflectionBlock instance of a ReflectionBlock null if the code must be generated without an active reflection module\r\n * @param worldPosVarName name of the variable holding the world position\r\n * @returns the shader code\r\n */\r\n public static GetCode(state: NodeMaterialBuildState, ssBlock: Nullable<SubSurfaceBlock>, reflectionBlock: Nullable<ReflectionBlock>, worldPosVarName: string): string {\r\n let code = \"\";\r\n\r\n const thickness = ssBlock?.thickness.isConnected ? ssBlock.thickness.associatedVariableName : \"0.\";\r\n const tintColor = ssBlock?.tintColor.isConnected ? ssBlock.tintColor.associatedVariableName : \"vec3(1.)\";\r\n const translucencyIntensity = ssBlock?.translucencyIntensity.isConnected ? ssBlock?.translucencyIntensity.associatedVariableName : \"1.\";\r\n const translucencyDiffusionDistance = ssBlock?.translucencyDiffusionDist.isConnected ? ssBlock?.translucencyDiffusionDist.associatedVariableName : \"vec3(1.)\";\r\n\r\n const refractionBlock: Nullable<RefractionBlock> = (ssBlock?.refraction.isConnected ? ssBlock?.refraction.connectedPoint?.ownerBlock : null) as Nullable<RefractionBlock>;\r\n\r\n const refractionTintAtDistance = refractionBlock?.tintAtDistance.isConnected ? refractionBlock.tintAtDistance.associatedVariableName : \"1.\";\r\n const refractionIntensity = refractionBlock?.intensity.isConnected ? refractionBlock.intensity.associatedVariableName : \"1.\";\r\n const refractionView = refractionBlock?.view.isConnected ? refractionBlock.view.associatedVariableName : \"\";\r\n\r\n const dispersion = ssBlock?.dispersion.isConnected ? ssBlock?.dispersion.associatedVariableName : \"0.0\";\r\n const isWebGPU = state.shaderLanguage === ShaderLanguage.WGSL;\r\n\r\n code += refractionBlock?.getCode(state) ?? \"\";\r\n\r\n code += `${isWebGPU ? \"var subSurfaceOut: subSurfaceOutParams\" : \"subSurfaceOutParams subSurfaceOut\"};\r\n\r\n #ifdef SUBSURFACE\r\n ${state._declareLocalVar(\"vThicknessParam\", NodeMaterialBlockConnectionPointTypes.Vector2)} = vec2${state.fSuffix}(0., ${thickness});\r\n ${state._declareLocalVar(\"vTintColor\", NodeMaterialBlockConnectionPointTypes.Vector4)} = vec4${state.fSuffix}(${tintColor}, ${refractionTintAtDistance});\r\n ${state._declareLocalVar(\"vSubSurfaceIntensity\", NodeMaterialBlockConnectionPointTypes.Vector3)} = vec3(${refractionIntensity}, ${translucencyIntensity}, 0.);\r\n ${state._declareLocalVar(\"dispersion\", NodeMaterialBlockConnectionPointTypes.Float)} = ${dispersion};\r\n subSurfaceOut = subSurfaceBlock(\r\n vSubSurfaceIntensity\r\n , vThicknessParam\r\n , vTintColor\r\n , normalW\r\n , specularEnvironmentReflectance\r\n #ifdef SS_THICKNESSANDMASK_TEXTURE\r\n , vec4${state.fSuffix}(0.)\r\n #endif\r\n #ifdef REFLECTION\r\n #ifdef SS_TRANSLUCENCY\r\n , ${(isWebGPU ? \"uniforms.\" : \"\") + reflectionBlock?._reflectionMatrixName}\r\n #ifdef USESPHERICALFROMREFLECTIONMAP\r\n #if !defined(NORMAL) || !defined(USESPHERICALINVERTEX)\r\n , reflectionOut.irradianceVector\r\n #endif\r\n #if defined(REALTIME_FILTERING)\r\n , ${reflectionBlock?._cubeSamplerName}\r\n ${isWebGPU ? `, ${reflectionBlock?._cubeSamplerName}Sampler` : \"\"}\r\n , ${reflectionBlock?._vReflectionFilteringInfoName}\r\n #endif\r\n #endif\r\n #ifdef USEIRRADIANCEMAP\r\n , irradianceSampler\r\n ${isWebGPU ? `, irradianceSamplerSampler` : \"\"}\r\n #endif\r\n #endif\r\n #endif\r\n #if defined(SS_REFRACTION) || defined(SS_TRANSLUCENCY)\r\n , surfaceAlbedo\r\n #endif\r\n #ifdef SS_REFRACTION\r\n , ${worldPosVarName}.xyz\r\n , viewDirectionW\r\n , ${refractionView}\r\n , ${(isWebGPU ? \"uniforms.\" : \"\") + (refractionBlock?._vRefractionInfosName ?? \"\")}\r\n , ${(isWebGPU ? \"uniforms.\" : \"\") + (refractionBlock?._refractionMatrixName ?? \"\")}\r\n , ${(isWebGPU ? \"uniforms.\" : \"\") + (refractionBlock?._vRefractionMicrosurfaceInfosName ?? \"\")}\r\n , ${isWebGPU ? \"uniforms.\" : \"\"}vLightingIntensity\r\n #ifdef SS_LINKREFRACTIONTOTRANSPARENCY\r\n , alpha\r\n #endif\r\n #ifdef ${refractionBlock?._defineLODRefractionAlpha ?? \"IGNORE\"}\r\n , NdotVUnclamped\r\n #endif\r\n #ifdef ${refractionBlock?._defineLinearSpecularRefraction ?? \"IGNORE\"}\r\n , roughness\r\n #endif\r\n , alphaG\r\n #ifdef ${refractionBlock?._define3DName ?? \"IGNORE\"}\r\n , ${refractionBlock?._cubeSamplerName ?? \"\"}\r\n ${isWebGPU ? `, ${refractionBlock?._cubeSamplerName}Sampler` : \"\"}\r\n #else\r\n , ${refractionBlock?._2DSamplerName ?? \"\"}\r\n ${isWebGPU ? `, ${refractionBlock?._2DSamplerName}Sampler` : \"\"}\r\n #endif\r\n #ifndef LODBASEDMICROSFURACE\r\n #ifdef ${refractionBlock?._define3DName ?? \"IGNORE\"}\r\n , ${refractionBlock?._cubeSamplerName ?? \"\"} \r\n ${isWebGPU ? `, ${refractionBlock?._cubeSamplerName}Sampler` : \"\"}\r\n , ${refractionBlock?._cubeSamplerName ?? \"\"} \r\n ${isWebGPU ? `, ${refractionBlock?._cubeSamplerName}Sampler` : \"\"}\r\n #else\r\n , ${refractionBlock?._2DSamplerName ?? \"\"}\r\n ${isWebGPU ? `, ${refractionBlock?._2DSamplerName}Sampler` : \"\"}\r\n , ${refractionBlock?._2DSamplerName ?? \"\"}\r\n ${isWebGPU ? `, ${refractionBlock?._2DSamplerName}Sampler` : \"\"}\r\n #endif\r\n #endif\r\n #ifdef ANISOTROPIC\r\n , anisotropicOut\r\n #endif\r\n #ifdef REALTIME_FILTERING\r\n , ${refractionBlock?._vRefractionFilteringInfoName ?? \"\"}\r\n #endif\r\n #ifdef SS_USE_LOCAL_REFRACTIONMAP_CUBIC\r\n , vRefractionPosition\r\n , vRefractionSize\r\n #endif\r\n #ifdef SS_DISPERSION\r\n , dispersion\r\n #endif\r\n #endif\r\n #ifdef SS_TRANSLUCENCY\r\n , ${translucencyDiffusionDistance}\r\n , vTintColor\r\n #ifdef SS_TRANSLUCENCYCOLOR_TEXTURE\r\n , vec4${state.fSuffix}(0.)\r\n #endif\r\n #endif \r\n );\r\n\r\n #ifdef SS_REFRACTION\r\n surfaceAlbedo = subSurfaceOut.surfaceAlbedo;\r\n #ifdef SS_LINKREFRACTIONTOTRANSPARENCY\r\n alpha = subSurfaceOut.alpha;\r\n #endif\r\n #endif\r\n #else\r\n subSurfaceOut.specularEnvironmentReflectance = specularEnvironmentReflectance;\r\n #endif\\n`;\r\n\r\n return code;\r\n }\r\n\r\n protected override _buildBlock(state: NodeMaterialBuildState) {\r\n if (state.target === NodeMaterialBlockTargets.Fragment) {\r\n state.sharedData.blocksWithDefines.push(this);\r\n }\r\n\r\n return this;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.SubSurfaceBlock\", SubSurfaceBlock);\r\n"]}
|
|
@@ -32,5 +32,6 @@ export declare class ColorConverterBlock extends NodeMaterialBlock {
|
|
|
32
32
|
*/
|
|
33
33
|
get hslOut(): NodeMaterialConnectionPoint;
|
|
34
34
|
protected _inputRename(name: string): string;
|
|
35
|
+
protected _outputRename(name: string): string;
|
|
35
36
|
protected _buildBlock(state: NodeMaterialBuildState): this;
|
|
36
37
|
}
|
|
@@ -57,6 +57,15 @@ export class ColorConverterBlock extends NodeMaterialBlock {
|
|
|
57
57
|
}
|
|
58
58
|
return name;
|
|
59
59
|
}
|
|
60
|
+
_outputRename(name) {
|
|
61
|
+
if (name === "rgb") {
|
|
62
|
+
return "rgbOut";
|
|
63
|
+
}
|
|
64
|
+
if (name === "hsl") {
|
|
65
|
+
return "hslOut";
|
|
66
|
+
}
|
|
67
|
+
return name;
|
|
68
|
+
}
|
|
60
69
|
_buildBlock(state) {
|
|
61
70
|
super._buildBlock(state);
|
|
62
71
|
const rgbInput = this.rgbIn;
|