@babylonjs/core 8.15.0 → 8.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. package/Animations/animatable.core.d.ts +6 -0
  2. package/Animations/animatable.core.js +7 -1
  3. package/Animations/animatable.core.js.map +1 -1
  4. package/Animations/animationGroup.d.ts +3 -1
  5. package/Animations/animationGroup.js +3 -2
  6. package/Animations/animationGroup.js.map +1 -1
  7. package/AudioV2/webAudio/components/webAudioParameterComponent.d.ts +8 -0
  8. package/AudioV2/webAudio/components/webAudioParameterComponent.js +36 -3
  9. package/AudioV2/webAudio/components/webAudioParameterComponent.js.map +1 -1
  10. package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.js +10 -0
  11. package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.js.map +1 -1
  12. package/AudioV2/webAudio/subProperties/spatialWebAudioListener.js +11 -0
  13. package/AudioV2/webAudio/subProperties/spatialWebAudioListener.js.map +1 -1
  14. package/AudioV2/webAudio/webAudioEngine.d.ts +7 -0
  15. package/AudioV2/webAudio/webAudioEngine.js +45 -0
  16. package/AudioV2/webAudio/webAudioEngine.js.map +1 -1
  17. package/AudioV2/webAudio/webAudioStaticSound.d.ts +1 -0
  18. package/AudioV2/webAudio/webAudioStaticSound.js +4 -1
  19. package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -1
  20. package/Behaviors/Cameras/framingBehavior.js +3 -3
  21. package/Behaviors/Cameras/framingBehavior.js.map +1 -1
  22. package/Debug/directionalLightFrustumViewer.d.ts +6 -0
  23. package/Debug/directionalLightFrustumViewer.js +39 -1
  24. package/Debug/directionalLightFrustumViewer.js.map +1 -1
  25. package/Engines/AbstractEngine/abstractEngine.alpha.d.ts +2 -1
  26. package/Engines/AbstractEngine/abstractEngine.alpha.js +9 -9
  27. package/Engines/AbstractEngine/abstractEngine.alpha.js.map +1 -1
  28. package/Engines/AbstractEngine/abstractEngine.states.d.ts +4 -104
  29. package/Engines/AbstractEngine/abstractEngine.states.js +4 -70
  30. package/Engines/AbstractEngine/abstractEngine.states.js.map +1 -1
  31. package/Engines/AbstractEngine/abstractEngine.stencil.d.ts +147 -0
  32. package/Engines/AbstractEngine/abstractEngine.stencil.js +93 -0
  33. package/Engines/AbstractEngine/abstractEngine.stencil.js.map +1 -0
  34. package/Engines/AbstractEngine/index.d.ts +1 -0
  35. package/Engines/AbstractEngine/index.js +1 -0
  36. package/Engines/AbstractEngine/index.js.map +1 -1
  37. package/Engines/Extensions/engine.alpha.d.ts +2 -1
  38. package/Engines/Extensions/engine.alpha.js +7 -78
  39. package/Engines/Extensions/engine.alpha.js.map +1 -1
  40. package/Engines/WebGL/webGL2ShaderProcessors.js +8 -1
  41. package/Engines/WebGL/webGL2ShaderProcessors.js.map +1 -1
  42. package/Engines/WebGPU/Extensions/engine.alpha.d.ts +2 -1
  43. package/Engines/WebGPU/Extensions/engine.alpha.js +12 -82
  44. package/Engines/WebGPU/Extensions/engine.alpha.js.map +1 -1
  45. package/Engines/WebGPU/webgpuCacheRenderPipeline.d.ts +12 -5
  46. package/Engines/WebGPU/webgpuCacheRenderPipeline.js +139 -72
  47. package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
  48. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +13 -1
  49. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
  50. package/Engines/WebGPU/webgpuStencilStateComposer.d.ts +8 -0
  51. package/Engines/WebGPU/webgpuStencilStateComposer.js +40 -0
  52. package/Engines/WebGPU/webgpuStencilStateComposer.js.map +1 -1
  53. package/Engines/abstractEngine.d.ts +7 -3
  54. package/Engines/abstractEngine.js +12 -5
  55. package/Engines/abstractEngine.js.map +1 -1
  56. package/Engines/constants.d.ts +30 -28
  57. package/Engines/constants.js +30 -28
  58. package/Engines/constants.js.map +1 -1
  59. package/Engines/engine.d.ts +10 -0
  60. package/Engines/engine.js +1 -0
  61. package/Engines/engine.js.map +1 -1
  62. package/Engines/engineCapabilities.d.ts +4 -0
  63. package/Engines/engineCapabilities.js.map +1 -1
  64. package/Engines/nativeEngine.d.ts +2 -1
  65. package/Engines/nativeEngine.js +6 -3
  66. package/Engines/nativeEngine.js.map +1 -1
  67. package/Engines/nullEngine.d.ts +2 -1
  68. package/Engines/nullEngine.js +7 -4
  69. package/Engines/nullEngine.js.map +1 -1
  70. package/Engines/thinEngine.js +16 -3
  71. package/Engines/thinEngine.js.map +1 -1
  72. package/Engines/webgpuEngine.d.ts +1 -0
  73. package/Engines/webgpuEngine.js +6 -4
  74. package/Engines/webgpuEngine.js.map +1 -1
  75. package/FrameGraph/Tasks/PostProcesses/passTask.d.ts +1 -1
  76. package/FrameGraph/Tasks/PostProcesses/passTask.js.map +1 -1
  77. package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +8 -1
  78. package/FrameGraph/Tasks/Rendering/objectRendererTask.js +14 -6
  79. package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
  80. package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.js +3 -0
  81. package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.js.map +1 -1
  82. package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js +6 -5
  83. package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js.map +1 -1
  84. package/FrameGraph/Tasks/Texture/clearTextureTask.d.ts +1 -1
  85. package/FrameGraph/Tasks/Texture/clearTextureTask.js +7 -5
  86. package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -1
  87. package/FrameGraph/frameGraph.d.ts +6 -0
  88. package/FrameGraph/frameGraph.js +8 -0
  89. package/FrameGraph/frameGraph.js.map +1 -1
  90. package/FrameGraph/frameGraphContext.d.ts +16 -0
  91. package/FrameGraph/frameGraphContext.js +23 -0
  92. package/FrameGraph/frameGraphContext.js.map +1 -1
  93. package/FrameGraph/frameGraphRenderContext.d.ts +9 -16
  94. package/FrameGraph/frameGraphRenderContext.js +15 -23
  95. package/FrameGraph/frameGraphRenderContext.js.map +1 -1
  96. package/FrameGraph/frameGraphUtils.d.ts +52 -0
  97. package/FrameGraph/frameGraphUtils.js +99 -0
  98. package/FrameGraph/frameGraphUtils.js.map +1 -0
  99. package/FrameGraph/index.d.ts +1 -0
  100. package/FrameGraph/index.js +1 -0
  101. package/FrameGraph/index.js.map +1 -1
  102. package/Gizmos/boundingBoxGizmo.js +2 -0
  103. package/Gizmos/boundingBoxGizmo.js.map +1 -1
  104. package/Loading/Plugins/babylonFileLoader.js +35 -2
  105. package/Loading/Plugins/babylonFileLoader.js.map +1 -1
  106. package/Materials/material.d.ts +32 -12
  107. package/Materials/material.js +49 -17
  108. package/Materials/material.js.map +1 -1
  109. package/Materials/materialStencilState.d.ts +24 -0
  110. package/Materials/materialStencilState.js +53 -1
  111. package/Materials/materialStencilState.js.map +1 -1
  112. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +4 -4
  113. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  114. package/Meshes/geometry.js +1 -1
  115. package/Meshes/geometry.js.map +1 -1
  116. package/Meshes/instancedMesh.d.ts +5 -0
  117. package/Meshes/instancedMesh.js +3 -3
  118. package/Meshes/instancedMesh.js.map +1 -1
  119. package/Meshes/mesh.d.ts +28 -5
  120. package/Meshes/mesh.js +127 -57
  121. package/Meshes/mesh.js.map +1 -1
  122. package/Meshes/thinInstanceMesh.js +4 -0
  123. package/Meshes/thinInstanceMesh.js.map +1 -1
  124. package/Misc/snapshotRenderingHelper.js +2 -1
  125. package/Misc/snapshotRenderingHelper.js.map +1 -1
  126. package/PostProcesses/RenderPipeline/Pipelines/taaMaterialManager.d.ts +71 -0
  127. package/PostProcesses/RenderPipeline/Pipelines/taaMaterialManager.js +156 -0
  128. package/PostProcesses/RenderPipeline/Pipelines/taaMaterialManager.js.map +1 -0
  129. package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.d.ts +13 -0
  130. package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.js +79 -3
  131. package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.js.map +1 -1
  132. package/PostProcesses/RenderPipeline/postProcessRenderPipeline.d.ts +4 -0
  133. package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js +5 -0
  134. package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js.map +1 -1
  135. package/PostProcesses/RenderPipeline/postProcessRenderPipelineManager.d.ts +12 -3
  136. package/PostProcesses/RenderPipeline/postProcessRenderPipelineManager.js +22 -1
  137. package/PostProcesses/RenderPipeline/postProcessRenderPipelineManager.js.map +1 -1
  138. package/PostProcesses/thinPassPostProcess.js +7 -3
  139. package/PostProcesses/thinPassPostProcess.js.map +1 -1
  140. package/PostProcesses/thinTAAPostProcess.d.ts +17 -0
  141. package/PostProcesses/thinTAAPostProcess.js +51 -0
  142. package/PostProcesses/thinTAAPostProcess.js.map +1 -1
  143. package/Rendering/edgesRenderer.js +3 -2
  144. package/Rendering/edgesRenderer.js.map +1 -1
  145. package/Rendering/geometryBufferRenderer.js +1 -1
  146. package/Rendering/geometryBufferRenderer.js.map +1 -1
  147. package/Rendering/outlineRenderer.js +1 -1
  148. package/Rendering/outlineRenderer.js.map +1 -1
  149. package/Shaders/lod.fragment.js +2 -3
  150. package/Shaders/lod.fragment.js.map +1 -1
  151. package/Shaders/taa.fragment.js +15 -1
  152. package/Shaders/taa.fragment.js.map +1 -1
  153. package/ShadersWGSL/lod.fragment.js +2 -2
  154. package/ShadersWGSL/lod.fragment.js.map +1 -1
  155. package/ShadersWGSL/taa.fragment.js +16 -2
  156. package/ShadersWGSL/taa.fragment.js.map +1 -1
  157. package/States/IStencilState.d.ts +6 -2
  158. package/States/IStencilState.js.map +1 -1
  159. package/States/alphaCullingState.d.ts +7 -5
  160. package/States/alphaCullingState.js +144 -33
  161. package/States/alphaCullingState.js.map +1 -1
  162. package/States/stencilState.d.ts +12 -0
  163. package/States/stencilState.js +29 -1
  164. package/States/stencilState.js.map +1 -1
  165. package/States/stencilStateComposer.d.ts +12 -0
  166. package/States/stencilStateComposer.js +48 -2
  167. package/States/stencilStateComposer.js.map +1 -1
  168. package/assetContainer.js +29 -8
  169. package/assetContainer.js.map +1 -1
  170. package/package.json +1 -1
  171. package/scene.d.ts +2 -1
  172. package/scene.js +1 -0
  173. package/scene.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"frameGraph.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/frameGraph.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,8BAA6B;AAClD,OAAO,EAAE,kBAAkB,EAAE,+BAA8B;AAC3D,OAAO,EAAE,MAAM,EAAE,0BAAyB;AAE1C,qDAAoD;AACpD,4DAA2D;AAE3D,IAAK,kBAIJ;AAJD,WAAK,kBAAkB;IACnB,+DAAU,CAAA;IACV,+DAAU,CAAA;IACV,2DAAQ,CAAA;AACZ,CAAC,EAJI,kBAAkB,KAAlB,kBAAkB,QAItB;AAED;;;GAGG;AACH,MAAM,OAAO,UAAU;IA6BnB;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED;;;OAGG;IACI,wBAAwB;QAC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AC,qBAAqB,GAAG,IAAI,CAAC;IACtC,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,qBAAqB,EAAE,EAAE,CAAC;QAC/B,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;QAClC,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;QAC/B,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;QAE/B,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACpD,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAC7C,CAAC;IACL,CAAC;CACJ","sourcesContent":["import type { Scene, AbstractEngine, FrameGraphTask, Nullable, NodeRenderGraph } from \"core/index\";\r\nimport { FrameGraphPass } from \"./Passes/pass\";\r\nimport { FrameGraphRenderPass } from \"./Passes/renderPass\";\r\nimport { FrameGraphCullPass } from \"./Passes/cullPass\";\r\nimport { FrameGraphRenderContext } from \"./frameGraphRenderContext\";\r\nimport { FrameGraphContext } from \"./frameGraphContext\";\r\nimport { FrameGraphTextureManager } from \"./frameGraphTextureManager\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport { _RetryWithInterval } from \"core/Misc/timingTools\";\r\nimport { Logger } from \"core/Misc/logger\";\r\n\r\nimport \"core/Engines/Extensions/engine.multiRender\";\r\nimport \"core/Engines/WebGPU/Extensions/engine.multiRender\";\r\n\r\nenum FrameGraphPassType {\r\n Normal = 0,\r\n Render = 1,\r\n Cull = 2,\r\n}\r\n\r\n/**\r\n * Class used to implement a frame graph\r\n * @experimental\r\n */\r\nexport class FrameGraph {\r\n /**\r\n * Gets the texture manager used by the frame graph\r\n */\r\n public readonly textureManager: FrameGraphTextureManager;\r\n\r\n private readonly _engine: AbstractEngine;\r\n private readonly _scene: Scene;\r\n private readonly _tasks: FrameGraphTask[] = [];\r\n private readonly _passContext: FrameGraphContext;\r\n private readonly _renderContext: FrameGraphRenderContext;\r\n private _currentProcessedTask: FrameGraphTask | null = null;\r\n private _whenReadyAsyncCancel: Nullable<() => void> = null;\r\n\r\n /**\r\n * Name of the frame graph\r\n */\r\n public name = \"Frame Graph\";\r\n\r\n /**\r\n * Gets or sets a boolean indicating that texture allocation should be optimized (that is, reuse existing textures when possible to limit GPU memory usage) (default: true)\r\n */\r\n public optimizeTextureAllocation = true;\r\n\r\n /**\r\n * Observable raised when the node render graph is built\r\n */\r\n public onBuildObservable = new Observable<FrameGraph>();\r\n\r\n /**\r\n * Gets the engine used by the frame graph\r\n */\r\n public get engine() {\r\n return this._engine;\r\n }\r\n\r\n /**\r\n * Gets the scene used by the frame graph\r\n */\r\n public get scene() {\r\n return this._scene;\r\n }\r\n\r\n /**\r\n * Gets the list of tasks in the frame graph\r\n */\r\n public get tasks() {\r\n return this._tasks;\r\n }\r\n\r\n /**\r\n * Gets the node render graph linked to the frame graph (if any)\r\n * @returns the linked node render graph or null if none\r\n */\r\n public getLinkedNodeRenderGraph(): Nullable<NodeRenderGraph> {\r\n return this._linkedNodeRenderGraph;\r\n }\r\n\r\n /**\r\n * Constructs the frame graph\r\n * @param scene defines the scene the frame graph is associated with\r\n * @param debugTextures defines a boolean indicating that textures created by the frame graph should be visible in the inspector (default is false)\r\n * @param _linkedNodeRenderGraph defines the linked node render graph (if any)\r\n */\r\n constructor(\r\n scene: Scene,\r\n debugTextures = false,\r\n private readonly _linkedNodeRenderGraph: Nullable<NodeRenderGraph> = null\r\n ) {\r\n this._scene = scene;\r\n this._engine = scene.getEngine();\r\n this.textureManager = new FrameGraphTextureManager(this._engine, debugTextures, scene);\r\n this._passContext = new FrameGraphContext(this._engine, this.textureManager, scene);\r\n this._renderContext = new FrameGraphRenderContext(this._engine, this.textureManager, scene);\r\n\r\n this._scene.frameGraphs.push(this);\r\n }\r\n\r\n /**\r\n * Gets the class name of the frame graph\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"FrameGraph\";\r\n }\r\n\r\n /**\r\n * Gets a task by name\r\n * @param name Name of the task to get\r\n * @returns The task or undefined if not found\r\n */\r\n public getTaskByName<T extends FrameGraphTask>(name: string): T | undefined {\r\n return this._tasks.find((t) => t.name === name) as T;\r\n }\r\n\r\n /**\r\n * Adds a task to the frame graph\r\n * @param task Task to add\r\n */\r\n public addTask(task: FrameGraphTask): void {\r\n if (this._currentProcessedTask !== null) {\r\n throw new Error(`FrameGraph.addTask: Can't add the task \"${task.name}\" while another task is currently building (task: ${this._currentProcessedTask.name}).`);\r\n }\r\n\r\n this._tasks.push(task);\r\n }\r\n\r\n /**\r\n * Adds a pass to a task. This method can only be called during a Task.record execution.\r\n * @param name The name of the pass\r\n * @param whenTaskDisabled If true, the pass will be added to the list of passes to execute when the task is disabled (default is false)\r\n * @returns The render pass created\r\n */\r\n public addPass(name: string, whenTaskDisabled = false): FrameGraphPass<FrameGraphContext> {\r\n return this._addPass(name, FrameGraphPassType.Normal, whenTaskDisabled) as FrameGraphPass<FrameGraphContext>;\r\n }\r\n\r\n /**\r\n * Adds a render pass to a task. This method can only be called during a Task.record execution.\r\n * @param name The name of the pass\r\n * @param whenTaskDisabled If true, the pass will be added to the list of passes to execute when the task is disabled (default is false)\r\n * @returns The render pass created\r\n */\r\n public addRenderPass(name: string, whenTaskDisabled = false): FrameGraphRenderPass {\r\n return this._addPass(name, FrameGraphPassType.Render, whenTaskDisabled) as FrameGraphRenderPass;\r\n }\r\n\r\n /**\r\n * Adds a cull pass to a task. This method can only be called during a Task.record execution.\r\n * @param name The name of the pass\r\n * @param whenTaskDisabled If true, the pass will be added to the list of passes to execute when the task is disabled (default is false)\r\n * @returns The cull pass created\r\n */\r\n public addCullPass(name: string, whenTaskDisabled = false): FrameGraphCullPass {\r\n return this._addPass(name, FrameGraphPassType.Cull, whenTaskDisabled) as FrameGraphCullPass;\r\n }\r\n\r\n private _addPass(name: string, passType: FrameGraphPassType, whenTaskDisabled = false): FrameGraphPass<FrameGraphContext> | FrameGraphRenderPass {\r\n if (!this._currentProcessedTask) {\r\n throw new Error(\"FrameGraph: A pass must be created during a Task.record execution only.\");\r\n }\r\n\r\n let pass: FrameGraphPass<FrameGraphContext> | FrameGraphRenderPass;\r\n\r\n switch (passType) {\r\n case FrameGraphPassType.Render:\r\n pass = new FrameGraphRenderPass(name, this._currentProcessedTask, this._renderContext, this._engine);\r\n break;\r\n case FrameGraphPassType.Cull:\r\n pass = new FrameGraphCullPass(name, this._currentProcessedTask, this._passContext, this._engine);\r\n break;\r\n default:\r\n pass = new FrameGraphPass(name, this._currentProcessedTask, this._passContext);\r\n break;\r\n }\r\n\r\n this._currentProcessedTask._addPass(pass, whenTaskDisabled);\r\n\r\n return pass;\r\n }\r\n\r\n /**\r\n * Builds the frame graph.\r\n * This method should be called after all tasks have been added to the frame graph (FrameGraph.addTask) and before the graph is executed (FrameGraph.execute).\r\n */\r\n public build(): void {\r\n this.textureManager._releaseTextures(false);\r\n\r\n try {\r\n for (const task of this._tasks) {\r\n task._reset();\r\n\r\n this._currentProcessedTask = task;\r\n this.textureManager._isRecordingTask = true;\r\n\r\n task.record();\r\n\r\n this.textureManager._isRecordingTask = false;\r\n this._currentProcessedTask = null;\r\n }\r\n\r\n this.textureManager._allocateTextures(this.optimizeTextureAllocation ? this._tasks : undefined);\r\n\r\n for (const task of this._tasks) {\r\n task._checkTask();\r\n }\r\n\r\n for (const task of this._tasks) {\r\n task.onTexturesAllocatedObservable.notifyObservers(this._renderContext);\r\n }\r\n\r\n this.onBuildObservable.notifyObservers(this);\r\n } catch (e) {\r\n this._tasks.length = 0;\r\n this._currentProcessedTask = null;\r\n this.textureManager._isRecordingTask = false;\r\n throw e;\r\n }\r\n }\r\n\r\n /**\r\n * Returns a promise that resolves when the frame graph is ready to be executed\r\n * This method must be called after the graph has been built (FrameGraph.build called)!\r\n * @param timeStep Time step in ms between retries (default is 16)\r\n * @param maxTimeout Maximum time in ms to wait for the graph to be ready (default is 30000)\r\n * @returns The promise that resolves when the graph is ready\r\n */\r\n public async whenReadyAsync(timeStep = 16, maxTimeout = 30000): Promise<void> {\r\n let firstNotReadyTask: FrameGraphTask | null = null;\r\n return await new Promise((resolve) => {\r\n this._whenReadyAsyncCancel = _RetryWithInterval(\r\n () => {\r\n let ready = this._renderContext._isReady();\r\n for (const task of this._tasks) {\r\n const taskIsReady = task.isReady();\r\n if (!taskIsReady && !firstNotReadyTask) {\r\n firstNotReadyTask = task;\r\n }\r\n ready &&= taskIsReady;\r\n }\r\n return ready;\r\n },\r\n () => {\r\n this._whenReadyAsyncCancel = null;\r\n resolve();\r\n },\r\n (err, isTimeout) => {\r\n this._whenReadyAsyncCancel = null;\r\n if (!isTimeout) {\r\n Logger.Error(\"FrameGraph: An unexpected error occurred while waiting for the frame graph to be ready.\");\r\n if (err) {\r\n Logger.Error(err);\r\n if (err.stack) {\r\n Logger.Error(err.stack);\r\n }\r\n }\r\n } else {\r\n Logger.Error(\r\n `FrameGraph: Timeout while waiting for the frame graph to be ready.${firstNotReadyTask ? ` First task not ready: ${firstNotReadyTask.name}` : \"\"}`\r\n );\r\n if (err) {\r\n Logger.Error(err);\r\n }\r\n }\r\n },\r\n timeStep,\r\n maxTimeout\r\n );\r\n });\r\n }\r\n\r\n /**\r\n * Executes the frame graph.\r\n */\r\n public execute(): void {\r\n this._renderContext.bindRenderTarget();\r\n\r\n this.textureManager._updateHistoryTextures();\r\n\r\n for (const task of this._tasks) {\r\n const passes = task._getPasses();\r\n\r\n for (const pass of passes) {\r\n pass._execute();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Clears the frame graph (remove the tasks and release the textures).\r\n * The frame graph can be built again after this method is called.\r\n */\r\n public clear(): void {\r\n this._whenReadyAsyncCancel?.();\r\n this._whenReadyAsyncCancel = null;\r\n\r\n for (const task of this._tasks) {\r\n task._reset();\r\n }\r\n\r\n this._tasks.length = 0;\r\n this.textureManager._releaseTextures();\r\n this._currentProcessedTask = null;\r\n }\r\n\r\n /**\r\n * Disposes the frame graph\r\n */\r\n public dispose(): void {\r\n this._whenReadyAsyncCancel?.();\r\n this._whenReadyAsyncCancel = null;\r\n this.clear();\r\n this.textureManager._dispose();\r\n this._renderContext._dispose();\r\n\r\n const index = this._scene.frameGraphs.indexOf(this);\r\n if (index !== -1) {\r\n this._scene.frameGraphs.splice(index, 1);\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"frameGraph.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/frameGraph.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,8BAA6B;AAClD,OAAO,EAAE,kBAAkB,EAAE,+BAA8B;AAC3D,OAAO,EAAE,MAAM,EAAE,0BAAyB;AAE1C,qDAAoD;AACpD,4DAA2D;AAE3D,IAAK,kBAIJ;AAJD,WAAK,kBAAkB;IACnB,+DAAU,CAAA;IACV,+DAAU,CAAA;IACV,2DAAQ,CAAA;AACZ,CAAC,EAJI,kBAAkB,KAAlB,kBAAkB,QAItB;AAED;;;GAGG;AACH,MAAM,OAAO,UAAU;IA6BnB;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,IAAW,KAA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AAG,IAAI,CAAC;QAElC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAC7B,IAAI,CAAC,MAAM,EAAE,CAAC;QAClB,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;QACvB,IAAI,CAAC,cAAc,CAAC,gBAAgB,EAAE,CAAC;QACvC,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;IACtC,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,qBAAqB,EAAE,EAAE,CAAC;QAC/B,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;QAClC,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;QAC/B,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;QAE/B,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACpD,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAC7C,CAAC;IACL,CAAC;CACJ","sourcesContent":["import type { Scene, AbstractEngine, FrameGraphTask, Nullable, NodeRenderGraph } from \"core/index\";\r\nimport { FrameGraphPass } from \"./Passes/pass\";\r\nimport { FrameGraphRenderPass } from \"./Passes/renderPass\";\r\nimport { FrameGraphCullPass } from \"./Passes/cullPass\";\r\nimport { FrameGraphRenderContext } from \"./frameGraphRenderContext\";\r\nimport { FrameGraphContext } from \"./frameGraphContext\";\r\nimport { FrameGraphTextureManager } from \"./frameGraphTextureManager\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport { _RetryWithInterval } from \"core/Misc/timingTools\";\r\nimport { Logger } from \"core/Misc/logger\";\r\n\r\nimport \"core/Engines/Extensions/engine.multiRender\";\r\nimport \"core/Engines/WebGPU/Extensions/engine.multiRender\";\r\n\r\nenum FrameGraphPassType {\r\n Normal = 0,\r\n Render = 1,\r\n Cull = 2,\r\n}\r\n\r\n/**\r\n * Class used to implement a frame graph\r\n * @experimental\r\n */\r\nexport class FrameGraph {\r\n /**\r\n * Gets the texture manager used by the frame graph\r\n */\r\n public readonly textureManager: FrameGraphTextureManager;\r\n\r\n private readonly _engine: AbstractEngine;\r\n private readonly _scene: Scene;\r\n private readonly _tasks: FrameGraphTask[] = [];\r\n private readonly _passContext: FrameGraphContext;\r\n private readonly _renderContext: FrameGraphRenderContext;\r\n private _currentProcessedTask: FrameGraphTask | null = null;\r\n private _whenReadyAsyncCancel: Nullable<() => void> = null;\r\n\r\n /**\r\n * Name of the frame graph\r\n */\r\n public name = \"Frame Graph\";\r\n\r\n /**\r\n * Gets or sets a boolean indicating that texture allocation should be optimized (that is, reuse existing textures when possible to limit GPU memory usage) (default: true)\r\n */\r\n public optimizeTextureAllocation = true;\r\n\r\n /**\r\n * Observable raised when the node render graph is built\r\n */\r\n public onBuildObservable = new Observable<FrameGraph>();\r\n\r\n /**\r\n * Gets the engine used by the frame graph\r\n */\r\n public get engine() {\r\n return this._engine;\r\n }\r\n\r\n /**\r\n * Gets the scene used by the frame graph\r\n */\r\n public get scene() {\r\n return this._scene;\r\n }\r\n\r\n /**\r\n * Gets the list of tasks in the frame graph\r\n */\r\n public get tasks() {\r\n return this._tasks;\r\n }\r\n\r\n /**\r\n * Gets the node render graph linked to the frame graph (if any)\r\n * @returns the linked node render graph or null if none\r\n */\r\n public getLinkedNodeRenderGraph(): Nullable<NodeRenderGraph> {\r\n return this._linkedNodeRenderGraph;\r\n }\r\n\r\n /**\r\n * Constructs the frame graph\r\n * @param scene defines the scene the frame graph is associated with\r\n * @param debugTextures defines a boolean indicating that textures created by the frame graph should be visible in the inspector (default is false)\r\n * @param _linkedNodeRenderGraph defines the linked node render graph (if any)\r\n */\r\n constructor(\r\n scene: Scene,\r\n debugTextures = false,\r\n private readonly _linkedNodeRenderGraph: Nullable<NodeRenderGraph> = null\r\n ) {\r\n this._scene = scene;\r\n this._engine = scene.getEngine();\r\n this.textureManager = new FrameGraphTextureManager(this._engine, debugTextures, scene);\r\n this._passContext = new FrameGraphContext(this._engine, this.textureManager, scene);\r\n this._renderContext = new FrameGraphRenderContext(this._engine, this.textureManager, scene);\r\n\r\n this._scene.frameGraphs.push(this);\r\n }\r\n\r\n /**\r\n * Gets the class name of the frame graph\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"FrameGraph\";\r\n }\r\n\r\n /**\r\n * Gets a task by name\r\n * @param name Name of the task to get\r\n * @returns The task or undefined if not found\r\n */\r\n public getTaskByName<T extends FrameGraphTask>(name: string): T | undefined {\r\n return this._tasks.find((t) => t.name === name) as T;\r\n }\r\n\r\n /**\r\n * Gets all tasks of a specific type\r\n * @param taskType Type of the task(s) to get\r\n * @returns The list of tasks of the specified type\r\n */\r\n public getTasksByType<T extends FrameGraphTask>(taskType: new (...args: any[]) => T): T[] {\r\n return this._tasks.filter((t) => t instanceof taskType) as T[];\r\n }\r\n\r\n /**\r\n * Adds a task to the frame graph\r\n * @param task Task to add\r\n */\r\n public addTask(task: FrameGraphTask): void {\r\n if (this._currentProcessedTask !== null) {\r\n throw new Error(`FrameGraph.addTask: Can't add the task \"${task.name}\" while another task is currently building (task: ${this._currentProcessedTask.name}).`);\r\n }\r\n\r\n this._tasks.push(task);\r\n }\r\n\r\n /**\r\n * Adds a pass to a task. This method can only be called during a Task.record execution.\r\n * @param name The name of the pass\r\n * @param whenTaskDisabled If true, the pass will be added to the list of passes to execute when the task is disabled (default is false)\r\n * @returns The render pass created\r\n */\r\n public addPass(name: string, whenTaskDisabled = false): FrameGraphPass<FrameGraphContext> {\r\n return this._addPass(name, FrameGraphPassType.Normal, whenTaskDisabled) as FrameGraphPass<FrameGraphContext>;\r\n }\r\n\r\n /**\r\n * Adds a render pass to a task. This method can only be called during a Task.record execution.\r\n * @param name The name of the pass\r\n * @param whenTaskDisabled If true, the pass will be added to the list of passes to execute when the task is disabled (default is false)\r\n * @returns The render pass created\r\n */\r\n public addRenderPass(name: string, whenTaskDisabled = false): FrameGraphRenderPass {\r\n return this._addPass(name, FrameGraphPassType.Render, whenTaskDisabled) as FrameGraphRenderPass;\r\n }\r\n\r\n /**\r\n * Adds a cull pass to a task. This method can only be called during a Task.record execution.\r\n * @param name The name of the pass\r\n * @param whenTaskDisabled If true, the pass will be added to the list of passes to execute when the task is disabled (default is false)\r\n * @returns The cull pass created\r\n */\r\n public addCullPass(name: string, whenTaskDisabled = false): FrameGraphCullPass {\r\n return this._addPass(name, FrameGraphPassType.Cull, whenTaskDisabled) as FrameGraphCullPass;\r\n }\r\n\r\n private _addPass(name: string, passType: FrameGraphPassType, whenTaskDisabled = false): FrameGraphPass<FrameGraphContext> | FrameGraphRenderPass {\r\n if (!this._currentProcessedTask) {\r\n throw new Error(\"FrameGraph: A pass must be created during a Task.record execution only.\");\r\n }\r\n\r\n let pass: FrameGraphPass<FrameGraphContext> | FrameGraphRenderPass;\r\n\r\n switch (passType) {\r\n case FrameGraphPassType.Render:\r\n pass = new FrameGraphRenderPass(name, this._currentProcessedTask, this._renderContext, this._engine);\r\n break;\r\n case FrameGraphPassType.Cull:\r\n pass = new FrameGraphCullPass(name, this._currentProcessedTask, this._passContext, this._engine);\r\n break;\r\n default:\r\n pass = new FrameGraphPass(name, this._currentProcessedTask, this._passContext);\r\n break;\r\n }\r\n\r\n this._currentProcessedTask._addPass(pass, whenTaskDisabled);\r\n\r\n return pass;\r\n }\r\n\r\n /**\r\n * Builds the frame graph.\r\n * This method should be called after all tasks have been added to the frame graph (FrameGraph.addTask) and before the graph is executed (FrameGraph.execute).\r\n */\r\n public build(): void {\r\n this.textureManager._releaseTextures(false);\r\n\r\n try {\r\n for (const task of this._tasks) {\r\n task._reset();\r\n\r\n this._currentProcessedTask = task;\r\n this.textureManager._isRecordingTask = true;\r\n\r\n task.record();\r\n\r\n this.textureManager._isRecordingTask = false;\r\n this._currentProcessedTask = null;\r\n }\r\n\r\n this.textureManager._allocateTextures(this.optimizeTextureAllocation ? this._tasks : undefined);\r\n\r\n for (const task of this._tasks) {\r\n task._checkTask();\r\n }\r\n\r\n for (const task of this._tasks) {\r\n task.onTexturesAllocatedObservable.notifyObservers(this._renderContext);\r\n }\r\n\r\n this.onBuildObservable.notifyObservers(this);\r\n } catch (e) {\r\n this._tasks.length = 0;\r\n this._currentProcessedTask = null;\r\n this.textureManager._isRecordingTask = false;\r\n throw e;\r\n }\r\n }\r\n\r\n /**\r\n * Returns a promise that resolves when the frame graph is ready to be executed\r\n * This method must be called after the graph has been built (FrameGraph.build called)!\r\n * @param timeStep Time step in ms between retries (default is 16)\r\n * @param maxTimeout Maximum time in ms to wait for the graph to be ready (default is 30000)\r\n * @returns The promise that resolves when the graph is ready\r\n */\r\n public async whenReadyAsync(timeStep = 16, maxTimeout = 30000): Promise<void> {\r\n let firstNotReadyTask: FrameGraphTask | null = null;\r\n return await new Promise((resolve) => {\r\n this._whenReadyAsyncCancel = _RetryWithInterval(\r\n () => {\r\n let ready = this._renderContext._isReady();\r\n for (const task of this._tasks) {\r\n const taskIsReady = task.isReady();\r\n if (!taskIsReady && !firstNotReadyTask) {\r\n firstNotReadyTask = task;\r\n }\r\n ready &&= taskIsReady;\r\n }\r\n return ready;\r\n },\r\n () => {\r\n this._whenReadyAsyncCancel = null;\r\n resolve();\r\n },\r\n (err, isTimeout) => {\r\n this._whenReadyAsyncCancel = null;\r\n if (!isTimeout) {\r\n Logger.Error(\"FrameGraph: An unexpected error occurred while waiting for the frame graph to be ready.\");\r\n if (err) {\r\n Logger.Error(err);\r\n if (err.stack) {\r\n Logger.Error(err.stack);\r\n }\r\n }\r\n } else {\r\n Logger.Error(\r\n `FrameGraph: Timeout while waiting for the frame graph to be ready.${firstNotReadyTask ? ` First task not ready: ${firstNotReadyTask.name}` : \"\"}`\r\n );\r\n if (err) {\r\n Logger.Error(err);\r\n }\r\n }\r\n },\r\n timeStep,\r\n maxTimeout\r\n );\r\n });\r\n }\r\n\r\n /**\r\n * Executes the frame graph.\r\n */\r\n public execute(): void {\r\n this._renderContext.bindRenderTarget();\r\n\r\n this.textureManager._updateHistoryTextures();\r\n\r\n for (const task of this._tasks) {\r\n const passes = task._getPasses();\r\n\r\n for (const pass of passes) {\r\n pass._execute();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Clears the frame graph (remove the tasks and release the textures).\r\n * The frame graph can be built again after this method is called.\r\n */\r\n public clear(): void {\r\n this._whenReadyAsyncCancel?.();\r\n this._whenReadyAsyncCancel = null;\r\n\r\n for (const task of this._tasks) {\r\n task._reset();\r\n }\r\n\r\n this._tasks.length = 0;\r\n this.textureManager._releaseTextures();\r\n this._currentProcessedTask = null;\r\n }\r\n\r\n /**\r\n * Disposes the frame graph\r\n */\r\n public dispose(): void {\r\n this._whenReadyAsyncCancel?.();\r\n this._whenReadyAsyncCancel = null;\r\n this.clear();\r\n this.textureManager._dispose();\r\n this._renderContext._dispose();\r\n\r\n const index = this._scene.frameGraphs.indexOf(this);\r\n if (index !== -1) {\r\n this._scene.frameGraphs.splice(index, 1);\r\n }\r\n }\r\n}\r\n"]}
