@babylonjs/core 7.33.0 → 7.34.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 (124) hide show
  1. package/Cameras/arcRotateCamera.d.ts +14 -0
  2. package/Cameras/arcRotateCamera.js +39 -19
  3. package/Cameras/arcRotateCamera.js.map +1 -1
  4. package/Decorators/nodeDecorator.d.ts +2 -0
  5. package/Decorators/nodeDecorator.js +1 -0
  6. package/Decorators/nodeDecorator.js.map +1 -1
  7. package/Engines/abstractEngine.js +2 -2
  8. package/Engines/abstractEngine.js.map +1 -1
  9. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.d.ts +63 -0
  10. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js +150 -0
  11. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js.map +1 -0
  12. package/FrameGraph/Node/Blocks/Rendering/objectRendererBlock.d.ts +3 -47
  13. package/FrameGraph/Node/Blocks/Rendering/objectRendererBlock.js +2 -129
  14. package/FrameGraph/Node/Blocks/Rendering/objectRendererBlock.js.map +1 -1
  15. package/FrameGraph/Node/Blocks/Rendering/taaObjectRendererBlock.d.ts +40 -0
  16. package/FrameGraph/Node/Blocks/Rendering/taaObjectRendererBlock.js +98 -0
  17. package/FrameGraph/Node/Blocks/Rendering/taaObjectRendererBlock.js.map +1 -0
  18. package/FrameGraph/Node/Blocks/Textures/clearBlock.js +3 -3
  19. package/FrameGraph/Node/Blocks/Textures/clearBlock.js.map +1 -1
  20. package/FrameGraph/Node/Blocks/index.d.ts +3 -2
  21. package/FrameGraph/Node/Blocks/index.js +3 -2
  22. package/FrameGraph/Node/Blocks/index.js.map +1 -1
  23. package/FrameGraph/Passes/renderPass.js +1 -1
  24. package/FrameGraph/Passes/renderPass.js.map +1 -1
  25. package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.d.ts +21 -0
  26. package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js +110 -0
  27. package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js.map +1 -0
  28. package/FrameGraph/frameGraph.d.ts +6 -0
  29. package/FrameGraph/frameGraph.js +15 -1
  30. package/FrameGraph/frameGraph.js.map +1 -1
  31. package/FrameGraph/frameGraphRenderContext.d.ts +3 -2
  32. package/FrameGraph/frameGraphRenderContext.js +9 -4
  33. package/FrameGraph/frameGraphRenderContext.js.map +1 -1
  34. package/FrameGraph/frameGraphTask.js +5 -1
  35. package/FrameGraph/frameGraphTask.js.map +1 -1
  36. package/FrameGraph/frameGraphTextureManager.d.ts +8 -0
  37. package/FrameGraph/frameGraphTextureManager.js +51 -7
  38. package/FrameGraph/frameGraphTextureManager.js.map +1 -1
  39. package/FrameGraph/frameGraphTypes.d.ts +2 -0
  40. package/FrameGraph/frameGraphTypes.js.map +1 -1
  41. package/FrameGraph/index.d.ts +3 -2
  42. package/FrameGraph/index.js +3 -2
  43. package/FrameGraph/index.js.map +1 -1
  44. package/Layers/layer.d.ts +4 -0
  45. package/Layers/layer.js +13 -2
  46. package/Layers/layer.js.map +1 -1
  47. package/Loading/sceneLoader.d.ts +11 -8
  48. package/Loading/sceneLoader.js +64 -35
  49. package/Loading/sceneLoader.js.map +1 -1
  50. package/Materials/GaussianSplatting/gaussianSplattingMaterial.d.ts +2 -0
  51. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +12 -0
  52. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  53. package/Materials/Node/Blocks/GaussianSplatting/gaussianBlock.js +6 -1
  54. package/Materials/Node/Blocks/GaussianSplatting/gaussianBlock.js.map +1 -1
  55. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js +9 -2
  56. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js.map +1 -1
  57. package/Materials/Node/Blocks/GaussianSplatting/index.d.ts +2 -0
  58. package/Materials/Node/Blocks/GaussianSplatting/index.js +3 -0
  59. package/Materials/Node/Blocks/GaussianSplatting/index.js.map +1 -1
  60. package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.js +10 -3
  61. package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.js.map +1 -1
  62. package/Materials/Node/nodeMaterial.d.ts +1 -1
  63. package/Materials/Node/nodeMaterial.js +1 -1
  64. package/Materials/Node/nodeMaterial.js.map +1 -1
  65. package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +2 -0
  66. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +7 -2
  67. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  68. package/Meshes/abstractMesh.hotSpot.js +2 -0
  69. package/Meshes/abstractMesh.hotSpot.js.map +1 -1
  70. package/Meshes/csg2.js +0 -3
  71. package/Meshes/csg2.js.map +1 -1
  72. package/Misc/webRequest.fetch.d.ts +16 -0
  73. package/Misc/webRequest.fetch.js +33 -0
  74. package/Misc/webRequest.fetch.js.map +1 -0
  75. package/PostProcesses/RenderPipeline/Pipelines/index.d.ts +2 -0
  76. package/PostProcesses/RenderPipeline/Pipelines/index.js +2 -0
  77. package/PostProcesses/RenderPipeline/Pipelines/index.js.map +1 -1
  78. package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.d.ts +6 -8
  79. package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.js +32 -49
  80. package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.js.map +1 -1
  81. package/PostProcesses/thinTAAPostProcess.d.ts +72 -0
  82. package/PostProcesses/thinTAAPostProcess.js +149 -0
  83. package/PostProcesses/thinTAAPostProcess.js.map +1 -0
  84. package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
  85. package/Rendering/IBLShadows/iblShadowsAccumulationPass.d.ts +3 -3
  86. package/Rendering/IBLShadows/iblShadowsAccumulationPass.js +7 -7
  87. package/Rendering/IBLShadows/iblShadowsAccumulationPass.js.map +1 -1
  88. package/Rendering/IBLShadows/iblShadowsRenderPipeline.d.ts +70 -69
  89. package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +102 -112
  90. package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
  91. package/Rendering/geometryBufferRenderer.js +8 -6
  92. package/Rendering/geometryBufferRenderer.js.map +1 -1
  93. package/Shaders/geometry.vertex.js +1 -1
  94. package/Shaders/geometry.vertex.js.map +1 -1
  95. package/Shaders/layer.fragment.js +3 -1
  96. package/Shaders/layer.fragment.js.map +1 -1
  97. package/Shaders/volumetricLightScattering.fragment.js +1 -1
  98. package/Shaders/volumetricLightScattering.fragment.js.map +1 -1
  99. package/ShadersWGSL/ShadersInclude/gaussianSplatting.d.ts +5 -0
  100. package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +47 -0
  101. package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -0
  102. package/ShadersWGSL/ShadersInclude/gaussianSplattingFragmentDeclaration.d.ts +7 -0
  103. package/ShadersWGSL/ShadersInclude/gaussianSplattingFragmentDeclaration.js +20 -0
  104. package/ShadersWGSL/ShadersInclude/gaussianSplattingFragmentDeclaration.js.map +1 -0
  105. package/ShadersWGSL/ShadersInclude/gaussianSplattingUboDeclaration.d.ts +7 -0
  106. package/ShadersWGSL/ShadersInclude/gaussianSplattingUboDeclaration.js +13 -0
  107. package/ShadersWGSL/ShadersInclude/gaussianSplattingUboDeclaration.js.map +1 -0
  108. package/ShadersWGSL/ShadersInclude/gaussianSplattingVertexDeclaration.d.ts +5 -0
  109. package/ShadersWGSL/ShadersInclude/gaussianSplattingVertexDeclaration.js +10 -0
  110. package/ShadersWGSL/ShadersInclude/gaussianSplattingVertexDeclaration.js.map +1 -0
  111. package/ShadersWGSL/gaussianSplatting.fragment.d.ts +10 -0
  112. package/ShadersWGSL/gaussianSplatting.fragment.js +23 -0
  113. package/ShadersWGSL/gaussianSplatting.fragment.js.map +1 -0
  114. package/ShadersWGSL/gaussianSplatting.vertex.d.ts +14 -0
  115. package/ShadersWGSL/gaussianSplatting.vertex.js +31 -0
  116. package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -0
  117. package/ShadersWGSL/geometry.vertex.js +1 -1
  118. package/ShadersWGSL/geometry.vertex.js.map +1 -1
  119. package/ShadersWGSL/layer.fragment.js +4 -2
  120. package/ShadersWGSL/layer.fragment.js.map +1 -1
  121. package/ShadersWGSL/taa.fragment.d.ts +5 -0
  122. package/ShadersWGSL/taa.fragment.js +11 -0
  123. package/ShadersWGSL/taa.fragment.js.map +1 -0
  124. package/package.json +1 -1
@@ -113,13 +113,13 @@ __decorate([
113
113
  editableInPropertyPage("Color", 5 /* PropertyTypeForEdition.Color4 */)
114
114
  ], NodeRenderGraphClearBlock.prototype, "color", null);
115
115
  __decorate([
116
- editableInPropertyPage("Clear color", 0 /* PropertyTypeForEdition.Boolean */)
116
+ editableInPropertyPage("Clear color", 0 /* PropertyTypeForEdition.Boolean */, undefined, { embedded: true })
117
117
  ], NodeRenderGraphClearBlock.prototype, "clearColor", null);
118
118
  __decorate([
119
- editableInPropertyPage("Clear depth", 0 /* PropertyTypeForEdition.Boolean */)
119
+ editableInPropertyPage("Clear depth", 0 /* PropertyTypeForEdition.Boolean */, undefined, { embedded: true })
120
120
  ], NodeRenderGraphClearBlock.prototype, "clearDepth", null);
121
121
  __decorate([
122
- editableInPropertyPage("Clear stencil", 0 /* PropertyTypeForEdition.Boolean */)
122
+ editableInPropertyPage("Clear stencil", 0 /* PropertyTypeForEdition.Boolean */, undefined, { embedded: true })
123
123
  ], NodeRenderGraphClearBlock.prototype, "clearStencil", null);
124
124
  RegisterClass("BABYLON.NodeRenderGraphClearBlock", NodeRenderGraphClearBlock);
