@babylonjs/core 7.54.0 → 7.54.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/AudioV2/abstractAudio/abstractAudioBus.d.ts +2 -3
  2. package/AudioV2/abstractAudio/abstractAudioBus.js.map +1 -1
  3. package/AudioV2/abstractAudio/abstractSound.d.ts +2 -3
  4. package/AudioV2/abstractAudio/abstractSound.js.map +1 -1
  5. package/AudioV2/abstractAudio/staticSound.d.ts +11 -14
  6. package/AudioV2/abstractAudio/staticSound.js +6 -8
  7. package/AudioV2/abstractAudio/staticSound.js.map +1 -1
  8. package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.d.ts +1 -1
  9. package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.js.map +1 -1
  10. package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.d.ts +2 -2
  11. package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.js +7 -7
  12. package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.js.map +1 -1
  13. package/AudioV2/webAudio/subNodes/stereoWebAudioSubNode.d.ts +2 -2
  14. package/AudioV2/webAudio/subNodes/stereoWebAudioSubNode.js +7 -7
  15. package/AudioV2/webAudio/subNodes/stereoWebAudioSubNode.js.map +1 -1
  16. package/AudioV2/webAudio/subNodes/volumeWebAudioSubNode.d.ts +2 -2
  17. package/AudioV2/webAudio/subNodes/volumeWebAudioSubNode.js +7 -7
  18. package/AudioV2/webAudio/subNodes/volumeWebAudioSubNode.js.map +1 -1
  19. package/AudioV2/webAudio/subNodes/webAudioAnalyzerSubNode.d.ts +1 -1
  20. package/AudioV2/webAudio/subNodes/webAudioAnalyzerSubNode.js +2 -2
  21. package/AudioV2/webAudio/subNodes/webAudioAnalyzerSubNode.js.map +1 -1
  22. package/AudioV2/webAudio/subNodes/webAudioBaseSubGraph.d.ts +3 -3
  23. package/AudioV2/webAudio/subNodes/webAudioBaseSubGraph.js +9 -9
  24. package/AudioV2/webAudio/subNodes/webAudioBaseSubGraph.js.map +1 -1
  25. package/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.d.ts +2 -2
  26. package/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.js +11 -11
  27. package/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.js.map +1 -1
  28. package/AudioV2/webAudio/subProperties/spatialWebAudioListener.js +1 -1
  29. package/AudioV2/webAudio/subProperties/spatialWebAudioListener.js.map +1 -1
  30. package/AudioV2/webAudio/webAudioBus.d.ts +6 -6
  31. package/AudioV2/webAudio/webAudioBus.js +27 -8
  32. package/AudioV2/webAudio/webAudioBus.js.map +1 -1
  33. package/AudioV2/webAudio/webAudioEngine.d.ts +9 -9
  34. package/AudioV2/webAudio/webAudioEngine.js +27 -27
  35. package/AudioV2/webAudio/webAudioEngine.js.map +1 -1
  36. package/AudioV2/webAudio/webAudioMainBus.d.ts +3 -5
  37. package/AudioV2/webAudio/webAudioMainBus.js +11 -12
  38. package/AudioV2/webAudio/webAudioMainBus.js.map +1 -1
  39. package/AudioV2/webAudio/webAudioMainOut.d.ts +1 -1
  40. package/AudioV2/webAudio/webAudioMainOut.js +2 -2
  41. package/AudioV2/webAudio/webAudioMainOut.js.map +1 -1
  42. package/AudioV2/webAudio/webAudioNode.d.ts +2 -2
  43. package/AudioV2/webAudio/webAudioNode.js.map +1 -1
  44. package/AudioV2/webAudio/webAudioStaticSound.d.ts +7 -7
  45. package/AudioV2/webAudio/webAudioStaticSound.js +29 -37
  46. package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -1
  47. package/AudioV2/webAudio/webAudioStreamingSound.d.ts +6 -6
  48. package/AudioV2/webAudio/webAudioStreamingSound.js +27 -27
  49. package/AudioV2/webAudio/webAudioStreamingSound.js.map +1 -1
  50. package/AudioV2/webAudio/webAudioUnmuteUI.js +3 -2
  51. package/AudioV2/webAudio/webAudioUnmuteUI.js.map +1 -1
  52. package/Cameras/arcRotateCamera.js +1 -1
  53. package/Cameras/arcRotateCamera.js.map +1 -1
  54. package/Debug/debugLayer.d.ts +1 -1
  55. package/Debug/debugLayer.js.map +1 -1
  56. package/Engines/abstractEngine.js +5 -11
  57. package/Engines/abstractEngine.js.map +1 -1
  58. package/Engines/constants.d.ts +5 -1
  59. package/Engines/constants.js +5 -1
  60. package/Engines/constants.js.map +1 -1
  61. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js +6 -0
  62. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js.map +1 -1
  63. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.js +1 -1
  64. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.js.map +1 -1
  65. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.d.ts +6 -6
  66. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js +31 -4
  67. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js.map +1 -1
  68. package/FlowGraph/flowGraphCoordinator.d.ts +21 -1
  69. package/FlowGraph/flowGraphCoordinator.js +51 -2
  70. package/FlowGraph/flowGraphCoordinator.js.map +1 -1
  71. package/FlowGraph/flowGraphParser.js +3 -0
  72. package/FlowGraph/flowGraphParser.js.map +1 -1
  73. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.d.ts +3 -0
  74. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js +13 -0
  75. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js.map +1 -1
  76. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js +16 -0
  77. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js.map +1 -1
  78. package/FrameGraph/Node/Blocks/Rendering/objectRendererBlock.d.ts +0 -3
  79. package/FrameGraph/Node/Blocks/Rendering/objectRendererBlock.js +8 -14
  80. package/FrameGraph/Node/Blocks/Rendering/objectRendererBlock.js.map +1 -1
  81. package/FrameGraph/Node/Blocks/Textures/clearBlock.d.ts +3 -0
  82. package/FrameGraph/Node/Blocks/Textures/clearBlock.js +13 -0
  83. package/FrameGraph/Node/Blocks/Textures/clearBlock.js.map +1 -1
  84. package/FrameGraph/Node/nodeRenderGraph.js +2 -1
  85. package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
  86. package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +4 -0
  87. package/FrameGraph/Tasks/Rendering/objectRendererTask.js +6 -0
  88. package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
  89. package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js +1 -0
  90. package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js.map +1 -1
  91. package/FrameGraph/Tasks/Texture/clearTextureTask.d.ts +4 -0
  92. package/FrameGraph/Tasks/Texture/clearTextureTask.js +11 -2
  93. package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -1
  94. package/FrameGraph/frameGraph.d.ts +18 -2
  95. package/FrameGraph/frameGraph.js +26 -1
  96. package/FrameGraph/frameGraph.js.map +1 -1
  97. package/Loading/Plugins/babylonFileLoader.js +4 -0
  98. package/Loading/Plugins/babylonFileLoader.js.map +1 -1
  99. package/Materials/GreasedLine/greasedLineSimpleMaterial.js +5 -4
  100. package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
  101. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js +4 -3
  102. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
  103. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js +26 -17
  104. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
  105. package/Materials/Node/Blocks/Fragment/shadowMapBlock.js +8 -0
  106. package/Materials/Node/Blocks/Fragment/shadowMapBlock.js.map +1 -1
  107. package/Materials/Node/Blocks/Input/inputBlock.js +1 -1
  108. package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
  109. package/Materials/Node/Blocks/PBR/clearCoatBlock.d.ts +2 -0
  110. package/Materials/Node/Blocks/PBR/clearCoatBlock.js +14 -7
  111. package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
  112. package/Materials/Node/Blocks/PBR/index.d.ts +1 -0
  113. package/Materials/Node/Blocks/PBR/index.js +1 -0
  114. package/Materials/Node/Blocks/PBR/index.js.map +1 -1
  115. package/Materials/Node/Blocks/PBR/iridescenceBlock.js +2 -1
  116. package/Materials/Node/Blocks/PBR/iridescenceBlock.js.map +1 -1
  117. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +3 -1
  118. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  119. package/Materials/Node/nodeMaterial.d.ts +2 -0
  120. package/Materials/Node/nodeMaterial.js +6 -1
  121. package/Materials/Node/nodeMaterial.js.map +1 -1
  122. package/Materials/Node/nodeMaterialBlock.js +11 -2
  123. package/Materials/Node/nodeMaterialBlock.js.map +1 -1
  124. package/Materials/Node/nodeMaterialBuildState.js +41 -13
  125. package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
  126. package/Materials/Node/nodeMaterialBuildStateSharedData.d.ts +11 -1
  127. package/Materials/Node/nodeMaterialBuildStateSharedData.js +11 -1
  128. package/Materials/Node/nodeMaterialBuildStateSharedData.js.map +1 -1
  129. package/Materials/PBR/pbrBaseMaterial.js +1 -1
  130. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  131. package/Materials/Textures/renderTargetTexture.d.ts +5 -0
  132. package/Materials/Textures/renderTargetTexture.js +9 -0
  133. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  134. package/Materials/effect.js +1 -1
  135. package/Materials/material.d.ts +5 -1
  136. package/Materials/material.js +9 -2
  137. package/Materials/material.js.map +1 -1
  138. package/Materials/materialPluginBase.js +1 -1
  139. package/Maths/math.vector.d.ts +7 -0
  140. package/Maths/math.vector.js +17 -0
  141. package/Maths/math.vector.js.map +1 -1
  142. package/Misc/sceneSerializer.js +2 -0
  143. package/Misc/sceneSerializer.js.map +1 -1
  144. package/Rendering/depthPeelingSceneComponent.js +1 -1
  145. package/Rendering/objectRenderer.d.ts +7 -0
  146. package/Rendering/objectRenderer.js +19 -0
  147. package/Rendering/objectRenderer.js.map +1 -1
  148. package/Shaders/ShadersInclude/pbrBlockIridescence.js +1 -0
  149. package/Shaders/ShadersInclude/pbrBlockIridescence.js.map +1 -1
  150. package/Shaders/ShadersInclude/pbrBlockReflection.js +1 -1
  151. package/Shaders/ShadersInclude/pbrBlockReflection.js.map +1 -1
  152. package/Shaders/imageProcessing.fragment.js +1 -1
  153. package/Shaders/imageProcessing.fragment.js.map +1 -1
  154. package/Shaders/motionBlur.fragment.js +1 -1
  155. package/Shaders/motionBlur.fragment.js.map +1 -1
  156. package/Shaders/pbr.fragment.js +1 -0
  157. package/Shaders/pbr.fragment.js.map +1 -1
  158. package/Shaders/screenSpaceReflection2.fragment.js +1 -1
  159. package/Shaders/screenSpaceReflection2.fragment.js.map +1 -1
  160. package/ShadersWGSL/ShadersInclude/pbrBlockIridescence.js +3 -2
  161. package/ShadersWGSL/ShadersInclude/pbrBlockIridescence.js.map +1 -1
  162. package/ShadersWGSL/imageProcessing.fragment.js +1 -1
  163. package/ShadersWGSL/imageProcessing.fragment.js.map +1 -1
  164. package/ShadersWGSL/motionBlur.fragment.js +1 -1
  165. package/ShadersWGSL/motionBlur.fragment.js.map +1 -1
  166. package/ShadersWGSL/pbr.fragment.js +1 -0
  167. package/ShadersWGSL/pbr.fragment.js.map +1 -1
  168. package/ShadersWGSL/screenSpaceReflection2.fragment.js +1 -1
  169. package/ShadersWGSL/screenSpaceReflection2.fragment.js.map +1 -1
  170. package/Sprites/spriteManager.js +1 -1
  171. package/Sprites/spriteManager.js.map +1 -1
  172. package/package.json +1 -1
  173. package/scene.d.ts +19 -2
  174. package/scene.js +27 -3
  175. package/scene.js.map +1 -1