@@ -6,6 +6,8 @@ export declare class FrameGraphContext {
6
6
  protected readonly _engine: AbstractEngine;
7
7
  protected readonly _textureManager: FrameGraphTextureManager;
8
8
  protected readonly _scene: Scene;
9
+ private _depthTest;
10
+ private _depthWrite;
9
11
  /** @internal */
10
12
  constructor(_engine: AbstractEngine, _textureManager: FrameGraphTextureManager, _scene: Scene);
11
13
  /**
@@ -32,4 +34,18 @@ export declare class FrameGraphContext {
32
34
  * Pops a debug group from the engine's debug stack.
33
35
  */
34
36
  popDebugGroup(): void;
37
+ /**
38
+ * Saves the current depth states (depth testing and depth writing)
39
+ */
40
+ saveDepthStates(): void;
41
+ /**
42
+ * Restores the depth states saved by saveDepthStates
43
+ */
44
+ restoreDepthStates(): void;
45
+ /**
46
+ * Sets the depth states for the current render target
47
+ * @param depthTest If true, depth testing is enabled
48
+ * @param depthWrite If true, depth writing is enabled
49
+ */
50
+ setDepthStates(depthTest: boolean, depthWrite: boolean): void;
35
51
  }
@@ -49,5 +49,28 @@ export class FrameGraphContext {
49
49
  popDebugGroup() {
50
50
  this._engine._debugPopGroup?.(1);
51
51
  }
52
+ /**
53
+ * Saves the current depth states (depth testing and depth writing)
54
+ */
55
+ saveDepthStates() {
56
+ this._depthTest = this._engine.getDepthBuffer();
57
+ this._depthWrite = this._engine.getDepthWrite();
58
+ }
59
+ /**
60
+ * Restores the depth states saved by saveDepthStates
61
+ */
62
+ restoreDepthStates() {
63
+ this._engine.setDepthBuffer(this._depthTest);
64
+ this._engine.setDepthWrite(this._depthWrite);
65
+ }
66
+ /**
67
+ * Sets the depth states for the current render target
68
+ * @param depthTest If true, depth testing is enabled
69
+ * @param depthWrite If true, depth writing is enabled
70
+ */
71
+ setDepthStates(depthTest, depthWrite) {
72
+ this._engine.setDepthBuffer(depthTest);
73
+ this._engine.setDepthWrite(depthWrite);
74
+ }
52
75
  }
