@babylonjs/core 7.31.2 → 7.32.1

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 (367) hide show
  1. package/Behaviors/Cameras/autoRotationBehavior.js +1 -0
  2. package/Behaviors/Cameras/autoRotationBehavior.js.map +1 -1
  3. package/Cameras/camera.d.ts +5 -2
  4. package/Cameras/camera.js +1 -0
  5. package/Cameras/camera.js.map +1 -1
  6. package/Decorators/nodeDecorator.d.ts +9 -1
  7. package/Decorators/nodeDecorator.js +8 -0
  8. package/Decorators/nodeDecorator.js.map +1 -1
  9. package/Engines/Extensions/engine.multiRender.js +40 -53
  10. package/Engines/Extensions/engine.multiRender.js.map +1 -1
  11. package/Engines/Extensions/engine.renderTarget.js +20 -8
  12. package/Engines/Extensions/engine.renderTarget.js.map +1 -1
  13. package/Engines/WebGPU/Extensions/engine.debugging.js +16 -7
  14. package/Engines/WebGPU/Extensions/engine.debugging.js.map +1 -1
  15. package/Engines/WebGPU/Extensions/engine.multiRender.js +43 -44
  16. package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
  17. package/Engines/WebGPU/Extensions/engine.renderTarget.js +8 -6
  18. package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
  19. package/Engines/WebGPU/webgpuHardwareTexture.d.ts +3 -3
  20. package/Engines/WebGPU/webgpuHardwareTexture.js +12 -9
  21. package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
  22. package/Engines/WebGPU/webgpuTextureHelper.js +25 -19
  23. package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
  24. package/Engines/WebGPU/webgpuTextureManager.d.ts +1 -1
  25. package/Engines/WebGPU/webgpuTextureManager.js +5 -3
  26. package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
  27. package/Engines/abstractEngine.d.ts +6 -1
  28. package/Engines/abstractEngine.js +2 -2
  29. package/Engines/abstractEngine.js.map +1 -1
  30. package/Engines/constants.d.ts +6 -1
  31. package/Engines/constants.js +6 -1
  32. package/Engines/constants.js.map +1 -1
  33. package/Engines/renderTargetWrapper.d.ts +7 -0
  34. package/Engines/renderTargetWrapper.js +15 -0
  35. package/Engines/renderTargetWrapper.js.map +1 -1
  36. package/Engines/webgpuEngine.d.ts +3 -1
  37. package/Engines/webgpuEngine.js +9 -8
  38. package/Engines/webgpuEngine.js.map +1 -1
  39. package/FrameGraph/Node/Blocks/PostProcesses/blackAndWhitePostProcessBlock.d.ts +47 -0
  40. package/FrameGraph/Node/Blocks/PostProcesses/blackAndWhitePostProcessBlock.js +113 -0
  41. package/FrameGraph/Node/Blocks/PostProcesses/blackAndWhitePostProcessBlock.js.map +1 -0
  42. package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.d.ts +62 -0
  43. package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.js +171 -0
  44. package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.js.map +1 -0
  45. package/FrameGraph/Node/Blocks/PostProcesses/blurPostProcessBlock.d.ts +51 -0
  46. package/FrameGraph/Node/Blocks/PostProcesses/blurPostProcessBlock.js +127 -0
  47. package/FrameGraph/Node/Blocks/PostProcesses/blurPostProcessBlock.js.map +1 -0
  48. package/FrameGraph/Node/Blocks/PostProcesses/circleOfConfusionPostProcessBlock.d.ts +67 -0
  49. package/FrameGraph/Node/Blocks/PostProcesses/circleOfConfusionPostProcessBlock.js +187 -0
  50. package/FrameGraph/Node/Blocks/PostProcesses/circleOfConfusionPostProcessBlock.js.map +1 -0
  51. package/FrameGraph/Node/Blocks/PostProcesses/depthOfFieldPostProcessBlock.d.ts +77 -0
  52. package/FrameGraph/Node/Blocks/PostProcesses/depthOfFieldPostProcessBlock.js +232 -0
  53. package/FrameGraph/Node/Blocks/PostProcesses/depthOfFieldPostProcessBlock.js.map +1 -0
  54. package/FrameGraph/Node/Blocks/PostProcesses/extractHighlightsPostProcessBlock.d.ts +47 -0
  55. package/FrameGraph/Node/Blocks/PostProcesses/extractHighlightsPostProcessBlock.js +113 -0
  56. package/FrameGraph/Node/Blocks/PostProcesses/extractHighlightsPostProcessBlock.js.map +1 -0
  57. package/FrameGraph/Node/Blocks/Rendering/cullObjectsBlock.d.ts +41 -0
  58. package/FrameGraph/Node/Blocks/Rendering/cullObjectsBlock.js +79 -0
  59. package/FrameGraph/Node/Blocks/Rendering/cullObjectsBlock.js.map +1 -0
  60. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.d.ts +119 -0
  61. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js +451 -0
  62. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js.map +1 -0
  63. package/FrameGraph/Node/Blocks/Rendering/objectRendererBlock.d.ts +63 -0
  64. package/FrameGraph/Node/Blocks/Rendering/objectRendererBlock.js +154 -0
  65. package/FrameGraph/Node/Blocks/Rendering/objectRendererBlock.js.map +1 -0
  66. package/FrameGraph/Node/Blocks/Teleport/teleportInBlock.d.ts +59 -0
  67. package/FrameGraph/Node/Blocks/Teleport/teleportInBlock.js +131 -0
  68. package/FrameGraph/Node/Blocks/Teleport/teleportInBlock.js.map +1 -0
  69. package/FrameGraph/Node/Blocks/Teleport/teleportOutBlock.d.ts +49 -0
  70. package/FrameGraph/Node/Blocks/Teleport/teleportOutBlock.js +107 -0
  71. package/FrameGraph/Node/Blocks/Teleport/teleportOutBlock.js.map +1 -0
  72. package/FrameGraph/Node/Blocks/Textures/clearBlock.d.ts +50 -0
  73. package/FrameGraph/Node/Blocks/Textures/clearBlock.js +125 -0
  74. package/FrameGraph/Node/Blocks/Textures/clearBlock.js.map +1 -0
  75. package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.d.ts +38 -0
  76. package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.js +71 -0
  77. package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.js.map +1 -0
  78. package/FrameGraph/Node/Blocks/Textures/generateMipmapsBlock.d.ts +34 -0
  79. package/FrameGraph/Node/Blocks/Textures/generateMipmapsBlock.js +59 -0
  80. package/FrameGraph/Node/Blocks/Textures/generateMipmapsBlock.js.map +1 -0
  81. package/FrameGraph/Node/Blocks/elbowBlock.d.ts +28 -0
  82. package/FrameGraph/Node/Blocks/elbowBlock.js +47 -0
  83. package/FrameGraph/Node/Blocks/elbowBlock.js.map +1 -0
  84. package/FrameGraph/Node/Blocks/index.d.ts +17 -0
  85. package/FrameGraph/Node/Blocks/index.js +18 -0
  86. package/FrameGraph/Node/Blocks/index.js.map +1 -0
  87. package/FrameGraph/Node/Blocks/inputBlock.d.ts +94 -0
  88. package/FrameGraph/Node/Blocks/inputBlock.js +270 -0
  89. package/FrameGraph/Node/Blocks/inputBlock.js.map +1 -0
  90. package/FrameGraph/Node/Blocks/outputBlock.d.ts +30 -0
  91. package/FrameGraph/Node/Blocks/outputBlock.js +51 -0
  92. package/FrameGraph/Node/Blocks/outputBlock.js.map +1 -0
  93. package/FrameGraph/Node/Types/nodeRenderGraphTypes.d.ts +110 -0
  94. package/FrameGraph/Node/Types/nodeRenderGraphTypes.js +78 -0
  95. package/FrameGraph/Node/Types/nodeRenderGraphTypes.js.map +1 -0
  96. package/FrameGraph/Node/nodeRenderGraph.d.ts +196 -0
  97. package/FrameGraph/Node/nodeRenderGraph.js +614 -0
  98. package/FrameGraph/Node/nodeRenderGraph.js.map +1 -0
  99. package/FrameGraph/Node/nodeRenderGraphBlock.d.ts +190 -0
  100. package/FrameGraph/Node/nodeRenderGraphBlock.js +495 -0
  101. package/FrameGraph/Node/nodeRenderGraphBlock.js.map +1 -0
  102. package/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.d.ts +143 -0
  103. package/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.js +275 -0
  104. package/FrameGraph/Node/nodeRenderGraphBlockConnectionPoint.js.map +1 -0
  105. package/FrameGraph/Node/nodeRenderGraphBuildState.d.ts +21 -0
  106. package/FrameGraph/Node/nodeRenderGraphBuildState.js +35 -0
  107. package/FrameGraph/Node/nodeRenderGraphBuildState.js.map +1 -0
  108. package/FrameGraph/Passes/cullPass.d.ts +28 -0
  109. package/FrameGraph/Passes/cullPass.js +38 -0
  110. package/FrameGraph/Passes/cullPass.js.map +1 -0
  111. package/FrameGraph/Passes/pass.d.ts +14 -0
  112. package/FrameGraph/Passes/pass.js +20 -0
  113. package/FrameGraph/Passes/pass.js.map +1 -0
  114. package/FrameGraph/Passes/renderPass.d.ts +49 -0
  115. package/FrameGraph/Passes/renderPass.js +72 -0
  116. package/FrameGraph/Passes/renderPass.js.map +1 -0
  117. package/FrameGraph/Tasks/PostProcesses/blackAndWhiteTask.d.ts +16 -0
  118. package/FrameGraph/Tasks/PostProcesses/blackAndWhiteTask.js +17 -0
  119. package/FrameGraph/Tasks/PostProcesses/blackAndWhiteTask.js.map +1 -0
  120. package/FrameGraph/Tasks/PostProcesses/bloomMergeTask.d.ts +12 -0
  121. package/FrameGraph/Tasks/PostProcesses/bloomMergeTask.js +21 -0
  122. package/FrameGraph/Tasks/PostProcesses/bloomMergeTask.js.map +1 -0
  123. package/FrameGraph/Tasks/PostProcesses/bloomTask.d.ts +54 -0
  124. package/FrameGraph/Tasks/PostProcesses/bloomTask.js +114 -0
  125. package/FrameGraph/Tasks/PostProcesses/bloomTask.js.map +1 -0
  126. package/FrameGraph/Tasks/PostProcesses/blurTask.d.ts +17 -0
  127. package/FrameGraph/Tasks/PostProcesses/blurTask.js +24 -0
  128. package/FrameGraph/Tasks/PostProcesses/blurTask.js.map +1 -0
  129. package/FrameGraph/Tasks/PostProcesses/circleOfConfusionTask.d.ts +30 -0
  130. package/FrameGraph/Tasks/PostProcesses/circleOfConfusionTask.js +35 -0
  131. package/FrameGraph/Tasks/PostProcesses/circleOfConfusionTask.js.map +1 -0
  132. package/FrameGraph/Tasks/PostProcesses/depthOfFieldBlurTask.d.ts +12 -0
  133. package/FrameGraph/Tasks/PostProcesses/depthOfFieldBlurTask.js +26 -0
  134. package/FrameGraph/Tasks/PostProcesses/depthOfFieldBlurTask.js.map +1 -0
  135. package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.d.ts +12 -0
  136. package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.js +29 -0
  137. package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.js.map +1 -0
  138. package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.d.ts +65 -0
  139. package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js +134 -0
  140. package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js.map +1 -0
  141. package/FrameGraph/Tasks/PostProcesses/extractHighlightsTask.d.ts +16 -0
  142. package/FrameGraph/Tasks/PostProcesses/extractHighlightsTask.js +17 -0
  143. package/FrameGraph/Tasks/PostProcesses/extractHighlightsTask.js.map +1 -0
  144. package/FrameGraph/Tasks/PostProcesses/postProcessTask.d.ts +41 -0
  145. package/FrameGraph/Tasks/PostProcesses/postProcessTask.js +64 -0
  146. package/FrameGraph/Tasks/PostProcesses/postProcessTask.js.map +1 -0
  147. package/FrameGraph/Tasks/Rendering/cullObjectsTask.d.ts +28 -0
  148. package/FrameGraph/Tasks/Rendering/cullObjectsTask.js +52 -0
  149. package/FrameGraph/Tasks/Rendering/cullObjectsTask.js.map +1 -0
  150. package/FrameGraph/Tasks/Rendering/geometryRendererTask.d.ts +145 -0
  151. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +259 -0
  152. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -0
  153. package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +66 -0
  154. package/FrameGraph/Tasks/Rendering/objectRendererTask.js +127 -0
  155. package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -0
  156. package/FrameGraph/Tasks/Texture/clearTextureTask.d.ts +34 -0
  157. package/FrameGraph/Tasks/Texture/clearTextureTask.js +42 -0
  158. package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -0
  159. package/FrameGraph/Tasks/Texture/copyToBackbufferColorTask.d.ts +12 -0
  160. package/FrameGraph/Tasks/Texture/copyToBackbufferColorTask.js +23 -0
  161. package/FrameGraph/Tasks/Texture/copyToBackbufferColorTask.js.map +1 -0
  162. package/FrameGraph/Tasks/Texture/copyToTextureTask.d.ts +26 -0
  163. package/FrameGraph/Tasks/Texture/copyToTextureTask.js +31 -0
  164. package/FrameGraph/Tasks/Texture/copyToTextureTask.js.map +1 -0
  165. package/FrameGraph/Tasks/Texture/generateMipMapsTask.d.ts +22 -0
  166. package/FrameGraph/Tasks/Texture/generateMipMapsTask.js +34 -0
  167. package/FrameGraph/Tasks/Texture/generateMipMapsTask.js.map +1 -0
  168. package/FrameGraph/frameGraph.d.ts +143 -0
  169. package/FrameGraph/frameGraph.js +275 -0
  170. package/FrameGraph/frameGraph.js.map +1 -0
  171. package/FrameGraph/frameGraphContext.d.ts +5 -0
  172. package/FrameGraph/frameGraphContext.js +6 -0
  173. package/FrameGraph/frameGraphContext.js.map +1 -0
  174. package/FrameGraph/frameGraphObjectList.d.ts +15 -0
  175. package/FrameGraph/frameGraphObjectList.js +7 -0
  176. package/FrameGraph/frameGraphObjectList.js.map +1 -0
  177. package/FrameGraph/frameGraphRenderContext.d.ts +110 -0
  178. package/FrameGraph/frameGraphRenderContext.js +237 -0
  179. package/FrameGraph/frameGraphRenderContext.js.map +1 -0
  180. package/FrameGraph/frameGraphTask.d.ts +49 -0
  181. package/FrameGraph/frameGraphTask.js +117 -0
  182. package/FrameGraph/frameGraphTask.js.map +1 -0
  183. package/FrameGraph/frameGraphTextureManager.d.ts +50 -0
  184. package/FrameGraph/frameGraphTextureManager.js +277 -0
  185. package/FrameGraph/frameGraphTextureManager.js.map +1 -0
  186. package/FrameGraph/frameGraphTypes.d.ts +59 -0
  187. package/FrameGraph/frameGraphTypes.js +9 -0
  188. package/FrameGraph/frameGraphTypes.js.map +1 -0
  189. package/FrameGraph/index.d.ts +28 -0
  190. package/FrameGraph/index.js +30 -0
  191. package/FrameGraph/index.js.map +1 -0
  192. package/Gamepads/gamepadSceneComponent.d.ts +0 -1
  193. package/Gamepads/gamepadSceneComponent.js +1 -7
  194. package/Gamepads/gamepadSceneComponent.js.map +1 -1
  195. package/Gizmos/boundingBoxGizmo.d.ts +7 -0
  196. package/Gizmos/boundingBoxGizmo.js +19 -6
  197. package/Gizmos/boundingBoxGizmo.js.map +1 -1
  198. package/Inputs/scene.inputManager.d.ts +3 -1
  199. package/Inputs/scene.inputManager.js +20 -8
  200. package/Inputs/scene.inputManager.js.map +1 -1
  201. package/Layers/layer.d.ts +1 -1
  202. package/Layers/layer.js +1 -1
  203. package/Layers/layer.js.map +1 -1
  204. package/Materials/PBR/pbrBaseMaterial.d.ts +4 -0
  205. package/Materials/PBR/pbrBaseMaterial.js +8 -0
  206. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  207. package/Materials/Textures/dynamicTexture.d.ts +32 -2
  208. package/Materials/Textures/dynamicTexture.js +13 -18
  209. package/Materials/Textures/dynamicTexture.js.map +1 -1
  210. package/Materials/Textures/index.d.ts +1 -0
  211. package/Materials/Textures/index.js +1 -0
  212. package/Materials/Textures/index.js.map +1 -1
  213. package/Materials/Textures/mirrorTexture.js +0 -6
  214. package/Materials/Textures/mirrorTexture.js.map +1 -1
  215. package/Materials/Textures/multiRenderTarget.d.ts +20 -8
  216. package/Materials/Textures/multiRenderTarget.js +2 -0
  217. package/Materials/Textures/multiRenderTarget.js.map +1 -1
  218. package/Materials/Textures/renderTargetTexture.d.ts +8 -1
  219. package/Materials/Textures/renderTargetTexture.js +28 -10
  220. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  221. package/Materials/Textures/textureCreationOptions.d.ts +20 -2
  222. package/Materials/Textures/textureCreationOptions.js +20 -1
  223. package/Materials/Textures/textureCreationOptions.js.map +1 -1
  224. package/Materials/effectRenderer.d.ts +132 -14
  225. package/Materials/effectRenderer.js +229 -33
  226. package/Materials/effectRenderer.js.map +1 -1
  227. package/Materials/index.d.ts +1 -0
  228. package/Materials/index.js +1 -0
  229. package/Materials/index.js.map +1 -1
  230. package/Materials/materialHelper.functions.js +2 -0
  231. package/Materials/materialHelper.functions.js.map +1 -1
  232. package/Materials/materialHelper.geometryrendering.d.ts +122 -0
  233. package/Materials/materialHelper.geometryrendering.js +259 -0
  234. package/Materials/materialHelper.geometryrendering.js.map +1 -0
  235. package/Materials/standardMaterial.d.ts +4 -0
  236. package/Materials/standardMaterial.js +8 -0
  237. package/Materials/standardMaterial.js.map +1 -1
  238. package/Maths/index.d.ts +1 -0
  239. package/Maths/index.js +1 -0
  240. package/Maths/index.js.map +1 -1
  241. package/Meshes/Builders/greasedLineBuilder.d.ts +1 -1
  242. package/Meshes/Node/Blocks/geometryOptimizeBlock.d.ts +22 -1
  243. package/Meshes/Node/Blocks/geometryOptimizeBlock.js +39 -0
  244. package/Meshes/Node/Blocks/geometryOptimizeBlock.js.map +1 -1
  245. package/Misc/copyTextureToTexture.d.ts +3 -2
  246. package/Misc/copyTextureToTexture.js +11 -5
  247. package/Misc/copyTextureToTexture.js.map +1 -1
  248. package/PostProcesses/blackAndWhitePostProcess.d.ts +5 -3
  249. package/PostProcesses/blackAndWhitePostProcess.js +24 -19
  250. package/PostProcesses/blackAndWhitePostProcess.js.map +1 -1
  251. package/PostProcesses/bloomEffect.d.ts +7 -5
  252. package/PostProcesses/bloomEffect.js +49 -23
  253. package/PostProcesses/bloomEffect.js.map +1 -1
  254. package/PostProcesses/bloomMergePostProcess.d.ts +5 -5
  255. package/PostProcesses/bloomMergePostProcess.js +28 -19
  256. package/PostProcesses/bloomMergePostProcess.js.map +1 -1
  257. package/PostProcesses/blurPostProcess.d.ts +7 -43
  258. package/PostProcesses/blurPostProcess.js +47 -185
  259. package/PostProcesses/blurPostProcess.js.map +1 -1
  260. package/PostProcesses/circleOfConfusionPostProcess.d.ts +13 -6
  261. package/PostProcesses/circleOfConfusionPostProcess.js +59 -38
  262. package/PostProcesses/circleOfConfusionPostProcess.js.map +1 -1
  263. package/PostProcesses/depthOfFieldBlurPostProcess.d.ts +2 -6
  264. package/PostProcesses/depthOfFieldBlurPostProcess.js +14 -11
  265. package/PostProcesses/depthOfFieldBlurPostProcess.js.map +1 -1
  266. package/PostProcesses/depthOfFieldEffect.d.ts +5 -2
  267. package/PostProcesses/depthOfFieldEffect.js +53 -45
  268. package/PostProcesses/depthOfFieldEffect.js.map +1 -1
  269. package/PostProcesses/depthOfFieldMergePostProcess.d.ts +0 -1
  270. package/PostProcesses/depthOfFieldMergePostProcess.js +18 -12
  271. package/PostProcesses/depthOfFieldMergePostProcess.js.map +1 -1
  272. package/PostProcesses/extractHighlightsPostProcess.d.ts +8 -4
  273. package/PostProcesses/extractHighlightsPostProcess.js +35 -22
  274. package/PostProcesses/extractHighlightsPostProcess.js.map +1 -1
  275. package/PostProcesses/index.d.ts +6 -0
  276. package/PostProcesses/index.js +6 -0
  277. package/PostProcesses/index.js.map +1 -1
  278. package/PostProcesses/postProcess.d.ts +15 -70
  279. package/PostProcesses/postProcess.js +80 -97
  280. package/PostProcesses/postProcess.js.map +1 -1
  281. package/PostProcesses/thinBlackAndWhitePostProcess.d.ts +28 -0
  282. package/PostProcesses/thinBlackAndWhitePostProcess.js +50 -0
  283. package/PostProcesses/thinBlackAndWhitePostProcess.js.map +1 -0
  284. package/PostProcesses/thinBloomEffect.d.ts +49 -0
  285. package/PostProcesses/thinBloomEffect.js +59 -0
  286. package/PostProcesses/thinBloomEffect.js.map +1 -0
  287. package/PostProcesses/thinBloomMergePostProcess.d.ts +15 -0
  288. package/PostProcesses/thinBloomMergePostProcess.js +38 -0
  289. package/PostProcesses/thinBloomMergePostProcess.js.map +1 -0
  290. package/PostProcesses/thinBlurPostProcess.d.ts +89 -0
  291. package/PostProcesses/thinBlurPostProcess.js +242 -0
  292. package/PostProcesses/thinBlurPostProcess.js.map +1 -0
  293. package/PostProcesses/thinCircleOfConfusionPostProcess.d.ts +62 -0
  294. package/PostProcesses/thinCircleOfConfusionPostProcess.js +81 -0
  295. package/PostProcesses/thinCircleOfConfusionPostProcess.js.map +1 -0
  296. package/PostProcesses/thinDepthOfFieldBlurPostProcess.d.ts +8 -0
  297. package/PostProcesses/thinDepthOfFieldBlurPostProcess.js +13 -0
  298. package/PostProcesses/thinDepthOfFieldBlurPostProcess.js.map +1 -0
  299. package/PostProcesses/thinDepthOfFieldEffect.d.ts +70 -0
  300. package/PostProcesses/thinDepthOfFieldEffect.js +115 -0
  301. package/PostProcesses/thinDepthOfFieldEffect.js.map +1 -0
  302. package/PostProcesses/thinDepthOfFieldMergePostProcess.d.ts +11 -0
  303. package/PostProcesses/thinDepthOfFieldMergePostProcess.js +30 -0
  304. package/PostProcesses/thinDepthOfFieldMergePostProcess.js.map +1 -0
  305. package/PostProcesses/thinExtractHighlightsPostProcess.d.ts +30 -0
  306. package/PostProcesses/thinExtractHighlightsPostProcess.js +55 -0
  307. package/PostProcesses/thinExtractHighlightsPostProcess.js.map +1 -0
  308. package/Rendering/depthPeelingRenderer.js +2 -2
  309. package/Rendering/depthPeelingRenderer.js.map +1 -1
  310. package/Rendering/fluidRenderer/fluidRenderingObject.js +4 -4
  311. package/Rendering/fluidRenderer/fluidRenderingObject.js.map +1 -1
  312. package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js +1 -1
  313. package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js.map +1 -1
  314. package/Shaders/ShadersInclude/pbrBlockPrePass.d.ts +5 -0
  315. package/Shaders/ShadersInclude/pbrBlockPrePass.js +75 -0
  316. package/Shaders/ShadersInclude/pbrBlockPrePass.js.map +1 -0
  317. package/Shaders/ShadersInclude/prePassVertex.js +1 -2
  318. package/Shaders/ShadersInclude/prePassVertex.js.map +1 -1
  319. package/Shaders/circleOfConfusion.fragment.js +9 -1
  320. package/Shaders/circleOfConfusion.fragment.js.map +1 -1
  321. package/Shaders/colorCorrection.fragment.js +1 -0
  322. package/Shaders/colorCorrection.fragment.js.map +1 -1
  323. package/Shaders/default.fragment.js +17 -25
  324. package/Shaders/default.fragment.js.map +1 -1
  325. package/Shaders/default.vertex.js +4 -6
  326. package/Shaders/default.vertex.js.map +1 -1
  327. package/Shaders/pbr.fragment.d.ts +1 -0
  328. package/Shaders/pbr.fragment.js +2 -74
  329. package/Shaders/pbr.fragment.js.map +1 -1
  330. package/Shaders/pbr.vertex.js +3 -3
  331. package/Shaders/pbr.vertex.js.map +1 -1
  332. package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.d.ts +5 -0
  333. package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.js +100 -0
  334. package/ShadersWGSL/ShadersInclude/pbrBlockPrePass.js.map +1 -0
  335. package/ShadersWGSL/ShadersInclude/prePassVertex.js +1 -2
  336. package/ShadersWGSL/ShadersInclude/prePassVertex.js.map +1 -1
  337. package/ShadersWGSL/background.vertex.js +1 -1
  338. package/ShadersWGSL/background.vertex.js.map +1 -1
  339. package/ShadersWGSL/circleOfConfusion.fragment.js +10 -2
  340. package/ShadersWGSL/circleOfConfusion.fragment.js.map +1 -1
  341. package/ShadersWGSL/default.fragment.js +20 -31
  342. package/ShadersWGSL/default.fragment.js.map +1 -1
  343. package/ShadersWGSL/default.vertex.js +4 -5
  344. package/ShadersWGSL/default.vertex.js.map +1 -1
  345. package/ShadersWGSL/glowMapGeneration.fragment.js +1 -1
  346. package/ShadersWGSL/glowMapGeneration.fragment.js.map +1 -1
  347. package/ShadersWGSL/glowMapGeneration.vertex.js +1 -1
  348. package/ShadersWGSL/glowMapGeneration.vertex.js.map +1 -1
  349. package/ShadersWGSL/pbr.fragment.d.ts +1 -0
  350. package/ShadersWGSL/pbr.fragment.js +2 -100
  351. package/ShadersWGSL/pbr.fragment.js.map +1 -1
  352. package/ShadersWGSL/pbr.vertex.js +4 -2
  353. package/ShadersWGSL/pbr.vertex.js.map +1 -1
  354. package/XR/features/WebXRRawCameraAccess.js +1 -1
  355. package/XR/features/WebXRRawCameraAccess.js.map +1 -1
  356. package/index.d.ts +1 -0
  357. package/index.js +1 -0
  358. package/index.js.map +1 -1
  359. package/package.json +1 -1
  360. package/scene.d.ts +19 -2
  361. package/scene.js +110 -13
  362. package/scene.js.map +1 -1
  363. package/sceneComponent.d.ts +0 -1
  364. package/sceneComponent.js +0 -1
  365. package/sceneComponent.js.map +1 -1
  366. package/types.d.ts +12 -0
  367. package/types.js.map +1 -1