125
125
  //# sourceMappingURL=clearBlock.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"clearBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FrameGraph/Node/Blocks/Textures/clearBlock.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OA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AAG,mBAAmB,CAAC,YAAY,CAAC;IACzD,CAAC;CACJ;AAjGG;IADC,sBAAsB,CAAC,OAAO,wCAAgC;sDAG9D;AAQD;IADC,sBAAsB,CAAC,aAAa,yCAAiC;2DAGrE;AAQD;IADC,sBAAsB,CAAC,aAAa,yCAAiC;2DAGrE;AAQD;IADC,sBAAsB,CAAC,eAAe,yCAAiC;6DAGvE;AAmEL,aAAa,CAAC,mCAAmC,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["// eslint-disable-next-line import/no-internal-modules\r\nimport type { NodeRenderGraphConnectionPoint, Scene, FrameGraphTextureHandle, FrameGraph, NodeRenderGraphBuildState } from \"core/index\";\r\nimport { NodeRenderGraphBlock } from \"../../nodeRenderGraphBlock\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeRenderGraphBlockConnectionPointTypes } from \"../../Types/nodeRenderGraphTypes\";\r\nimport { Color4 } from \"../../../../Maths/math.color\";\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"../../../../Decorators/nodeDecorator\";\r\nimport { FrameGraphClearTextureTask } from \"../../../Tasks/Texture/clearTextureTask\";\r\n\r\n/**\r\n * Block used to clear a texture\r\n */\r\nexport class NodeRenderGraphClearBlock extends NodeRenderGraphBlock {\r\n protected override _frameGraphTask: FrameGraphClearTextureTask;\r\n\r\n /**\r\n * Gets the frame graph task associated with this block\r\n */\r\n public override get task() {\r\n return this._frameGraphTask;\r\n }\r\n\r\n /**\r\n * Create a new NodeRenderGraphClearBlock\r\n * @param name defines the block name\r\n * @param frameGraph defines the hosting frame graph\r\n * @param scene defines the hosting scene\r\n */\r\n public constructor(name: string, frameGraph: FrameGraph, scene: Scene) {\r\n super(name, frameGraph, scene);\r\n\r\n this.registerInput(\"texture\", NodeRenderGraphBlockConnectionPointTypes.Texture);\r\n this.registerOutput(\"output\", NodeRenderGraphBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this.texture.addAcceptedConnectionPointTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAll);\r\n this.output._typeConnectionSource = this.texture;\r\n\r\n this._frameGraphTask = new FrameGraphClearTextureTask(name, frameGraph);\r\n }\r\n\r\n /** Gets or sets the clear color */\r\n @editableInPropertyPage(\"Color\", PropertyTypeForEdition.Color4)\r\n public get color(): Color4 {\r\n return this._frameGraphTask.color;\r\n }\r\n\r\n public set color(value: Color4) {\r\n this._frameGraphTask.color = value;\r\n }\r\n\r\n /** Gets or sets a boolean indicating whether the color part of the texture should be cleared. */\r\n @editableInPropertyPage(\"Clear color\", PropertyTypeForEdition.Boolean)\r\n public get clearColor(): boolean {\r\n return !!this._frameGraphTask.clearColor;\r\n }\r\n\r\n public set clearColor(value: boolean) {\r\n this._frameGraphTask.clearColor = value;\r\n }\r\n\r\n /** Gets or sets a boolean indicating whether the depth part of the texture should be cleared. */\r\n @editableInPropertyPage(\"Clear depth\", PropertyTypeForEdition.Boolean)\r\n public get clearDepth(): boolean {\r\n return !!this._frameGraphTask.clearDepth;\r\n }\r\n\r\n public set clearDepth(value: boolean) {\r\n this._frameGraphTask.clearDepth = value;\r\n }\r\n\r\n /** Gets or sets a boolean indicating whether the stencil part of the texture should be cleared. */\r\n @editableInPropertyPage(\"Clear stencil\", PropertyTypeForEdition.Boolean)\r\n public get clearStencil(): boolean {\r\n return !!this._frameGraphTask.clearStencil;\r\n }\r\n\r\n public set clearStencil(value: boolean) {\r\n this._frameGraphTask.clearStencil = value;\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"NodeRenderGraphClearBlock\";\r\n }\r\n /**\r\n * Gets the texture input component\r\n */\r\n public get texture(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeRenderGraphConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock(state: NodeRenderGraphBuildState) {\r\n super._buildBlock(state);\r\n\r\n this._frameGraphTask.name = this.name;\r\n\r\n this._propagateInputValueToOutput(this.texture, this.output);\r\n\r\n const textureConnectedPoint = this.texture.connectedPoint;\r\n if (textureConnectedPoint) {\r\n this._frameGraphTask.destinationTexture = textureConnectedPoint.value as FrameGraphTextureHandle;\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codes: string[] = [];\r\n codes.push(`${this._codeVariableName}.color = new BABYLON.Color4(${this.color.r}, ${this.color.g}, ${this.color.b}, ${this.color.a});`);\r\n codes.push(`${this._codeVariableName}.clearColor = ${this.clearColor};`);\r\n codes.push(`${this._codeVariableName}.clearDepth = ${this.clearDepth};`);\r\n codes.push(`${this._codeVariableName}.clearStencil = ${this.clearStencil};`);\r\n return super._dumpPropertiesCode() + codes.join(\"\\n\");\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.color = this.color.asArray();\r\n serializationObject.clearColor = this.clearColor;\r\n serializationObject.clearDepth = this.clearDepth;\r\n serializationObject.clearStencil = this.clearStencil;\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n this.color = Color4.FromArray(serializationObject.color);\r\n this.clearColor = serializationObject.clearColor;\r\n this.clearDepth = serializationObject.clearDepth;\r\n this.clearStencil = serializationObject.clearStencil;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.NodeRenderGraphClearBlock\", NodeRenderGraphClearBlock);\r\n"]}