53
76
  //# sourceMappingURL=frameGraphContext.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"frameGraphContext.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/frameGraphContext.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAC1B,gBAAgB;IAChB,YACuB,OAAuB,EACvB,eAAyC,EACzC,MAAa;QAFb,YAAO,GAAP,OAAO,CAAgB;QACvB,oBAAe,GAAf,eAAe,CAA0B;QACzC,WAAM,GAAN,MAAM,CAAO;IACjC,CAAC;IAEJ;;;;OAIG;IACI,eAAe,CAAC,SAAiC;QACpD,MAAM,mBAAmB,GAAG,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC;QAE9D,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;QAChC,IAAI,CAAC,MAAM,CAAC,mBAAmB,EAAE,CAAC;QAElC,SAAS,CAAC,MAAM,EAAE,CAAC;QAEnB,IAAI,IAAI,CAAC,OAAO,CAAC,oBAAoB,KAAK,mBAAmB,EAAE,CAAC;YAC5D,IAAI,CAAC,mBAAmB,EAAE,CAAC;gBACvB,IAAI,CAAC,OAAO,CAAC,yBAAyB,EAAE,CAAC;YAC7C,CAAC;iBAAM,CAAC;gBACJ,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,mBAAmB,CAAC,CAAC;YACtD,CAAC;QACL,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACI,oBAAoB,CAAC,MAA+B;QACvD,OAAO,IAAI,CAAC,eAAe,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAC7D,CAAC;IAED;;;OAGG;IACI,cAAc,CAAC,IAAY;QAC9B,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAC5C,CAAC;IAED;;OAEG;IACI,aAAa;QAChB,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC;CACJ","sourcesContent":["import type { AbstractEngine, FrameGraphTextureManager, Scene, FrameGraphTextureHandle, Nullable, InternalTexture } from \"core/index\";\r\n\r\n/**\r\n * Base class for frame graph context.\r\n */\r\nexport class FrameGraphContext {\r\n /** @internal */\r\n constructor(\r\n protected readonly _engine: AbstractEngine,\r\n protected readonly _textureManager: FrameGraphTextureManager,\r\n protected readonly _scene: Scene\r\n ) {}\r\n\r\n /**\r\n * Renders a component without managing the render target.\r\n * Use this method when you have a component that handles its own rendering logic which is not fully integrated into the frame graph system.\r\n * @param component The component to render.\r\n */\r\n public renderUnmanaged(component: { render: () => void }): void {\r\n const currentRenderTarget = this._engine._currentRenderTarget;\r\n\r\n this._scene.incrementRenderId();\r\n this._scene.resetCachedMaterial();\r\n\r\n component.render();\r\n\r\n if (this._engine._currentRenderTarget !== currentRenderTarget) {\r\n if (!currentRenderTarget) {\r\n this._engine.restoreDefaultFramebuffer();\r\n } else {\r\n this._engine.bindFramebuffer(currentRenderTarget);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets a texture from a handle.\r\n * Note that if the texture is a history texture, the read texture for the current frame will be returned.\r\n * @param handle The handle of the texture\r\n * @returns The texture or null if not found\r\n */\r\n public getTextureFromHandle(handle: FrameGraphTextureHandle): Nullable<InternalTexture> {\r\n return this._textureManager.getTextureFromHandle(handle);\r\n }\r\n\r\n /**\r\n * Pushes a debug group to the engine's debug stack.\r\n * @param name The name of the debug group\r\n */\r\n public pushDebugGroup(name: string) {\r\n this._engine._debugPushGroup?.(name, 1);\r\n }\r\n\r\n /**\r\n * Pops a debug group from the engine's debug stack.\r\n */\r\n public popDebugGroup() {\r\n this._engine._debugPopGroup?.(1);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"frameGraphContext.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/frameGraphContext.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAI1B,gBAAgB;IAChB,YACuB,OAAuB,EACvB,eAAyC,EACzC,MAAa;QAFb,YAAO,GAAP,OAAO,CAAgB;QACvB,oBAAe,GAAf,eAAe,CAA0B;QACzC,WAAM,GAAN,MAAM,CAAO;IACjC,CAAC;IAEJ;;;;OAIG;IACI,eAAe,CAAC,SAAiC;QACpD,MAAM,mBAAmB,GAAG,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC;QAE9D,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAC;QAChC,IAAI,CAAC,MAAM,CAAC,mBAAmB,EAAE,CAAC;QAElC,SAAS,CAAC,MAAM,EAAE,CAAC;QAEnB,IAAI,IAAI,CAAC,OAAO,CAAC,oBAAoB,KAAK,mBAAmB,EAAE,CAAC;YAC5D,IAAI,CAAC,mBAAmB,EAAE,CAAC;gBACvB,IAAI,CAAC,OAAO,CAAC,yBAAyB,EAAE,CAAC;YAC7C,CAAC;iBAAM,CAAC;gBACJ,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,mBAAmB,CAAC,CAAC;YACtD,CAAC;QACL,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACI,oBAAoB,CAAC,MAA+B;QACvD,OAAO,IAAI,CAAC,eAAe,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAC7D,CAAC;IAED;;;OAGG;IACI,cAAc,CAAC,IAAY;QAC9B,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAC5C,CAAC;IAED;;OAEG;IACI,aAAa;QAChB,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC;IAED;;OAEG;IACI,eAAe;QAClB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC;QAChD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;IACpD,CAAC;IAED;;OAEG;IACI,kBAAkB;QACrB,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC7C,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACjD,CAAC;IAED;;;;OAIG;IACI,cAAc,CAAC,SAAkB,EAAE,UAAmB;QACzD,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QACvC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAC3C,CAAC;CACJ","sourcesContent":["import type { AbstractEngine, FrameGraphTextureManager, Scene, FrameGraphTextureHandle, Nullable, InternalTexture } from \"core/index\";\r\n\r\n/**\r\n * Base class for frame graph context.\r\n */\r\nexport class FrameGraphContext {\r\n private _depthTest: boolean;\r\n private _depthWrite: boolean;\r\n\r\n /** @internal */\r\n constructor(\r\n protected readonly _engine: AbstractEngine,\r\n protected readonly _textureManager: FrameGraphTextureManager,\r\n protected readonly _scene: Scene\r\n ) {}\r\n\r\n /**\r\n * Renders a component without managing the render target.\r\n * Use this method when you have a component that handles its own rendering logic which is not fully integrated into the frame graph system.\r\n * @param component The component to render.\r\n */\r\n public renderUnmanaged(component: { render: () => void }): void {\r\n const currentRenderTarget = this._engine._currentRenderTarget;\r\n\r\n this._scene.incrementRenderId();\r\n this._scene.resetCachedMaterial();\r\n\r\n component.render();\r\n\r\n if (this._engine._currentRenderTarget !== currentRenderTarget) {\r\n if (!currentRenderTarget) {\r\n this._engine.restoreDefaultFramebuffer();\r\n } else {\r\n this._engine.bindFramebuffer(currentRenderTarget);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Gets a texture from a handle.\r\n * Note that if the texture is a history texture, the read texture for the current frame will be returned.\r\n * @param handle The handle of the texture\r\n * @returns The texture or null if not found\r\n */\r\n public getTextureFromHandle(handle: FrameGraphTextureHandle): Nullable<InternalTexture> {\r\n return this._textureManager.getTextureFromHandle(handle);\r\n }\r\n\r\n /**\r\n * Pushes a debug group to the engine's debug stack.\r\n * @param name The name of the debug group\r\n */\r\n public pushDebugGroup(name: string) {\r\n this._engine._debugPushGroup?.(name, 1);\r\n }\r\n\r\n /**\r\n * Pops a debug group from the engine's debug stack.\r\n */\r\n public popDebugGroup() {\r\n this._engine._debugPopGroup?.(1);\r\n }\r\n\r\n /**\r\n * Saves the current depth states (depth testing and depth writing)\r\n */\r\n public saveDepthStates(): void {\r\n this._depthTest = this._engine.getDepthBuffer();\r\n this._depthWrite = this._engine.getDepthWrite();\r\n }\r\n\r\n /**\r\n * Restores the depth states saved by saveDepthStates\r\n */\r\n public restoreDepthStates(): void {\r\n this._engine.setDepthBuffer(this._depthTest);\r\n this._engine.setDepthWrite(this._depthWrite);\r\n }\r\n\r\n /**\r\n * Sets the depth states for the current render target\r\n * @param depthTest If true, depth testing is enabled\r\n * @param depthWrite If true, depth writing is enabled\r\n */\r\n public setDepthStates(depthTest: boolean, depthWrite: boolean): void {\r\n this._engine.setDepthBuffer(depthTest);\r\n this._engine.setDepthWrite(depthWrite);\r\n }\r\n}\r\n"]}