@@ -0,0 +1,614 @@
1
+ import { __decorate } from "../../tslib.es6.js";
2
+ import { Observable } from "../../Misc/observable.js";
3
+ import { NodeRenderGraphOutputBlock } from "./Blocks/outputBlock.js";
4
+ import { FrameGraph } from "../frameGraph.js";
5
+ import { GetClass } from "../../Misc/typeStore.js";
6
+ import { serialize } from "../../Misc/decorators.js";
7
+ import { SerializationHelper } from "../../Misc/decorators.serialization.js";
8
+
9
+ import { WebRequest } from "../../Misc/webRequest.js";
10
+ import { NodeRenderGraphInputBlock } from "./Blocks/inputBlock.js";
11
+ import { Tools } from "../../Misc/tools.js";
12
+ import { Engine } from "../../Engines/engine.js";
13
+ import { NodeRenderGraphBlockConnectionPointTypes } from "./Types/nodeRenderGraphTypes.js";
14
+ import { NodeRenderGraphClearBlock } from "./Blocks/Textures/clearBlock.js";
15
+ import { NodeRenderGraphBuildState } from "./nodeRenderGraphBuildState.js";
16
+ /**
17
+ * Defines a node render graph
18
+ */
19
+ export class NodeRenderGraph {
20
+ /** @returns the inspector from bundle or global */
21
+ _getGlobalNodeRenderGraphEditor() {
22
+ // UMD Global name detection from Webpack Bundle UMD Name.
23
+ if (typeof NODERENDERGRAPHEDITOR !== "undefined") {
24
+ return NODERENDERGRAPHEDITOR;
25
+ }
26
+ // In case of module let's check the global emitted from the editor entry point.
27
+ if (typeof BABYLON !== "undefined" && typeof BABYLON.NodeRenderGraphEditor !== "undefined") {
28
+ return BABYLON;
29
+ }
30
+ return undefined;
31
+ }
32
+ /**
33
+ * Gets the frame graph used by this node render graph
34
+ */
35
+ get frameGraph() {
36
+ return this._frameGraph;
37
+ }
38
+ /**
39
+ * Gets the scene used by this node render graph
40
+ * @returns the scene used by this node render graph
41
+ */
42
+ getScene() {
43
+ return this._scene;
44
+ }
45
+ /**
46
+ * Creates a new node render graph
47
+ * @param name defines the name of the node render graph
48
+ * @param scene defines the scene to use to execute the graph
49
+ * @param options defines the options to use when creating the graph
50
+ */
51
+ constructor(name, scene, options) {
52
+ this._buildId = NodeRenderGraph._BuildIdGenerator++;
53
+ // eslint-disable-next-line @typescript-eslint/naming-convention
54
+ this.BJSNODERENDERGRAPHEDITOR = this._getGlobalNodeRenderGraphEditor();
55
+ /**
56
+ * Gets or sets data used by visual editor
57
+ * @see https://nrge.babylonjs.com
58
+ */
59
+ this.editorData = null;
60
+ /**
61
+ * Gets an array of blocks that needs to be serialized even if they are not yet connected
62
+ */
63
+ this.attachedBlocks = [];
64
+ /**
65
+ * Observable raised when the node render graph is built
66
+ */
67
+ this.onBuildObservable = new Observable();
68
+ /**
69
+ * Observable raised when an error is detected
70
+ */
71
+ this.onBuildErrorObservable = new Observable();
72
+ /** Gets or sets the RenderGraphOutputBlock used to gather the final node render graph data */
73
+ this.outputBlock = null;
74
+ this._resizeObserver = null;
75
+ this.name = name;
76
+ this._scene = scene;
77
+ this._engine = scene.getEngine();
78
+ options = {
79
+ debugTextures: false,
80
+ autoConfigure: false,
81
+ verbose: false,
82
+ rebuildGraphOnEngineResize: true,
83
+ autoFillExternalInputs: true,
84
+ ...options,
85
+ };
86
+ this._options = options;
87
+ this._frameGraph = new FrameGraph(this._engine, options.debugTextures, this._scene);
88
+ if (options.rebuildGraphOnEngineResize) {
89
+ this._resizeObserver = this._engine.onResizeObservable.add(() => {
90
+ this.build();
91
+ });
92
+ }
93
+ }
94
+ /**
95
+ * Gets the current class name ("NodeRenderGraph")
96
+ * @returns the class name
97
+ */
98
+ getClassName() {
99
+ return "NodeRenderGraph";
100
+ }
101
+ /**
102
+ * Gets a block by its name
103
+ * @param name defines the name of the block to retrieve
104
+ * @returns the required block or null if not found
105
+ */
106
+ getBlockByName(name) {
107
+ let result = null;
108
+ for (const block of this.attachedBlocks) {
109
+ if (block.name === name) {
110
+ if (!result) {
111
+ result = block;
112
+ }
113
+ else {
114
+ Tools.Warn("More than one block was found with the name `" + name + "`");
115
+ return result;
116
+ }
117
+ }
118
+ }
119
+ return result;
120
+ }
121
+ /**
122
+ * Get a block using a predicate
123
+ * @param predicate defines the predicate used to find the good candidate
124
+ * @returns the required block or null if not found
125
+ */
126
+ getBlockByPredicate(predicate) {
127
+ for (const block of this.attachedBlocks) {
128
+ if (predicate(block)) {
129
+ return block;
130
+ }
131
+ }
132
+ return null;
133
+ }
134
+ /**
135
+ * Get all blocks that match a predicate
136
+ * @param predicate defines the predicate used to find the good candidate(s)
137
+ * @returns the list of blocks found
138
+ */
139
+ getBlocksByPredicate(predicate) {
140
+ const blocks = [];
141
+ for (const block of this.attachedBlocks) {
142
+ if (predicate(block)) {
143
+ blocks.push(block);
144
+ }
145
+ }
146
+ return blocks;
147
+ }
148
+ /**
149
+ * Gets the list of input blocks attached to this material
150
+ * @returns an array of InputBlocks
151
+ */
152
+ getInputBlocks() {
153
+ const blocks = [];
154
+ for (const block of this.attachedBlocks) {
155
+ if (block.isInput) {
156
+ blocks.push(block);
157
+ }
158
+ }
159
+ return blocks;
160
+ }
161
+ /**
162
+ * Launch the node render graph editor
163
+ * @param config Define the configuration of the editor
164
+ * @returns a promise fulfilled when the node editor is visible
165
+ */
166
+ edit(config) {
167
+ return new Promise((resolve) => {
168
+ this.BJSNODERENDERGRAPHEDITOR = this.BJSNODERENDERGRAPHEDITOR || this._getGlobalNodeRenderGraphEditor();
169
+ if (typeof this.BJSNODERENDERGRAPHEDITOR == "undefined") {
170
+ const editorUrl = config && config.editorURL ? config.editorURL : NodeRenderGraph.EditorURL;
171
+ // Load editor and add it to the DOM
172
+ Tools.LoadBabylonScript(editorUrl, () => {
173
+ this.BJSNODERENDERGRAPHEDITOR = this.BJSNODERENDERGRAPHEDITOR || this._getGlobalNodeRenderGraphEditor();
174
+ this._createNodeEditor(config?.nodeRenderGraphEditorConfig);
175
+ resolve();
176
+ });
177
+ }
178
+ else {
179
+ // Otherwise creates the editor
180
+ this._createNodeEditor(config?.nodeRenderGraphEditorConfig);
181
+ resolve();
182
+ }
183
+ });
184
+ }
185
+ /**
186
+ * Creates the node editor window.
187
+ * @param additionalConfig Additional configuration for the FGE
188
+ */
189
+ _createNodeEditor(additionalConfig) {
190
+ const nodeEditorConfig = {
191
+ nodeRenderGraph: this,
192
+ ...additionalConfig,
193
+ };
194
+ this.BJSNODERENDERGRAPHEDITOR.NodeRenderGraphEditor.Show(nodeEditorConfig);
195
+ }
196
+ /**
197
+ * Build the final list of blocks that will be executed by the "execute" method
198
+ */
199
+ build() {
200
+ if (!this.outputBlock) {
201
+ throw new Error("You must define the outputBlock property before building the node render graph");
202
+ }
203
+ this._initializeBlock(this.outputBlock);
204
+ this._frameGraph.clear();
205
+ const state = new NodeRenderGraphBuildState();
206
+ state.buildId = this._buildId;
207
+ state.verbose = this._options.verbose;
208
+ if (this._options.autoFillExternalInputs) {
209
+ this._autoFillExternalInputs();
210
+ }
211
+ this.outputBlock.build(state);
212
+ this._frameGraph.build();
213
+ this._buildId = NodeRenderGraph._BuildIdGenerator++;
214
+ if (state.emitErrors(this.onBuildErrorObservable)) {
215
+ this.onBuildObservable.notifyObservers(this);
216
+ }
217
+ }
218
+ _autoFillExternalInputs() {
219
+ const allInputs = this.getInputBlocks();
220
+ let cameraIndex = 0;
221
+ for (const input of allInputs) {
222
+ if (!input.isExternal) {
223
+ continue;
224
+ }
225
+ if (!input.isAnAncestorOfType("NodeRenderGraphOutputBlock")) {
226
+ continue;
227
+ }
228
+ if ((input.type & NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBuffer) !== 0) {
229
+ // nothing to do
230
+ }
231
+ else if (input.isCamera()) {
232
+ const camera = this._scene.cameras[cameraIndex++] || this._scene.cameras[0];
233
+ if (!this._scene.cameraToUseForPointers) {
234
+ this._scene.cameraToUseForPointers = camera;
235
+ }
236
+ input.value = camera;
237
+ }
238
+ else if (input.isObjectList()) {
239
+ input.value = { meshes: this._scene.meshes, particleSystems: this._scene.particleSystems };
240
+ }
241
+ }
242
+ }
243
+ /**
244
+ * Returns a promise that resolves when the node render graph is ready to be executed
245
+ * This method must be called after the graph has been built (NodeRenderGraph.build called)!
246
+ * @param timeout Timeout in ms between retries (default is 16)
247
+ * @returns The promise that resolves when the graph is ready
248
+ */
249
+ whenReadyAsync(timeout = 16) {
250
+ return this._frameGraph.whenReadyAsync(timeout);
251
+ }
252
+ /**
253
+ * Execute the graph (the graph must have been built before!)
254
+ */
255
+ execute() {
256
+ this._frameGraph.execute();
257
+ }
258
+ _initializeBlock(node) {
259
+ node.initialize();
260
+ if (this._options.autoConfigure) {
261
+ node.autoConfigure();
262
+ }
263
+ if (this.attachedBlocks.indexOf(node) === -1) {
264
+ this.attachedBlocks.push(node);
265
+ }
266
+ for (const input of node.inputs) {
267
+ const connectedPoint = input.connectedPoint;
268
+ if (connectedPoint) {
269
+ const block = connectedPoint.ownerBlock;
270
+ if (block !== node) {
271
+ this._initializeBlock(block);
272
+ }
273
+ }
274
+ }
275
+ }
276
+ /**
277
+ * Clear the current graph
278
+ */
279
+ clear() {
280
+ this.outputBlock = null;
281
+ this.attachedBlocks.length = 0;
282
+ }
283
+ /**
284
+ * Remove a block from the current graph
285
+ * @param block defines the block to remove
286
+ */
287
+ removeBlock(block) {
288
+ const attachedBlockIndex = this.attachedBlocks.indexOf(block);
289
+ if (attachedBlockIndex > -1) {
290
+ this.attachedBlocks.splice(attachedBlockIndex, 1);
291
+ }
292
+ if (block === this.outputBlock) {
293
+ this.outputBlock = null;
294
+ }
295
+ }
296
+ /**
297
+ * Clear the current graph and load a new one from a serialization object
298
+ * @param source defines the JSON representation of the graph
299
+ * @param merge defines whether or not the source must be merged or replace the current content
300
+ */
301
+ parseSerializedObject(source, merge = false) {
302
+ if (!merge) {
303
+ this.clear();
304
+ }
305
+ const map = {};
306
+ // Create blocks
307
+ for (const parsedBlock of source.blocks) {
308
+ const blockType = GetClass(parsedBlock.customType);
309
+ if (blockType) {
310
+ const additionalConstructionParameters = parsedBlock.additionalConstructionParameters;
311
+ const block = additionalConstructionParameters
312
+ ? new blockType("", this._frameGraph, this._scene, ...additionalConstructionParameters)
313
+ : new blockType("", this._frameGraph, this._scene);
314
+ block._deserialize(parsedBlock);
315
+ map[parsedBlock.id] = block;
316
+ this.attachedBlocks.push(block);
317
+ }
318
+ }
319
+ // Reconnect teleportation
320
+ for (const block of this.attachedBlocks) {
321
+ if (block.isTeleportOut) {
322
+ const teleportOut = block;
323
+ const id = teleportOut._tempEntryPointUniqueId;
324
+ if (id) {
325
+ const source = map[id];
326
+ if (source) {
327
+ source.attachToEndpoint(teleportOut);
328
+ }
329
+ }
330
+ }
331
+ }
332
+ // Connections - Starts with input blocks only (except if in "merge" mode where we scan all blocks)
333
+ for (let blockIndex = 0; blockIndex < source.blocks.length; blockIndex++) {
334
+ const parsedBlock = source.blocks[blockIndex];
335
+ const block = map[parsedBlock.id];
336
+ if (!block) {
337
+ continue;
338
+ }
339
+ if (block.inputs.length && parsedBlock.inputs.some((i) => i.targetConnectionName) && !merge) {
340
+ continue;
341
+ }
342
+ this._restoreConnections(block, source, map);
343
+ }
344
+ // Outputs
345
+ if (source.outputNodeId) {
346
+ this.outputBlock = map[source.outputNodeId];
347
+ }
348
+ // UI related info
349
+ if (source.locations || (source.editorData && source.editorData.locations)) {
350
+ const locations = source.locations || source.editorData.locations;
351
+ for (const location of locations) {
352
+ if (map[location.blockId]) {
353
+ location.blockId = map[location.blockId].uniqueId;
354
+ }
355
+ }
356
+ if (merge && this.editorData && this.editorData.locations) {
357
+ locations.concat(this.editorData.locations);
358
+ }
359
+ if (source.locations) {
360
+ this.editorData = {
361
+ locations: locations,
362
+ };
363
+ }
364
+ else {
365
+ this.editorData = source.editorData;
366
+ this.editorData.locations = locations;
367
+ }
368
+ const blockMap = [];
369
+ for (const key in map) {
370
+ blockMap[key] = map[key].uniqueId;
371
+ }
372
+ this.editorData.map = blockMap;
373
+ }
374
+ this.comment = source.comment;
375
+ }
376
+ _restoreConnections(block, source, map) {
377
+ for (const outputPoint of block.outputs) {
378
+ for (const candidate of source.blocks) {
379
+ const target = map[candidate.id];
380
+ if (!target) {
381
+ continue;
382
+ }
383
+ for (const input of candidate.inputs) {
384
+ if (map[input.targetBlockId] === block && input.targetConnectionName === outputPoint.name) {
385
+ const inputPoint = target.getInputByName(input.inputName);
386
+ if (!inputPoint || inputPoint.isConnected) {
387
+ continue;
388
+ }
389
+ outputPoint.connectTo(inputPoint, true);
390
+ this._restoreConnections(target, source, map);
391
+ continue;
392
+ }
393
+ }
394
+ }
395
+ }
396
+ }
397
+ /**
398
+ * Generate a string containing the code declaration required to create an equivalent of this node render graph
399
+ * @returns a string
400
+ */
401
+ generateCode() {
402
+ let alreadyDumped = [];
403
+ const blocks = [];
404
+ const uniqueNames = ["const", "var", "let"];
405
+ // Gets active blocks
406
+ if (this.outputBlock) {
407
+ this._gatherBlocks(this.outputBlock, blocks);
408
+ }
409
+ // Generate
410
+ const options = JSON.stringify(this._options);
411
+ let codeString = `let nodeRenderGraph = new BABYLON.NodeRenderGraph("${this.name || "render graph"}", scene, ${options});\n`;
412
+ for (const node of blocks) {
413
+ if (node.isInput && alreadyDumped.indexOf(node) === -1) {
414
+ codeString += node._dumpCode(uniqueNames, alreadyDumped) + "\n";
415
+ }
416
+ }
417
+ if (this.outputBlock) {
418
+ // Connections
419
+ alreadyDumped = [];
420
+ codeString += "// Connections\n";
421
+ codeString += this.outputBlock._dumpCodeForOutputConnections(alreadyDumped);
422
+ // Output nodes
423
+ codeString += "// Output nodes\n";
424
+ codeString += `nodeRenderGraph.outputBlock = ${this.outputBlock._codeVariableName};\n`;
425
+ codeString += `nodeRenderGraph.build();\n`;
426
+ }
427
+ return codeString;
428
+ }
429
+ _gatherBlocks(rootNode, list) {
430
+ if (list.indexOf(rootNode) !== -1) {
431
+ return;
432
+ }
433
+ list.push(rootNode);
434
+ for (const input of rootNode.inputs) {
435
+ const connectedPoint = input.connectedPoint;
436
+ if (connectedPoint) {
437
+ const block = connectedPoint.ownerBlock;
438
+ if (block !== rootNode) {
439
+ this._gatherBlocks(block, list);
440
+ }
441
+ }
442
+ }
443
+ // Teleportation
444
+ if (rootNode.isTeleportOut) {
445
+ const block = rootNode;
446
+ if (block.entryPoint) {
447
+ this._gatherBlocks(block.entryPoint, list);
448
+ }
449
+ }
450
+ }
451
+ /**
452
+ * Clear the current graph and set it to a default state
453
+ */
454
+ setToDefault() {
455
+ this.clear();
456
+ this.editorData = null;
457
+ // Source
458
+ const backBuffer = new NodeRenderGraphInputBlock("BackBuffer color", this._frameGraph, this._scene, NodeRenderGraphBlockConnectionPointTypes.TextureBackBuffer);
459
+ // Clear texture
460
+ const clear = new NodeRenderGraphClearBlock("Clear", this._frameGraph, this._scene);
461
+ backBuffer.output.connectTo(clear.texture);
462
+ // Final output
463
+ const output = new NodeRenderGraphOutputBlock("Output", this._frameGraph, this._scene);
464
+ clear.output.connectTo(output.texture);
465
+ this.outputBlock = output;
466
+ }
467
+ /**
468
+ * Makes a duplicate of the current node render graph.
469
+ * @param name defines the name to use for the new node render graph
470
+ * @returns the new node render graph
471
+ */
472
+ clone(name) {
473
+ const serializationObject = this.serialize();
474
+ const clone = SerializationHelper.Clone(() => new NodeRenderGraph(name, this._scene), this);
475
+ clone.name = name;
476
+ clone.parseSerializedObject(serializationObject);
477
+ clone._buildId = this._buildId;
478
+ clone.build();
479
+ return clone;
480
+ }
481
+ /**
482
+ * Serializes this node render graph in a JSON representation
483
+ * @param selectedBlocks defines the list of blocks to save (if null the whole node render graph will be saved)
484
+ * @returns the serialized node render graph object
485
+ */
486
+ serialize(selectedBlocks) {
487
+ const serializationObject = selectedBlocks ? {} : SerializationHelper.Serialize(this);
488
+ serializationObject.editorData = JSON.parse(JSON.stringify(this.editorData)); // Copy
489
+ let blocks = [];
490
+ if (selectedBlocks) {
491
+ blocks = selectedBlocks;
492
+ }
493
+ else {
494
+ serializationObject.customType = "BABYLON.NodeRenderGraph";
495
+ if (this.outputBlock) {
496
+ serializationObject.outputNodeId = this.outputBlock.uniqueId;
497
+ }
498
+ }
499
+ // Blocks
500
+ serializationObject.blocks = [];
501
+ for (const block of blocks) {
502
+ serializationObject.blocks.push(block.serialize());
503
+ }
504
+ if (!selectedBlocks) {
505
+ for (const block of this.attachedBlocks) {
506
+ if (blocks.indexOf(block) !== -1) {
507
+ continue;
508
+ }
509
+ serializationObject.blocks.push(block.serialize());
510
+ }
511
+ }
512
+ return serializationObject;
513
+ }
514
+ /**
515
+ * Disposes the ressources
516
+ */
517
+ dispose() {
518
+ for (const block of this.attachedBlocks) {
519
+ block.dispose();
520
+ }
521
+ this._frameGraph.dispose();
522
+ this._frameGraph = undefined;
523
+ this._engine.onResizeObservable.remove(this._resizeObserver);
524
+ this._resizeObserver = null;
525
+ this.attachedBlocks.length = 0;
526
+ this.onBuildObservable.clear();
527
+ this.onBuildErrorObservable.clear();
528
+ }
529
+ /**
530
+ * Creates a new node render graph set to default basic configuration
531
+ * @param name defines the name of the node render graph
532
+ * @param scene defines the scene to use
533
+ * @param nodeRenderGraphOptions defines options to use when creating the node render graph
534
+ * @returns a new NodeRenderGraph
535
+ */
536
+ static CreateDefault(name, scene, nodeRenderGraphOptions) {
537
+ const renderGraph = new NodeRenderGraph(name, scene, nodeRenderGraphOptions);
538
+ renderGraph.setToDefault();
539
+ renderGraph.build();
540
+ return renderGraph;
541
+ }
542
+ /**
543
+ * Creates a node render graph from parsed graph data
544
+ * @param source defines the JSON representation of the node render graph
545
+ * @param scene defines the scene to use
546
+ * @param nodeRenderGraphOptions defines options to use when creating the node render
547
+ * @param skipBuild defines whether to skip building the node render graph (default is true)
548
+ * @returns a new node render graph
549
+ */
550
+ static Parse(source, scene, nodeRenderGraphOptions, skipBuild = true) {
551
+ const renderGraph = SerializationHelper.Parse(() => new NodeRenderGraph(source.name, scene, nodeRenderGraphOptions), source, null);
552
+ renderGraph.parseSerializedObject(source);
553
+ if (!skipBuild) {
554
+ renderGraph.build();
555
+ }
556
+ return renderGraph;
557
+ }
558
+ /**
559
+ * Creates a node render graph from a snippet saved by the node render graph editor
560
+ * @param snippetId defines the snippet to load
561
+ * @param scene defines the scene to use
562
+ * @param nodeRenderGraphOptions defines options to use when creating the node render graph
563
+ * @param nodeRenderGraph defines a node render graph to update (instead of creating a new one)
564
+ * @param skipBuild defines whether to skip building the node render graph (default is true)
565
+ * @returns a promise that will resolve to the new node render graph
566
+ */
567
+ static ParseFromSnippetAsync(snippetId, scene, nodeRenderGraphOptions, nodeRenderGraph, skipBuild = true) {
568
+ if (snippetId === "_BLANK") {
569
+ return Promise.resolve(NodeRenderGraph.CreateDefault("blank", scene, nodeRenderGraphOptions));
570
+ }
571
+ return new Promise((resolve, reject) => {
572
+ const request = new WebRequest();
573
+ request.addEventListener("readystatechange", () => {
574
+ if (request.readyState == 4) {
575
+ if (request.status == 200) {
576
+ const snippet = JSON.parse(JSON.parse(request.responseText).jsonPayload);
577
+ const serializationObject = JSON.parse(snippet.nodeRenderGraph);
578
+ if (!nodeRenderGraph) {
579
+ nodeRenderGraph = SerializationHelper.Parse(() => new NodeRenderGraph(snippetId, scene, nodeRenderGraphOptions), serializationObject, null);
580
+ }
581
+ nodeRenderGraph.parseSerializedObject(serializationObject);
582
+ nodeRenderGraph.snippetId = snippetId;
583
+ try {
584
+ if (!skipBuild) {
585
+ nodeRenderGraph.build();
586
+ }
587
+ resolve(nodeRenderGraph);
588
+ }
589
+ catch (err) {
590
+ reject(err);
591
+ }
592
+ }
593
+ else {
594
+ reject("Unable to load the snippet " + snippetId);
595
+ }
596
+ }
597
+ });
598
+ request.open("GET", this.SnippetUrl + "/" + snippetId.replace(/#/g, "/"));
599
+ request.send();
600
+ });
601
+ }
602
+ }
603
+ NodeRenderGraph._BuildIdGenerator = 0;
604
+ /** Define the Url to load node editor script */
605
+ NodeRenderGraph.EditorURL = `${Tools._DefaultCdnUrl}/v${Engine.Version}/NodeRenderGraph/babylon.nodeRenderGraph.js`;
606
+ /** Define the Url to load snippets */
607
+ NodeRenderGraph.SnippetUrl = `https://snippet.babylonjs.com`;
608
+ __decorate([
609
+ serialize()
610
+ ], NodeRenderGraph.prototype, "name", void 0);
611
+ __decorate([
612
+ serialize("comment")
613
+ ], NodeRenderGraph.prototype, "comment", void 0);
614
+ //# sourceMappingURL=nodeRenderGraph.js.map