1
+ {"version":3,"file":"clearBlock.js","sourceRoot":"","sources":["../../../../../../../dev/core/src/FrameGraph/Node/Blocks/Textures/clearBlock.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,wCAAwC,EAAE,MAAM,kCAAkC,CAAC;AAC5F,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OA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QAAQ,EAAE,IAAI,EAAE,CAAC;2DAGpG;AAQD;IADC,sBAAsB,CAAC,aAAa,0CAAkC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;2DAGpG;AAQD;IADC,sBAAsB,CAAC,eAAe,0CAAkC,SAAS,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;6DAGtG;AAmEL,aAAa,CAAC,mCAAmC,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["// eslint-disable-next-line import/no-internal-modules\r\nimport type { NodeRenderGraphConnectionPoint, Scene, FrameGraphTextureHandle, FrameGraph, NodeRenderGraphBuildState } from \"core/index\";\r\nimport { NodeRenderGraphBlock } from \"../../nodeRenderGraphBlock\";\r\nimport { RegisterClass } from \"../../../../Misc/typeStore\";\r\nimport { NodeRenderGraphBlockConnectionPointTypes } from \"../../Types/nodeRenderGraphTypes\";\r\nimport { Color4 } from \"../../../../Maths/math.color\";\r\nimport { editableInPropertyPage, PropertyTypeForEdition } from \"../../../../Decorators/nodeDecorator\";\r\nimport { FrameGraphClearTextureTask } from \"../../../Tasks/Texture/clearTextureTask\";\r\n\r\n/**\r\n * Block used to clear a texture\r\n */\r\nexport class NodeRenderGraphClearBlock extends NodeRenderGraphBlock {\r\n protected override _frameGraphTask: FrameGraphClearTextureTask;\r\n\r\n /**\r\n * Gets the frame graph task associated with this block\r\n */\r\n public override get task() {\r\n return this._frameGraphTask;\r\n }\r\n\r\n /**\r\n * Create a new NodeRenderGraphClearBlock\r\n * @param name defines the block name\r\n * @param frameGraph defines the hosting frame graph\r\n * @param scene defines the hosting scene\r\n */\r\n public constructor(name: string, frameGraph: FrameGraph, scene: Scene) {\r\n super(name, frameGraph, scene);\r\n\r\n this.registerInput(\"texture\", NodeRenderGraphBlockConnectionPointTypes.Texture);\r\n this.registerOutput(\"output\", NodeRenderGraphBlockConnectionPointTypes.BasedOnInput);\r\n\r\n this.texture.addAcceptedConnectionPointTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAll);\r\n this.output._typeConnectionSource = this.texture;\r\n\r\n this._frameGraphTask = new FrameGraphClearTextureTask(name, frameGraph);\r\n }\r\n\r\n /** Gets or sets the clear color */\r\n @editableInPropertyPage(\"Color\", PropertyTypeForEdition.Color4)\r\n public get color(): Color4 {\r\n return this._frameGraphTask.color;\r\n }\r\n\r\n public set color(value: Color4) {\r\n this._frameGraphTask.color = value;\r\n }\r\n\r\n /** Gets or sets a boolean indicating whether the color part of the texture should be cleared. */\r\n @editableInPropertyPage(\"Clear color\", PropertyTypeForEdition.Boolean, undefined, { embedded: true })\r\n public get clearColor(): boolean {\r\n return !!this._frameGraphTask.clearColor;\r\n }\r\n\r\n public set clearColor(value: boolean) {\r\n this._frameGraphTask.clearColor = value;\r\n }\r\n\r\n /** Gets or sets a boolean indicating whether the depth part of the texture should be cleared. */\r\n @editableInPropertyPage(\"Clear depth\", PropertyTypeForEdition.Boolean, undefined, { embedded: true })\r\n public get clearDepth(): boolean {\r\n return !!this._frameGraphTask.clearDepth;\r\n }\r\n\r\n public set clearDepth(value: boolean) {\r\n this._frameGraphTask.clearDepth = value;\r\n }\r\n\r\n /** Gets or sets a boolean indicating whether the stencil part of the texture should be cleared. */\r\n @editableInPropertyPage(\"Clear stencil\", PropertyTypeForEdition.Boolean, undefined, { embedded: true })\r\n public get clearStencil(): boolean {\r\n return !!this._frameGraphTask.clearStencil;\r\n }\r\n\r\n public set clearStencil(value: boolean) {\r\n this._frameGraphTask.clearStencil = value;\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"NodeRenderGraphClearBlock\";\r\n }\r\n /**\r\n * Gets the texture input component\r\n */\r\n public get texture(): NodeRenderGraphConnectionPoint {\r\n return this._inputs[0];\r\n }\r\n\r\n /**\r\n * Gets the output component\r\n */\r\n public get output(): NodeRenderGraphConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n protected override _buildBlock(state: NodeRenderGraphBuildState) {\r\n super._buildBlock(state);\r\n\r\n this._frameGraphTask.name = this.name;\r\n\r\n this._propagateInputValueToOutput(this.texture, this.output);\r\n\r\n const textureConnectedPoint = this.texture.connectedPoint;\r\n if (textureConnectedPoint) {\r\n this._frameGraphTask.destinationTexture = textureConnectedPoint.value as FrameGraphTextureHandle;\r\n }\r\n }\r\n\r\n protected override _dumpPropertiesCode() {\r\n const codes: string[] = [];\r\n codes.push(`${this._codeVariableName}.color = new BABYLON.Color4(${this.color.r}, ${this.color.g}, ${this.color.b}, ${this.color.a});`);\r\n codes.push(`${this._codeVariableName}.clearColor = ${this.clearColor};`);\r\n codes.push(`${this._codeVariableName}.clearDepth = ${this.clearDepth};`);\r\n codes.push(`${this._codeVariableName}.clearStencil = ${this.clearStencil};`);\r\n return super._dumpPropertiesCode() + codes.join(\"\\n\");\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.color = this.color.asArray();\r\n serializationObject.clearColor = this.clearColor;\r\n serializationObject.clearDepth = this.clearDepth;\r\n serializationObject.clearStencil = this.clearStencil;\r\n return serializationObject;\r\n }\r\n\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n this.color = Color4.FromArray(serializationObject.color);\r\n this.clearColor = serializationObject.clearColor;\r\n this.clearDepth = serializationObject.clearDepth;\r\n this.clearStencil = serializationObject.clearStencil;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.NodeRenderGraphClearBlock\", NodeRenderGraphClearBlock);\r\n"]}
@@ -7,9 +7,10 @@ export * from "./PostProcesses/blurPostProcessBlock";
7
7
  export * from "./PostProcesses/circleOfConfusionPostProcessBlock";
8
8
  export * from "./PostProcesses/depthOfFieldPostProcessBlock";
9
9
  export * from "./PostProcesses/extractHighlightsPostProcessBlock";
10
- export * from "./Rendering/objectRendererBlock";
11
- export * from "./Rendering/geometryRendererBlock";
12
10
  export * from "./Rendering/cullObjectsBlock";
11
+ export * from "./Rendering/geometryRendererBlock";
12
+ export * from "./Rendering/objectRendererBlock";
13
+ export * from "./Rendering/taaObjectRendererBlock";
13
14
  export * from "./Teleport/teleportInBlock";
14
15
  export * from "./Teleport/teleportOutBlock";
15
16
  export * from "./Textures/clearBlock";
@@ -7,9 +7,10 @@ export * from "./PostProcesses/blurPostProcessBlock.js";
7
7
  export * from "./PostProcesses/circleOfConfusionPostProcessBlock.js";
8
8
  export * from "./PostProcesses/depthOfFieldPostProcessBlock.js";
9
9
  export * from "./PostProcesses/extractHighlightsPostProcessBlock.js";
10
- export * from "./Rendering/objectRendererBlock.js";
11
- export * from "./Rendering/geometryRendererBlock.js";
12
10
  export * from "./Rendering/cullObjectsBlock.js";
11
+ export * from "./Rendering/geometryRendererBlock.js";
12
+ export * from "./Rendering/objectRendererBlock.js";
13
+ export * from "./Rendering/taaObjectRendererBlock.js";
13
14
  export * from "./Teleport/teleportInBlock.js";
14
15
  export * from "./Teleport/teleportOutBlock.js";
15
16
  export * from "./Textures/clearBlock.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Node/Blocks/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,+CAA+C,CAAC;AAC9D,cAAc,uCAAuC,CAAC;AACtD,cAAc,sCAAsC,CAAC;AACrD,cAAc,mDAAmD,CAAC;AAClE,cAAc,8CAA8C,CAAC;AAC7D,cAAc,mDAAmD,CAAC;AAClE,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC","sourcesContent":["export * from \"./elbowBlock\";\r\nexport * from \"./inputBlock\";\r\nexport * from \"./outputBlock\";\r\nexport * from \"./PostProcesses/blackAndWhitePostProcessBlock\";\r\nexport * from \"./PostProcesses/bloomPostProcessBlock\";\r\nexport * from \"./PostProcesses/blurPostProcessBlock\";\r\nexport * from \"./PostProcesses/circleOfConfusionPostProcessBlock\";\r\nexport * from \"./PostProcesses/depthOfFieldPostProcessBlock\";\r\nexport * from \"./PostProcesses/extractHighlightsPostProcessBlock\";\r\nexport * from \"./Rendering/objectRendererBlock\";\r\nexport * from \"./Rendering/geometryRendererBlock\";\r\nexport * from \"./Rendering/cullObjectsBlock\";\r\nexport * from \"./Teleport/teleportInBlock\";\r\nexport * from \"./Teleport/teleportOutBlock\";\r\nexport * from \"./Textures/clearBlock\";\r\nexport * from \"./Textures/copyTextureBlock\";\r\nexport * from \"./Textures/generateMipmapsBlock\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Node/Blocks/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAE9B,cAAc,+CAA+C,CAAC;AAC9D,cAAc,uCAAuC,CAAC;AACtD,cAAc,sCAAsC,CAAC;AACrD,cAAc,mDAAmD,CAAC;AAClE,cAAc,8CAA8C,CAAC;AAC7D,cAAc,mDAAmD,CAAC;AAElE,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,oCAAoC,CAAC;AAEnD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAE5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC","sourcesContent":["export * from \"./elbowBlock\";\r\nexport * from \"./inputBlock\";\r\nexport * from \"./outputBlock\";\r\n\r\nexport * from \"./PostProcesses/blackAndWhitePostProcessBlock\";\r\nexport * from \"./PostProcesses/bloomPostProcessBlock\";\r\nexport * from \"./PostProcesses/blurPostProcessBlock\";\r\nexport * from \"./PostProcesses/circleOfConfusionPostProcessBlock\";\r\nexport * from \"./PostProcesses/depthOfFieldPostProcessBlock\";\r\nexport * from \"./PostProcesses/extractHighlightsPostProcessBlock\";\r\n\r\nexport * from \"./Rendering/cullObjectsBlock\";\r\nexport * from \"./Rendering/geometryRendererBlock\";\r\nexport * from \"./Rendering/objectRendererBlock\";\r\nexport * from \"./Rendering/taaObjectRendererBlock\";\r\n\r\nexport * from \"./Teleport/teleportInBlock\";\r\nexport * from \"./Teleport/teleportOutBlock\";\r\n\r\nexport * from \"./Textures/clearBlock\";\r\nexport * from \"./Textures/copyTextureBlock\";\r\nexport * from \"./Textures/generateMipmapsBlock\";\r\n"]}
@@ -59,7 +59,7 @@ export class FrameGraphRenderPass extends FrameGraphPass {
59
59
  this._context._shareDepth(this._renderTargetDepth, this._renderTarget);
60
60
  this._depthShared = true;
61
61
  }
62
- this._context._bindRenderTarget(this._renderTarget, `frame graph - render pass '${this.name}'`);
62
+ this._context.bindRenderTarget(this._renderTarget, `frame graph - render pass '${this.name}'`);
63
63
  super._execute();
64
64
  this._context._flushDebugMessages();
65
65
  }
@@ -1 +1 @@
1
- {"version":3,"file":"renderPass.js","sourceRoot":"","sources":["../../../../../dev/core/src/FrameGraph/Passes/renderPass.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAExC;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,cAAuC;IAO7E;;;;OAIG;IACI,MAAM,CAAC,YAAY,CAAC,IAAqB;QAC5C,OAAQ,IAA6B,CAAC,eAAe,KAAK,SAAS,CAAC;IACxE,CAAC;IAED;;OAEG;IACH,IAAW,YAAY;QACnB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,IAAW,iBAAiB;QACxB,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACnC,CAAC;IAED,gBAAgB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AA2D,CAAC;IACnI,CAAC;CACJ","sourcesContent":["// eslint-disable-next-line import/no-internal-modules\r\nimport type { Nullable, FrameGraphRenderContext, AbstractEngine, IFrameGraphPass, FrameGraphTextureHandle, FrameGraphTask } from \"core/index\";\r\nimport { FrameGraphPass } from \"./pass\";\r\n\r\n/**\r\n * Render pass used to render objects.\r\n */\r\nexport class FrameGraphRenderPass extends FrameGraphPass<FrameGraphRenderContext> {\r\n protected _engine: AbstractEngine;\r\n protected _renderTarget: FrameGraphTextureHandle;\r\n protected _renderTargetDepth: FrameGraphTextureHandle | undefined;\r\n protected _usedTextures: FrameGraphTextureHandle[] = [];\r\n protected _depthShared = false;\r\n\r\n /**\r\n * Checks if a pass is a render pass.\r\n * @param pass The pass to check.\r\n * @returns True if the pass is a render pass, else false.\r\n */\r\n public static IsRenderPass(pass: IFrameGraphPass): pass is FrameGraphRenderPass {\r\n return (pass as FrameGraphRenderPass).setRenderTarget !== undefined;\r\n }\r\n\r\n /**\r\n * Gets the render target used by the render pass.\r\n */\r\n public get renderTarget(): FrameGraphTextureHandle {\r\n return this._renderTarget;\r\n }\r\n\r\n /**\r\n * Gets the render target depth used by the render pass.\r\n */\r\n public get renderTargetDepth(): FrameGraphTextureHandle | undefined {\r\n return this._renderTargetDepth;\r\n }\r\n\r\n /** @internal */\r\n constructor(name: string, parentTask: FrameGraphTask, context: FrameGraphRenderContext, engine: AbstractEngine) {\r\n super(name, parentTask, context);\r\n this._engine = engine;\r\n }\r\n\r\n /**\r\n * Indicates that the pass will use the given texture.\r\n * Use this method to indicate that the pass will use a texture so that the frame graph can handle the texture's lifecycle.\r\n * You don't have to call this method for the render target / render target depth textures.\r\n * @param texture The texture used.\r\n */\r\n public useTexture(texture: FrameGraphTextureHandle) {\r\n this._usedTextures.push(texture);\r\n }\r\n\r\n /**\r\n * Sets the render target to use for rendering.\r\n * @param renderTargetHandle The render target to use for rendering.\r\n */\r\n public setRenderTarget(renderTargetHandle: FrameGraphTextureHandle) {\r\n this._renderTarget = renderTargetHandle;\r\n }\r\n\r\n /**\r\n * Sets the render target depth to use for rendering.\r\n * @param renderTargetHandle The render target depth to use for rendering.\r\n */\r\n public setRenderTargetDepth(renderTargetHandle?: FrameGraphTextureHandle) {\r\n this._renderTargetDepth = renderTargetHandle;\r\n }\r\n\r\n /** @internal */\r\n public override _execute() {\r\n if (this._renderTargetDepth && !this._depthShared) {\r\n this._context._shareDepth(this._renderTargetDepth, this._renderTarget);\r\n this._depthShared = true;\r\n }\r\n\r\n this._context._bindRenderTarget(this._renderTarget, `frame graph - render pass '${this.name}'`);\r\n\r\n super._execute();\r\n\r\n this._context._flushDebugMessages();\r\n }\r\n\r\n /** @internal */\r\n public override _isValid(): Nullable<string> {\r\n const errMsg = super._isValid();\r\n return errMsg ? errMsg : this._renderTarget !== undefined ? null : \"Render target is not set (call setRenderTarget to set it)\";\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"renderPass.js","sourceRoot":"","sources":["../../../../../dev/core/src/FrameGraph/Passes/renderPass.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAExC;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,cAAuC;IAO7E;;;;OAIG;IACI,MAAM,CAAC,YAAY,CAAC,IAAqB;QAC5C,OAAQ,IAA6B,CAAC,eAAe,KAAK,SAAS,CAAC;IACxE,CAAC;IAED;;OAEG;IACH,IAAW,YAAY;QACnB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,IAAW,iBAAiB;QACxB,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACnC,CAAC;IAED,gBAAgB;IAChB,YAAY,IAAY,EAAE,UAA0B,EAAE,OAAgC,EAAE,MAAsB;QAC1G,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;QA5B3B,kBAAa,GAA8B,EAAE,CAAC;QAC9C,iBAAY,GAAG,KAAK,CAAC;QA4B3B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IAC1B,CAAC;IAED;;;;;OAKG;IACI,UAAU,CAAC,OAAgC;QAC9C,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;IAED;;;OAGG;IACI,eAAe,CAAC,kBAA2C;QAC9D,IAAI,CAAC,aAAa,GAAG,kBAAkB,CAAC;IAC5C,CAAC;IAED;;;OAGG;IACI,oBAAoB,CAAC,kBAA4C;QACpE,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;IACjD,CAAC;IAED,gBAAgB;IACA,QAAQ;QACpB,IAAI,IAAI,CAAC,kBAAkB,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;YAC/C,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;YACvE,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;SAC5B;QAED,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,aAAa,EAAE,8BAA8B,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;QAE/F,KAAK,CAAC,QAAQ,EAAE,CAAC;QAEjB,IAAI,CAAC,QAAQ,CAAC,mBAAmB,EAAE,CAAC;IACxC,CAAC;IAED,gBAAgB;IACA,QAAQ;QACpB,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;QAChC,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,2DAA2D,CAAC;IACnI,CAAC;CACJ","sourcesContent":["// eslint-disable-next-line import/no-internal-modules\r\nimport type { Nullable, FrameGraphRenderContext, AbstractEngine, IFrameGraphPass, FrameGraphTextureHandle, FrameGraphTask } from \"core/index\";\r\nimport { FrameGraphPass } from \"./pass\";\r\n\r\n/**\r\n * Render pass used to render objects.\r\n */\r\nexport class FrameGraphRenderPass extends FrameGraphPass<FrameGraphRenderContext> {\r\n protected _engine: AbstractEngine;\r\n protected _renderTarget: FrameGraphTextureHandle;\r\n protected _renderTargetDepth: FrameGraphTextureHandle | undefined;\r\n protected _usedTextures: FrameGraphTextureHandle[] = [];\r\n protected _depthShared = false;\r\n\r\n /**\r\n * Checks if a pass is a render pass.\r\n * @param pass The pass to check.\r\n * @returns True if the pass is a render pass, else false.\r\n */\r\n public static IsRenderPass(pass: IFrameGraphPass): pass is FrameGraphRenderPass {\r\n return (pass as FrameGraphRenderPass).setRenderTarget !== undefined;\r\n }\r\n\r\n /**\r\n * Gets the render target used by the render pass.\r\n */\r\n public get renderTarget(): FrameGraphTextureHandle {\r\n return this._renderTarget;\r\n }\r\n\r\n /**\r\n * Gets the render target depth used by the render pass.\r\n */\r\n public get renderTargetDepth(): FrameGraphTextureHandle | undefined {\r\n return this._renderTargetDepth;\r\n }\r\n\r\n /** @internal */\r\n constructor(name: string, parentTask: FrameGraphTask, context: FrameGraphRenderContext, engine: AbstractEngine) {\r\n super(name, parentTask, context);\r\n this._engine = engine;\r\n }\r\n\r\n /**\r\n * Indicates that the pass will use the given texture.\r\n * Use this method to indicate that the pass will use a texture so that the frame graph can handle the texture's lifecycle.\r\n * You don't have to call this method for the render target / render target depth textures.\r\n * @param texture The texture used.\r\n */\r\n public useTexture(texture: FrameGraphTextureHandle) {\r\n this._usedTextures.push(texture);\r\n }\r\n\r\n /**\r\n * Sets the render target to use for rendering.\r\n * @param renderTargetHandle The render target to use for rendering.\r\n */\r\n public setRenderTarget(renderTargetHandle: FrameGraphTextureHandle) {\r\n this._renderTarget = renderTargetHandle;\r\n }\r\n\r\n /**\r\n * Sets the render target depth to use for rendering.\r\n * @param renderTargetHandle The render target depth to use for rendering.\r\n */\r\n public setRenderTargetDepth(renderTargetHandle?: FrameGraphTextureHandle) {\r\n this._renderTargetDepth = renderTargetHandle;\r\n }\r\n\r\n /** @internal */\r\n public override _execute() {\r\n if (this._renderTargetDepth && !this._depthShared) {\r\n this._context._shareDepth(this._renderTargetDepth, this._renderTarget);\r\n this._depthShared = true;\r\n }\r\n\r\n this._context.bindRenderTarget(this._renderTarget, `frame graph - render pass '${this.name}'`);\r\n\r\n super._execute();\r\n\r\n this._context._flushDebugMessages();\r\n }\r\n\r\n /** @internal */\r\n public override _isValid(): Nullable<string> {\r\n const errMsg = super._isValid();\r\n return errMsg ? errMsg : this._renderTarget !== undefined ? null : \"Render target is not set (call setRenderTarget to set it)\";\r\n }\r\n}\r\n"]}
@@ -0,0 +1,21 @@
1
+ import type { FrameGraph, Scene, DrawWrapper } from "../../../index.js";
2
+ import { FrameGraphObjectRendererTask } from "./objectRendererTask";
3
+ import { ThinTAAPostProcess } from "../../../PostProcesses/thinTAAPostProcess.js";
4
+ /**
5
+ * Task used to render objects to a texture with Temporal Anti-Aliasing (TAA).
6
+ */
7
+ export declare class FrameGraphTAAObjectRendererTask extends FrameGraphObjectRendererTask {
8
+ /**
9
+ * The TAA post process.
10
+ */
11
+ readonly postProcess: ThinTAAPostProcess;
12
+ protected readonly _postProcessDrawWrapper: DrawWrapper;
13
+ /**
14
+ * Constructs a new TAA object renderer task.
15
+ * @param name The name of the task
16
+ * @param frameGraph The frame graph the task belongs to.
17
+ * @param scene The scene the frame graph is associated with.
18
+ */
19
+ constructor(name: string, frameGraph: FrameGraph, scene: Scene);
20
+ record(): void;
21
+ }
@@ -0,0 +1,110 @@
1
+ import { backbufferColorTextureHandle, backbufferDepthStencilTextureHandle } from "../../frameGraphTypes.js";
2
+ import { FrameGraphObjectRendererTask } from "./objectRendererTask.js";
3
+ import { ThinTAAPostProcess } from "../../../PostProcesses/thinTAAPostProcess.js";
4
+
5
+ /**
6
+ * Task used to render objects to a texture with Temporal Anti-Aliasing (TAA).
7
+ */
8
+ export class FrameGraphTAAObjectRendererTask extends FrameGraphObjectRendererTask {
9
+ /**
10
+ * Constructs a new TAA object renderer task.
11
+ * @param name The name of the task
12
+ * @param frameGraph The frame graph the task belongs to.
13
+ * @param scene The scene the frame graph is associated with.
14
+ */
15
+ constructor(name, frameGraph, scene) {
16
+ super(name, frameGraph, scene);
17
+ this.postProcess = new ThinTAAPostProcess(`${name} post-process`, scene.getEngine());
18
+ this._postProcessDrawWrapper = this.postProcess.drawWrapper;
19
+ }
20
+ record() {
21
+ if (this.destinationTexture === undefined || this.objectList === undefined) {
22
+ throw new Error(`FrameGraphTAAObjectRendererTask ${this.name}: destinationTexture and objectList are required`);
23
+ }
24
+ if (this.destinationTexture === backbufferColorTextureHandle || this.depthTexture === backbufferDepthStencilTextureHandle) {
25
+ throw new Error(`FrameGraphTAAObjectRendererTask ${this.name}: the back buffer color/depth textures are not allowed. Use regular textures instead.`);
26
+ }
27
+ const outputTextureDescription = this._frameGraph.getTextureDescription(this.destinationTexture);
28
+ let depthEnabled = false;
29
+ if (this.depthTexture !== undefined) {
30
+ const depthTextureDescription = this._frameGraph.getTextureDescription(this.depthTexture);
31
+ if (depthTextureDescription.options.samples !== outputTextureDescription.options.samples) {
32
+ throw new Error(`FrameGraphTAAObjectRendererTask ${this.name}: the depth texture and the output texture must have the same number of samples`);
33
+ }
34
+ depthEnabled = true;
35
+ }
36
+ this.postProcess.camera = this.camera;
37
+ this.postProcess.textureWidth = outputTextureDescription.size.width;
38
+ this.postProcess.textureHeight = outputTextureDescription.size.height;
39
+ const textureCreationOptions = {
40
+ size: outputTextureDescription.size,
41
+ options: {
42
+ createMipMaps: false,
43
+ generateMipMaps: false,
44
+ types: [2],
45
+ samplingModes: [1],
46
+ formats: [5],
47
+ samples: 1,
48
+ useSRGBBuffers: [false],
49
+ generateDepthBuffer: false,
50
+ generateStencilBuffer: false,
51
+ label: "",
52
+ },
53
+ sizeIsPercentage: false,
54
+ isHistoryTexture: true,
55
+ };
56
+ const pingPongHandle = this._frameGraph.createRenderTargetTexture(`${this.name} history`, textureCreationOptions);
57
+ this._frameGraph.resolveDanglingHandle(this.outputTexture, pingPongHandle);
58
+ if (this.depthTexture !== undefined) {
59
+ this._frameGraph.resolveDanglingHandle(this.outputDepthTexture, this.depthTexture);
60
+ }
61
+ this._rtt._size = outputTextureDescription.size;
62
+ const pass = this._frameGraph.addRenderPass(this.name);
63
+ pass.setRenderTarget(this.destinationTexture);
64
+ if (this.depthTexture !== undefined) {
65
+ pass.setRenderTargetDepth(this.depthTexture);
66
+ }
67
+ pass.setExecuteFunc((context) => {
68
+ this._rtt.renderList = this.objectList.meshes;
69
+ this._rtt.particleSystemList = this.objectList.particleSystems;
70
+ this._scene.incrementRenderId();
71
+ this._scene.resetCachedMaterial();
72
+ this.postProcess.updateProjectionMatrix();
73
+ context.setDepthStates(this.depthTest && depthEnabled, this.depthWrite && depthEnabled);
74
+ // We define the active camera and transformation matrices ourselves, otherwise this will be done by calling context.render, in which case
75
+ // getProjectionMatrix will be called with a "true" parameter, forcing recalculation of the projection matrix and losing our changes.
76
+ if (!this.postProcess.disabled) {
77
+ this._scene.activeCamera = this.camera;
78
+ this._scene.setTransformMatrix(this.camera.getViewMatrix(), this.camera.getProjectionMatrix());
79
+ }
80
+ context.render(this._rtt);
81
+ this._scene.activeCamera = null;
82
+ context.bindRenderTarget(pingPongHandle, "frame graph - TAA merge with history texture");
83
+ if (!this.postProcess.disabled) {
84
+ context.applyFullScreenEffect(this._postProcessDrawWrapper, () => {
85
+ this.postProcess.bind();
86
+ context.bindTextureHandle(this._postProcessDrawWrapper.effect, "textureSampler", this.destinationTexture);
87
+ context.bindTextureHandle(this._postProcessDrawWrapper.effect, "historySampler", pingPongHandle);
88
+ });
89
+ }
90
+ else {
91
+ context.copyTexture(this.destinationTexture);
92
+ }
93
+ });
94
+ const passDisabled = this._frameGraph.addRenderPass(this.name + "_disabled", true);
95
+ passDisabled.setRenderTarget(this.outputTexture);
96
+ if (this.depthTexture !== undefined) {
97
+ passDisabled.setRenderTargetDepth(this.depthTexture);
98
+ }
99
+ passDisabled.setExecuteFunc((context) => {
100
+ context.copyTexture(this.destinationTexture);
101
+ });
102
+ if (this.dependencies !== undefined) {
103
+ for (const handle of this.dependencies) {
104
+ pass.useTexture(handle);
105
+ passDisabled.useTexture(handle);
106
+ }
107
+ }
108
+ }
109
+ }
110
+ //# sourceMappingURL=taaObjectRendererTask.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"taaObjectRendererTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Rendering/taaObjectRendererTask.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,4BAA4B,EAAE,mCAAmC,EAAE,MAAM,uBAAuB,CAAC;AAC1G,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,qDAA8C;AAC3E,OAAO,EAAE,SAAS,EAAE,sCAA+B;AAEnD;;GAEG;AACH,MAAM,OAAO,+BAAgC,SAAQ,4BAA4B;IAQ7E;;;;;OAKG;IACH,YAAY,IAAY,EAAE,UAAsB,EAAE,KAAY;QAC1D,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;QAE/B,IAAI,CAAC,WAAW,GAAG,IAAI,kBAAkB,CAAC,GAAG,IAAI,eAAe,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC;QACrF,IAAI,CAAC,uBAAuB,GAAG,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;IAChE,CAAC;IAEe,MAAM;QAClB,IAAI,IAAI,CAAC,kBAAkB,KAAK,SAAS,IAAI,IAAI,CAAC,UAAU,KAAK,SAAS,EAAE;YACxE,MAAM,IAAI,KAAK,CAAC,mCAAmC,IAAI,CAAC,IAAI,kDAAkD,CAAC,CAAC;SACnH;QAED,IAAI,IAAI,CAAC,kBAAkB,KAAK,4BAA4B,IAAI,IAAI,CAAC,YAAY,KAAK,mCAAmC,EAAE;YACvH,MAAM,IAAI,KAAK,CAAC,mCAAmC,IAAI,CAAC,IAAI,uFAAuF,CAAC,CAAC;SACxJ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AAC;SACxD;QACD,YAAY,CAAC,cAAc,CAAC,CAAC,OAAO,EAAE,EAAE;YACpC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QACjD,CAAC,CAAC,CAAC;QAEH,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS,EAAE;YACjC,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,YAAY,EAAE;gBACpC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;gBACxB,YAAY,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;aACnC;SACJ;IACL,CAAC;CACJ","sourcesContent":["// eslint-disable-next-line import/no-internal-modules\r\nimport type { FrameGraph, Scene, DrawWrapper, FrameGraphTextureCreationOptions } from \"core/index\";\r\nimport { backbufferColorTextureHandle, backbufferDepthStencilTextureHandle } from \"../../frameGraphTypes\";\r\nimport { FrameGraphObjectRendererTask } from \"./objectRendererTask\";\r\nimport { ThinTAAPostProcess } from \"core/PostProcesses/thinTAAPostProcess\";\r\nimport { Constants } from \"core/Engines/constants\";\r\n\r\n/**\r\n * Task used to render objects to a texture with Temporal Anti-Aliasing (TAA).\r\n */\r\nexport class FrameGraphTAAObjectRendererTask extends FrameGraphObjectRendererTask {\r\n /**\r\n * The TAA post process.\r\n */\r\n public readonly postProcess: ThinTAAPostProcess;\r\n\r\n protected readonly _postProcessDrawWrapper: DrawWrapper;\r\n\r\n /**\r\n * Constructs a new TAA object renderer task.\r\n * @param name The name of the task\r\n * @param frameGraph The frame graph the task belongs to.\r\n * @param scene The scene the frame graph is associated with.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, scene: Scene) {\r\n super(name, frameGraph, scene);\r\n\r\n this.postProcess = new ThinTAAPostProcess(`${name} post-process`, scene.getEngine());\r\n this._postProcessDrawWrapper = this.postProcess.drawWrapper;\r\n }\r\n\r\n public override record() {\r\n if (this.destinationTexture === undefined || this.objectList === undefined) {\r\n throw new Error(`FrameGraphTAAObjectRendererTask ${this.name}: destinationTexture and objectList are required`);\r\n }\r\n\r\n if (this.destinationTexture === backbufferColorTextureHandle || this.depthTexture === backbufferDepthStencilTextureHandle) {\r\n throw new Error(`FrameGraphTAAObjectRendererTask ${this.name}: the back buffer color/depth textures are not allowed. Use regular textures instead.`);\r\n }\r\n\r\n const outputTextureDescription = this._frameGraph.getTextureDescription(this.destinationTexture);\r\n\r\n let depthEnabled = false;\r\n\r\n if (this.depthTexture !== undefined) {\r\n const depthTextureDescription = this._frameGraph.getTextureDescription(this.depthTexture);\r\n if (depthTextureDescription.options.samples !== outputTextureDescription.options.samples) {\r\n throw new Error(`FrameGraphTAAObjectRendererTask ${this.name}: the depth texture and the output texture must have the same number of samples`);\r\n }\r\n\r\n depthEnabled = true;\r\n }\r\n\r\n this.postProcess.camera = this.camera;\r\n this.postProcess.textureWidth = outputTextureDescription.size.width;\r\n this.postProcess.textureHeight = outputTextureDescription.size.height;\r\n\r\n const textureCreationOptions: FrameGraphTextureCreationOptions = {\r\n size: outputTextureDescription.size,\r\n options: {\r\n createMipMaps: false,\r\n generateMipMaps: false,\r\n types: [Constants.TEXTURETYPE_HALF_FLOAT],\r\n samplingModes: [Constants.TEXTURE_NEAREST_NEAREST],\r\n formats: [Constants.TEXTUREFORMAT_RGBA],\r\n samples: 1,\r\n useSRGBBuffers: [false],\r\n generateDepthBuffer: false,\r\n generateStencilBuffer: false,\r\n label: \"\",\r\n },\r\n sizeIsPercentage: false,\r\n isHistoryTexture: true,\r\n };\r\n\r\n const pingPongHandle = this._frameGraph.createRenderTargetTexture(`${this.name} history`, textureCreationOptions);\r\n\r\n this._frameGraph.resolveDanglingHandle(this.outputTexture, pingPongHandle);\r\n if (this.depthTexture !== undefined) {\r\n this._frameGraph.resolveDanglingHandle(this.outputDepthTexture, this.depthTexture);\r\n }\r\n\r\n this._rtt._size = outputTextureDescription.size;\r\n\r\n const pass = this._frameGraph.addRenderPass(this.name);\r\n\r\n pass.setRenderTarget(this.destinationTexture);\r\n if (this.depthTexture !== undefined) {\r\n pass.setRenderTargetDepth(this.depthTexture);\r\n }\r\n\r\n pass.setExecuteFunc((context) => {\r\n this._rtt.renderList = this.objectList.meshes;\r\n this._rtt.particleSystemList = this.objectList.particleSystems;\r\n\r\n this._scene.incrementRenderId();\r\n this._scene.resetCachedMaterial();\r\n\r\n this.postProcess.updateProjectionMatrix();\r\n\r\n context.setDepthStates(this.depthTest && depthEnabled, this.depthWrite && depthEnabled);\r\n\r\n // We define the active camera and transformation matrices ourselves, otherwise this will be done by calling context.render, in which case\r\n // getProjectionMatrix will be called with a \"true\" parameter, forcing recalculation of the projection matrix and losing our changes.\r\n if (!this.postProcess.disabled) {\r\n this._scene.activeCamera = this.camera;\r\n this._scene.setTransformMatrix(this.camera.getViewMatrix(), this.camera.getProjectionMatrix());\r\n }\r\n\r\n context.render(this._rtt);\r\n\r\n this._scene.activeCamera = null;\r\n\r\n context.bindRenderTarget(pingPongHandle, \"frame graph - TAA merge with history texture\");\r\n\r\n if (!this.postProcess.disabled) {\r\n context.applyFullScreenEffect(this._postProcessDrawWrapper, () => {\r\n this.postProcess.bind();\r\n context.bindTextureHandle(this._postProcessDrawWrapper.effect!, \"textureSampler\", this.destinationTexture);\r\n context.bindTextureHandle(this._postProcessDrawWrapper.effect!, \"historySampler\", pingPongHandle);\r\n });\r\n } else {\r\n context.copyTexture(this.destinationTexture);\r\n }\r\n });\r\n\r\n const passDisabled = this._frameGraph.addRenderPass(this.name + \"_disabled\", true);\r\n\r\n passDisabled.setRenderTarget(this.outputTexture);\r\n if (this.depthTexture !== undefined) {\r\n passDisabled.setRenderTargetDepth(this.depthTexture);\r\n }\r\n passDisabled.setExecuteFunc((context) => {\r\n context.copyTexture(this.destinationTexture);\r\n });\r\n\r\n if (this.dependencies !== undefined) {\r\n for (const handle of this.dependencies) {\r\n pass.useTexture(handle);\r\n passDisabled.useTexture(handle);\r\n }\r\n }\r\n }\r\n}\r\n"]}
@@ -131,6 +131,12 @@ export declare class FrameGraph {
131
131
  * @param creationOptions The options to use when creating the new texture (if handle is not provided)
132
132
  */
133
133
  resolveDanglingHandle(danglingHandle: FrameGraphTextureHandle, handle?: FrameGraphTextureHandle, newTextureName?: string, creationOptions?: FrameGraphTextureCreationOptions): void;
134
+ /**
135
+ * Checks if a handle is a history texture (or points to a history texture, for a dangling handle)
136
+ * @param handle The handle to check
137
+ * @returns True if the handle is a history texture, otherwise false
138
+ */
139
+ isHistoryTexture(handle: FrameGraphTextureHandle): boolean;
134
140
  /**
135
141
  * Clears the frame graph (remove the tasks and release the textures).
136
142
  * The frame graph can be built again after this method is called.
@@ -141,7 +141,8 @@ export class FrameGraph {
141
141
  * Executes the frame graph.
142
142
  */
143
143
  execute() {
144
- this._renderContext._bindRenderTarget();
144
+ this._renderContext.bindRenderTarget();
145
+ this._textureManager.updateHistoryTextures();
145
146
  for (const task of this._tasks) {
146
147
  const passes = task._getPasses();
147
148
  for (const pass of passes) {
@@ -251,6 +252,19 @@ export class FrameGraph {
251
252
  }
252
253
  this._textureManager.resolveDanglingHandle(danglingHandle, handle);
253
254
  }
255
+ /**
256
+ * Checks if a handle is a history texture (or points to a history texture, for a dangling handle)
257
+ * @param handle The handle to check
258
+ * @returns True if the handle is a history texture, otherwise false
259
+ */
260
+ isHistoryTexture(handle) {
261
+ const entry = this._textureManager._textures.get(handle);
262
+ if (!entry) {
263
+ return false;
264
+ }
265
+ handle = entry.refHandle ?? handle;
266
+ return this._textureManager._historyTextures.has(handle);
267
+ }
254
268
  /**
255
269
  * Clears the frame graph (remove the tasks and release the textures).
256
270
  * The frame graph can be built again after this method is called.
@@ -1 +1 @@
1
- {"version":3,"file":"frameGraph.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/frameGraph.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,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A8F,CAAC,CAAC;aACnH;YACD,IAAI,CAAC,eAAe,CAAC,yBAAyB,CAAC,cAAc,EAAE,CAAC,CAAC,IAAI,CAAC,qBAAqB,EAAE,eAAe,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC;YACrI,OAAO;SACV;QAED,IAAI,CAAC,eAAe,CAAC,qBAAqB,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;IACvE,CAAC;IAED;;;OAGG;IACI,KAAK;QACR,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM,EAAE;YAC5B,IAAI,CAAC,MAAM,EAAE,CAAC;SACjB;QAED,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;QACvB,IAAI,CAAC,eAAe,CAAC,eAAe,EAAE,CAAC;QACvC,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;IACtC,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC;QAC/B,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;IACnC,CAAC;CACJ","sourcesContent":["/* eslint-disable import/no-internal-modules */\r\nimport type {\r\n Scene,\r\n AbstractEngine,\r\n RenderTargetWrapper,\r\n FrameGraphTextureCreationOptions,\r\n FrameGraphTextureHandle,\r\n FrameGraphTextureDescription,\r\n Nullable,\r\n FrameGraphTask,\r\n} 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 { getDimensionsFromTextureSize, textureSizeIsObject } from \"../Materials/Textures/textureCreationOptions\";\r\n\r\nenum FrameGraphPassType {\r\n Render = 0,\r\n Cull = 1,\r\n Compute = 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 /** @internal */\r\n public readonly _passContext: FrameGraphContext;\r\n /** @internal */\r\n public readonly _renderContext: FrameGraphRenderContext;\r\n\r\n private readonly _engine: AbstractEngine;\r\n private readonly _textureManager: FrameGraphTextureManager;\r\n private _tasks: FrameGraphTask[] = [];\r\n private _currentProcessedTask: FrameGraphTask | null = null;\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 * Constructs the frame graph\r\n * @param engine defines the hosting engine\r\n * @param debugTextures defines a boolean indicating that textures created by the frame graph should be visible in the inspector\r\n * @param scene defines the scene in which debugging textures are to be created\r\n */\r\n constructor(engine: AbstractEngine, debugTextures = false, scene?: Scene) {\r\n this._engine = engine;\r\n this._textureManager = new FrameGraphTextureManager(this._engine, debugTextures, scene);\r\n this._passContext = new FrameGraphContext();\r\n this._renderContext = new FrameGraphRenderContext(this._engine, this._textureManager);\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 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 for (const task of this._tasks) {\r\n task._reset();\r\n\r\n this._currentProcessedTask = task;\r\n\r\n task.record();\r\n\r\n this._currentProcessedTask = null;\r\n }\r\n\r\n this._textureManager.allocateTextures();\r\n\r\n for (const task of this._tasks) {\r\n task._checkTask();\r\n }\r\n\r\n this.onBuildObservable.notifyObservers(this);\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 timeout Timeout in ms between retries (default is 16)\r\n * @returns The promise that resolves when the graph is ready\r\n */\r\n public whenReadyAsync(timeout = 16): Promise<void> {\r\n return new Promise((resolve) => {\r\n const checkReady = () => {\r\n let ready = true;\r\n for (const task of this._tasks) {\r\n ready &&= task.isReady();\r\n }\r\n if (ready) {\r\n resolve();\r\n } else {\r\n setTimeout(checkReady, timeout);\r\n }\r\n };\r\n\r\n checkReady();\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 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 * Imports a texture into the frame graph\r\n * @param name Name of the texture\r\n * @param texture Texture to import\r\n * @param handle Existing handle to use for the texture. If not provided (default), a new handle will be created.\r\n * @returns The handle to the texture\r\n */\r\n public importTexture(name: string, texture: RenderTargetWrapper, handle?: FrameGraphTextureHandle): FrameGraphTextureHandle {\r\n return this._textureManager.importTexture(name, texture, handle);\r\n }\r\n\r\n /**\r\n * Gets the creation options of a texture\r\n * @param handle Handle of the texture\r\n * @param cloneOptions If true, the options will be cloned before being returned (default is false)\r\n * @returns The creation options of the texture\r\n */\r\n public getTextureCreationOptions(handle: FrameGraphTextureHandle, cloneOptions = false): FrameGraphTextureCreationOptions {\r\n const creationOptions = this._textureManager.getTextureCreationOptions(handle);\r\n\r\n return cloneOptions\r\n ? {\r\n size: getDimensionsFromTextureSize(creationOptions.size),\r\n options: { ...creationOptions.options },\r\n sizeIsPercentage: creationOptions.sizeIsPercentage,\r\n }\r\n : creationOptions;\r\n }\r\n\r\n /**\r\n * Gets the description of a texture\r\n * @param handle Handle of the texture\r\n * @returns The description of the texture\r\n */\r\n public getTextureDescription(handle: FrameGraphTextureHandle): FrameGraphTextureDescription {\r\n const creationOptions = this.getTextureCreationOptions(handle);\r\n\r\n const size = !creationOptions.sizeIsPercentage\r\n ? textureSizeIsObject(creationOptions.size)\r\n ? { width: creationOptions.size.width, height: creationOptions.size.height }\r\n : { width: creationOptions.size, height: creationOptions.size }\r\n : this._textureManager.getAbsoluteDimensions(creationOptions.size);\r\n\r\n return {\r\n size,\r\n options: { ...creationOptions.options },\r\n };\r\n }\r\n\r\n /**\r\n * Gets a texture handle or creates a new texture if the handle is not provided.\r\n * @param handle If provided, will simply return the handle\r\n * @param newTextureName Name of the new texture to create\r\n * @param creationOptions Options to use when creating the new texture\r\n * @returns The handle to the texture. If handle is not provided, newTextureName and creationOptions must be provided.\r\n */\r\n public getTextureHandleOrCreateTexture(handle?: FrameGraphTextureHandle, newTextureName?: string, creationOptions?: FrameGraphTextureCreationOptions): FrameGraphTextureHandle {\r\n if (handle === undefined) {\r\n if (newTextureName === undefined || creationOptions === undefined) {\r\n throw new Error(\"getTextureHandleOrCreateTexture: Either handle or newTextureName and creationOptions must be provided.\");\r\n }\r\n return this.createRenderTargetTexture(newTextureName, creationOptions);\r\n }\r\n return handle;\r\n }\r\n\r\n /**\r\n * Gets a texture from a handle\r\n * @param handle The handle of the texture\r\n * @returns The texture or null if not found\r\n */\r\n public getTexture(handle: FrameGraphTextureHandle): Nullable<RenderTargetWrapper> {\r\n return this._textureManager.getTextureFromHandle(handle);\r\n }\r\n\r\n /**\r\n * Creates a new render target texture\r\n * @param name Name of the texture\r\n * @param creationOptions Options to use when creating the texture\r\n * @param multiTargetMode If true, the texture will be created in multi target mode (default is false). In this mode, a handle is created for each target separately, in addition to the handle created for the main render target texture itself.\r\n * @returns The handle to the texture\r\n */\r\n public createRenderTargetTexture(name: string, creationOptions: FrameGraphTextureCreationOptions, multiTargetMode = false): FrameGraphTextureHandle {\r\n return this._textureManager.createRenderTargetTexture(name, !!this._currentProcessedTask, creationOptions, multiTargetMode);\r\n }\r\n\r\n /**\r\n * Creates a handle which is not associated with any texture.\r\n * Call resolveDanglingHandle to associate the handle with a valid texture handle.\r\n * @returns The dangling handle\r\n */\r\n public createDanglingHandle(): FrameGraphTextureHandle {\r\n return this._textureManager.createDanglingHandle();\r\n }\r\n\r\n /**\r\n * Associates a texture with a dangling handle\r\n * @param danglingHandle The dangling handle\r\n * @param handle The handle to associate with the dangling handle (if not provided, a new texture handle will be created)\r\n * @param newTextureName The name of the new texture to create (if handle is not provided)\r\n * @param creationOptions The options to use when creating the new texture (if handle is not provided)\r\n */\r\n public resolveDanglingHandle(\r\n danglingHandle: FrameGraphTextureHandle,\r\n handle?: FrameGraphTextureHandle,\r\n newTextureName?: string,\r\n creationOptions?: FrameGraphTextureCreationOptions\r\n ) {\r\n if (handle === undefined) {\r\n if (newTextureName === undefined || creationOptions === undefined) {\r\n throw new Error(\"resolveDanglingHandle: Either handle or newTextureName and creationOptions must be provided.\");\r\n }\r\n this._textureManager.createRenderTargetTexture(newTextureName, !!this._currentProcessedTask, creationOptions, false, danglingHandle);\r\n return;\r\n }\r\n\r\n this._textureManager.resolveDanglingHandle(danglingHandle, handle);\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 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.clear();\r\n this._textureManager.dispose();\r\n this._renderContext._dispose();\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"frameGraph.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/frameGraph.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAA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\n Scene,\r\n AbstractEngine,\r\n RenderTargetWrapper,\r\n FrameGraphTextureCreationOptions,\r\n FrameGraphTextureHandle,\r\n FrameGraphTextureDescription,\r\n Nullable,\r\n FrameGraphTask,\r\n} 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 { getDimensionsFromTextureSize, textureSizeIsObject } from \"../Materials/Textures/textureCreationOptions\";\r\n\r\nenum FrameGraphPassType {\r\n Render = 0,\r\n Cull = 1,\r\n Compute = 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 /** @internal */\r\n public readonly _passContext: FrameGraphContext;\r\n /** @internal */\r\n public readonly _renderContext: FrameGraphRenderContext;\r\n\r\n private readonly _engine: AbstractEngine;\r\n private readonly _textureManager: FrameGraphTextureManager;\r\n private _tasks: FrameGraphTask[] = [];\r\n private _currentProcessedTask: FrameGraphTask | null = null;\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 * Constructs the frame graph\r\n * @param engine defines the hosting engine\r\n * @param debugTextures defines a boolean indicating that textures created by the frame graph should be visible in the inspector\r\n * @param scene defines the scene in which debugging textures are to be created\r\n */\r\n constructor(engine: AbstractEngine, debugTextures = false, scene?: Scene) {\r\n this._engine = engine;\r\n this._textureManager = new FrameGraphTextureManager(this._engine, debugTextures, scene);\r\n this._passContext = new FrameGraphContext();\r\n this._renderContext = new FrameGraphRenderContext(this._engine, this._textureManager);\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 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 for (const task of this._tasks) {\r\n task._reset();\r\n\r\n this._currentProcessedTask = task;\r\n\r\n task.record();\r\n\r\n this._currentProcessedTask = null;\r\n }\r\n\r\n this._textureManager.allocateTextures();\r\n\r\n for (const task of this._tasks) {\r\n task._checkTask();\r\n }\r\n\r\n this.onBuildObservable.notifyObservers(this);\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 timeout Timeout in ms between retries (default is 16)\r\n * @returns The promise that resolves when the graph is ready\r\n */\r\n public whenReadyAsync(timeout = 16): Promise<void> {\r\n return new Promise((resolve) => {\r\n const checkReady = () => {\r\n let ready = true;\r\n for (const task of this._tasks) {\r\n ready &&= task.isReady();\r\n }\r\n if (ready) {\r\n resolve();\r\n } else {\r\n setTimeout(checkReady, timeout);\r\n }\r\n };\r\n\r\n checkReady();\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 * Imports a texture into the frame graph\r\n * @param name Name of the texture\r\n * @param texture Texture to import\r\n * @param handle Existing handle to use for the texture. If not provided (default), a new handle will be created.\r\n * @returns The handle to the texture\r\n */\r\n public importTexture(name: string, texture: RenderTargetWrapper, handle?: FrameGraphTextureHandle): FrameGraphTextureHandle {\r\n return this._textureManager.importTexture(name, texture, handle);\r\n }\r\n\r\n /**\r\n * Gets the creation options of a texture\r\n * @param handle Handle of the texture\r\n * @param cloneOptions If true, the options will be cloned before being returned (default is false)\r\n * @returns The creation options of the texture\r\n */\r\n public getTextureCreationOptions(handle: FrameGraphTextureHandle, cloneOptions = false): FrameGraphTextureCreationOptions {\r\n const creationOptions = this._textureManager.getTextureCreationOptions(handle);\r\n\r\n return cloneOptions\r\n ? {\r\n size: getDimensionsFromTextureSize(creationOptions.size),\r\n options: { ...creationOptions.options },\r\n sizeIsPercentage: creationOptions.sizeIsPercentage,\r\n }\r\n : creationOptions;\r\n }\r\n\r\n /**\r\n * Gets the description of a texture\r\n * @param handle Handle of the texture\r\n * @returns The description of the texture\r\n */\r\n public getTextureDescription(handle: FrameGraphTextureHandle): FrameGraphTextureDescription {\r\n const creationOptions = this.getTextureCreationOptions(handle);\r\n\r\n const size = !creationOptions.sizeIsPercentage\r\n ? textureSizeIsObject(creationOptions.size)\r\n ? { width: creationOptions.size.width, height: creationOptions.size.height }\r\n : { width: creationOptions.size, height: creationOptions.size }\r\n : this._textureManager.getAbsoluteDimensions(creationOptions.size);\r\n\r\n return {\r\n size,\r\n options: { ...creationOptions.options },\r\n };\r\n }\r\n\r\n /**\r\n * Gets a texture handle or creates a new texture if the handle is not provided.\r\n * @param handle If provided, will simply return the handle\r\n * @param newTextureName Name of the new texture to create\r\n * @param creationOptions Options to use when creating the new texture\r\n * @returns The handle to the texture. If handle is not provided, newTextureName and creationOptions must be provided.\r\n */\r\n public getTextureHandleOrCreateTexture(handle?: FrameGraphTextureHandle, newTextureName?: string, creationOptions?: FrameGraphTextureCreationOptions): FrameGraphTextureHandle {\r\n if (handle === undefined) {\r\n if (newTextureName === undefined || creationOptions === undefined) {\r\n throw new Error(\"getTextureHandleOrCreateTexture: Either handle or newTextureName and creationOptions must be provided.\");\r\n }\r\n return this.createRenderTargetTexture(newTextureName, creationOptions);\r\n }\r\n return handle;\r\n }\r\n\r\n /**\r\n * Gets a texture from a handle\r\n * @param handle The handle of the texture\r\n * @returns The texture or null if not found\r\n */\r\n public getTexture(handle: FrameGraphTextureHandle): Nullable<RenderTargetWrapper> {\r\n return this._textureManager.getTextureFromHandle(handle);\r\n }\r\n\r\n /**\r\n * Creates a new render target texture\r\n * @param name Name of the texture\r\n * @param creationOptions Options to use when creating the texture\r\n * @param multiTargetMode If true, the texture will be created in multi target mode (default is false). In this mode, a handle is created for each target separately, in addition to the handle created for the main render target texture itself.\r\n * @returns The handle to the texture\r\n */\r\n public createRenderTargetTexture(name: string, creationOptions: FrameGraphTextureCreationOptions, multiTargetMode = false): FrameGraphTextureHandle {\r\n return this._textureManager.createRenderTargetTexture(name, !!this._currentProcessedTask, creationOptions, multiTargetMode);\r\n }\r\n\r\n /**\r\n * Creates a handle which is not associated with any texture.\r\n * Call resolveDanglingHandle to associate the handle with a valid texture handle.\r\n * @returns The dangling handle\r\n */\r\n public createDanglingHandle(): FrameGraphTextureHandle {\r\n return this._textureManager.createDanglingHandle();\r\n }\r\n\r\n /**\r\n * Associates a texture with a dangling handle\r\n * @param danglingHandle The dangling handle\r\n * @param handle The handle to associate with the dangling handle (if not provided, a new texture handle will be created)\r\n * @param newTextureName The name of the new texture to create (if handle is not provided)\r\n * @param creationOptions The options to use when creating the new texture (if handle is not provided)\r\n */\r\n public resolveDanglingHandle(\r\n danglingHandle: FrameGraphTextureHandle,\r\n handle?: FrameGraphTextureHandle,\r\n newTextureName?: string,\r\n creationOptions?: FrameGraphTextureCreationOptions\r\n ) {\r\n if (handle === undefined) {\r\n if (newTextureName === undefined || creationOptions === undefined) {\r\n throw new Error(\"resolveDanglingHandle: Either handle or newTextureName and creationOptions must be provided.\");\r\n }\r\n this._textureManager.createRenderTargetTexture(newTextureName, !!this._currentProcessedTask, creationOptions, false, danglingHandle);\r\n return;\r\n }\r\n\r\n this._textureManager.resolveDanglingHandle(danglingHandle, handle);\r\n }\r\n\r\n /**\r\n * Checks if a handle is a history texture (or points to a history texture, for a dangling handle)\r\n * @param handle The handle to check\r\n * @returns True if the handle is a history texture, otherwise false\r\n */\r\n public isHistoryTexture(handle: FrameGraphTextureHandle): boolean {\r\n const entry = this._textureManager._textures.get(handle);\r\n if (!entry) {\r\n return false;\r\n }\r\n\r\n handle = entry.refHandle ?? handle;\r\n\r\n return this._textureManager._historyTextures.has(handle);\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 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.clear();\r\n this._textureManager.dispose();\r\n this._renderContext._dispose();\r\n }\r\n}\r\n"]}
@@ -97,9 +97,10 @@ export declare class FrameGraphRenderContext extends FrameGraphContext {
97
97
  * Binds a render target texture so that upcoming draw calls will render to it
98
98
  * Note: it is a lazy operation, so the render target will only be bound when needed. This way, it is possible to call
99
99
  * this method several times with different render targets without incurring the cost of binding if no draw calls are made
100
- * @internal
100
+ * @param renderTargetHandle The handle of the render target texture to bind (default: backbufferColorTextureHandle)
101
+ * @param debugMessage Optional debug message to display when the render target is bound (visible in PIX, for example)
101
102
  */
102
- _bindRenderTarget(renderTargetHandle?: FrameGraphTextureHandle, debugMessage?: string): void;
103
+ bindRenderTarget(renderTargetHandle?: FrameGraphTextureHandle, debugMessage?: string): void;
103
104
  /** @internal */
104
105
  _flushDebugMessages(): void;
105
106
  /** @internal */
@@ -154,7 +154,7 @@ export class FrameGraphRenderContext extends FrameGraphContext {
154
154
  */
155
155
  copyTexture(sourceTexture, forceCopyToBackbuffer = false) {
156
156
  if (forceCopyToBackbuffer) {
157
- this._bindRenderTarget();
157
+ this.bindRenderTarget();
158
158
  }
159
159
  this._applyRenderTarget();
160
160
  this._copyTexture.copy(this._textureManager.getTextureFromHandle(sourceTexture).texture);
@@ -171,9 +171,10 @@ export class FrameGraphRenderContext extends FrameGraphContext {
171
171
  * Binds a render target texture so that upcoming draw calls will render to it
172
172
  * Note: it is a lazy operation, so the render target will only be bound when needed. This way, it is possible to call
173
173
  * this method several times with different render targets without incurring the cost of binding if no draw calls are made
174
- * @internal
174
+ * @param renderTargetHandle The handle of the render target texture to bind (default: backbufferColorTextureHandle)
175
+ * @param debugMessage Optional debug message to display when the render target is bound (visible in PIX, for example)
175
176
  */
176
- _bindRenderTarget(renderTargetHandle = backbufferColorTextureHandle, debugMessage) {
177
+ bindRenderTarget(renderTargetHandle = backbufferColorTextureHandle, debugMessage) {
177
178
  if (renderTargetHandle === this._currentRenderTargetHandle) {
178
179
  this._flushDebugMessages();
179
180
  if (debugMessage !== undefined) {
@@ -208,7 +209,11 @@ export class FrameGraphRenderContext extends FrameGraphContext {
208
209
  }
209
210
  const handle = this._currentRenderTargetHandle;
210
211
  const textureSlot = this._textureManager._textures.get(handle);
211
- const renderTarget = textureSlot.texture;
212
+ let renderTarget = textureSlot.texture;
213
+ if (textureSlot.creationOptions.isHistoryTexture) {
214
+ const historyEntry = this._textureManager._historyTextures.get(textureSlot.refHandle ?? handle);
215
+ renderTarget = historyEntry.textures[historyEntry.index];
216
+ }
212
217
  this._flushDebugMessages();
213
218
  if (!renderTarget) {
214
219
  if (handle === backbufferColorTextureHandle || textureSlot.refHandle === backbufferColorTextureHandle) {
@@ -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,8BAA8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,CAAC;YAC9C,IAAI,CAAC,0BAA0B,GAAG,IAAI,CAAC;SAC1C;QAED,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;IACrC,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":["// eslint-disable-next-line import/no-internal-modules\r\nimport type { Nullable, AbstractEngine, DrawWrapper, IColor4Like, Layer, FrameGraphTextureHandle, Effect, FrameGraphTextureManager, RenderTargetTexture } 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\nimport { backbufferColorTextureHandle, backbufferDepthStencilTextureHandle } from \"./frameGraphTypes\";\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 _currentRenderTargetHandle: FrameGraphTextureHandle;\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 /** @internal */\r\n constructor(\r\n private readonly _engine: AbstractEngine,\r\n private readonly _textureManager: FrameGraphTextureManager\r\n ) {\r\n super();\r\n this._effectRenderer = new EffectRenderer(this._engine);\r\n this._copyTexture = new CopyTextureToTexture(this._engine);\r\n this._currentRenderTargetHandle = backbufferColorTextureHandle;\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 * 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 const texture = this._textureManager.getTextureFromHandle(this._currentRenderTargetHandle);\r\n if (!texture) {\r\n // Texture is backbuffer, no need to generate mipmaps\r\n return;\r\n }\r\n if (this._renderTargetIsBound) {\r\n // we can't generate the mipmaps if the texture is bound as a render target\r\n this._flushDebugMessages();\r\n this._engine.unBindFramebuffer(texture);\r\n this._renderTargetIsBound = false;\r\n }\r\n this._engine.generateMipmaps(texture.texture!);\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)?.texture!;\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 const texture = this._textureManager.getTextureFromHandle(handle);\r\n if (texture) {\r\n effect._bindTexture(name, texture.texture!);\r\n }\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)!.texture!);\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 */\r\n public render(object: Layer | RenderTargetTexture): void {\r\n this._applyRenderTarget();\r\n object.render();\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 * @internal\r\n */\r\n public _bindRenderTarget(renderTargetHandle: FrameGraphTextureHandle = backbufferColorTextureHandle, debugMessage?: string) {\r\n if (renderTargetHandle === this._currentRenderTargetHandle) {\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._currentRenderTargetHandle = renderTargetHandle;\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 _shareDepth(srcRenderTargetHandle: FrameGraphTextureHandle, dstRenderTargetHandle: FrameGraphTextureHandle) {\r\n const srcTexture = this._textureManager.getTextureFromHandle(srcRenderTargetHandle);\r\n const dstTexture = this._textureManager.getTextureFromHandle(dstRenderTargetHandle);\r\n\r\n if (srcTexture && dstTexture) {\r\n srcTexture.shareDepth(dstTexture);\r\n }\r\n }\r\n\r\n private _applyRenderTarget() {\r\n if (this._renderTargetIsBound) {\r\n return;\r\n }\r\n\r\n const handle = this._currentRenderTargetHandle;\r\n const textureSlot = this._textureManager._textures.get(handle)!;\r\n\r\n const renderTarget = textureSlot.texture;\r\n\r\n this._flushDebugMessages();\r\n\r\n if (!renderTarget) {\r\n if (handle === backbufferColorTextureHandle || textureSlot.refHandle === backbufferColorTextureHandle) {\r\n this._engine.restoreDefaultFramebuffer();\r\n } else if (handle === backbufferDepthStencilTextureHandle || textureSlot.refHandle === backbufferDepthStencilTextureHandle) {\r\n this._engine.restoreDefaultFramebuffer();\r\n }\r\n } else {\r\n this._engine.bindFramebuffer(renderTarget);\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 _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,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BACxH,IAAI,CAAC,OAAO,CAAC,yBAAyB,EAAE,CAAC;aAC5C;SACJ;aAAM;YACH,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;SAC9C;QAED,IAAI,IAAI,CAAC,4BAA4B,KAAK,SAAS,EAAE;YACjD,IAAI,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;SAC1C;QAED,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;IACrC,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":["// eslint-disable-next-line import/no-internal-modules\r\nimport type { Nullable, AbstractEngine, DrawWrapper, IColor4Like, Layer, FrameGraphTextureHandle, Effect, FrameGraphTextureManager, RenderTargetTexture } 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\nimport { backbufferColorTextureHandle, backbufferDepthStencilTextureHandle } from \"./frameGraphTypes\";\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 _currentRenderTargetHandle: FrameGraphTextureHandle;\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 /** @internal */\r\n constructor(\r\n private readonly _engine: AbstractEngine,\r\n private readonly _textureManager: FrameGraphTextureManager\r\n ) {\r\n super();\r\n this._effectRenderer = new EffectRenderer(this._engine);\r\n this._copyTexture = new CopyTextureToTexture(this._engine);\r\n this._currentRenderTargetHandle = backbufferColorTextureHandle;\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 * 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 const texture = this._textureManager.getTextureFromHandle(this._currentRenderTargetHandle);\r\n if (!texture) {\r\n // Texture is backbuffer, no need to generate mipmaps\r\n return;\r\n }\r\n if (this._renderTargetIsBound) {\r\n // we can't generate the mipmaps if the texture is bound as a render target\r\n this._flushDebugMessages();\r\n this._engine.unBindFramebuffer(texture);\r\n this._renderTargetIsBound = false;\r\n }\r\n this._engine.generateMipmaps(texture.texture!);\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)?.texture!;\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 const texture = this._textureManager.getTextureFromHandle(handle);\r\n if (texture) {\r\n effect._bindTexture(name, texture.texture!);\r\n }\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)!.texture!);\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 */\r\n public render(object: Layer | RenderTargetTexture): void {\r\n this._applyRenderTarget();\r\n object.render();\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 renderTargetHandle The handle of the render target texture to bind (default: backbufferColorTextureHandle)\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(renderTargetHandle: FrameGraphTextureHandle = backbufferColorTextureHandle, debugMessage?: string) {\r\n if (renderTargetHandle === this._currentRenderTargetHandle) {\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._currentRenderTargetHandle = renderTargetHandle;\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 _shareDepth(srcRenderTargetHandle: FrameGraphTextureHandle, dstRenderTargetHandle: FrameGraphTextureHandle) {\r\n const srcTexture = this._textureManager.getTextureFromHandle(srcRenderTargetHandle);\r\n const dstTexture = this._textureManager.getTextureFromHandle(dstRenderTargetHandle);\r\n\r\n if (srcTexture && dstTexture) {\r\n srcTexture.shareDepth(dstTexture);\r\n }\r\n }\r\n\r\n private _applyRenderTarget() {\r\n if (this._renderTargetIsBound) {\r\n return;\r\n }\r\n\r\n const handle = this._currentRenderTargetHandle;\r\n const textureSlot = this._textureManager._textures.get(handle)!;\r\n\r\n let renderTarget = textureSlot.texture;\r\n\r\n if (textureSlot.creationOptions.isHistoryTexture) {\r\n const historyEntry = this._textureManager._historyTextures.get(textureSlot.refHandle ?? handle)!;\r\n renderTarget = historyEntry.textures[historyEntry.index];\r\n }\r\n\r\n this._flushDebugMessages();\r\n\r\n if (!renderTarget) {\r\n if (handle === backbufferColorTextureHandle || textureSlot.refHandle === backbufferColorTextureHandle) {\r\n this._engine.restoreDefaultFramebuffer();\r\n } else if (handle === backbufferDepthStencilTextureHandle || textureSlot.refHandle === backbufferDepthStencilTextureHandle) {\r\n this._engine.restoreDefaultFramebuffer();\r\n }\r\n } else {\r\n this._engine.bindFramebuffer(renderTarget);\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 _dispose() {\r\n this._effectRenderer.dispose();\r\n this._copyTexture.dispose();\r\n }\r\n}\r\n"]}