@@ -11,8 +11,6 @@ export declare class FrameGraphRenderContext extends FrameGraphContext {
11
11
  private _debugMessageHasBeenPushed;
12
12
  private _renderTargetIsBound;
13
13
  private readonly _copyTexture;
14
- private _depthTest;
15
- private _depthWrite;
16
14
  private static _IsObjectRenderer;
17
15
  /** @internal */
18
16
  constructor(engine: AbstractEngine, textureManager: FrameGraphTextureManager, scene: Scene);
@@ -57,6 +55,15 @@ export declare class FrameGraphRenderContext extends FrameGraphContext {
57
55
  * @param attachments The attachments to clear
58
56
  */
59
57
  clearColorAttachments(color: Nullable<IColor4Like>, attachments: number[]): void;
58
+ /**
59
+ * Clears all attachments (color(s) + depth/stencil) of the current render target
60
+ * @param color Defines the color to use
61
+ * @param attachments The attachments to clear
62
+ * @param backBuffer Defines if the back buffer must be cleared
63
+ * @param depth Defines if the depth buffer must be cleared
64
+ * @param stencil Defines if the stencil buffer must be cleared
65
+ */
66
+ clearAttachments(color: Nullable<IColor4Like>, attachments: number[], backBuffer: boolean, depth: boolean, stencil?: boolean): void;
60
67
  /**
61
68
  * Binds the attachments to the current render target
62
69
  * @param attachments The attachments to bind
@@ -79,20 +86,6 @@ export declare class FrameGraphRenderContext extends FrameGraphContext {
79
86
  * @param handle The handle of the texture to bind
80
87
  */
81
88
  bindTextureHandle(effect: Effect, name: string, handle: FrameGraphTextureHandle): void;
82
- /**
83
- * Saves the current depth states (depth testing and depth writing)
84
- */
85
- saveDepthStates(): void;
86
- /**
87
- * Restores the depth states saved by saveDepthStates
88
- */
89
- restoreDepthStates(): void;
90
- /**
91
- * Sets the depth states for the current render target
92
- * @param depthTest If true, depth testing is enabled
93
- * @param depthWrite If true, depth writing is enabled
94
- */
95
- setDepthStates(depthTest: boolean, depthWrite: boolean): void;
96
89
  /**
97
90
  * Applies a full-screen effect to the current render target
98
91
  * @param drawWrapper The draw wrapper containing the effect to apply
@@ -74,6 +74,19 @@ export class FrameGraphRenderContext extends FrameGraphContext {
74
74
  this._engine.bindAttachments(attachments);
75
75
  this._engine.clear(color, true, false, false);
76
76
  }
77
+ /**
78
+ * Clears all attachments (color(s) + depth/stencil) of the current render target
79
+ * @param color Defines the color to use
80
+ * @param attachments The attachments to clear
81
+ * @param backBuffer Defines if the back buffer must be cleared
82
+ * @param depth Defines if the depth buffer must be cleared
83
+ * @param stencil Defines if the stencil buffer must be cleared
84
+ */
85
+ clearAttachments(color, attachments, backBuffer, depth, stencil) {
86
+ this._applyRenderTarget();
87
+ this._engine.bindAttachments(attachments);
88
+ this._engine.clear(color, backBuffer, depth, stencil);
89
+ }
77
90
  /**
78
91
  * Binds the attachments to the current render target
79
92
  * @param attachments The attachments to bind
@@ -136,29 +149,6 @@ export class FrameGraphRenderContext extends FrameGraphContext {
136
149
  }
137
150
  effect._bindTexture(name, texture);
138
151
  }
139
- /**
140
- * Saves the current depth states (depth testing and depth writing)
141
- */
142
- saveDepthStates() {
143
- this._depthTest = this._engine.getDepthBuffer();
144
- this._depthWrite = this._engine.getDepthWrite();
145
- }
146
- /**
147
- * Restores the depth states saved by saveDepthStates
148
- */
149
- restoreDepthStates() {
150
- this._engine.setDepthBuffer(this._depthTest);
151
- this._engine.setDepthWrite(this._depthWrite);
152
- }
153
- /**
154
- * Sets the depth states for the current render target
155
- * @param depthTest If true, depth testing is enabled
156
- * @param depthWrite If true, depth writing is enabled
157
- */
158
- setDepthStates(depthTest, depthWrite) {
159
- this._engine.setDepthBuffer(depthTest);
160
- this._engine.setDepthWrite(depthWrite);
161
- }
162
152
  /**
163
153
  * Applies a full-screen effect to the current render target
164
154
  * @param drawWrapper The draw wrapper containing the effect to apply
@@ -205,6 +195,7 @@ export class FrameGraphRenderContext extends FrameGraphContext {
205
195
  */
206
196
  render(object, viewportWidth, viewportHeight) {
207
197
  if (FrameGraphRenderContext._IsObjectRenderer(object)) {
198
+ this._scene._intermediateRendering = true;
208
199
  if (object.shouldRender()) {
209
200
  this._scene.incrementRenderId();
210
201
  this._scene.resetCachedMaterial();
@@ -214,6 +205,7 @@ export class FrameGraphRenderContext extends FrameGraphContext {
214
205
  object.render();
215
206
  object.finishRender();
216
207
  }
208
+ this._scene._intermediateRendering = false;
217
209
  }
218
210
  else {
219
211
  this._applyRenderTarget();
@@ -1 +1 @@
1
- {"version":3,"file":"frameGraphRenderContext.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/frameGraphRenderContext.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD;;;GAGG;AACH,MAAM,OAAO,uBAAwB,SAAQ,iBAAiB;IAUlD,MAAM,CAAC,iBAAiB,CAAC,KAAoD;QACjF,OAAQ,KAAwB,CAAC,UAAU,KAAK,SAAS,CAAC;IAC9D,CAAC;IAED,gBAAgB;IAChB,YAAY,MAAsB,EAAE,cAAwC,EAAE,KAAY;QACtF,KAAK,CAAC,MAAM,EAAE,cAAc,EAAE,KAAK,CAAC,CAAC;QAZjC,+BAA0B,GAAG,KAAK,CAAC;QACnC,yBAAoB,GAAG,IAAI,CAAC;QAYhC,IAAI,CAAC,eAAe,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxD,IAAI,CAAC,YAAY,GAAG,IAAI,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/D,CAAC;IAED;;;;OAIG;IACI,YAAY,CAAC,MAA+B;QAC/C,OAAO,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IACrD,CAAC;IAED;;;;OAIG;IACI,iBAAiB,CAAC,MAA+B;QACpD,OAAO,IAAI,CAAC,eAAe,CAAC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r\n Layer,\r\n FrameGraphTextureHandle,\r\n Effect,\r\n FrameGraphTextureManager,\r\n ObjectRenderer,\r\n Scene,\r\n FrameGraphRenderTarget,\r\n InternalTexture,\r\n UtilityLayerRenderer,\r\n} from \"core/index\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { EffectRenderer } from \"../Materials/effectRenderer\";\r\nimport { CopyTextureToTexture } from \"../Misc/copyTextureToTexture\";\r\nimport { FrameGraphContext } from \"./frameGraphContext\";\r\n\r\n/**\r\n * Frame graph context used render passes.\r\n * @experimental\r\n */\r\nexport class FrameGraphRenderContext extends FrameGraphContext {\r\n private readonly _effectRenderer: EffectRenderer;\r\n private _currentRenderTarget: FrameGraphRenderTarget | undefined;\r\n private _debugMessageWhenTargetBound: string | undefined;\r\n private _debugMessageHasBeenPushed = false;\r\n private _renderTargetIsBound = true;\r\n private readonly _copyTexture: CopyTextureToTexture;\r\n private _depthTest: boolean;\r\n private _depthWrite: boolean;\r\n\r\n private static _IsObjectRenderer(value: Layer | ObjectRenderer | UtilityLayerRenderer): value is ObjectRenderer {\r\n return (value as ObjectRenderer).initRender !== undefined;\r\n }\r\n\r\n /** @internal */\r\n constructor(engine: AbstractEngine, textureManager: FrameGraphTextureManager, scene: Scene) {\r\n super(engine, textureManager, scene);\r\n this._effectRenderer = new EffectRenderer(this._engine);\r\n this._copyTexture = new CopyTextureToTexture(this._engine);\r\n }\r\n\r\n /**\r\n * Checks whether a texture handle points to the backbuffer's color or depth texture\r\n * @param handle The handle to check\r\n * @returns True if the handle points to the backbuffer's color or depth texture, otherwise false\r\n */\r\n public isBackbuffer(handle: FrameGraphTextureHandle): boolean {\r\n return this._textureManager.isBackbuffer(handle);\r\n }\r\n\r\n /**\r\n * Checks whether a texture handle points to the backbuffer's color texture\r\n * @param handle The handle to check\r\n * @returns True if the handle points to the backbuffer's color texture, otherwise false\r\n */\r\n public isBackbufferColor(handle: FrameGraphTextureHandle): boolean {\r\n return this._textureManager.isBackbufferColor(handle);\r\n }\r\n\r\n /**\r\n * Checks whether a texture handle points to the backbuffer's depth texture\r\n * @param handle The handle to check\r\n * @returns True if the handle points to the backbuffer's depth texture, otherwise false\r\n */\r\n public isBackbufferDepthStencil(handle: FrameGraphTextureHandle): boolean {\r\n return this._textureManager.isBackbufferDepthStencil(handle);\r\n }\r\n\r\n /**\r\n * Creates a (frame graph) render target wrapper\r\n * Note that renderTargets or renderTargetDepth can be undefined, but not both at the same time!\r\n * @param name Name of the render target wrapper\r\n * @param renderTargets Render target handles (textures) to use\r\n * @param renderTargetDepth Render target depth handle (texture) to use\r\n * @returns The created render target wrapper\r\n */\r\n public createRenderTarget(\r\n name: string,\r\n renderTargets?: FrameGraphTextureHandle | FrameGraphTextureHandle[],\r\n renderTargetDepth?: FrameGraphTextureHandle\r\n ): FrameGraphRenderTarget {\r\n return this._textureManager.createRenderTarget(name, renderTargets, renderTargetDepth);\r\n }\r\n\r\n /**\r\n * Clears the current render buffer or the current render target (if any is set up)\r\n * @param color Defines the color to use\r\n * @param backBuffer Defines if the back buffer must be cleared\r\n * @param depth Defines if the depth buffer must be cleared\r\n * @param stencil Defines if the stencil buffer must be cleared\r\n */\r\n public clear(color: Nullable<IColor4Like>, backBuffer: boolean, depth: boolean, stencil?: boolean): void {\r\n this._applyRenderTarget();\r\n this._engine.clear(color, backBuffer, depth, stencil);\r\n }\r\n\r\n /**\r\n * Clears the color attachments of the current render target\r\n * @param color Defines the color to use\r\n * @param attachments The attachments to clear\r\n */\r\n public clearColorAttachments(color: Nullable<IColor4Like>, attachments: number[]): void {\r\n this._applyRenderTarget();\r\n this._engine.bindAttachments(attachments);\r\n this._engine.clear(color, true, false, false);\r\n }\r\n\r\n /**\r\n * Binds the attachments to the current render target\r\n * @param attachments The attachments to bind\r\n */\r\n public bindAttachments(attachments: number[]): void {\r\n this._applyRenderTarget();\r\n this._engine.bindAttachments(attachments);\r\n }\r\n\r\n /**\r\n * Generates mipmaps for the current render target\r\n */\r\n public generateMipMaps(): void {\r\n if (this._currentRenderTarget?.renderTargetWrapper === undefined) {\r\n return;\r\n }\r\n\r\n if (this._renderTargetIsBound && this._engine._currentRenderTarget) {\r\n // we can't generate the mipmaps if the render target is bound\r\n this._flushDebugMessages();\r\n this._engine.unBindFramebuffer(this._engine._currentRenderTarget);\r\n this._renderTargetIsBound = false;\r\n }\r\n\r\n const textures = this._currentRenderTarget.renderTargetWrapper.textures;\r\n if (textures) {\r\n for (const texture of textures) {\r\n this._engine.generateMipmaps(texture);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Sets the texture sampling mode for a given texture handle\r\n * @param handle Handle of the texture to set the sampling mode for\r\n * @param samplingMode Sampling mode to set\r\n */\r\n public setTextureSamplingMode(handle: FrameGraphTextureHandle, samplingMode: number): void {\r\n const internalTexture = this._textureManager.getTextureFromHandle(handle);\r\n if (internalTexture && internalTexture.samplingMode !== samplingMode) {\r\n this._engine.updateTextureSamplingMode(samplingMode, internalTexture);\r\n }\r\n }\r\n\r\n /**\r\n * Binds a texture handle to a given effect (resolves the handle to a texture and binds it to the effect)\r\n * @param effect The effect to bind the texture to\r\n * @param name The name of the texture in the effect\r\n * @param handle The handle of the texture to bind\r\n */\r\n public bindTextureHandle(effect: Effect, name: string, handle: FrameGraphTextureHandle): void {\r\n let texture: Nullable<InternalTexture>;\r\n\r\n const historyEntry = this._textureManager._historyTextures.get(handle);\r\n if (historyEntry) {\r\n texture = historyEntry.textures[historyEntry.index]; // texture we write to in this frame\r\n if (\r\n this._currentRenderTarget !== undefined &&\r\n this._currentRenderTarget.renderTargetWrapper !== undefined &&\r\n this._currentRenderTarget.renderTargetWrapper.textures!.includes(texture!)\r\n ) {\r\n // If the current render target renders to the history write texture, we bind the read texture instead\r\n texture = historyEntry.textures[historyEntry.index ^ 1];\r\n }\r\n } else {\r\n texture = this._textureManager._textures.get(handle)!.texture;\r\n }\r\n\r\n effect._bindTexture(name, texture);\r\n }\r\n\r\n /**\r\n * Saves the current depth states (depth testing and depth writing)\r\n */\r\n public saveDepthStates(): void {\r\n this._depthTest = this._engine.getDepthBuffer();\r\n this._depthWrite = this._engine.getDepthWrite();\r\n }\r\n\r\n /**\r\n * Restores the depth states saved by saveDepthStates\r\n */\r\n public restoreDepthStates(): void {\r\n this._engine.setDepthBuffer(this._depthTest);\r\n this._engine.setDepthWrite(this._depthWrite);\r\n }\r\n\r\n /**\r\n * Sets the depth states for the current render target\r\n * @param depthTest If true, depth testing is enabled\r\n * @param depthWrite If true, depth writing is enabled\r\n */\r\n public setDepthStates(depthTest: boolean, depthWrite: boolean): void {\r\n this._engine.setDepthBuffer(depthTest);\r\n this._engine.setDepthWrite(depthWrite);\r\n }\r\n\r\n /**\r\n * Applies a full-screen effect to the current render target\r\n * @param drawWrapper The draw wrapper containing the effect to apply\r\n * @param customBindings The custom bindings to use when applying the effect (optional)\r\n * @returns True if the effect was applied, otherwise false (effect not ready)\r\n */\r\n public applyFullScreenEffect(drawWrapper: DrawWrapper, customBindings?: () => void): boolean {\r\n if (!drawWrapper.effect?.isReady()) {\r\n return false;\r\n }\r\n\r\n this._applyRenderTarget();\r\n\r\n const engineDepthMask = this._engine.getDepthWrite(); // for some reasons, depthWrite is not restored by EffectRenderer.restoreStates\r\n\r\n this._effectRenderer.saveStates();\r\n this._effectRenderer.setViewport();\r\n\r\n this._engine.enableEffect(drawWrapper);\r\n this._engine.setState(false);\r\n this._engine.setDepthBuffer(false);\r\n this._engine.setDepthWrite(false);\r\n\r\n this._effectRenderer.bindBuffers(drawWrapper.effect);\r\n customBindings?.();\r\n this._effectRenderer.draw();\r\n this._effectRenderer.restoreStates();\r\n this._engine.setDepthWrite(engineDepthMask);\r\n this._engine.setAlphaMode(Constants.ALPHA_DISABLE);\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Copies a texture to the current render target\r\n * @param sourceTexture The source texture to copy from\r\n * @param forceCopyToBackbuffer If true, the copy will be done to the back buffer regardless of the current render target\r\n */\r\n public copyTexture(sourceTexture: FrameGraphTextureHandle, forceCopyToBackbuffer = false): void {\r\n if (forceCopyToBackbuffer) {\r\n this.bindRenderTarget();\r\n }\r\n this._applyRenderTarget();\r\n this._copyTexture.copy(this._textureManager.getTextureFromHandle(sourceTexture)!);\r\n }\r\n\r\n /**\r\n * Renders a RenderTargetTexture or a layer\r\n * @param object The RenderTargetTexture/Layer to render\r\n * @param viewportWidth The width of the viewport (optional for Layer, but mandatory for ObjectRenderer)\r\n * @param viewportHeight The height of the viewport (optional for Layer, but mandatory for ObjectRenderer)\r\n */\r\n public render(object: Layer | ObjectRenderer | UtilityLayerRenderer, viewportWidth?: number, viewportHeight?: number): void {\r\n if (FrameGraphRenderContext._IsObjectRenderer(object)) {\r\n if (object.shouldRender()) {\r\n this._scene.incrementRenderId();\r\n this._scene.resetCachedMaterial();\r\n\r\n this._applyRenderTarget();\r\n\r\n object.prepareRenderList();\r\n\r\n object.initRender(viewportWidth!, viewportHeight!);\r\n\r\n object.render();\r\n\r\n object.finishRender();\r\n }\r\n } else {\r\n this._applyRenderTarget();\r\n object.render();\r\n }\r\n }\r\n\r\n /**\r\n * Binds a render target texture so that upcoming draw calls will render to it\r\n * Note: it is a lazy operation, so the render target will only be bound when needed. This way, it is possible to call\r\n * this method several times with different render targets without incurring the cost of binding if no draw calls are made\r\n * @param renderTarget The handle of the render target texture to bind (default: undefined, meaning \"back buffer\"). Pass an array for MRT rendering.\r\n * @param debugMessage Optional debug message to display when the render target is bound (visible in PIX, for example)\r\n */\r\n public bindRenderTarget(renderTarget?: FrameGraphRenderTarget, debugMessage?: string) {\r\n if (\r\n (renderTarget?.renderTargetWrapper === undefined && this._currentRenderTarget === undefined) ||\r\n (renderTarget && this._currentRenderTarget && renderTarget.equals(this._currentRenderTarget))\r\n ) {\r\n this._flushDebugMessages();\r\n if (debugMessage !== undefined) {\r\n this._engine._debugPushGroup?.(debugMessage, 2);\r\n this._debugMessageWhenTargetBound = undefined;\r\n this._debugMessageHasBeenPushed = true;\r\n }\r\n return;\r\n }\r\n this._currentRenderTarget = renderTarget?.renderTargetWrapper === undefined ? undefined : renderTarget;\r\n this._debugMessageWhenTargetBound = debugMessage;\r\n this._renderTargetIsBound = false;\r\n }\r\n\r\n /** @internal */\r\n public _flushDebugMessages() {\r\n if (this._debugMessageHasBeenPushed) {\r\n this._engine._debugPopGroup?.(2);\r\n this._debugMessageHasBeenPushed = false;\r\n }\r\n }\r\n\r\n /** @internal */\r\n public _applyRenderTarget() {\r\n if (this._renderTargetIsBound) {\r\n return;\r\n }\r\n\r\n this._flushDebugMessages();\r\n\r\n const renderTargetWrapper = this._currentRenderTarget?.renderTargetWrapper;\r\n\r\n if (renderTargetWrapper === undefined) {\r\n this._engine.restoreDefaultFramebuffer();\r\n } else {\r\n if (this._engine._currentRenderTarget) {\r\n this._engine.unBindFramebuffer(this._engine._currentRenderTarget);\r\n }\r\n this._engine.bindFramebuffer(renderTargetWrapper);\r\n }\r\n\r\n if (this._debugMessageWhenTargetBound !== undefined) {\r\n this._engine._debugPushGroup?.(this._debugMessageWhenTargetBound, 2);\r\n this._debugMessageWhenTargetBound = undefined;\r\n this._debugMessageHasBeenPushed = true;\r\n }\r\n\r\n this._renderTargetIsBound = true;\r\n }\r\n\r\n /** @internal */\r\n public _isReady(): boolean {\r\n return this._copyTexture.isReady();\r\n }\r\n\r\n /** @internal */\r\n public _dispose() {\r\n this._effectRenderer.dispose();\r\n this._copyTexture.dispose();\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"frameGraphRenderContext.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/frameGraphRenderContext.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD;;;GAGG;AACH,MAAM,OAAO,uBAAwB,SAAQ,iBA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CAAC,OAAO,CAAC,eAAe,EAAE,CAAC,IAAI,CAAC,4BAA4B,EAAE,CAAC,CAAC,CAAC;YACrE,IAAI,CAAC,4BAA4B,GAAG,SAAS,CAAC;YAC9C,IAAI,CAAC,0BAA0B,GAAG,IAAI,CAAC;QAC3C,CAAC;QAED,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;IACrC,CAAC;IAED,gBAAgB;IACT,QAAQ;QACX,OAAO,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;IACvC,CAAC;IAED,gBAAgB;IACT,QAAQ;QACX,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC;QAC/B,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;IAChC,CAAC;CACJ","sourcesContent":["import type {\r\n Nullable,\r\n AbstractEngine,\r\n DrawWrapper,\r\n IColor4Like,\r\n Layer,\r\n FrameGraphTextureHandle,\r\n Effect,\r\n FrameGraphTextureManager,\r\n ObjectRenderer,\r\n Scene,\r\n FrameGraphRenderTarget,\r\n InternalTexture,\r\n UtilityLayerRenderer,\r\n} from \"core/index\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { EffectRenderer } from \"../Materials/effectRenderer\";\r\nimport { CopyTextureToTexture } from \"../Misc/copyTextureToTexture\";\r\nimport { FrameGraphContext } from \"./frameGraphContext\";\r\n\r\n/**\r\n * Frame graph context used render passes.\r\n * @experimental\r\n */\r\nexport class FrameGraphRenderContext extends FrameGraphContext {\r\n private readonly _effectRenderer: EffectRenderer;\r\n private _currentRenderTarget: FrameGraphRenderTarget | undefined;\r\n private _debugMessageWhenTargetBound: string | undefined;\r\n private _debugMessageHasBeenPushed = false;\r\n private _renderTargetIsBound = true;\r\n private readonly _copyTexture: CopyTextureToTexture;\r\n\r\n private static _IsObjectRenderer(value: Layer | ObjectRenderer | UtilityLayerRenderer): value is ObjectRenderer {\r\n return (value as ObjectRenderer).initRender !== undefined;\r\n }\r\n\r\n /** @internal */\r\n constructor(engine: AbstractEngine, textureManager: FrameGraphTextureManager, scene: Scene) {\r\n super(engine, textureManager, scene);\r\n this._effectRenderer = new EffectRenderer(this._engine);\r\n this._copyTexture = new CopyTextureToTexture(this._engine);\r\n }\r\n\r\n /**\r\n * Checks whether a texture handle points to the backbuffer's color or depth texture\r\n * @param handle The handle to check\r\n * @returns True if the handle points to the backbuffer's color or depth texture, otherwise false\r\n */\r\n public isBackbuffer(handle: FrameGraphTextureHandle): boolean {\r\n return this._textureManager.isBackbuffer(handle);\r\n }\r\n\r\n /**\r\n * Checks whether a texture handle points to the backbuffer's color texture\r\n * @param handle The handle to check\r\n * @returns True if the handle points to the backbuffer's color texture, otherwise false\r\n */\r\n public isBackbufferColor(handle: FrameGraphTextureHandle): boolean {\r\n return this._textureManager.isBackbufferColor(handle);\r\n }\r\n\r\n /**\r\n * Checks whether a texture handle points to the backbuffer's depth texture\r\n * @param handle The handle to check\r\n * @returns True if the handle points to the backbuffer's depth texture, otherwise false\r\n */\r\n public isBackbufferDepthStencil(handle: FrameGraphTextureHandle): boolean {\r\n return this._textureManager.isBackbufferDepthStencil(handle);\r\n }\r\n\r\n /**\r\n * Creates a (frame graph) render target wrapper\r\n * Note that renderTargets or renderTargetDepth can be undefined, but not both at the same time!\r\n * @param name Name of the render target wrapper\r\n * @param renderTargets Render target handles (textures) to use\r\n * @param renderTargetDepth Render target depth handle (texture) to use\r\n * @returns The created render target wrapper\r\n */\r\n public createRenderTarget(\r\n name: string,\r\n renderTargets?: FrameGraphTextureHandle | FrameGraphTextureHandle[],\r\n renderTargetDepth?: FrameGraphTextureHandle\r\n ): FrameGraphRenderTarget {\r\n return this._textureManager.createRenderTarget(name, renderTargets, renderTargetDepth);\r\n }\r\n\r\n /**\r\n * Clears the current render buffer or the current render target (if any is set up)\r\n * @param color Defines the color to use\r\n * @param backBuffer Defines if the back buffer must be cleared\r\n * @param depth Defines if the depth buffer must be cleared\r\n * @param stencil Defines if the stencil buffer must be cleared\r\n */\r\n public clear(color: Nullable<IColor4Like>, backBuffer: boolean, depth: boolean, stencil?: boolean): void {\r\n this._applyRenderTarget();\r\n this._engine.clear(color, backBuffer, depth, stencil);\r\n }\r\n\r\n /**\r\n * Clears the color attachments of the current render target\r\n * @param color Defines the color to use\r\n * @param attachments The attachments to clear\r\n */\r\n public clearColorAttachments(color: Nullable<IColor4Like>, attachments: number[]): void {\r\n this._applyRenderTarget();\r\n this._engine.bindAttachments(attachments);\r\n this._engine.clear(color, true, false, false);\r\n }\r\n\r\n /**\r\n * Clears all attachments (color(s) + depth/stencil) of the current render target\r\n * @param color Defines the color to use\r\n * @param attachments The attachments to clear\r\n * @param backBuffer Defines if the back buffer must be cleared\r\n * @param depth Defines if the depth buffer must be cleared\r\n * @param stencil Defines if the stencil buffer must be cleared\r\n */\r\n public clearAttachments(color: Nullable<IColor4Like>, attachments: number[], backBuffer: boolean, depth: boolean, stencil?: boolean): void {\r\n this._applyRenderTarget();\r\n this._engine.bindAttachments(attachments);\r\n this._engine.clear(color, backBuffer, depth, stencil);\r\n }\r\n\r\n /**\r\n * Binds the attachments to the current render target\r\n * @param attachments The attachments to bind\r\n */\r\n public bindAttachments(attachments: number[]): void {\r\n this._applyRenderTarget();\r\n this._engine.bindAttachments(attachments);\r\n }\r\n\r\n /**\r\n * Generates mipmaps for the current render target\r\n */\r\n public generateMipMaps(): void {\r\n if (this._currentRenderTarget?.renderTargetWrapper === undefined) {\r\n return;\r\n }\r\n\r\n if (this._renderTargetIsBound && this._engine._currentRenderTarget) {\r\n // we can't generate the mipmaps if the render target is bound\r\n this._flushDebugMessages();\r\n this._engine.unBindFramebuffer(this._engine._currentRenderTarget);\r\n this._renderTargetIsBound = false;\r\n }\r\n\r\n const textures = this._currentRenderTarget.renderTargetWrapper.textures;\r\n if (textures) {\r\n for (const texture of textures) {\r\n this._engine.generateMipmaps(texture);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Sets the texture sampling mode for a given texture handle\r\n * @param handle Handle of the texture to set the sampling mode for\r\n * @param samplingMode Sampling mode to set\r\n */\r\n public setTextureSamplingMode(handle: FrameGraphTextureHandle, samplingMode: number): void {\r\n const internalTexture = this._textureManager.getTextureFromHandle(handle);\r\n if (internalTexture && internalTexture.samplingMode !== samplingMode) {\r\n this._engine.updateTextureSamplingMode(samplingMode, internalTexture);\r\n }\r\n }\r\n\r\n /**\r\n * Binds a texture handle to a given effect (resolves the handle to a texture and binds it to the effect)\r\n * @param effect The effect to bind the texture to\r\n * @param name The name of the texture in the effect\r\n * @param handle The handle of the texture to bind\r\n */\r\n public bindTextureHandle(effect: Effect, name: string, handle: FrameGraphTextureHandle): void {\r\n let texture: Nullable<InternalTexture>;\r\n\r\n const historyEntry = this._textureManager._historyTextures.get(handle);\r\n if (historyEntry) {\r\n texture = historyEntry.textures[historyEntry.index]; // texture we write to in this frame\r\n if (\r\n this._currentRenderTarget !== undefined &&\r\n this._currentRenderTarget.renderTargetWrapper !== undefined &&\r\n this._currentRenderTarget.renderTargetWrapper.textures!.includes(texture!)\r\n ) {\r\n // If the current render target renders to the history write texture, we bind the read texture instead\r\n texture = historyEntry.textures[historyEntry.index ^ 1];\r\n }\r\n } else {\r\n texture = this._textureManager._textures.get(handle)!.texture;\r\n }\r\n\r\n effect._bindTexture(name, texture);\r\n }\r\n\r\n /**\r\n * Applies a full-screen effect to the current render target\r\n * @param drawWrapper The draw wrapper containing the effect to apply\r\n * @param customBindings The custom bindings to use when applying the effect (optional)\r\n * @returns True if the effect was applied, otherwise false (effect not ready)\r\n */\r\n public applyFullScreenEffect(drawWrapper: DrawWrapper, customBindings?: () => void): boolean {\r\n if (!drawWrapper.effect?.isReady()) {\r\n return false;\r\n }\r\n\r\n this._applyRenderTarget();\r\n\r\n const engineDepthMask = this._engine.getDepthWrite(); // for some reasons, depthWrite is not restored by EffectRenderer.restoreStates\r\n\r\n this._effectRenderer.saveStates();\r\n this._effectRenderer.setViewport();\r\n\r\n this._engine.enableEffect(drawWrapper);\r\n this._engine.setState(false);\r\n this._engine.setDepthBuffer(false);\r\n this._engine.setDepthWrite(false);\r\n\r\n this._effectRenderer.bindBuffers(drawWrapper.effect);\r\n customBindings?.();\r\n this._effectRenderer.draw();\r\n this._effectRenderer.restoreStates();\r\n this._engine.setDepthWrite(engineDepthMask);\r\n this._engine.setAlphaMode(Constants.ALPHA_DISABLE);\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Copies a texture to the current render target\r\n * @param sourceTexture The source texture to copy from\r\n * @param forceCopyToBackbuffer If true, the copy will be done to the back buffer regardless of the current render target\r\n */\r\n public copyTexture(sourceTexture: FrameGraphTextureHandle, forceCopyToBackbuffer = false): void {\r\n if (forceCopyToBackbuffer) {\r\n this.bindRenderTarget();\r\n }\r\n this._applyRenderTarget();\r\n this._copyTexture.copy(this._textureManager.getTextureFromHandle(sourceTexture)!);\r\n }\r\n\r\n /**\r\n * Renders a RenderTargetTexture or a layer\r\n * @param object The RenderTargetTexture/Layer to render\r\n * @param viewportWidth The width of the viewport (optional for Layer, but mandatory for ObjectRenderer)\r\n * @param viewportHeight The height of the viewport (optional for Layer, but mandatory for ObjectRenderer)\r\n */\r\n public render(object: Layer | ObjectRenderer | UtilityLayerRenderer, viewportWidth?: number, viewportHeight?: number): void {\r\n if (FrameGraphRenderContext._IsObjectRenderer(object)) {\r\n this._scene._intermediateRendering = true;\r\n if (object.shouldRender()) {\r\n this._scene.incrementRenderId();\r\n this._scene.resetCachedMaterial();\r\n\r\n this._applyRenderTarget();\r\n\r\n object.prepareRenderList();\r\n\r\n object.initRender(viewportWidth!, viewportHeight!);\r\n\r\n object.render();\r\n\r\n object.finishRender();\r\n }\r\n this._scene._intermediateRendering = false;\r\n } else {\r\n this._applyRenderTarget();\r\n object.render();\r\n }\r\n }\r\n\r\n /**\r\n * Binds a render target texture so that upcoming draw calls will render to it\r\n * Note: it is a lazy operation, so the render target will only be bound when needed. This way, it is possible to call\r\n * this method several times with different render targets without incurring the cost of binding if no draw calls are made\r\n * @param renderTarget The handle of the render target texture to bind (default: undefined, meaning \"back buffer\"). Pass an array for MRT rendering.\r\n * @param debugMessage Optional debug message to display when the render target is bound (visible in PIX, for example)\r\n */\r\n public bindRenderTarget(renderTarget?: FrameGraphRenderTarget, debugMessage?: string) {\r\n if (\r\n (renderTarget?.renderTargetWrapper === undefined && this._currentRenderTarget === undefined) ||\r\n (renderTarget && this._currentRenderTarget && renderTarget.equals(this._currentRenderTarget))\r\n ) {\r\n this._flushDebugMessages();\r\n if (debugMessage !== undefined) {\r\n this._engine._debugPushGroup?.(debugMessage, 2);\r\n this._debugMessageWhenTargetBound = undefined;\r\n this._debugMessageHasBeenPushed = true;\r\n }\r\n return;\r\n }\r\n this._currentRenderTarget = renderTarget?.renderTargetWrapper === undefined ? undefined : renderTarget;\r\n this._debugMessageWhenTargetBound = debugMessage;\r\n this._renderTargetIsBound = false;\r\n }\r\n\r\n /** @internal */\r\n public _flushDebugMessages() {\r\n if (this._debugMessageHasBeenPushed) {\r\n this._engine._debugPopGroup?.(2);\r\n this._debugMessageHasBeenPushed = false;\r\n }\r\n }\r\n\r\n /** @internal */\r\n public _applyRenderTarget() {\r\n if (this._renderTargetIsBound) {\r\n return;\r\n }\r\n\r\n this._flushDebugMessages();\r\n\r\n const renderTargetWrapper = this._currentRenderTarget?.renderTargetWrapper;\r\n\r\n if (renderTargetWrapper === undefined) {\r\n this._engine.restoreDefaultFramebuffer();\r\n } else {\r\n if (this._engine._currentRenderTarget) {\r\n this._engine.unBindFramebuffer(this._engine._currentRenderTarget);\r\n }\r\n this._engine.bindFramebuffer(renderTargetWrapper);\r\n }\r\n\r\n if (this._debugMessageWhenTargetBound !== undefined) {\r\n this._engine._debugPushGroup?.(this._debugMessageWhenTargetBound, 2);\r\n this._debugMessageWhenTargetBound = undefined;\r\n this._debugMessageHasBeenPushed = true;\r\n }\r\n\r\n this._renderTargetIsBound = true;\r\n }\r\n\r\n /** @internal */\r\n public _isReady(): boolean {\r\n return this._copyTexture.isReady();\r\n }\r\n\r\n /** @internal */\r\n public _dispose() {\r\n this._effectRenderer.dispose();\r\n this._copyTexture.dispose();\r\n }\r\n}\r\n"]}
@@ -0,0 +1,52 @@
1
+ import type { Camera, FrameGraph, Nullable } from "../index.js";
2
+ import { FrameGraphObjectRendererTask } from "./Tasks/Rendering/objectRendererTask.js";
3
+ import { UtilityLayerRenderer } from "../Rendering/utilityLayerRenderer.js";
4
+ /**
5
+ * Looks for the main camera used by the frame graph.
6
+ * By default, this is the camera used by the main object renderer task.
7
+ * If no such task, we try to find a camera in either a geometry renderer or a utility layer renderer tasks.
8
+ * @param frameGraph The frame graph to search in
9
+ * @returns The main camera used by the frame graph, or null if not found
10
+ */
11
+ export declare function FindMainCamera(frameGraph: FrameGraph): Nullable<Camera>;
12
+ /**
13
+ * Looks for the main object renderer task in the frame graph.
14
+ * By default, this is the object renderer task with isMainObjectRenderer set to true.
15
+ * If no such task, we return the last object renderer task that has an object list with meshes (or null if none found).
16
+ * @param frameGraph The frame graph to search in
17
+ * @returns The main object renderer of the frame graph, or null if not found
18
+ */
19
+ export declare function FindMainObjectRenderer(frameGraph: FrameGraph): Nullable<FrameGraphObjectRendererTask>;
20
+ /**
21
+ * Creates a utility layer renderer compatible with the given frame graph.
22
+ * @param frameFraph The frame graph to create the utility layer renderer for
23
+ * @param handleEvents True if the utility layer renderer should handle events, false otherwise (default is true)
24
+ * @returns The created utility layer renderer
25
+ */
26
+ export declare function CreateUtilityLayerRenderer(frameFraph: FrameGraph, handleEvents?: boolean): UtilityLayerRenderer;
27
+ /**
28
+ * Class used to host frame graph specific utilities
29
+ */
30
+ export declare const FrameGraphUtils: {
31
+ /**
32
+ * Looks for the main camera used by the frame graph.
33
+ * We assume that the camera used by the the last rendering task in the graph is the main camera.
34
+ * @param frameGraph The frame graph to search in
35
+ * @returns The main camera used by the frame graph, or null if not found
36
+ */
37
+ FindMainCamera: typeof FindMainCamera;
38
+ /**
39
+ * Looks for the main object renderer task in the frame graph.
40
+ * We assume that the last object renderer task that has an object list with meshes is the main object renderer.
41
+ * @param frameGraph The frame graph to search in
42
+ * @returns The main object renderer of the frame graph, or null if not found
43
+ */
44
+ FindMainObjectRenderer: typeof FindMainObjectRenderer;
45
+ /**
46
+ * Creates a utility layer renderer compatible with the given frame graph.
47
+ * @param frameFraph The frame graph to create the utility layer renderer for
48
+ * @param handleEvents True if the utility layer renderer should handle events, false otherwise
49
+ * @returns The created utility layer renderer
50
+ */
51
+ CreateUtilityLayerRenderer: typeof CreateUtilityLayerRenderer;
52
+ };
@@ -0,0 +1,99 @@
1
+ import { FrameGraphObjectRendererTask } from "./Tasks/Rendering/objectRendererTask.js";
2
+ import { FrameGraphGeometryRendererTask } from "./Tasks/Rendering/geometryRendererTask.js";
3
+ import { FrameGraphUtilityLayerRendererTask } from "./Tasks/Rendering/utilityLayerRendererTask.js";
4
+ import { UtilityLayerRenderer } from "../Rendering/utilityLayerRenderer.js";
5
+ /**
6
+ * Looks for the main camera used by the frame graph.
7
+ * By default, this is the camera used by the main object renderer task.
8
+ * If no such task, we try to find a camera in either a geometry renderer or a utility layer renderer tasks.
9
+ * @param frameGraph The frame graph to search in
10
+ * @returns The main camera used by the frame graph, or null if not found
11
+ */
12
+ export function FindMainCamera(frameGraph) {
13
+ const mainObjectRenderer = FrameGraphUtils.FindMainObjectRenderer(frameGraph);
14
+ if (mainObjectRenderer) {
15
+ return mainObjectRenderer.camera;
16
+ }
17
+ // Try to find a camera in either the geometry renderer or the utility layer renderer tasks
18
+ const tasks = frameGraph.tasks;
19
+ for (let i = tasks.length - 1; i >= 0; i--) {
20
+ const task = tasks[i];
21
+ if (task instanceof FrameGraphGeometryRendererTask || task instanceof FrameGraphUtilityLayerRendererTask) {
22
+ return task.camera;
23
+ }
24
+ }
25
+ return null;
26
+ }
27
+ /**
28
+ * Looks for the main object renderer task in the frame graph.
29
+ * By default, this is the object renderer task with isMainObjectRenderer set to true.
30
+ * If no such task, we return the last object renderer task that has an object list with meshes (or null if none found).
31
+ * @param frameGraph The frame graph to search in
32
+ * @returns The main object renderer of the frame graph, or null if not found
33
+ */
34
+ export function FindMainObjectRenderer(frameGraph) {
35
+ const objectRenderers = frameGraph.getTasksByType(FrameGraphObjectRendererTask);
36
+ let fallbackRenderer = null;
37
+ for (let i = objectRenderers.length - 1; i >= 0; --i) {
38
+ if (objectRenderers[i].isMainObjectRenderer) {
39
+ return objectRenderers[i];
40
+ }
41
+ if (objectRenderers[i].objectList.meshes && !fallbackRenderer) {
42
+ fallbackRenderer = objectRenderers[i];
43
+ }
44
+ }
45
+ return fallbackRenderer;
46
+ }
47
+ /**
48
+ * Creates a utility layer renderer compatible with the given frame graph.
49
+ * @param frameFraph The frame graph to create the utility layer renderer for
50
+ * @param handleEvents True if the utility layer renderer should handle events, false otherwise (default is true)
51
+ * @returns The created utility layer renderer
52
+ */
53
+ export function CreateUtilityLayerRenderer(frameFraph, handleEvents = true) {
54
+ const scene = frameFraph.scene;
55
+ const layer = new UtilityLayerRenderer(scene, handleEvents, true);
56
+ layer.utilityLayerScene.activeCamera = scene.activeCamera;
57
+ let camera = FrameGraphUtils.FindMainCamera(scene.frameGraph);
58
+ if (!camera && scene.cameras.length > 0) {
59
+ camera = scene.cameras[0];
60
+ }
61
+ if (camera) {
62
+ layer.setRenderCamera(camera);
63
+ layer.utilityLayerScene.activeCamera = camera;
64
+ }
65
+ const gizmoLayerRenderObserver = scene.onAfterRenderObservable.add(() => {
66
+ layer.render();
67
+ });
68
+ layer.utilityLayerScene.onDisposeObservable.addOnce(() => {
69
+ scene.onAfterRenderObservable.remove(gizmoLayerRenderObserver);
70
+ });
71
+ return layer;
72
+ }
73
+ /**
74
+ * Class used to host frame graph specific utilities
75
+ */
76
+ export const FrameGraphUtils = {
77
+ /**
78
+ * Looks for the main camera used by the frame graph.
79
+ * We assume that the camera used by the the last rendering task in the graph is the main camera.
80
+ * @param frameGraph The frame graph to search in
81
+ * @returns The main camera used by the frame graph, or null if not found
82
+ */
83
+ FindMainCamera,
84
+ /**
85
+ * Looks for the main object renderer task in the frame graph.
86
+ * We assume that the last object renderer task that has an object list with meshes is the main object renderer.
87
+ * @param frameGraph The frame graph to search in
88
+ * @returns The main object renderer of the frame graph, or null if not found
89
+ */
90
+ FindMainObjectRenderer,
91
+ /**
92
+ * Creates a utility layer renderer compatible with the given frame graph.
93
+ * @param frameFraph The frame graph to create the utility layer renderer for
94
+ * @param handleEvents True if the utility layer renderer should handle events, false otherwise
95
+ * @returns The created utility layer renderer
96
+ */
97
+ CreateUtilityLayerRenderer,
98
+ };
99
+ //# sourceMappingURL=frameGraphUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frameGraphUtils.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/frameGraphUtils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,4BAA4B,EAAE,gDAA2D;AAClG,OAAO,EAAE,8BAA8B,EAAE,kDAA6D;AACtG,OAAO,EAAE,kCAAkC,EAAE,sDAAiE;AAC9G,OAAO,EAAE,oBAAoB,EAAE,6CAA4C;AAE3E;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,UAAsB;IACjD,MAAM,kBAAkB,GAAG,eAAe,CAAC,sBAAsB,CAAC,UAAU,CAAC,CAAC;IAC9E,IAAI,kBAAkB,EAAE,CAAC;QACrB,OAAO,kBAAkB,CAAC,MAAM,CAAC;IACrC,CAAC;IAED,2FAA2F;IAC3F,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;IAE/B,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACzC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACtB,IAAI,IAAI,YAAY,8BAA8B,IAAI,IAAI,YAAY,kCAAkC,EAAE,CAAC;YACvG,OAAO,IAAI,CAAC,MAAM,CAAC;QACvB,CAAC;IACL,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC;AAED;;;;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,GAAG,MAAM,CAAC;IAClD,CAAC;IAED,MAAM,wBAAwB,GAAG,KAAK,CAAC,uBAAuB,CAAC,GAAG,CAAC,GAAG,EAAE;QACpE,KAAK,CAAC,MAAM,EAAE,CAAC;IACnB,CAAC,CAAC,CAAC;IAEH,KAAK,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,OAAO,CAAC,GAAG,EAAE;QACrD,KAAK,CAAC,uBAAuB,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACjB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC3B;;;;;OAKG;IACH,cAAc;IAEd;;;;;OAKG;IACH,sBAAsB;IAEtB;;;;;OAKG;IACH,0BAA0B;CAC7B,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\n// eslint-disable-next-line import/no-internal-modules\r\nimport type { Camera, FrameGraph, Nullable } from \"core/index\";\r\nimport { FrameGraphObjectRendererTask } from \"core/FrameGraph/Tasks/Rendering/objectRendererTask\";\r\nimport { FrameGraphGeometryRendererTask } from \"core/FrameGraph/Tasks/Rendering/geometryRendererTask\";\r\nimport { FrameGraphUtilityLayerRendererTask } from \"core/FrameGraph/Tasks/Rendering/utilityLayerRendererTask\";\r\nimport { UtilityLayerRenderer } from \"core/Rendering/utilityLayerRenderer\";\r\n\r\n/**\r\n * Looks for the main camera used by the frame graph.\r\n * By default, this is the camera used by the main object renderer task.\r\n * If no such task, we try to find a camera in either a geometry renderer or a utility layer renderer tasks.\r\n * @param frameGraph The frame graph to search in\r\n * @returns The main camera used by the frame graph, or null if not found\r\n */\r\nexport function FindMainCamera(frameGraph: FrameGraph): Nullable<Camera> {\r\n const mainObjectRenderer = FrameGraphUtils.FindMainObjectRenderer(frameGraph);\r\n if (mainObjectRenderer) {\r\n return mainObjectRenderer.camera;\r\n }\r\n\r\n // Try to find a camera in either the geometry renderer or the utility layer renderer tasks\r\n const tasks = frameGraph.tasks;\r\n\r\n for (let i = tasks.length - 1; i >= 0; i--) {\r\n const task = tasks[i];\r\n if (task instanceof FrameGraphGeometryRendererTask || task instanceof FrameGraphUtilityLayerRendererTask) {\r\n return task.camera;\r\n }\r\n }\r\n\r\n return null;\r\n}\r\n\r\n/**\r\n * Looks for the main object renderer task in the frame graph.\r\n * By default, this is the object renderer task with isMainObjectRenderer set to true.\r\n * If no such task, we return the last object renderer task that has an object list with meshes (or null if none found).\r\n * @param frameGraph The frame graph to search in\r\n * @returns The main object renderer of the frame graph, or null if not found\r\n */\r\nexport function FindMainObjectRenderer(frameGraph: FrameGraph): Nullable<FrameGraphObjectRendererTask> {\r\n const objectRenderers = frameGraph.getTasksByType<FrameGraphObjectRendererTask>(FrameGraphObjectRendererTask);\r\n\r\n let fallbackRenderer: Nullable<FrameGraphObjectRendererTask> = null;\r\n for (let i = objectRenderers.length - 1; i >= 0; --i) {\r\n if (objectRenderers[i].isMainObjectRenderer) {\r\n return objectRenderers[i];\r\n }\r\n if (objectRenderers[i].objectList.meshes && !fallbackRenderer) {\r\n fallbackRenderer = objectRenderers[i];\r\n }\r\n }\r\n return fallbackRenderer;\r\n}\r\n\r\n/**\r\n * Creates a utility layer renderer compatible with the given frame graph.\r\n * @param frameFraph The frame graph to create the utility layer renderer for\r\n * @param handleEvents True if the utility layer renderer should handle events, false otherwise (default is true)\r\n * @returns The created utility layer renderer\r\n */\r\nexport function CreateUtilityLayerRenderer(frameFraph: FrameGraph, handleEvents = true): UtilityLayerRenderer {\r\n const scene = frameFraph.scene;\r\n const layer = new UtilityLayerRenderer(scene, handleEvents, true);\r\n\r\n layer.utilityLayerScene.activeCamera = scene.activeCamera;\r\n\r\n let camera = FrameGraphUtils.FindMainCamera(scene.frameGraph!);\r\n\r\n if (!camera && scene.cameras.length > 0) {\r\n camera = scene.cameras[0];\r\n }\r\n\r\n if (camera) {\r\n layer.setRenderCamera(camera);\r\n layer.utilityLayerScene.activeCamera = camera;\r\n }\r\n\r\n const gizmoLayerRenderObserver = scene.onAfterRenderObservable.add(() => {\r\n layer.render();\r\n });\r\n\r\n layer.utilityLayerScene.onDisposeObservable.addOnce(() => {\r\n scene.onAfterRenderObservable.remove(gizmoLayerRenderObserver);\r\n });\r\n\r\n return layer;\r\n}\r\n\r\n/**\r\n * Class used to host frame graph specific utilities\r\n */\r\nexport const FrameGraphUtils = {\r\n /**\r\n * Looks for the main camera used by the frame graph.\r\n * We assume that the camera used by the the last rendering task in the graph is the main camera.\r\n * @param frameGraph The frame graph to search in\r\n * @returns The main camera used by the frame graph, or null if not found\r\n */\r\n FindMainCamera,\r\n\r\n /**\r\n * Looks for the main object renderer task in the frame graph.\r\n * We assume that the last object renderer task that has an object list with meshes is the main object renderer.\r\n * @param frameGraph The frame graph to search in\r\n * @returns The main object renderer of the frame graph, or null if not found\r\n */\r\n FindMainObjectRenderer,\r\n\r\n /**\r\n * Creates a utility layer renderer compatible with the given frame graph.\r\n * @param frameFraph The frame graph to create the utility layer renderer for\r\n * @param handleEvents True if the utility layer renderer should handle events, false otherwise\r\n * @returns The created utility layer renderer\r\n */\r\n CreateUtilityLayerRenderer,\r\n};\r\n"]}
@@ -44,3 +44,4 @@ export * from "./frameGraphRenderTarget.js";
44
44
  export * from "./frameGraphTask.js";
45
45
  export * from "./frameGraphTextureManager.js";
46
46
  export * from "./frameGraphTypes.js";
47
+ export * from "./frameGraphUtils.js";
@@ -45,4 +45,5 @@ export * from "./frameGraphRenderTarget.js";
45
45
  export * from "./frameGraphTask.js";
46
46
  export * from "./frameGraphTextureManager.js";
47
47
  export * from "./frameGraphTypes.js";
48
+ export * from "./frameGraphUtils.js";
48
49
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc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nodeRenderGraph\";\r\nexport * from \"./Node/nodeRenderGraphBlock\";\r\nexport * from \"./Node/nodeRenderGraphBlockConnectionPoint\";\r\nexport * from \"./Node/nodeRenderGraphBuildState\";\r\nexport * from \"./Node/Types/nodeRenderGraphTypes\";\r\nexport * from \"./Node/Blocks/index\";\r\n\r\nexport * from \"./Passes/cullPass\";\r\nexport * from \"./Passes/pass\";\r\nexport * from \"./Passes/renderPass\";\r\n\r\nexport * from \"./Tasks/Layers/glowLayerTask\";\r\nexport * from \"./Tasks/Layers/highlightLayerTask\";\r\n\r\nexport * from \"./Tasks/Misc/cullObjectsTask\";\r\nexport * from \"./Tasks/Misc/executeTask\";\r\n\r\nexport * from \"./Tasks/PostProcesses/anaglyphTask\";\r\nexport * from \"./Tasks/PostProcesses/blackAndWhiteTask\";\r\nexport * from \"./Tasks/PostProcesses/bloomTask\";\r\nexport * from \"./Tasks/PostProcesses/blurTask\";\r\nexport * from \"./Tasks/PostProcesses/chromaticAberrationTask\";\r\nexport * from \"./Tasks/PostProcesses/circleOfConfusionTask\";\r\nexport * from \"./Tasks/PostProcesses/depthOfFieldTask\";\r\nexport * from \"./Tasks/PostProcesses/extractHighlightsTask\";\r\nexport * from \"./Tasks/PostProcesses/fxaaTask\";\r\nexport * from \"./Tasks/PostProcesses/grainTask\";\r\nexport * from \"./Tasks/PostProcesses/imageProcessingTask\";\r\nexport * from \"./Tasks/PostProcesses/motionBlurTask\";\r\nexport * from \"./Tasks/PostProcesses/passTask\";\r\nexport * from \"./Tasks/PostProcesses/postProcessTask\";\r\nexport * from \"./Tasks/PostProcesses/ssrRenderingPipelineTask\";\r\n\r\nexport * from \"./Tasks/Texture/clearTextureTask\";\r\nexport * from \"./Tasks/Texture/copyToBackbufferColorTask\";\r\nexport * from \"./Tasks/Texture/copyToTextureTask\";\r\nexport * from \"./Tasks/Texture/generateMipMapsTask\";\r\n\r\nexport * from \"./Tasks/Rendering/csmShadowGeneratorTask\";\r\nexport * from \"./Tasks/Rendering/geometryRendererTask\";\r\nexport * from \"./Tasks/Rendering/objectRendererTask\";\r\nexport * from \"./Tasks/Rendering/shadowGeneratorTask\";\r\nexport * from \"./Tasks/Rendering/taaObjectRendererTask\";\r\nexport * from \"./Tasks/Rendering/utilityLayerRendererTask\";\r\n\r\nexport * from \"./frameGraph\";\r\nexport * from \"./frameGraphContext\";\r\nexport * from \"./frameGraphObjectList\";\r\nexport * from \"./frameGraphRenderContext\";\r\nexport * from \"./frameGraphRenderTarget\";\r\nexport * from \"./frameGraphTask\";\r\nexport * from \"./frameGraphTextureManager\";\r\nexport * from \"./frameGraphTypes\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4CAA4C,CAAC;AAC3D,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAClD,cAAc,qBAAqB,CAAC;AAEpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AAEpC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mCAAmC,CAAC;AAElD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AAEzC,cAAc,oCAAoC,CAAC;AACnD,cAAc,yCAAyC,CAAC;AACxD,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,+CAA+C,CAAC;AAC9D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,wCAAwC,CAAC;AACvD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,sCAAsC,CAAC;AACrD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uCAAuC,CAAC;AACtD,cAAc,gDAAgD,CAAC;AAE/D,cAAc,kCAAkC,CAAC;AACjD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,CAAC;AAEpD,cAAc,0CAA0C,CAAC;AACzD,cAAc,wCAAwC,CAAC;AACvD,cAAc,sCAAsC,CAAC;AACrD,cAAc,uCAAuC,CAAC;AACtD,cAAc,yCAAyC,CAAC;AACxD,cAAc,4CAA4C,CAAC;AAE3D,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nexport * from \"./Node/nodeRenderGraph\";\r\nexport * from \"./Node/nodeRenderGraphBlock\";\r\nexport * from \"./Node/nodeRenderGraphBlockConnectionPoint\";\r\nexport * from \"./Node/nodeRenderGraphBuildState\";\r\nexport * from \"./Node/Types/nodeRenderGraphTypes\";\r\nexport * from \"./Node/Blocks/index\";\r\n\r\nexport * from \"./Passes/cullPass\";\r\nexport * from \"./Passes/pass\";\r\nexport * from \"./Passes/renderPass\";\r\n\r\nexport * from \"./Tasks/Layers/glowLayerTask\";\r\nexport * from \"./Tasks/Layers/highlightLayerTask\";\r\n\r\nexport * from \"./Tasks/Misc/cullObjectsTask\";\r\nexport * from \"./Tasks/Misc/executeTask\";\r\n\r\nexport * from \"./Tasks/PostProcesses/anaglyphTask\";\r\nexport * from \"./Tasks/PostProcesses/blackAndWhiteTask\";\r\nexport * from \"./Tasks/PostProcesses/bloomTask\";\r\nexport * from \"./Tasks/PostProcesses/blurTask\";\r\nexport * from \"./Tasks/PostProcesses/chromaticAberrationTask\";\r\nexport * from \"./Tasks/PostProcesses/circleOfConfusionTask\";\r\nexport * from \"./Tasks/PostProcesses/depthOfFieldTask\";\r\nexport * from \"./Tasks/PostProcesses/extractHighlightsTask\";\r\nexport * from \"./Tasks/PostProcesses/fxaaTask\";\r\nexport * from \"./Tasks/PostProcesses/grainTask\";\r\nexport * from \"./Tasks/PostProcesses/imageProcessingTask\";\r\nexport * from \"./Tasks/PostProcesses/motionBlurTask\";\r\nexport * from \"./Tasks/PostProcesses/passTask\";\r\nexport * from \"./Tasks/PostProcesses/postProcessTask\";\r\nexport * from \"./Tasks/PostProcesses/ssrRenderingPipelineTask\";\r\n\r\nexport * from \"./Tasks/Texture/clearTextureTask\";\r\nexport * from \"./Tasks/Texture/copyToBackbufferColorTask\";\r\nexport * from \"./Tasks/Texture/copyToTextureTask\";\r\nexport * from \"./Tasks/Texture/generateMipMapsTask\";\r\n\r\nexport * from \"./Tasks/Rendering/csmShadowGeneratorTask\";\r\nexport * from \"./Tasks/Rendering/geometryRendererTask\";\r\nexport * from \"./Tasks/Rendering/objectRendererTask\";\r\nexport * from \"./Tasks/Rendering/shadowGeneratorTask\";\r\nexport * from \"./Tasks/Rendering/taaObjectRendererTask\";\r\nexport * from \"./Tasks/Rendering/utilityLayerRendererTask\";\r\n\r\nexport * from \"./frameGraph\";\r\nexport * from \"./frameGraphContext\";\r\nexport * from \"./frameGraphObjectList\";\r\nexport * from \"./frameGraphRenderContext\";\r\nexport * from \"./frameGraphRenderTarget\";\r\nexport * from \"./frameGraphTask\";\r\nexport * from \"./frameGraphTextureManager\";\r\nexport * from \"./frameGraphTypes\";\r\nexport * from \"./frameGraphUtils\";\r\n"]}
@@ -802,6 +802,8 @@ export class BoundingBoxGizmo extends Gizmo {
802
802
  this.onScaleBoxDragEndObservable.clear();
803
803
  this.onRotationSphereDragObservable.clear();
804
804
  this.onRotationSphereDragEndObservable.clear();
805
+ this._coloredMaterial.dispose();
806
+ this._hoverColoredMaterial.dispose();
805
807
  super.dispose();
806
808
  }
807
809
  /**