@@ -1,5 +1,6 @@
1
1
  import { Observable } from "../Misc/observable.js";
2
2
  import { FlowGraph } from "./flowGraph.js";
3
+ import { Logger } from "../Misc/logger.js";
3
4
  /**
4
5
  * This class holds all of the existing flow graphs and is responsible for creating new ones.
5
6
  * It also handles starting/stopping multiple graphs and communication between them through an Event Coordinator
@@ -13,12 +14,30 @@ export class FlowGraphCoordinator {
13
14
  */
14
15
  config) {
15
16
  this.config = config;
17
+ /**
18
+ * When set to true (default) custom events will be dispatched synchronously.
19
+ * This means that the events will be dispatched immediately when they are triggered.
20
+ */
21
+ this.dispatchEventsSynchronously = true;
16
22
  this._flowGraphs = [];
17
23
  this._customEventsMap = new Map();
24
+ this._eventExecutionCounter = new Map();
25
+ this._executeOnNextFrame = [];
18
26
  // When the scene is disposed, dispose all graphs currently running on it.
19
- this.config.scene.onDisposeObservable.add(() => {
27
+ this._disposeObserver = this.config.scene.onDisposeObservable.add(() => {
20
28
  this.dispose();
21
29
  });
30
+ this._onBeforeRenderObserver = this.config.scene.onBeforeRenderObservable.add(() => {
31
+ // Reset the event execution counter at the beginning of each frame.
32
+ this._eventExecutionCounter.clear();
33
+ if (this._executeOnNextFrame.length) {
34
+ // Execute the events that were triggered on the next frame.
35
+ this._executeOnNextFrame.forEach((event) => {
36
+ this.notifyCustomEvent(event.id, event.data, false);
37
+ });
38
+ this._executeOnNextFrame.length = 0;
39
+ }
40
+ });
22
41
  // Add itself to the SceneCoordinators list for the Inspector.
23
42
  const coordinators = FlowGraphCoordinator.SceneCoordinators.get(this.config.scene) ?? [];
24
43
  coordinators.push(this);
@@ -55,6 +74,8 @@ export class FlowGraphCoordinator {
55
74
  dispose() {
56
75
  this._flowGraphs.forEach((graph) => graph.dispose());
57
76
  this._flowGraphs.length = 0;
77
+ this._disposeObserver?.remove();
78
+ this._onBeforeRenderObserver?.remove();
58
79
  // Remove itself from the SceneCoordinators list for the Inspector.
59
80
  const coordinators = FlowGraphCoordinator.SceneCoordinators.get(this.config.scene) ?? [];
60
81
  const index = coordinators.indexOf(this);
@@ -74,6 +95,7 @@ export class FlowGraphCoordinator {
74
95
  graph.serialize(serializedGraph, valueSerializeFunction);
75
96
  serializationObject._flowGraphs.push(serializedGraph);
76
97
  });
98
+ serializationObject.dispatchEventsSynchronously = this.dispatchEventsSynchronously;
77
99
  }
78
100
  /**
79
101
  * Gets the list of flow graphs
@@ -99,14 +121,41 @@ export class FlowGraphCoordinator {
99
121
  * Notifies the observable for the given event id with the given data.
100
122
  * @param id the id of the event
101
123
  * @param data the data to send with the event
124
+ * @param async if true, the event will be dispatched asynchronously
102
125
  */
103
- notifyCustomEvent(id, data) {
126
+ notifyCustomEvent(id, data, async = !this.dispatchEventsSynchronously) {
127
+ if (async) {
128
+ this._executeOnNextFrame.push({ id, data });
129
+ return;
130
+ }
131
+ // check if we are not exceeding the max number of events
132
+ if (this._eventExecutionCounter.has(id)) {
133
+ const count = this._eventExecutionCounter.get(id);
134
+ this._eventExecutionCounter.set(id, count + 1);
135
+ if (count >= FlowGraphCoordinator.MaxEventTypeExecutionPerFrame) {
136
+ count === FlowGraphCoordinator.MaxEventTypeExecutionPerFrame && Logger.Warn(`FlowGraphCoordinator: Too many executions of event "${id}".`);
137
+ return;
138
+ }
139
+ }
140
+ else {
141
+ this._eventExecutionCounter.set(id, 1);
142
+ }
104
143
  const observable = this._customEventsMap.get(id);
105
144
  if (observable) {
106
145
  observable.notifyObservers(data);
107
146
  }
108
147
  }
109
148
  }
149
+ /**
150
+ * The maximum number of events per type.
151
+ * This is used to limit the number of events that can be created in a single scene.
152
+ * This is to prevent infinite loops.
153
+ */
154
+ FlowGraphCoordinator.MaxEventsPerType = 30;
155
+ /**
156
+ * The maximum number of execution of a specific event in a single frame.
157
+ */
158
+ FlowGraphCoordinator.MaxEventTypeExecutionPerFrame = 30;
110
159
  /**
111
160
  * @internal
112
161
  * A list of all the coordinators per scene. Will be used by the inspector
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphCoordinator.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphCoordinator.ts"],"names":[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G,UAAU,GAAG,IAAI,UAAU,EAAM,mBAAmB,CAAC,CAAC;YACtD,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;QAC9C,CAAC;QACD,OAAO,UAAU,CAAC;IACtB,CAAC;IAED;;;;OAIG;IACI,iBAAiB,CAAC,EAAU,EAAE,IAAS;QAC1C,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;;AApHD;;;GAGG;AACoB,sCAAiB,GAAuC,IAAI,GAAG,EAAE,AAAhD,CAAiD","sourcesContent":["import { 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\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 * @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 private readonly _flowGraphs: FlowGraph[] = [];\r\n\r\n private _customEventsMap: Map<string, Observable<any>> = new Map();\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.config.scene.onDisposeObservable.add(() => {\r\n this.dispose();\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\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 }\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 */\r\n public notifyCustomEvent(id: string, data: any) {\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;IAkC7B;IACI;;OAEG;IACI,MAA0C;QAA1C,WAAM,GAAN,MAAM,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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;;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"]}
@@ -47,6 +47,9 @@ export function GetSignalInConnectionByUniqueId(blocks, uniqueId) {
47
47
  export async function ParseCoordinatorAsync(serializedObject, options) {
48
48
  const valueParseFunction = options.valueParseFunction ?? defaultValueParseFunction;
49
49
  const coordinator = new FlowGraphCoordinator({ scene: options.scene });
50
+ if (serializedObject.dispatchEventsSynchronously) {
51
+ coordinator.dispatchEventsSynchronously = serializedObject.dispatchEventsSynchronously;
52
+ }
50
53
  await options.scene.whenReadyAsync();
51
54
  // if custom default values are defined, set them in the global context
52
55
  if (serializedObject._defaultValues) {
@@ -1 +1 @@
1
- {"version":3,"file":"flowGraphParser.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphParser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAM9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAGhF,OAAO,EAAE,0BAA0B,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAG5E;;;;;GAKG;AACH,MAAM,UAAU,8BAA8B,CAAC,MAAwB,EAAE,QAAgB;IACrF,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QACzB,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC;YACtC,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;gBAChC,OAAO,OAAO,CAAC;YACnB,CAAC;QACL,CAAC;IACL,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,oDAAoD,GAAG,QAAQ,CAAC,CAAC;AACrF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,+BAA+B,CAAC,MAAwB,EAAE,QAAgB;IACtF,KAAK,MAAM,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AC;IACL,CAAC;IACD,GAAG,CAAC,QAAQ,GAAG,mBAAmB,CAAC,QAAQ,CAAC;IAC5C,GAAG,CAAC,WAAW,IAAI,GAAG,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;IACxD,OAAO,GAAG,CAAC;AACf,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iCAAiC,CAAgC,sBAA2B,EAAE,EAAE,UAAkB,EAAE,SAAqC;IACrK,MAAM,UAAU,GAAG,IAAI,SAAS,CAAC,mBAAmB,CAAC,IAAI,EAAE,mBAAmB,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;IAC5G,UAAU,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;IAC5C,OAAO,UAAU,CAAC;AACtB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB,CAAC,mBAAwB,EAAE,UAA0B,EAAE,SAAyC;IACpI,MAAM,QAAQ,GAAG,aAAa,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IAC7D,MAAM,YAAY,GAAG,mBAAmB,CAAC,YAAY,CAAC;IACtD,MAAM,UAAU,GAAG,IAAI,SAAS,CAAC,mBAAmB,CAAC,IAAI,EAAE,mBAAmB,CAAC,eAAe,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;IACrK,UAAU,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;IAC5C,OAAO,UAAU,CAAC;AACtB,CAAC;AAED;;;;GAIG;AACH,SAAS,aAAa,CAAC,mBAAwB;IAC3C,OAAO,IAAI,QAAQ,CAAC,mBAAmB,CAAC,QAAQ,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC;AACxF,CAAC","sourcesContent":["import type { IAssetContainer } from \"core/IAssetContainer\";\nimport { blockFactory } from \"./Blocks/flowGraphBlockFactory\";\nimport type { FlowGraphBlockNames } from \"./Blocks/flowGraphBlockNames\";\nimport type { FlowGraph, IFlowGraphParseOptions } from \"./flowGraph\";\nimport type { FlowGraphBlock, IFlowGraphBlockParseOptions } from \"./flowGraphBlock\";\nimport type { FlowGraphContext, IFlowGraphContextParseOptions } from \"./flowGraphContext\";\nimport type { FlowGraphCoordinatorParseOptions } from \"./flowGraphCoordinator\";\nimport { FlowGraphCoordinator } from \"./flowGraphCoordinator\";\nimport type { FlowGraphDataConnection } from \"./flowGraphDataConnection\";\nimport { FlowGraphEventBlock } from \"./flowGraphEventBlock\";\nimport { FlowGraphExecutionBlock } from \"./flowGraphExecutionBlock\";\nimport type { FlowGraphSignalConnection } from \"./flowGraphSignalConnection\";\nimport { defaultValueParseFunction, needsPathConverter } from \"./serialization\";\nimport type { ISerializedFlowGraph, ISerializedFlowGraphBlock, ISerializedFlowGraphContext } from \"./typeDefinitions\";\nimport type { Node } from \"core/node\";\nimport { getRichTypeByFlowGraphType, RichType } from \"./flowGraphRichTypes\";\nimport type { FlowGraphConnection } from \"./flowGraphConnection\";\n\n/**\n * Given a list of blocks, find an output data connection that has a specific unique id\n * @param blocks a list of flow graph blocks\n * @param uniqueId the unique id of a connection\n * @returns the connection that has this unique id. throws an error if none was found\n */\nexport function GetDataOutConnectionByUniqueId(blocks: FlowGraphBlock[], uniqueId: string): FlowGraphDataConnection<any> {\n for (const block of blocks) {\n for (const dataOut of block.dataOutputs) {\n if (dataOut.uniqueId === uniqueId) {\n return dataOut;\n }\n }\n }\n throw new Error(\"Could not find data out connection with unique id \" + uniqueId);\n}\n\n/**\n * Given a list of blocks, find an input signal connection that has a specific unique id\n * @param blocks a list of flow graph blocks\n * @param uniqueId the unique id of a connection\n * @returns the connection that has this unique id. throws an error if none was found\n */\nexport function GetSignalInConnectionByUniqueId(blocks: FlowGraphBlock[], uniqueId: string): FlowGraphSignalConnection {\n for (const block of blocks) {\n if (block instanceof FlowGraphExecutionBlock) {\n for (const signalIn of block.signalInputs) {\n if (signalIn.uniqueId === uniqueId) {\n return signalIn;\n }\n }\n }\n }\n throw new Error(\"Could not find signal in connection with unique id \" + uniqueId);\n}\n\n/**\n * Parses a serialized coordinator.\n * @param serializedObject the object to parse\n * @param options the options to use when parsing\n * @returns the parsed coordinator\n */\nexport async function ParseCoordinatorAsync(serializedObject: any, options: FlowGraphCoordinatorParseOptions) {\n const valueParseFunction = options.valueParseFunction ?? defaultValueParseFunction;\n const coordinator = new FlowGraphCoordinator({ scene: options.scene });\n\n await options.scene.whenReadyAsync();\n // if custom default values are defined, set them in the global context\n if (serializedObject._defaultValues) {\n for (const key in serializedObject._defaultValues) {\n // key is the FlowGraphType, value is the default value\n const value = serializedObject._defaultValues[key];\n getRichTypeByFlowGraphType(key).defaultValue = value;\n }\n }\n // async-parse the flow graphs. This can be done in parallel\n await Promise.all(\n serializedObject._flowGraphs?.map((serializedGraph: any) => ParseFlowGraphAsync(serializedGraph, { coordinator, valueParseFunction, pathConverter: options.pathConverter }))\n );\n return coordinator;\n}\n\n/**\n * Parses a graph from a given serialization object\n * @param serializationObject the object where the values are written\n * @param options options for parsing the graph\n * @returns the parsed graph\n */\nexport async function ParseFlowGraphAsync(serializationObject: ISerializedFlowGraph, options: IFlowGraphParseOptions): Promise<FlowGraph> {\n // get all classes types needed for the blocks using the block factory\n const resolvedClasses = await Promise.all(\n serializationObject.allBlocks.map(async (serializedBlock) => {\n const classFactory = blockFactory(serializedBlock.className as FlowGraphBlockNames);\n return classFactory();\n })\n );\n // async will be used when we start using the block async factory\n return ParseFlowGraph(serializationObject, options, resolvedClasses);\n}\n\n/**\n * Parses a graph from a given serialization object\n * @param serializationObject the object where the values are written\n * @param options options for parsing the graph\n * @param resolvedClasses the resolved classes for the blocks\n * @returns the parsed graph\n */\nexport function ParseFlowGraph(serializationObject: ISerializedFlowGraph, options: IFlowGraphParseOptions, resolvedClasses: (typeof FlowGraphBlock)[]) {\n const graph = options.coordinator.createGraph();\n const blocks: FlowGraphBlock[] = [];\n const valueParseFunction = options.valueParseFunction ?? defaultValueParseFunction;\n // Parse all blocks\n // for (const serializedBlock of serializationObject.allBlocks) {\n for (let i = 0; i < serializationObject.allBlocks.length; i++) {\n const serializedBlock = serializationObject.allBlocks[i];\n const block = ParseFlowGraphBlockWithClassType(\n serializedBlock,\n { scene: options.coordinator.config.scene, pathConverter: options.pathConverter, assetsContainer: options.coordinator.config.scene, valueParseFunction },\n resolvedClasses[i]\n );\n blocks.push(block);\n if (block instanceof FlowGraphEventBlock) {\n graph.addEventBlock(block);\n }\n }\n // After parsing all blocks, connect them\n for (const block of blocks) {\n for (const dataIn of block.dataInputs) {\n for (const serializedConnection of dataIn.connectedPointIds) {\n const connection = GetDataOutConnectionByUniqueId(blocks, serializedConnection);\n dataIn.connectTo(connection);\n }\n }\n if (block instanceof FlowGraphExecutionBlock) {\n for (const signalOut of block.signalOutputs) {\n for (const serializedConnection of signalOut.connectedPointIds) {\n const connection = GetSignalInConnectionByUniqueId(blocks, serializedConnection);\n signalOut.connectTo(connection);\n }\n }\n }\n }\n for (const serializedContext of serializationObject.executionContexts) {\n ParseFlowGraphContext(serializedContext, { graph, valueParseFunction }, serializationObject.rightHanded);\n }\n return graph;\n}\n\n/**\n * Parses a context\n * @param serializationObject the object containing the context serialization values\n * @param options the options for parsing the context\n * @param rightHanded whether the serialized data is right handed\n * @returns\n */\nexport function ParseFlowGraphContext(serializationObject: ISerializedFlowGraphContext, options: IFlowGraphContextParseOptions, rightHanded?: boolean): FlowGraphContext {\n const result = options.graph.createContext();\n if (serializationObject.enableLogging) {\n result.enableLogging = true;\n }\n result.treatDataAsRightHanded = rightHanded || false;\n const valueParseFunction = options.valueParseFunction ?? defaultValueParseFunction;\n result.uniqueId = serializationObject.uniqueId;\n const scene = result.getScene();\n // check if assets context is available\n if (serializationObject._assetsContext) {\n const ac = serializationObject._assetsContext;\n const assetsContext: IAssetContainer = {\n meshes: ac.meshes?.map((m: string) => scene.getMeshById(m)),\n lights: ac.lights?.map((l: string) => scene.getLightByName(l)),\n cameras: ac.cameras?.map((c: string) => scene.getCameraByName(c)),\n materials: ac.materials?.map((m: string) => scene.getMaterialById(m)),\n textures: ac.textures?.map((t: string) => scene.getTextureByName(t)),\n animations: ac.animations?.map((a: string) => scene.animations.find((anim) => anim.name === a)),\n skeletons: ac.skeletons?.map((s: string) => scene.getSkeletonByName(s)),\n particleSystems: ac.particleSystems?.map((ps: string) => scene.getParticleSystemById(ps)),\n animationGroups: ac.animationGroups?.map((ag: string) => scene.getAnimationGroupByName(ag)),\n transformNodes: ac.transformNodes?.map((tn: string) => scene.getTransformNodeById(tn)),\n rootNodes: [],\n multiMaterials: [],\n morphTargetManagers: [],\n geometries: [],\n actionManagers: [],\n environmentTexture: null,\n postProcesses: [],\n sounds: null,\n effectLayers: [],\n layers: [],\n reflectionProbes: [],\n lensFlareSystems: [],\n proceduralTextures: [],\n getNodes: function (): Array<Node> {\n throw new Error(\"Function not implemented.\");\n },\n };\n result.assetsContext = assetsContext;\n }\n for (const key in serializationObject._userVariables) {\n const value = valueParseFunction(key, serializationObject._userVariables, result.assetsContext, scene);\n result.userVariables[key] = value;\n }\n for (const key in serializationObject._connectionValues) {\n const value = valueParseFunction(key, serializationObject._connectionValues, result.assetsContext, scene);\n result._setConnectionValueByKey(key, value);\n }\n\n return result;\n}\n\n/**\n * Parses a block from a serialization object\n * This function is async due to the factory method that is used to create the block's class. If you load the class externally use ParseBlockWithClassType\n * @param serializationObject the object to parse from\n * @param parseOptions options for parsing the block\n * @returns the parsed block\n */\nexport async function ParseBlockAsync(serializationObject: ISerializedFlowGraphBlock, parseOptions: IFlowGraphBlockParseOptions): Promise<FlowGraphBlock> {\n const classFactory = blockFactory(serializationObject.className as FlowGraphBlockNames);\n const classType = await classFactory();\n return ParseFlowGraphBlockWithClassType(serializationObject, parseOptions, classType);\n}\n\n/**\n * Parses a block from a serialization object\n * @param serializationObject the object to parse from\n * @param parseOptions options for parsing the block\n * @param classType the class type of the block. This is used when the class is not loaded asynchronously\n * @returns the parsed block\n */\nexport function ParseFlowGraphBlockWithClassType(\n serializationObject: ISerializedFlowGraphBlock,\n parseOptions: IFlowGraphBlockParseOptions,\n classType: typeof FlowGraphBlock\n): FlowGraphBlock {\n const parsedConfig: any = {};\n const valueParseFunction = parseOptions.valueParseFunction ?? defaultValueParseFunction;\n if (serializationObject.config) {\n for (const key in serializationObject.config) {\n parsedConfig[key] = valueParseFunction(key, serializationObject.config, parseOptions.assetsContainer || parseOptions.scene, parseOptions.scene);\n }\n }\n if (needsPathConverter(serializationObject.className)) {\n if (!parseOptions.pathConverter) {\n throw new Error(\"Path converter is required for this block\");\n }\n parsedConfig.pathConverter = parseOptions.pathConverter;\n }\n const obj = new classType(parsedConfig);\n obj.uniqueId = serializationObject.uniqueId;\n for (let i = 0; i < serializationObject.dataInputs.length; i++) {\n const dataInput = obj.getDataInput(serializationObject.dataInputs[i].name);\n if (dataInput) {\n dataInput.deserialize(serializationObject.dataInputs[i]);\n } else {\n throw new Error(\"Could not find data input with name \" + serializationObject.dataInputs[i].name + \" in block \" + serializationObject.className);\n }\n }\n for (let i = 0; i < serializationObject.dataOutputs.length; i++) {\n const dataOutput = obj.getDataOutput(serializationObject.dataOutputs[i].name);\n if (dataOutput) {\n dataOutput.deserialize(serializationObject.dataOutputs[i]);\n } else {\n throw new Error(\"Could not find data output with name \" + serializationObject.dataOutputs[i].name + \" in block \" + serializationObject.className);\n }\n }\n obj.metadata = serializationObject.metadata;\n obj.deserialize && obj.deserialize(serializationObject);\n return obj;\n}\n\n/**\n * Parses a connection from an object\n * @param serializationObject the object to parse from.\n * @param ownerBlock the block that owns the connection.\n * @param classType the class type of the connection.\n * @returns the parsed connection.\n */\nexport function ParseGraphConnectionWithClassType<BlockT extends FlowGraphBlock>(serializationObject: any = {}, ownerBlock: BlockT, classType: typeof FlowGraphConnection) {\n const connection = new classType(serializationObject.name, serializationObject._connectionType, ownerBlock);\n connection.deserialize(serializationObject);\n return connection;\n}\n\n/**\n * Parses a data connection from a serialized object.\n * @param serializationObject the object to parse from\n * @param ownerBlock the block that owns the connection\n * @param classType the class type of the data connection\n * @returns the parsed connection\n */\nexport function ParseGraphDataConnection(serializationObject: any, ownerBlock: FlowGraphBlock, classType: typeof FlowGraphDataConnection): FlowGraphDataConnection<any> {\n const richType = ParseRichType(serializationObject.richType);\n const defaultValue = serializationObject.defaultValue;\n const connection = new classType(serializationObject.name, serializationObject._connectionType, ownerBlock, richType, defaultValue, !!serializationObject._optional);\n connection.deserialize(serializationObject);\n return connection;\n}\n\n/**\n * Parses a rich type from a serialization object.\n * @param serializationObject a serialization object\n * @returns the parsed rich type\n */\nfunction ParseRichType(serializationObject: any): RichType<any> {\n return new RichType(serializationObject.typeName, serializationObject.defaultValue);\n}\n"]}
1
+ {"version":3,"file":"flowGraphParser.js","sourceRoot":"","sources":["../../../../dev/core/src/FlowGraph/flowGraphParser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAM9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAGhF,OAAO,EAAE,0BAA0B,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAG5E;;;;;GAKG;AACH,MAAM,UAAU,8BAA8B,CAAC,MAAwB,EAAE,QAAgB;IACrF,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QACzB,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC;YACtC,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;gBAChC,OAAO,OAAO,CAAC;YACnB,CAAC;QACL,CAAC;IACL,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,oDAAoD,GAAG,QAAQ,CAAC,CAAC;AACrF,CAAC;AAED;;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,CAAC,QAAQ,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC;AACxF,CAAC","sourcesContent":["import type { IAssetContainer } from \"core/IAssetContainer\";\nimport { blockFactory } from \"./Blocks/flowGraphBlockFactory\";\nimport type { FlowGraphBlockNames } from \"./Blocks/flowGraphBlockNames\";\nimport type { FlowGraph, IFlowGraphParseOptions } from \"./flowGraph\";\nimport type { FlowGraphBlock, IFlowGraphBlockParseOptions } from \"./flowGraphBlock\";\nimport type { FlowGraphContext, IFlowGraphContextParseOptions } from \"./flowGraphContext\";\nimport type { FlowGraphCoordinatorParseOptions } from \"./flowGraphCoordinator\";\nimport { FlowGraphCoordinator } from \"./flowGraphCoordinator\";\nimport type { FlowGraphDataConnection } from \"./flowGraphDataConnection\";\nimport { FlowGraphEventBlock } from \"./flowGraphEventBlock\";\nimport { FlowGraphExecutionBlock } from \"./flowGraphExecutionBlock\";\nimport type { FlowGraphSignalConnection } from \"./flowGraphSignalConnection\";\nimport { defaultValueParseFunction, needsPathConverter } from \"./serialization\";\nimport type { ISerializedFlowGraph, ISerializedFlowGraphBlock, ISerializedFlowGraphContext } from \"./typeDefinitions\";\nimport type { Node } from \"core/node\";\nimport { getRichTypeByFlowGraphType, RichType } from \"./flowGraphRichTypes\";\nimport type { FlowGraphConnection } from \"./flowGraphConnection\";\n\n/**\n * Given a list of blocks, find an output data connection that has a specific unique id\n * @param blocks a list of flow graph blocks\n * @param uniqueId the unique id of a connection\n * @returns the connection that has this unique id. throws an error if none was found\n */\nexport function GetDataOutConnectionByUniqueId(blocks: FlowGraphBlock[], uniqueId: string): FlowGraphDataConnection<any> {\n for (const block of blocks) {\n for (const dataOut of block.dataOutputs) {\n if (dataOut.uniqueId === uniqueId) {\n return dataOut;\n }\n }\n }\n throw new Error(\"Could not find data out connection with unique id \" + uniqueId);\n}\n\n/**\n * Given a list of blocks, find an input signal connection that has a specific unique id\n * @param blocks a list of flow graph blocks\n * @param uniqueId the unique id of a connection\n * @returns the connection that has this unique id. throws an error if none was found\n */\nexport function GetSignalInConnectionByUniqueId(blocks: FlowGraphBlock[], uniqueId: string): FlowGraphSignalConnection {\n for (const block of blocks) {\n if (block instanceof FlowGraphExecutionBlock) {\n for (const signalIn of block.signalInputs) {\n if (signalIn.uniqueId === uniqueId) {\n return signalIn;\n }\n }\n }\n }\n throw new Error(\"Could not find signal in connection with unique id \" + uniqueId);\n}\n\n/**\n * Parses a serialized coordinator.\n * @param serializedObject the object to parse\n * @param options the options to use when parsing\n * @returns the parsed coordinator\n */\nexport async function ParseCoordinatorAsync(serializedObject: any, options: FlowGraphCoordinatorParseOptions) {\n const valueParseFunction = options.valueParseFunction ?? defaultValueParseFunction;\n const coordinator = new FlowGraphCoordinator({ scene: options.scene });\n\n if (serializedObject.dispatchEventsSynchronously) {\n coordinator.dispatchEventsSynchronously = serializedObject.dispatchEventsSynchronously;\n }\n\n await options.scene.whenReadyAsync();\n // if custom default values are defined, set them in the global context\n if (serializedObject._defaultValues) {\n for (const key in serializedObject._defaultValues) {\n // key is the FlowGraphType, value is the default value\n const value = serializedObject._defaultValues[key];\n getRichTypeByFlowGraphType(key).defaultValue = value;\n }\n }\n // async-parse the flow graphs. This can be done in parallel\n await Promise.all(\n serializedObject._flowGraphs?.map((serializedGraph: any) => ParseFlowGraphAsync(serializedGraph, { coordinator, valueParseFunction, pathConverter: options.pathConverter }))\n );\n return coordinator;\n}\n\n/**\n * Parses a graph from a given serialization object\n * @param serializationObject the object where the values are written\n * @param options options for parsing the graph\n * @returns the parsed graph\n */\nexport async function ParseFlowGraphAsync(serializationObject: ISerializedFlowGraph, options: IFlowGraphParseOptions): Promise<FlowGraph> {\n // get all classes types needed for the blocks using the block factory\n const resolvedClasses = await Promise.all(\n serializationObject.allBlocks.map(async (serializedBlock) => {\n const classFactory = blockFactory(serializedBlock.className as FlowGraphBlockNames);\n return classFactory();\n })\n );\n // async will be used when we start using the block async factory\n return ParseFlowGraph(serializationObject, options, resolvedClasses);\n}\n\n/**\n * Parses a graph from a given serialization object\n * @param serializationObject the object where the values are written\n * @param options options for parsing the graph\n * @param resolvedClasses the resolved classes for the blocks\n * @returns the parsed graph\n */\nexport function ParseFlowGraph(serializationObject: ISerializedFlowGraph, options: IFlowGraphParseOptions, resolvedClasses: (typeof FlowGraphBlock)[]) {\n const graph = options.coordinator.createGraph();\n const blocks: FlowGraphBlock[] = [];\n const valueParseFunction = options.valueParseFunction ?? defaultValueParseFunction;\n // Parse all blocks\n // for (const serializedBlock of serializationObject.allBlocks) {\n for (let i = 0; i < serializationObject.allBlocks.length; i++) {\n const serializedBlock = serializationObject.allBlocks[i];\n const block = ParseFlowGraphBlockWithClassType(\n serializedBlock,\n { scene: options.coordinator.config.scene, pathConverter: options.pathConverter, assetsContainer: options.coordinator.config.scene, valueParseFunction },\n resolvedClasses[i]\n );\n blocks.push(block);\n if (block instanceof FlowGraphEventBlock) {\n graph.addEventBlock(block);\n }\n }\n // After parsing all blocks, connect them\n for (const block of blocks) {\n for (const dataIn of block.dataInputs) {\n for (const serializedConnection of dataIn.connectedPointIds) {\n const connection = GetDataOutConnectionByUniqueId(blocks, serializedConnection);\n dataIn.connectTo(connection);\n }\n }\n if (block instanceof FlowGraphExecutionBlock) {\n for (const signalOut of block.signalOutputs) {\n for (const serializedConnection of signalOut.connectedPointIds) {\n const connection = GetSignalInConnectionByUniqueId(blocks, serializedConnection);\n signalOut.connectTo(connection);\n }\n }\n }\n }\n for (const serializedContext of serializationObject.executionContexts) {\n ParseFlowGraphContext(serializedContext, { graph, valueParseFunction }, serializationObject.rightHanded);\n }\n return graph;\n}\n\n/**\n * Parses a context\n * @param serializationObject the object containing the context serialization values\n * @param options the options for parsing the context\n * @param rightHanded whether the serialized data is right handed\n * @returns\n */\nexport function ParseFlowGraphContext(serializationObject: ISerializedFlowGraphContext, options: IFlowGraphContextParseOptions, rightHanded?: boolean): FlowGraphContext {\n const result = options.graph.createContext();\n if (serializationObject.enableLogging) {\n result.enableLogging = true;\n }\n result.treatDataAsRightHanded = rightHanded || false;\n const valueParseFunction = options.valueParseFunction ?? defaultValueParseFunction;\n result.uniqueId = serializationObject.uniqueId;\n const scene = result.getScene();\n // check if assets context is available\n if (serializationObject._assetsContext) {\n const ac = serializationObject._assetsContext;\n const assetsContext: IAssetContainer = {\n meshes: ac.meshes?.map((m: string) => scene.getMeshById(m)),\n lights: ac.lights?.map((l: string) => scene.getLightByName(l)),\n cameras: ac.cameras?.map((c: string) => scene.getCameraByName(c)),\n materials: ac.materials?.map((m: string) => scene.getMaterialById(m)),\n textures: ac.textures?.map((t: string) => scene.getTextureByName(t)),\n animations: ac.animations?.map((a: string) => scene.animations.find((anim) => anim.name === a)),\n skeletons: ac.skeletons?.map((s: string) => scene.getSkeletonByName(s)),\n particleSystems: ac.particleSystems?.map((ps: string) => scene.getParticleSystemById(ps)),\n animationGroups: ac.animationGroups?.map((ag: string) => scene.getAnimationGroupByName(ag)),\n transformNodes: ac.transformNodes?.map((tn: string) => scene.getTransformNodeById(tn)),\n rootNodes: [],\n multiMaterials: [],\n morphTargetManagers: [],\n geometries: [],\n actionManagers: [],\n environmentTexture: null,\n postProcesses: [],\n sounds: null,\n effectLayers: [],\n layers: [],\n reflectionProbes: [],\n lensFlareSystems: [],\n proceduralTextures: [],\n getNodes: function (): Array<Node> {\n throw new Error(\"Function not implemented.\");\n },\n };\n result.assetsContext = assetsContext;\n }\n for (const key in serializationObject._userVariables) {\n const value = valueParseFunction(key, serializationObject._userVariables, result.assetsContext, scene);\n result.userVariables[key] = value;\n }\n for (const key in serializationObject._connectionValues) {\n const value = valueParseFunction(key, serializationObject._connectionValues, result.assetsContext, scene);\n result._setConnectionValueByKey(key, value);\n }\n\n return result;\n}\n\n/**\n * Parses a block from a serialization object\n * This function is async due to the factory method that is used to create the block's class. If you load the class externally use ParseBlockWithClassType\n * @param serializationObject the object to parse from\n * @param parseOptions options for parsing the block\n * @returns the parsed block\n */\nexport async function ParseBlockAsync(serializationObject: ISerializedFlowGraphBlock, parseOptions: IFlowGraphBlockParseOptions): Promise<FlowGraphBlock> {\n const classFactory = blockFactory(serializationObject.className as FlowGraphBlockNames);\n const classType = await classFactory();\n return ParseFlowGraphBlockWithClassType(serializationObject, parseOptions, classType);\n}\n\n/**\n * Parses a block from a serialization object\n * @param serializationObject the object to parse from\n * @param parseOptions options for parsing the block\n * @param classType the class type of the block. This is used when the class is not loaded asynchronously\n * @returns the parsed block\n */\nexport function ParseFlowGraphBlockWithClassType(\n serializationObject: ISerializedFlowGraphBlock,\n parseOptions: IFlowGraphBlockParseOptions,\n classType: typeof FlowGraphBlock\n): FlowGraphBlock {\n const parsedConfig: any = {};\n const valueParseFunction = parseOptions.valueParseFunction ?? defaultValueParseFunction;\n if (serializationObject.config) {\n for (const key in serializationObject.config) {\n parsedConfig[key] = valueParseFunction(key, serializationObject.config, parseOptions.assetsContainer || parseOptions.scene, parseOptions.scene);\n }\n }\n if (needsPathConverter(serializationObject.className)) {\n if (!parseOptions.pathConverter) {\n throw new Error(\"Path converter is required for this block\");\n }\n parsedConfig.pathConverter = parseOptions.pathConverter;\n }\n const obj = new classType(parsedConfig);\n obj.uniqueId = serializationObject.uniqueId;\n for (let i = 0; i < serializationObject.dataInputs.length; i++) {\n const dataInput = obj.getDataInput(serializationObject.dataInputs[i].name);\n if (dataInput) {\n dataInput.deserialize(serializationObject.dataInputs[i]);\n } else {\n throw new Error(\"Could not find data input with name \" + serializationObject.dataInputs[i].name + \" in block \" + serializationObject.className);\n }\n }\n for (let i = 0; i < serializationObject.dataOutputs.length; i++) {\n const dataOutput = obj.getDataOutput(serializationObject.dataOutputs[i].name);\n if (dataOutput) {\n dataOutput.deserialize(serializationObject.dataOutputs[i]);\n } else {\n throw new Error(\"Could not find data output with name \" + serializationObject.dataOutputs[i].name + \" in block \" + serializationObject.className);\n }\n }\n obj.metadata = serializationObject.metadata;\n obj.deserialize && obj.deserialize(serializationObject);\n return obj;\n}\n\n/**\n * Parses a connection from an object\n * @param serializationObject the object to parse from.\n * @param ownerBlock the block that owns the connection.\n * @param classType the class type of the connection.\n * @returns the parsed connection.\n */\nexport function ParseGraphConnectionWithClassType<BlockT extends FlowGraphBlock>(serializationObject: any = {}, ownerBlock: BlockT, classType: typeof FlowGraphConnection) {\n const connection = new classType(serializationObject.name, serializationObject._connectionType, ownerBlock);\n connection.deserialize(serializationObject);\n return connection;\n}\n\n/**\n * Parses a data connection from a serialized object.\n * @param serializationObject the object to parse from\n * @param ownerBlock the block that owns the connection\n * @param classType the class type of the data connection\n * @returns the parsed connection\n */\nexport function ParseGraphDataConnection(serializationObject: any, ownerBlock: FlowGraphBlock, classType: typeof FlowGraphDataConnection): FlowGraphDataConnection<any> {\n const richType = ParseRichType(serializationObject.richType);\n const defaultValue = serializationObject.defaultValue;\n const connection = new classType(serializationObject.name, serializationObject._connectionType, ownerBlock, richType, defaultValue, !!serializationObject._optional);\n connection.deserialize(serializationObject);\n return connection;\n}\n\n/**\n * Parses a rich type from a serialization object.\n * @param serializationObject a serialization object\n * @returns the parsed rich type\n */\nfunction ParseRichType(serializationObject: any): RichType<any> {\n return new RichType(serializationObject.typeName, serializationObject.defaultValue);\n}\n"]}
@@ -26,6 +26,9 @@ export declare class NodeRenderGraphBaseObjectRendererBlock extends NodeRenderGr
26
26
  /** Indicates if shadows must be enabled or disabled */
27
27
  get disableShadows(): boolean;
28
28
  set disableShadows(value: boolean);
29
+ /** If the rendering should be done in linear space */
30
+ get renderInLinearSpace(): boolean;
31
+ set renderInLinearSpace(value: boolean);
29
32
  /**
30
33
  * Gets the current class name
31
34
  * @returns the class name
@@ -58,6 +58,13 @@ export class NodeRenderGraphBaseObjectRendererBlock extends NodeRenderGraphBlock
58
58
  set disableShadows(value) {
59
59
  this._frameGraphTask.disableShadows = value;
60
60
  }
61
+ /** If the rendering should be done in linear space */
62
+ get renderInLinearSpace() {
63
+ return this._frameGraphTask.renderInLinearSpace;
64
+ }
65
+ set renderInLinearSpace(value) {
66
+ this._frameGraphTask.renderInLinearSpace = value;
67
+ }
61
68
  /**
62
69
  * Gets the current class name
63
70
  * @returns the class name
@@ -149,6 +156,7 @@ export class NodeRenderGraphBaseObjectRendererBlock extends NodeRenderGraphBlock
149
156
  codes.push(`${this._codeVariableName}.depthTest = ${this.depthTest};`);
150
157
  codes.push(`${this._codeVariableName}.depthWrite = ${this.depthWrite};`);
151
158
  codes.push(`${this._codeVariableName}.disableShadows = ${this.disableShadows};`);
159
+ codes.push(`${this._codeVariableName}.renderInLinearSpace = ${this.renderInLinearSpace};`);
152
160
  return super._dumpPropertiesCode() + codes.join("\n");
153
161
  }
154
162
  serialize() {
@@ -156,6 +164,7 @@ export class NodeRenderGraphBaseObjectRendererBlock extends NodeRenderGraphBlock
156
164
  serializationObject.depthTest = this.depthTest;
157
165
  serializationObject.depthWrite = this.depthWrite;
158
166
  serializationObject.disableShadows = this.disableShadows;
167
+ serializationObject.renderInLinearSpace = this.renderInLinearSpace;
159
168
  return serializationObject;
160
169
  }
161
170
  _deserialize(serializationObject) {
@@ -163,6 +172,7 @@ export class NodeRenderGraphBaseObjectRendererBlock extends NodeRenderGraphBlock
163
172
  this.depthTest = serializationObject.depthTest;
164
173
  this.depthWrite = serializationObject.depthWrite;
165
174
  this.disableShadows = serializationObject.disableShadows;
175
+ this.renderInLinearSpace = !!serializationObject.renderInLinearSpace;
166
176
  }
167
177
  }
168
178
  __decorate([
@@ -174,4 +184,7 @@ __decorate([
174
184
  __decorate([
175
185
  editableInPropertyPage("Disable shadows", 0 /* PropertyTypeForEdition.Boolean */, "PROPERTIES")
176
186
  ], NodeRenderGraphBaseObjectRendererBlock.prototype, "disableShadows", null);
187
+ __decorate([
188
+ editableInPropertyPage("Render in linear space", 0 /* PropertyTypeForEdition.Boolean */, "PROPERTIES")
189
+ ], NodeRenderGraphBaseObjectRendererBlock.prototype, "renderInLinearSpace", null);
177
190
  //# sourceMappingURL=baseObjectRendererBlock.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"baseObjectRendererBlock.js","sourceRoot":"","sources":["../../../../../../../dev/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r\n Camera,\r\n FrameGraphObjectRendererTask,\r\n NodeRenderGraphResourceContainerBlock,\r\n FrameGraphShadowGeneratorTask,\r\n // eslint-disable-next-line import/no-internal-modules\r\n} from \"core/index\";\r\nimport { NodeRenderGraphBlock } from \"../../nodeRenderGraphBlock\";\r\nimport { NodeRenderGraphBlockConnectionPointTypes, NodeRenderGraphConnectionPointDirection } from \"../../Types/nodeRenderGraphTypes\";\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"../../../../Decorators/nodeDecorator\";\r\nimport { NodeRenderGraphConnectionPoint } from \"../../nodeRenderGraphBlockConnectionPoint\";\r\nimport { NodeRenderGraphConnectionPointCustomObject } from \"../../nodeRenderGraphConnectionPointCustomObject\";\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class NodeRenderGraphBaseObjectRendererBlock extends NodeRenderGraphBlock {\r\n protected override _frameGraphTask: FrameGraphObjectRendererTask;\r\n\r\n /**\r\n * Gets the frame graph task associated with this block\r\n */\r\n public override get task() {\r\n return this._frameGraphTask;\r\n }\r\n\r\n /**\r\n * Create a new NodeRenderGraphBaseObjectRendererBlock\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 */\r\n public constructor(name: string, frameGraph: FrameGraph, scene: Scene) {\r\n super(name, frameGraph, scene);\r\n\r\n this.registerInput(\"target\", NodeRenderGraphBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"depth\", NodeRenderGraphBlockConnectionPointTypes.AutoDetect, true);\r\n this.registerInput(\"camera\", NodeRenderGraphBlockConnectionPointTypes.Camera);\r\n this.registerInput(\"objects\", NodeRenderGraphBlockConnectionPointTypes.ObjectList);\r\n this._addDependenciesInput();\r\n this.registerInput(\"shadowGenerators\", NodeRenderGraphBlockConnectionPointTypes.AutoDetect, true);\r\n\r\n this.registerOutput(\"output\", NodeRenderGraphBlockConnectionPointTypes.BasedOnInput);\r\n this.registerOutput(\"outputDepth\", NodeRenderGraphBlockConnectionPointTypes.BasedOnInput);\r\n this.registerOutput(\r\n \"objectRenderer\",\r\n NodeRenderGraphBlockConnectionPointTypes.Object,\r\n new NodeRenderGraphConnectionPointCustomObject(\r\n \"objectRenderer\",\r\n this,\r\n NodeRenderGraphConnectionPointDirection.Output,\r\n NodeRenderGraphBaseObjectRendererBlock,\r\n \"NodeRenderGraphBaseObjectRendererBlock\"\r\n )\r\n );\r\n\r\n this.target.addExcludedConnectionPointFromAllowedTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBufferDepthStencil);\r\n this.depth.addExcludedConnectionPointFromAllowedTypes(\r\n NodeRenderGraphBlockConnectionPointTypes.TextureDepthStencilAttachment | NodeRenderGraphBlockConnectionPointTypes.TextureBackBufferDepthStencilAttachment\r\n );\r\n this.shadowGenerators.addExcludedConnectionPointFromAllowedTypes(\r\n NodeRenderGraphBlockConnectionPointTypes.ShadowGenerator | NodeRenderGraphBlockConnectionPointTypes.ResourceContainer\r\n );\r\n\r\n this.output._typeConnectionSource = this.target;\r\n this.outputDepth._typeConnectionSource = this.depth;\r\n }\r\n\r\n /** Indicates if depth testing must be enabled or disabled */\r\n @editableInPropertyPage(\"Depth test\", PropertyTypeForEdition.Boolean, \"PROPERTIES\")\r\n public get depthTest() {\r\n return this._frameGraphTask.depthTest;\r\n }\r\n\r\n public set depthTest(value: boolean) {\r\n this._frameGraphTask.depthTest = value;\r\n }\r\n\r\n /** Indicates if depth writing must be enabled or disabled */\r\n @editableInPropertyPage(\"Depth write\", PropertyTypeForEdition.Boolean, \"PROPERTIES\")\r\n public get depthWrite() {\r\n return this._frameGraphTask.depthWrite;\r\n }\r\n\r\n public set depthWrite(value: boolean) {\r\n this._frameGraphTask.depthWrite = value;\r\n }\r\n\r\n /** Indicates if shadows must be enabled or disabled */\r\n @editableInPropertyPage(\"Disable shadows\", PropertyTypeForEdition.Boolean, \"PROPERTIES\")\r\n public get disableShadows() {\r\n return this._frameGraphTask.disableShadows;\r\n }\r\n\r\n public set disableShadows(value: boolean) {\r\n this._frameGraphTask.disableShadows = value;\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 \"NodeRenderGraphBaseObjectRendererBlock\";\r\n }\r\n\r\n /**\r\n * Gets the target texture input component\r\n */\r\n public get target(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the depth texture input component\r\n */\r\n public get depth(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the camera input component\r\n */\r\n public get camera(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the objects input component\r\n */\r\n public get objects(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the dependencies input component\r\n */\r\n public get dependencies(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the shadowGenerators input component\r\n */\r\n public get shadowGenerators(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[5];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeRenderGraphConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Gets the output depth component\r\n */\r\n public get outputDepth(): NodeRenderGraphConnectionPoint {\r\n return this._outputs[1];\r\n }\r\n\r\n /**\r\n * Gets the objectRenderer component\r\n */\r\n public get objectRenderer(): NodeRenderGraphConnectionPoint {\r\n return this._outputs[2];\r\n }\r\n\r\n protected override _buildBlock(state: NodeRenderGraphBuildState) {\r\n super._buildBlock(state);\r\n\r\n this.output.value = this._frameGraphTask.outputTexture; // the value of the output connection point is the \"output\" texture of the task\r\n this.outputDepth.value = this._frameGraphTask.outputDepthTexture; // the value of the outputDepth connection point is the \"outputDepth\" texture of the task\r\n this.objectRenderer.value = this._frameGraphTask; // the value of the objectRenderer connection point is the task itself\r\n\r\n this._frameGraphTask.targetTexture = this.target.connectedPoint?.value as FrameGraphTextureHandle;\r\n this._frameGraphTask.depthTexture = this.depth.connectedPoint?.value as FrameGraphTextureHandle;\r\n this._frameGraphTask.camera = this.camera.connectedPoint?.value as Camera;\r\n this._frameGraphTask.objectList = this.objects.connectedPoint?.value as FrameGraphObjectList;\r\n\r\n this._frameGraphTask.shadowGenerators = [];\r\n\r\n const shadowGeneratorsConnectedPoint = this.shadowGenerators.connectedPoint;\r\n if (shadowGeneratorsConnectedPoint) {\r\n if (shadowGeneratorsConnectedPoint.type === NodeRenderGraphBlockConnectionPointTypes.ResourceContainer) {\r\n const container = shadowGeneratorsConnectedPoint.ownerBlock as NodeRenderGraphResourceContainerBlock;\r\n container.inputs.forEach((input) => {\r\n if (input.connectedPoint && input.connectedPoint.value !== undefined && NodeRenderGraphConnectionPoint.IsShadowGenerator(input.connectedPoint.value)) {\r\n this._frameGraphTask.shadowGenerators!.push(input.connectedPoint.value as FrameGraphShadowGeneratorTask);\r\n }\r\n });\r\n } else if (NodeRenderGraphConnectionPoint.IsShadowGenerator(shadowGeneratorsConnectedPoint.value)) {\r\n this._frameGraphTask.shadowGenerators[0] = shadowGeneratorsConnectedPoint.value as FrameGraphShadowGeneratorTask;\r\n }\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codes: string[] = [];\r\n codes.push(`${this._codeVariableName}.depthTest = ${this.depthTest};`);\r\n codes.push(`${this._codeVariableName}.depthWrite = ${this.depthWrite};`);\r\n codes.push(`${this._codeVariableName}.disableShadows = ${this.disableShadows};`);\r\n return super._dumpPropertiesCode() + codes.join(\"\\n\");\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.depthTest = this.depthTest;\r\n serializationObject.depthWrite = this.depthWrite;\r\n serializationObject.disableShadows = this.disableShadows;\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n this.depthTest = serializationObject.depthTest;\r\n this.depthWrite = serializationObject.depthWrite;\r\n this.disableShadows = serializationObject.disableShadows;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"baseObjectRendererBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.ts"],"names":[],"mappings":";AAYA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,wCAAwC,EAA2C,MAAM,kCAAkC,CAAC;AACrI,OAAO,EAAE,sBAAsB,EAA0B,MAAM,sCAAsC,CAAC;AACtG,OAAO,EAAE,8BAA8B,EAAE,MAAM,2CAA2C,CAAC;AAC3F,OAAO,EAAE,0CAA0C,EAAE,MAAM,kDAAkD,CAAC;AAE9G;;GAEG;AACH,MAAM,OAAO,sCAAuC,SAAQ,oBAAoB;IAG5E;;OAEG;IACH,IAAoB,IAAI;QACpB,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAED;;;;;OAKG;IACH,YAAmB,IAAY,EAAE,UAAsB,EAAE,KAAY;QACjE,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;QAE/B,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,wCAAwC,CAAC,UAAU,CAAC,CAAC;QAClF,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,wCAAwC,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QACvF,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,wCAAwC,CAAC,MAAM,CAAC,CAAC;QAC9E,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,wCAAwC,CAAC,UAAU,CAAC,CAAC;QACnF,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAC7B,IAAI,CAAC,aAAa,CAAC,kBAAkB,EAAE,wCAAwC,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAElG,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,wCAAwC,CAAC,YAAY,CAAC,CAA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C,mBAAmB,CAAC,CAAC;QACxC,IAAI,CAAC,SAAS,GAAG,mBAAmB,CAAC,SAAS,CAAC;QAC/C,IAAI,CAAC,UAAU,GAAG,mBAAmB,CAAC,UAAU,CAAC;QACjD,IAAI,CAAC,cAAc,GAAG,mBAAmB,CAAC,cAAc,CAAC;QACzD,IAAI,CAAC,mBAAmB,GAAG,CAAC,CAAC,mBAAmB,CAAC,mBAAmB,CAAC;IACzE,CAAC;CACJ;AAnKG;IADC,sBAAsB,CAAC,YAAY,0CAAkC,YAAY,CAAC;uEAGlF;AAQD;IADC,sBAAsB,CAAC,aAAa,0CAAkC,YAAY,CAAC;wEAGnF;AAQD;IADC,sBAAsB,CAAC,iBAAiB,0CAAkC,YAAY,CAAC;4EAGvF;AAQD;IADC,sBAAsB,CAAC,wBAAwB,0CAAkC,YAAY,CAAC;iFAG9F","sourcesContent":["import type {\r\n Scene,\r\n NodeRenderGraphBuildState,\r\n FrameGraph,\r\n FrameGraphTextureHandle,\r\n FrameGraphObjectList,\r\n Camera,\r\n FrameGraphObjectRendererTask,\r\n NodeRenderGraphResourceContainerBlock,\r\n FrameGraphShadowGeneratorTask,\r\n // eslint-disable-next-line import/no-internal-modules\r\n} from \"core/index\";\r\nimport { NodeRenderGraphBlock } from \"../../nodeRenderGraphBlock\";\r\nimport { NodeRenderGraphBlockConnectionPointTypes, NodeRenderGraphConnectionPointDirection } from \"../../Types/nodeRenderGraphTypes\";\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"../../../../Decorators/nodeDecorator\";\r\nimport { NodeRenderGraphConnectionPoint } from \"../../nodeRenderGraphBlockConnectionPoint\";\r\nimport { NodeRenderGraphConnectionPointCustomObject } from \"../../nodeRenderGraphConnectionPointCustomObject\";\r\n\r\n/**\r\n * @internal\r\n */\r\nexport class NodeRenderGraphBaseObjectRendererBlock extends NodeRenderGraphBlock {\r\n protected override _frameGraphTask: FrameGraphObjectRendererTask;\r\n\r\n /**\r\n * Gets the frame graph task associated with this block\r\n */\r\n public override get task() {\r\n return this._frameGraphTask;\r\n }\r\n\r\n /**\r\n * Create a new NodeRenderGraphBaseObjectRendererBlock\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 */\r\n public constructor(name: string, frameGraph: FrameGraph, scene: Scene) {\r\n super(name, frameGraph, scene);\r\n\r\n this.registerInput(\"target\", NodeRenderGraphBlockConnectionPointTypes.AutoDetect);\r\n this.registerInput(\"depth\", NodeRenderGraphBlockConnectionPointTypes.AutoDetect, true);\r\n this.registerInput(\"camera\", NodeRenderGraphBlockConnectionPointTypes.Camera);\r\n this.registerInput(\"objects\", NodeRenderGraphBlockConnectionPointTypes.ObjectList);\r\n this._addDependenciesInput();\r\n this.registerInput(\"shadowGenerators\", NodeRenderGraphBlockConnectionPointTypes.AutoDetect, true);\r\n\r\n this.registerOutput(\"output\", NodeRenderGraphBlockConnectionPointTypes.BasedOnInput);\r\n this.registerOutput(\"outputDepth\", NodeRenderGraphBlockConnectionPointTypes.BasedOnInput);\r\n this.registerOutput(\r\n \"objectRenderer\",\r\n NodeRenderGraphBlockConnectionPointTypes.Object,\r\n new NodeRenderGraphConnectionPointCustomObject(\r\n \"objectRenderer\",\r\n this,\r\n NodeRenderGraphConnectionPointDirection.Output,\r\n NodeRenderGraphBaseObjectRendererBlock,\r\n \"NodeRenderGraphBaseObjectRendererBlock\"\r\n )\r\n );\r\n\r\n this.target.addExcludedConnectionPointFromAllowedTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBufferDepthStencil);\r\n this.depth.addExcludedConnectionPointFromAllowedTypes(\r\n NodeRenderGraphBlockConnectionPointTypes.TextureDepthStencilAttachment | NodeRenderGraphBlockConnectionPointTypes.TextureBackBufferDepthStencilAttachment\r\n );\r\n this.shadowGenerators.addExcludedConnectionPointFromAllowedTypes(\r\n NodeRenderGraphBlockConnectionPointTypes.ShadowGenerator | NodeRenderGraphBlockConnectionPointTypes.ResourceContainer\r\n );\r\n\r\n this.output._typeConnectionSource = this.target;\r\n this.outputDepth._typeConnectionSource = this.depth;\r\n }\r\n\r\n /** Indicates if depth testing must be enabled or disabled */\r\n @editableInPropertyPage(\"Depth test\", PropertyTypeForEdition.Boolean, \"PROPERTIES\")\r\n public get depthTest() {\r\n return this._frameGraphTask.depthTest;\r\n }\r\n\r\n public set depthTest(value: boolean) {\r\n this._frameGraphTask.depthTest = value;\r\n }\r\n\r\n /** Indicates if depth writing must be enabled or disabled */\r\n @editableInPropertyPage(\"Depth write\", PropertyTypeForEdition.Boolean, \"PROPERTIES\")\r\n public get depthWrite() {\r\n return this._frameGraphTask.depthWrite;\r\n }\r\n\r\n public set depthWrite(value: boolean) {\r\n this._frameGraphTask.depthWrite = value;\r\n }\r\n\r\n /** Indicates if shadows must be enabled or disabled */\r\n @editableInPropertyPage(\"Disable shadows\", PropertyTypeForEdition.Boolean, \"PROPERTIES\")\r\n public get disableShadows() {\r\n return this._frameGraphTask.disableShadows;\r\n }\r\n\r\n public set disableShadows(value: boolean) {\r\n this._frameGraphTask.disableShadows = value;\r\n }\r\n\r\n /** If the rendering should be done in linear space */\r\n @editableInPropertyPage(\"Render in linear space\", PropertyTypeForEdition.Boolean, \"PROPERTIES\")\r\n public get renderInLinearSpace() {\r\n return this._frameGraphTask.renderInLinearSpace;\r\n }\r\n\r\n public set renderInLinearSpace(value: boolean) {\r\n this._frameGraphTask.renderInLinearSpace = value;\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 \"NodeRenderGraphBaseObjectRendererBlock\";\r\n }\r\n\r\n /**\r\n * Gets the target texture input component\r\n */\r\n public get target(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the depth texture input component\r\n */\r\n public get depth(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[1];\r\n }\r\n\r\n /**\r\n * Gets the camera input component\r\n */\r\n public get camera(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[2];\r\n }\r\n\r\n /**\r\n * Gets the objects input component\r\n */\r\n public get objects(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[3];\r\n }\r\n\r\n /**\r\n * Gets the dependencies input component\r\n */\r\n public get dependencies(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[4];\r\n }\r\n\r\n /**\r\n * Gets the shadowGenerators input component\r\n */\r\n public get shadowGenerators(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[5];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeRenderGraphConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Gets the output depth component\r\n */\r\n public get outputDepth(): NodeRenderGraphConnectionPoint {\r\n return this._outputs[1];\r\n }\r\n\r\n /**\r\n * Gets the objectRenderer component\r\n */\r\n public get objectRenderer(): NodeRenderGraphConnectionPoint {\r\n return this._outputs[2];\r\n }\r\n\r\n protected override _buildBlock(state: NodeRenderGraphBuildState) {\r\n super._buildBlock(state);\r\n\r\n this.output.value = this._frameGraphTask.outputTexture; // the value of the output connection point is the \"output\" texture of the task\r\n this.outputDepth.value = this._frameGraphTask.outputDepthTexture; // the value of the outputDepth connection point is the \"outputDepth\" texture of the task\r\n this.objectRenderer.value = this._frameGraphTask; // the value of the objectRenderer connection point is the task itself\r\n\r\n this._frameGraphTask.targetTexture = this.target.connectedPoint?.value as FrameGraphTextureHandle;\r\n this._frameGraphTask.depthTexture = this.depth.connectedPoint?.value as FrameGraphTextureHandle;\r\n this._frameGraphTask.camera = this.camera.connectedPoint?.value as Camera;\r\n this._frameGraphTask.objectList = this.objects.connectedPoint?.value as FrameGraphObjectList;\r\n\r\n this._frameGraphTask.shadowGenerators = [];\r\n\r\n const shadowGeneratorsConnectedPoint = this.shadowGenerators.connectedPoint;\r\n if (shadowGeneratorsConnectedPoint) {\r\n if (shadowGeneratorsConnectedPoint.type === NodeRenderGraphBlockConnectionPointTypes.ResourceContainer) {\r\n const container = shadowGeneratorsConnectedPoint.ownerBlock as NodeRenderGraphResourceContainerBlock;\r\n container.inputs.forEach((input) => {\r\n if (input.connectedPoint && input.connectedPoint.value !== undefined && NodeRenderGraphConnectionPoint.IsShadowGenerator(input.connectedPoint.value)) {\r\n this._frameGraphTask.shadowGenerators!.push(input.connectedPoint.value as FrameGraphShadowGeneratorTask);\r\n }\r\n });\r\n } else if (NodeRenderGraphConnectionPoint.IsShadowGenerator(shadowGeneratorsConnectedPoint.value)) {\r\n this._frameGraphTask.shadowGenerators[0] = shadowGeneratorsConnectedPoint.value as FrameGraphShadowGeneratorTask;\r\n }\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codes: string[] = [];\r\n codes.push(`${this._codeVariableName}.depthTest = ${this.depthTest};`);\r\n codes.push(`${this._codeVariableName}.depthWrite = ${this.depthWrite};`);\r\n codes.push(`${this._codeVariableName}.disableShadows = ${this.disableShadows};`);\r\n codes.push(`${this._codeVariableName}.renderInLinearSpace = ${this.renderInLinearSpace};`);\r\n return super._dumpPropertiesCode() + codes.join(\"\\n\");\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.depthTest = this.depthTest;\r\n serializationObject.depthWrite = this.depthWrite;\r\n serializationObject.disableShadows = this.disableShadows;\r\n serializationObject.renderInLinearSpace = this.renderInLinearSpace;\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n this.depthTest = serializationObject.depthTest;\r\n this.depthWrite = serializationObject.depthWrite;\r\n this.disableShadows = serializationObject.disableShadows;\r\n this.renderInLinearSpace = !!serializationObject.renderInLinearSpace;\r\n }\r\n}\r\n"]}
@@ -94,9 +94,25 @@ export class NodeRenderGraphGeometryRendererBlock extends NodeRenderGraphBlock {
94
94
  }
95
95
  set doNotChangeAspectRatio(value) {
96
96
  const disabled = this._frameGraphTask.disabled;
97
+ const depthTest = this.depthTest;
98
+ const depthWrite = this.depthWrite;
99
+ const width = this.width;
100
+ const height = this.height;
101
+ const sizeInPercentage = this.sizeInPercentage;
102
+ const samples = this.samples;
103
+ const reverseCulling = this.reverseCulling;
104
+ const dontRenderWhenMaterialDepthWriteIsDisabled = this.dontRenderWhenMaterialDepthWriteIsDisabled;
97
105
  this._frameGraphTask.dispose();
98
106
  this._frameGraphTask = new FrameGraphGeometryRendererTask(this.name, this._frameGraph, this._scene, { doNotChangeAspectRatio: value });
99
107
  this._additionalConstructionParameters = [value];
108
+ this.depthTest = depthTest;
109
+ this.depthWrite = depthWrite;
110
+ this.width = width;
111
+ this.height = height;
112
+ this.sizeInPercentage = sizeInPercentage;
113
+ this.samples = samples;
114
+ this.reverseCulling = reverseCulling;
115
+ this.dontRenderWhenMaterialDepthWriteIsDisabled = dontRenderWhenMaterialDepthWriteIsDisabled;
100
116
  this._frameGraphTask.disabled = disabled;
101
117
  }
102
118
  /** Width of the geometry texture */