@onerjs/core 8.32.7 → 8.32.9

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 (112) hide show
  1. package/Audio/sound.js +0 -1
  2. package/Audio/sound.js.map +1 -1
  3. package/AudioV2/abstractAudio/abstractSoundSource.js +12 -4
  4. package/AudioV2/abstractAudio/abstractSoundSource.js.map +1 -1
  5. package/AudioV2/webAudio/webAudioStaticSound.js +10 -3
  6. package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -1
  7. package/Engines/Extensions/engine.prefilteredCubeTexture.js +1 -1
  8. package/Engines/Extensions/engine.prefilteredCubeTexture.js.map +1 -1
  9. package/Engines/abstractEngine.js +2 -2
  10. package/Engines/abstractEngine.js.map +1 -1
  11. package/FrameGraph/Node/Blocks/PostProcesses/baseWithPropertiesPostProcessBlock.js +1 -1
  12. package/FrameGraph/Node/Blocks/PostProcesses/baseWithPropertiesPostProcessBlock.js.map +1 -1
  13. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.d.ts +18 -0
  14. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js +105 -15
  15. package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js.map +1 -1
  16. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js +7 -7
  17. package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js.map +1 -1
  18. package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.js +1 -1
  19. package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.js.map +1 -1
  20. package/FrameGraph/Passes/pass.d.ts +11 -2
  21. package/FrameGraph/Passes/pass.js +14 -2
  22. package/FrameGraph/Passes/pass.js.map +1 -1
  23. package/FrameGraph/Passes/renderPass.d.ts +4 -2
  24. package/FrameGraph/Passes/renderPass.js +5 -2
  25. package/FrameGraph/Passes/renderPass.js.map +1 -1
  26. package/FrameGraph/Tasks/Layers/baseLayerTask.js +27 -31
  27. package/FrameGraph/Tasks/Layers/baseLayerTask.js.map +1 -1
  28. package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +41 -1
  29. package/FrameGraph/Tasks/Rendering/objectRendererTask.js +122 -0
  30. package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
  31. package/FrameGraph/Tasks/Texture/clearTextureTask.js +6 -4
  32. package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -1
  33. package/FrameGraph/frameGraph.js +3 -0
  34. package/FrameGraph/frameGraph.js.map +1 -1
  35. package/FrameGraph/frameGraphRenderTarget.js +1 -0
  36. package/FrameGraph/frameGraphRenderTarget.js.map +1 -1
  37. package/FrameGraph/frameGraphTask.d.ts +2 -0
  38. package/FrameGraph/frameGraphTask.js +11 -0
  39. package/FrameGraph/frameGraphTask.js.map +1 -1
  40. package/FrameGraph/frameGraphTypes.d.ts +8 -0
  41. package/FrameGraph/frameGraphTypes.js.map +1 -1
  42. package/Layers/effectLayer.d.ts +1 -1
  43. package/Layers/effectLayer.js.map +1 -1
  44. package/Layers/glowLayer.js +2 -0
  45. package/Layers/glowLayer.js.map +1 -1
  46. package/Layers/highlightLayer.js +2 -0
  47. package/Layers/highlightLayer.js.map +1 -1
  48. package/Materials/GaussianSplatting/gaussianSplattingMaterial.d.ts +9 -0
  49. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +66 -22
  50. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  51. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js +3 -6
  52. package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js.map +1 -1
  53. package/Materials/materialHelper.functions.js +2 -8
  54. package/Materials/materialHelper.functions.js.map +1 -1
  55. package/Materials/shaderMaterial.js +2 -2
  56. package/Materials/shaderMaterial.js.map +1 -1
  57. package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +16 -6
  58. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +37 -33
  59. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  60. package/Misc/snapshotRenderingHelper.js +10 -0
  61. package/Misc/snapshotRenderingHelper.js.map +1 -1
  62. package/Rendering/depthPeelingRenderer.d.ts +7 -78
  63. package/Rendering/depthPeelingRenderer.js +12 -398
  64. package/Rendering/depthPeelingRenderer.js.map +1 -1
  65. package/Rendering/depthPeelingSceneComponent.d.ts +3 -3
  66. package/Rendering/depthPeelingSceneComponent.js.map +1 -1
  67. package/Rendering/depthRenderer.js +9 -1
  68. package/Rendering/depthRenderer.js.map +1 -1
  69. package/Rendering/index.d.ts +1 -0
  70. package/Rendering/index.js +1 -0
  71. package/Rendering/index.js.map +1 -1
  72. package/Rendering/objectRenderer.d.ts +20 -0
  73. package/Rendering/objectRenderer.js +17 -1
  74. package/Rendering/objectRenderer.js.map +1 -1
  75. package/Rendering/renderingGroup.d.ts +10 -3
  76. package/Rendering/renderingGroup.js +24 -13
  77. package/Rendering/renderingGroup.js.map +1 -1
  78. package/Rendering/renderingManager.d.ts +6 -2
  79. package/Rendering/renderingManager.js +8 -2
  80. package/Rendering/renderingManager.js.map +1 -1
  81. package/Rendering/thinDepthPeelingRenderer.d.ts +120 -0
  82. package/Rendering/thinDepthPeelingRenderer.js +469 -0
  83. package/Rendering/thinDepthPeelingRenderer.js.map +1 -0
  84. package/Shaders/ShadersInclude/gaussianSplatting.js +1 -1
  85. package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
  86. package/Shaders/gaussianSplatting.vertex.js +2 -2
  87. package/Shaders/gaussianSplatting.vertex.js.map +1 -1
  88. package/Shaders/gaussianSplattingDepth.fragment.js +9 -2
  89. package/Shaders/gaussianSplattingDepth.fragment.js.map +1 -1
  90. package/Shaders/gaussianSplattingDepth.vertex.js +13 -2
  91. package/Shaders/gaussianSplattingDepth.vertex.js.map +1 -1
  92. package/Shaders/oitFinalSimpleBlend.fragment.d.ts +5 -0
  93. package/Shaders/oitFinalSimpleBlend.fragment.js +12 -0
  94. package/Shaders/oitFinalSimpleBlend.fragment.js.map +1 -0
  95. package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +1 -5
  96. package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -1
  97. package/ShadersWGSL/gaussianSplatting.vertex.js +2 -2
  98. package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
  99. package/ShadersWGSL/gaussianSplattingDepth.fragment.js +12 -3
  100. package/ShadersWGSL/gaussianSplattingDepth.fragment.js.map +1 -1
  101. package/ShadersWGSL/gaussianSplattingDepth.vertex.js +13 -2
  102. package/ShadersWGSL/gaussianSplattingDepth.vertex.js.map +1 -1
  103. package/ShadersWGSL/iblVoxelGrid.vertex.d.ts +1 -0
  104. package/ShadersWGSL/iblVoxelGrid.vertex.js +15 -8
  105. package/ShadersWGSL/iblVoxelGrid.vertex.js.map +1 -1
  106. package/ShadersWGSL/oitFinalSimpleBlend.fragment.d.ts +5 -0
  107. package/ShadersWGSL/oitFinalSimpleBlend.fragment.js +13 -0
  108. package/ShadersWGSL/oitFinalSimpleBlend.fragment.js.map +1 -0
  109. package/node.d.ts +2 -0
  110. package/node.js +5 -0
  111. package/node.js.map +1 -1
  112. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"clearTextureTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Texture/clearTextureTask.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAErE;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,cAAc;IAmD1D;;;;OAIG;IACH,YAAY,IAAY,EAAE,UAAsB;QAC5C,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAxD5B;;WAEG;QACI,UAAK,GAAG,IAAI,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,CAAC,IAAI,GAAG,WAAW,EAAE,IAAI,CAAC,CAAC;YAEnF,YAAY,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;YAC7C,YAAY,CAAC,oBAAoB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YACrD,YAAY,CAAC,cAAc,CAAC,CAAC,QAAQ,EAAE,EAAE,GAAE,CAAC,CAAC,CAAC;QAClD,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ","sourcesContent":["import type { FrameGraph, FrameGraphTextureHandle, FrameGraphRenderPass } from \"core/index\";\r\nimport { Color4, TmpColors } from \"../../../Maths/math.color\";\r\nimport { FrameGraphTask } from \"../../frameGraphTask\";\r\nimport { backbufferColorTextureHandle } from \"../../frameGraphTypes\";\r\n\r\n/**\r\n * Task used to clear a texture.\r\n */\r\nexport class FrameGraphClearTextureTask extends FrameGraphTask {\r\n /**\r\n * The color to clear the texture with.\r\n */\r\n public color = new Color4(0.2, 0.2, 0.3, 1);\r\n\r\n /**\r\n * If the color should be cleared.\r\n */\r\n public clearColor = true;\r\n\r\n /**\r\n * If the color should be converted to linear space (default: false).\r\n */\r\n public convertColorToLinearSpace = false;\r\n\r\n /**\r\n * If the depth should be cleared.\r\n */\r\n public clearDepth = false;\r\n\r\n /**\r\n * If the stencil should be cleared.\r\n */\r\n public clearStencil = false;\r\n\r\n /**\r\n * The value to use to clear the stencil buffer (default: 0).\r\n */\r\n public stencilValue = 0;\r\n\r\n /**\r\n * The color texture to clear.\r\n */\r\n public targetTexture?: FrameGraphTextureHandle | FrameGraphTextureHandle[];\r\n\r\n /**\r\n * The depth attachment texture to clear.\r\n */\r\n public depthTexture?: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The output texture (same as targetTexture, but the handle will be different).\r\n */\r\n public readonly outputTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The output depth texture (same as depthTexture, but the handle will be different).\r\n */\r\n public readonly outputDepthTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * Constructs a new clear task.\r\n * @param name The name of the task.\r\n * @param frameGraph The frame graph the task belongs to.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph) {\r\n super(name, frameGraph);\r\n\r\n this.outputTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.outputDepthTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"FrameGraphClearTextureTask\";\r\n }\r\n\r\n public record(skipCreationOfDisabledPasses = false): FrameGraphRenderPass {\r\n if (this.targetTexture === undefined && this.depthTexture === undefined) {\r\n throw new Error(`FrameGraphClearTextureTask ${this.name}: targetTexture and depthTexture can't both be undefined.`);\r\n }\r\n\r\n const textureManager = this._frameGraph.textureManager;\r\n const targetTextures = this.targetTexture !== undefined ? (Array.isArray(this.targetTexture) ? this.targetTexture : [this.targetTexture]) : undefined;\r\n\r\n if (this.targetTexture !== undefined) {\r\n textureManager.resolveDanglingHandle(this.outputTexture, targetTextures![0]);\r\n }\r\n if (this.depthTexture !== undefined) {\r\n textureManager.resolveDanglingHandle(this.outputDepthTexture, this.depthTexture);\r\n }\r\n if (this.targetTexture !== undefined && this.depthTexture !== undefined) {\r\n const targetDescription = textureManager.getTextureDescription(targetTextures![0]);\r\n const depthDescription = textureManager.getTextureDescription(this.depthTexture);\r\n\r\n if (targetDescription.size.width !== depthDescription.size.width || targetDescription.size.height !== depthDescription.size.height) {\r\n throw new Error(\r\n `FrameGraphClearTextureTask ${this.name}: the depth texture (size: ${depthDescription.size.width}x${depthDescription.size.height}) and the target texture (size: ${targetDescription.size.width}x${targetDescription.size.height}) must have the same dimensions.`\r\n );\r\n }\r\n\r\n const textureSamples = targetDescription.options.samples || 1;\r\n const depthSamples = depthDescription.options.samples || 1;\r\n\r\n if (textureSamples !== depthSamples && textureSamples !== 0 && depthSamples !== 0) {\r\n throw new Error(\r\n `FrameGraphClearTextureTask ${this.name}: the depth texture (${depthSamples} samples) and the target texture (${textureSamples} samples) must have the same number of samples.`\r\n );\r\n }\r\n }\r\n\r\n const attachments = this._frameGraph.engine.buildTextureLayout(\r\n targetTextures ? Array(targetTextures.length).fill(true) : [],\r\n this.targetTexture === backbufferColorTextureHandle && !this._frameGraph.textureManager.backBufferTextureOverriden\r\n );\r\n\r\n const color = TmpColors.Color4[0];\r\n\r\n const pass = this._frameGraph.addRenderPass(this.name);\r\n\r\n pass.setRenderTarget(targetTextures);\r\n pass.setRenderTargetDepth(this.depthTexture);\r\n pass.setExecuteFunc((context) => {\r\n color.copyFrom(this.color);\r\n if (this.convertColorToLinearSpace) {\r\n color.toLinearSpaceToRef(color);\r\n }\r\n\r\n const renderTargetWrapper = pass.frameGraphRenderTarget!.renderTargetWrapper;\r\n if (renderTargetWrapper) {\r\n renderTargetWrapper.disableAutomaticMSAAResolve = true;\r\n }\r\n\r\n context.clearAttachments(color, attachments, !!this.clearColor, !!this.clearDepth, !!this.clearStencil, this.stencilValue);\r\n });\r\n\r\n if (!skipCreationOfDisabledPasses) {\r\n const passDisabled = this._frameGraph.addRenderPass(this.name + \"_disabled\", true);\r\n\r\n passDisabled.setRenderTarget(targetTextures);\r\n passDisabled.setRenderTargetDepth(this.depthTexture);\r\n passDisabled.setExecuteFunc((_context) => {});\r\n }\r\n\r\n return pass;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"clearTextureTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Texture/clearTextureTask.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAErE;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,cAAc;IAmD1D;;;;OAIG;IACH,YAAY,IAAY,EAAE,UAAsB;QAC5C,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAxD5B;;WAE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,CAAC,4BAA4B,EAAE,CAAC;YAChC,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,GAAG,WAAW,EAAE,IAAI,CAAC,CAAC;YAEnF,YAAY,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;YAC7C,YAAY,CAAC,oBAAoB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YACrD,YAAY,CAAC,cAAc,CAAC,CAAC,QAAQ,EAAE,EAAE,GAAE,CAAC,CAAC,CAAC;QAClD,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ","sourcesContent":["import type { FrameGraph, FrameGraphTextureHandle, FrameGraphRenderPass } from \"core/index\";\r\nimport { Color4, TmpColors } from \"../../../Maths/math.color\";\r\nimport { FrameGraphTask } from \"../../frameGraphTask\";\r\nimport { backbufferColorTextureHandle } from \"../../frameGraphTypes\";\r\n\r\n/**\r\n * Task used to clear a texture.\r\n */\r\nexport class FrameGraphClearTextureTask extends FrameGraphTask {\r\n /**\r\n * The color to clear the texture with.\r\n */\r\n public color = new Color4(0.2, 0.2, 0.3, 1);\r\n\r\n /**\r\n * If the color should be cleared.\r\n */\r\n public clearColor = true;\r\n\r\n /**\r\n * If the color should be converted to linear space (default: false).\r\n */\r\n public convertColorToLinearSpace = false;\r\n\r\n /**\r\n * If the depth should be cleared.\r\n */\r\n public clearDepth = false;\r\n\r\n /**\r\n * If the stencil should be cleared.\r\n */\r\n public clearStencil = false;\r\n\r\n /**\r\n * The value to use to clear the stencil buffer (default: 0).\r\n */\r\n public stencilValue = 0;\r\n\r\n /**\r\n * The color texture to clear.\r\n */\r\n public targetTexture?: FrameGraphTextureHandle | FrameGraphTextureHandle[];\r\n\r\n /**\r\n * The depth attachment texture to clear.\r\n */\r\n public depthTexture?: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The output texture (same as targetTexture, but the handle will be different).\r\n */\r\n public readonly outputTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The output depth texture (same as depthTexture, but the handle will be different).\r\n */\r\n public readonly outputDepthTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * Constructs a new clear task.\r\n * @param name The name of the task.\r\n * @param frameGraph The frame graph the task belongs to.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph) {\r\n super(name, frameGraph);\r\n\r\n this.outputTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.outputDepthTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"FrameGraphClearTextureTask\";\r\n }\r\n\r\n public record(skipCreationOfDisabledPasses = false): FrameGraphRenderPass {\r\n if (this.targetTexture === undefined && this.depthTexture === undefined) {\r\n throw new Error(`FrameGraphClearTextureTask ${this.name}: targetTexture and depthTexture can't both be undefined.`);\r\n }\r\n\r\n const textureManager = this._frameGraph.textureManager;\r\n const targetTextures = this.targetTexture !== undefined ? (Array.isArray(this.targetTexture) ? this.targetTexture : [this.targetTexture]) : undefined;\r\n\r\n if (this.targetTexture !== undefined) {\r\n textureManager.resolveDanglingHandle(this.outputTexture, targetTextures![0]);\r\n }\r\n if (this.depthTexture !== undefined) {\r\n textureManager.resolveDanglingHandle(this.outputDepthTexture, this.depthTexture);\r\n }\r\n if (this.targetTexture !== undefined && this.depthTexture !== undefined) {\r\n const targetDescription = textureManager.getTextureDescription(targetTextures![0]);\r\n const depthDescription = textureManager.getTextureDescription(this.depthTexture);\r\n\r\n if (targetDescription.size.width !== depthDescription.size.width || targetDescription.size.height !== depthDescription.size.height) {\r\n throw new Error(\r\n `FrameGraphClearTextureTask ${this.name}: the depth texture (size: ${depthDescription.size.width}x${depthDescription.size.height}) and the target texture (size: ${targetDescription.size.width}x${targetDescription.size.height}) must have the same dimensions.`\r\n );\r\n }\r\n\r\n const textureSamples = targetDescription.options.samples || 1;\r\n const depthSamples = depthDescription.options.samples || 1;\r\n\r\n if (textureSamples !== depthSamples && textureSamples !== 0 && depthSamples !== 0) {\r\n throw new Error(\r\n `FrameGraphClearTextureTask ${this.name}: the depth texture (${depthSamples} samples) and the target texture (${textureSamples} samples) must have the same number of samples.`\r\n );\r\n }\r\n }\r\n\r\n const attachments = this._frameGraph.engine.buildTextureLayout(\r\n targetTextures ? Array(targetTextures.length).fill(true) : [],\r\n this.targetTexture === backbufferColorTextureHandle && !this._frameGraph.textureManager.backBufferTextureOverriden\r\n );\r\n\r\n const color = TmpColors.Color4[0];\r\n\r\n const pass = this._frameGraph.addRenderPass(this.name);\r\n\r\n pass.setRenderTarget(targetTextures);\r\n pass.setRenderTargetDepth(this.depthTexture);\r\n pass.setInitializeFunc(() => {\r\n const renderTargetWrapper = pass.frameGraphRenderTarget.renderTargetWrapper;\r\n if (renderTargetWrapper) {\r\n renderTargetWrapper.disableAutomaticMSAAResolve = true;\r\n }\r\n });\r\n pass.setExecuteFunc((context) => {\r\n color.copyFrom(this.color);\r\n if (this.convertColorToLinearSpace) {\r\n color.toLinearSpaceToRef(color);\r\n }\r\n\r\n context.clearAttachments(color, attachments, !!this.clearColor, !!this.clearDepth, !!this.clearStencil, this.stencilValue);\r\n });\r\n\r\n if (!skipCreationOfDisabledPasses) {\r\n const passDisabled = this._frameGraph.addRenderPass(this.name + \"_disabled\", true);\r\n\r\n passDisabled.setRenderTarget(targetTextures);\r\n passDisabled.setRenderTargetDepth(this.depthTexture);\r\n passDisabled.setExecuteFunc((_context) => {});\r\n }\r\n\r\n return pass;\r\n }\r\n}\r\n"]}
@@ -205,6 +205,9 @@ export class FrameGraph {
205
205
  for (const task of this._tasks) {
206
206
  task.onTexturesAllocatedObservable.notifyObservers(this._renderContext);
207
207
  }
208
+ for (const task of this._tasks) {
209
+ task._initializePasses();
210
+ }
208
211
  this._built = true;
209
212
  this.onBuildObservable.notifyObservers(this);
210
213
  if (waitForReadiness) {
@@ -1 +1 @@
1
- {"version":3,"file":"frameGraph.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/frameGraph.ts"],"names":[],"mappings":"AACA,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7C,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAC7B,IAAI,CAAC,QAAQ,EAAE,CAAC;QACpB,CAAC;QAED,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,8BAA8B;IACpG,CAAC;IAED;;;OAGG;IACI,KAAK;QACR,IAAI,CAAC,qBAAqB,EAAE,EAAE,CAAC;QAC/B,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;QAElC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAC7B,IAAI,CAAC,MAAM,EAAE,CAAC;QAClB,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;QACvB,IAAI,CAAC,cAAc,CAAC,gBAAgB,EAAE,CAAC;QACvC,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;IACtC,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,qBAAqB,EAAE,EAAE,CAAC;QAC/B,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;QAClC,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;QAC/B,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;QAE/B,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;CACJ","sourcesContent":["import type { Scene, AbstractEngine, FrameGraphTask, Nullable, NodeRenderGraph, IDisposable } from \"core/index\";\r\nimport { FrameGraphPass } from \"./Passes/pass\";\r\nimport { FrameGraphRenderPass } from \"./Passes/renderPass\";\r\nimport { FrameGraphObjectListPass } from \"./Passes/objectListPass\";\r\nimport { FrameGraphRenderContext } from \"./frameGraphRenderContext\";\r\nimport { FrameGraphContext } from \"./frameGraphContext\";\r\nimport { FrameGraphTextureManager } from \"./frameGraphTextureManager\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport { _RetryWithInterval } from \"core/Misc/timingTools\";\r\nimport { Logger } from \"core/Misc/logger\";\r\nimport { UniqueIdGenerator } from \"core/Misc/uniqueIdGenerator\";\r\n\r\nenum FrameGraphPassType {\r\n Normal = 0,\r\n Render = 1,\r\n ObjectList = 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 implements IDisposable {\r\n /**\r\n * Gets the texture manager used by the frame graph\r\n */\r\n public readonly textureManager: FrameGraphTextureManager;\r\n\r\n private readonly _engine: AbstractEngine;\r\n private readonly _scene: Scene;\r\n private readonly _tasks: FrameGraphTask[] = [];\r\n private readonly _passContext: FrameGraphContext;\r\n private readonly _renderContext: FrameGraphRenderContext;\r\n private readonly _initAsyncPromises: Promise<unknown>[] = [];\r\n private _currentProcessedTask: FrameGraphTask | null = null;\r\n private _whenReadyAsyncCancel: Nullable<() => void> = null;\r\n private _importPromise: Promise<any>;\r\n\r\n /**\r\n * Name of the frame graph\r\n */\r\n public name = \"Frame Graph\";\r\n\r\n /**\r\n * Gets the unique id of the frame graph\r\n */\r\n public readonly uniqueId = UniqueIdGenerator.UniqueId;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that texture allocation should be optimized (that is, reuse existing textures when possible to limit GPU memory usage) (default: true)\r\n */\r\n public optimizeTextureAllocation = true;\r\n\r\n /**\r\n * Observable raised when the node render graph is built\r\n */\r\n public onBuildObservable = new Observable<FrameGraph>();\r\n\r\n /**\r\n * Gets the engine used by the frame graph\r\n */\r\n public get engine() {\r\n return this._engine;\r\n }\r\n\r\n /**\r\n * Gets the scene used by the frame graph\r\n */\r\n public get scene() {\r\n return this._scene;\r\n }\r\n\r\n /**\r\n * Gets the list of tasks in the frame graph\r\n */\r\n public get tasks() {\r\n return this._tasks;\r\n }\r\n\r\n /**\r\n * Indicates whether the execution of the frame graph is paused (default is false)\r\n */\r\n public pausedExecution = false;\r\n\r\n /**\r\n * Gets the node render graph linked to the frame graph (if any)\r\n * @returns the linked node render graph or null if none\r\n */\r\n public getLinkedNodeRenderGraph(): Nullable<NodeRenderGraph> {\r\n return this._linkedNodeRenderGraph;\r\n }\r\n\r\n /**\r\n * Constructs the frame graph\r\n * @param scene defines the scene the frame graph is associated with\r\n * @param debugTextures defines a boolean indicating that textures created by the frame graph should be visible in the inspector (default is false)\r\n * @param _linkedNodeRenderGraph defines the linked node render graph (if any)\r\n */\r\n constructor(\r\n scene: Scene,\r\n debugTextures = false,\r\n private readonly _linkedNodeRenderGraph: Nullable<NodeRenderGraph> = null\r\n ) {\r\n this._scene = scene;\r\n this._engine = scene.getEngine();\r\n this._importPromise = this._engine.isWebGPU ? import(\"../Engines/WebGPU/Extensions/engine.multiRender\") : import(\"../Engines/Extensions/engine.multiRender\");\r\n this.textureManager = new FrameGraphTextureManager(this._engine, debugTextures, scene);\r\n this._passContext = new FrameGraphContext(this._engine, this.textureManager, scene);\r\n this._renderContext = new FrameGraphRenderContext(this._engine, this.textureManager, scene);\r\n\r\n this._scene.addFrameGraph(this);\r\n }\r\n\r\n /**\r\n * Gets the class name of the frame graph\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"FrameGraph\";\r\n }\r\n\r\n /**\r\n * Gets a task by name\r\n * @param name Name of the task to get\r\n * @returns The task or undefined if not found\r\n */\r\n public getTaskByName<T extends FrameGraphTask>(name: string): T | undefined {\r\n return this._tasks.find((t) => t.name === name) as T;\r\n }\r\n\r\n /**\r\n * Gets all tasks of a specific type\r\n * @param taskType Type of the task(s) to get\r\n * @returns The list of tasks of the specified type\r\n */\r\n public getTasksByType<T extends FrameGraphTask>(taskType: new (...args: any[]) => T): T[] {\r\n return this._tasks.filter((t) => t instanceof taskType) as T[];\r\n }\r\n\r\n /**\r\n * Adds a task to the frame graph\r\n * @param task Task to add\r\n */\r\n public addTask(task: FrameGraphTask): void {\r\n if (this._currentProcessedTask !== null) {\r\n throw new Error(`FrameGraph.addTask: Can't add the task \"${task.name}\" while another task is currently building (task: ${this._currentProcessedTask.name}).`);\r\n }\r\n\r\n this._tasks.push(task);\r\n this._initAsyncPromises.push(task.initAsync());\r\n }\r\n\r\n /**\r\n * Adds a pass to a task. This method can only be called during a Task.record execution.\r\n * @param name The name of the pass\r\n * @param whenTaskDisabled If true, the pass will be added to the list of passes to execute when the task is disabled (default is false)\r\n * @returns The render pass created\r\n */\r\n public addPass(name: string, whenTaskDisabled = false): FrameGraphPass<FrameGraphContext> {\r\n return this._addPass(name, FrameGraphPassType.Normal, whenTaskDisabled) as FrameGraphPass<FrameGraphContext>;\r\n }\r\n\r\n /**\r\n * Adds a render pass to a task. This method can only be called during a Task.record execution.\r\n * @param name The name of the pass\r\n * @param whenTaskDisabled If true, the pass will be added to the list of passes to execute when the task is disabled (default is false)\r\n * @returns The render pass created\r\n */\r\n public addRenderPass(name: string, whenTaskDisabled = false): FrameGraphRenderPass {\r\n return this._addPass(name, FrameGraphPassType.Render, whenTaskDisabled) as FrameGraphRenderPass;\r\n }\r\n\r\n /**\r\n * Adds an object list 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 object list pass created\r\n */\r\n public addObjectListPass(name: string, whenTaskDisabled = false): FrameGraphObjectListPass {\r\n return this._addPass(name, FrameGraphPassType.ObjectList, whenTaskDisabled) as FrameGraphObjectListPass;\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.ObjectList:\r\n pass = new FrameGraphObjectListPass(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 /** @internal */\r\n public async _whenAsynchronousInitializationDoneAsync(): Promise<void> {\r\n if (this._initAsyncPromises.length > 0) {\r\n await Promise.all(this._initAsyncPromises);\r\n this._initAsyncPromises.length = 0;\r\n }\r\n }\r\n\r\n /**\r\n * @deprecated Use buildAsync instead\r\n */\r\n public build(): void {\r\n void this.buildAsync(false);\r\n }\r\n\r\n private _built = false; // TODO: to be removed when build() is removed\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 * @param waitForReadiness If true, the method will wait for the frame graph to be ready before returning (default is true)\r\n */\r\n public async buildAsync(waitForReadiness = true): Promise<void> {\r\n this.textureManager._releaseTextures(false);\r\n\r\n this.pausedExecution = true;\r\n this._built = false;\r\n\r\n try {\r\n await this._importPromise;\r\n\r\n await this._whenAsynchronousInitializationDoneAsync();\r\n\r\n for (const task of this._tasks) {\r\n task._reset();\r\n\r\n this._currentProcessedTask = task;\r\n this.textureManager._isRecordingTask = true;\r\n\r\n task.record();\r\n\r\n this.textureManager._isRecordingTask = false;\r\n this._currentProcessedTask = null;\r\n }\r\n\r\n this.textureManager._allocateTextures(this.optimizeTextureAllocation ? this._tasks : undefined);\r\n\r\n for (const task of this._tasks) {\r\n task._checkTask();\r\n }\r\n\r\n for (const task of this._tasks) {\r\n task.onTexturesAllocatedObservable.notifyObservers(this._renderContext);\r\n }\r\n\r\n this._built = true;\r\n\r\n this.onBuildObservable.notifyObservers(this);\r\n\r\n if (waitForReadiness) {\r\n await this.whenReadyAsync();\r\n }\r\n } catch (e) {\r\n this._tasks.length = 0;\r\n this._currentProcessedTask = null;\r\n this.textureManager._isRecordingTask = false;\r\n throw e;\r\n } finally {\r\n this.pausedExecution = false;\r\n this._built = true;\r\n }\r\n }\r\n\r\n /**\r\n * Checks if the frame graph is ready to be executed.\r\n * Note that you can use the whenReadyAsync method to wait for the frame graph to be ready.\r\n * @returns True if the frame graph is ready to be executed, else false\r\n */\r\n public isReady(): boolean {\r\n let ready = this._renderContext._isReady();\r\n for (const task of this._tasks) {\r\n ready &&= task.isReady();\r\n }\r\n return ready;\r\n }\r\n\r\n /**\r\n * Returns a promise that resolves when the frame graph is ready to be executed.\r\n * In general, calling “await buildAsync()” should suffice, as this function also waits for readiness by default.\r\n * @param timeStep Time step in ms between retries (default is 16)\r\n * @param maxTimeout Maximum time in ms to wait for the graph to be ready (default is 10000)\r\n * @returns The promise that resolves when the graph is ready\r\n */\r\n public async whenReadyAsync(timeStep = 16, maxTimeout = 10000): Promise<void> {\r\n let firstNotReadyTask: FrameGraphTask | null = null;\r\n\r\n // TODO: to be removed when build() is removed\r\n await new Promise((resolve) => {\r\n const checkBuilt = () => {\r\n if (this._built) {\r\n resolve(void 0);\r\n return;\r\n }\r\n setTimeout(checkBuilt, 16);\r\n };\r\n checkBuilt();\r\n });\r\n // END TODO\r\n\r\n return await new Promise((resolve, reject) => {\r\n this._whenReadyAsyncCancel = _RetryWithInterval(\r\n () => {\r\n let ready = this._renderContext._isReady();\r\n for (const task of this._tasks) {\r\n const taskIsReady = task.isReady();\r\n if (!taskIsReady && !firstNotReadyTask) {\r\n firstNotReadyTask = task;\r\n }\r\n ready &&= taskIsReady;\r\n }\r\n return ready;\r\n },\r\n () => {\r\n this._whenReadyAsyncCancel = null;\r\n resolve();\r\n },\r\n (err, isTimeout) => {\r\n this._whenReadyAsyncCancel = null;\r\n if (!isTimeout) {\r\n Logger.Error(\"FrameGraph: An unexpected error occurred while waiting for the frame graph to be ready.\");\r\n if (err) {\r\n Logger.Error(err);\r\n if (err.stack) {\r\n Logger.Error(err.stack);\r\n }\r\n }\r\n } else {\r\n Logger.Error(\r\n `FrameGraph: Timeout while waiting for the frame graph to be ready.${firstNotReadyTask ? ` First task not ready: ${firstNotReadyTask.name}` : \"\"}`\r\n );\r\n if (err) {\r\n Logger.Error(err);\r\n }\r\n }\r\n reject(new Error(err));\r\n },\r\n timeStep,\r\n maxTimeout\r\n );\r\n });\r\n }\r\n\r\n /**\r\n * Executes the frame graph.\r\n */\r\n public execute(): void {\r\n if (this.pausedExecution) {\r\n return;\r\n }\r\n\r\n this._renderContext.bindRenderTarget();\r\n\r\n this.textureManager._updateHistoryTextures();\r\n\r\n for (const task of this._tasks) {\r\n task._execute();\r\n }\r\n\r\n this._renderContext.bindRenderTarget(undefined, undefined, true); // restore default framebuffer\r\n }\r\n\r\n /**\r\n * Clears the frame graph (remove the tasks and release the textures).\r\n * The frame graph can be built again after this method is called.\r\n */\r\n public clear(): void {\r\n this._whenReadyAsyncCancel?.();\r\n this._whenReadyAsyncCancel = null;\r\n\r\n for (const task of this._tasks) {\r\n task._reset();\r\n }\r\n\r\n this._tasks.length = 0;\r\n this.textureManager._releaseTextures();\r\n this._currentProcessedTask = null;\r\n }\r\n\r\n /**\r\n * Disposes the frame graph\r\n */\r\n public dispose(): void {\r\n this._whenReadyAsyncCancel?.();\r\n this._whenReadyAsyncCancel = null;\r\n this.clear();\r\n this.textureManager._dispose();\r\n this._renderContext._dispose();\r\n\r\n this._scene.removeFrameGraph(this);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"frameGraph.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/frameGraph.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,iBAAiB,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I,CAAC,cAAc,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,8BAA8B;IACpG,CAAC;IAED;;;OAGG;IACI,KAAK;QACR,IAAI,CAAC,qBAAqB,EAAE,EAAE,CAAC;QAC/B,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;QAElC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAC7B,IAAI,CAAC,MAAM,EAAE,CAAC;QAClB,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;QACvB,IAAI,CAAC,cAAc,CAAC,gBAAgB,EAAE,CAAC;QACvC,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;IACtC,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,qBAAqB,EAAE,EAAE,CAAC;QAC/B,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;QAClC,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;QAC/B,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;QAE/B,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;CACJ","sourcesContent":["import type { Scene, AbstractEngine, FrameGraphTask, Nullable, NodeRenderGraph, IDisposable } from \"core/index\";\r\nimport { FrameGraphPass } from \"./Passes/pass\";\r\nimport { FrameGraphRenderPass } from \"./Passes/renderPass\";\r\nimport { FrameGraphObjectListPass } from \"./Passes/objectListPass\";\r\nimport { FrameGraphRenderContext } from \"./frameGraphRenderContext\";\r\nimport { FrameGraphContext } from \"./frameGraphContext\";\r\nimport { FrameGraphTextureManager } from \"./frameGraphTextureManager\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport { _RetryWithInterval } from \"core/Misc/timingTools\";\r\nimport { Logger } from \"core/Misc/logger\";\r\nimport { UniqueIdGenerator } from \"core/Misc/uniqueIdGenerator\";\r\n\r\nenum FrameGraphPassType {\r\n Normal = 0,\r\n Render = 1,\r\n ObjectList = 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 implements IDisposable {\r\n /**\r\n * Gets the texture manager used by the frame graph\r\n */\r\n public readonly textureManager: FrameGraphTextureManager;\r\n\r\n private readonly _engine: AbstractEngine;\r\n private readonly _scene: Scene;\r\n private readonly _tasks: FrameGraphTask[] = [];\r\n private readonly _passContext: FrameGraphContext;\r\n private readonly _renderContext: FrameGraphRenderContext;\r\n private readonly _initAsyncPromises: Promise<unknown>[] = [];\r\n private _currentProcessedTask: FrameGraphTask | null = null;\r\n private _whenReadyAsyncCancel: Nullable<() => void> = null;\r\n private _importPromise: Promise<any>;\r\n\r\n /**\r\n * Name of the frame graph\r\n */\r\n public name = \"Frame Graph\";\r\n\r\n /**\r\n * Gets the unique id of the frame graph\r\n */\r\n public readonly uniqueId = UniqueIdGenerator.UniqueId;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that texture allocation should be optimized (that is, reuse existing textures when possible to limit GPU memory usage) (default: true)\r\n */\r\n public optimizeTextureAllocation = true;\r\n\r\n /**\r\n * Observable raised when the node render graph is built\r\n */\r\n public onBuildObservable = new Observable<FrameGraph>();\r\n\r\n /**\r\n * Gets the engine used by the frame graph\r\n */\r\n public get engine() {\r\n return this._engine;\r\n }\r\n\r\n /**\r\n * Gets the scene used by the frame graph\r\n */\r\n public get scene() {\r\n return this._scene;\r\n }\r\n\r\n /**\r\n * Gets the list of tasks in the frame graph\r\n */\r\n public get tasks() {\r\n return this._tasks;\r\n }\r\n\r\n /**\r\n * Indicates whether the execution of the frame graph is paused (default is false)\r\n */\r\n public pausedExecution = false;\r\n\r\n /**\r\n * Gets the node render graph linked to the frame graph (if any)\r\n * @returns the linked node render graph or null if none\r\n */\r\n public getLinkedNodeRenderGraph(): Nullable<NodeRenderGraph> {\r\n return this._linkedNodeRenderGraph;\r\n }\r\n\r\n /**\r\n * Constructs the frame graph\r\n * @param scene defines the scene the frame graph is associated with\r\n * @param debugTextures defines a boolean indicating that textures created by the frame graph should be visible in the inspector (default is false)\r\n * @param _linkedNodeRenderGraph defines the linked node render graph (if any)\r\n */\r\n constructor(\r\n scene: Scene,\r\n debugTextures = false,\r\n private readonly _linkedNodeRenderGraph: Nullable<NodeRenderGraph> = null\r\n ) {\r\n this._scene = scene;\r\n this._engine = scene.getEngine();\r\n this._importPromise = this._engine.isWebGPU ? import(\"../Engines/WebGPU/Extensions/engine.multiRender\") : import(\"../Engines/Extensions/engine.multiRender\");\r\n this.textureManager = new FrameGraphTextureManager(this._engine, debugTextures, scene);\r\n this._passContext = new FrameGraphContext(this._engine, this.textureManager, scene);\r\n this._renderContext = new FrameGraphRenderContext(this._engine, this.textureManager, scene);\r\n\r\n this._scene.addFrameGraph(this);\r\n }\r\n\r\n /**\r\n * Gets the class name of the frame graph\r\n * @returns the class name\r\n */\r\n public getClassName() {\r\n return \"FrameGraph\";\r\n }\r\n\r\n /**\r\n * Gets a task by name\r\n * @param name Name of the task to get\r\n * @returns The task or undefined if not found\r\n */\r\n public getTaskByName<T extends FrameGraphTask>(name: string): T | undefined {\r\n return this._tasks.find((t) => t.name === name) as T;\r\n }\r\n\r\n /**\r\n * Gets all tasks of a specific type\r\n * @param taskType Type of the task(s) to get\r\n * @returns The list of tasks of the specified type\r\n */\r\n public getTasksByType<T extends FrameGraphTask>(taskType: new (...args: any[]) => T): T[] {\r\n return this._tasks.filter((t) => t instanceof taskType) as T[];\r\n }\r\n\r\n /**\r\n * Adds a task to the frame graph\r\n * @param task Task to add\r\n */\r\n public addTask(task: FrameGraphTask): void {\r\n if (this._currentProcessedTask !== null) {\r\n throw new Error(`FrameGraph.addTask: Can't add the task \"${task.name}\" while another task is currently building (task: ${this._currentProcessedTask.name}).`);\r\n }\r\n\r\n this._tasks.push(task);\r\n this._initAsyncPromises.push(task.initAsync());\r\n }\r\n\r\n /**\r\n * Adds a pass to a task. This method can only be called during a Task.record execution.\r\n * @param name The name of the pass\r\n * @param whenTaskDisabled If true, the pass will be added to the list of passes to execute when the task is disabled (default is false)\r\n * @returns The render pass created\r\n */\r\n public addPass(name: string, whenTaskDisabled = false): FrameGraphPass<FrameGraphContext> {\r\n return this._addPass(name, FrameGraphPassType.Normal, whenTaskDisabled) as FrameGraphPass<FrameGraphContext>;\r\n }\r\n\r\n /**\r\n * Adds a render pass to a task. This method can only be called during a Task.record execution.\r\n * @param name The name of the pass\r\n * @param whenTaskDisabled If true, the pass will be added to the list of passes to execute when the task is disabled (default is false)\r\n * @returns The render pass created\r\n */\r\n public addRenderPass(name: string, whenTaskDisabled = false): FrameGraphRenderPass {\r\n return this._addPass(name, FrameGraphPassType.Render, whenTaskDisabled) as FrameGraphRenderPass;\r\n }\r\n\r\n /**\r\n * Adds an object list 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 object list pass created\r\n */\r\n public addObjectListPass(name: string, whenTaskDisabled = false): FrameGraphObjectListPass {\r\n return this._addPass(name, FrameGraphPassType.ObjectList, whenTaskDisabled) as FrameGraphObjectListPass;\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.ObjectList:\r\n pass = new FrameGraphObjectListPass(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 /** @internal */\r\n public async _whenAsynchronousInitializationDoneAsync(): Promise<void> {\r\n if (this._initAsyncPromises.length > 0) {\r\n await Promise.all(this._initAsyncPromises);\r\n this._initAsyncPromises.length = 0;\r\n }\r\n }\r\n\r\n /**\r\n * @deprecated Use buildAsync instead\r\n */\r\n public build(): void {\r\n void this.buildAsync(false);\r\n }\r\n\r\n private _built = false; // TODO: to be removed when build() is removed\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 * @param waitForReadiness If true, the method will wait for the frame graph to be ready before returning (default is true)\r\n */\r\n public async buildAsync(waitForReadiness = true): Promise<void> {\r\n this.textureManager._releaseTextures(false);\r\n\r\n this.pausedExecution = true;\r\n this._built = false;\r\n\r\n try {\r\n await this._importPromise;\r\n\r\n await this._whenAsynchronousInitializationDoneAsync();\r\n\r\n for (const task of this._tasks) {\r\n task._reset();\r\n\r\n this._currentProcessedTask = task;\r\n this.textureManager._isRecordingTask = true;\r\n\r\n task.record();\r\n\r\n this.textureManager._isRecordingTask = false;\r\n this._currentProcessedTask = null;\r\n }\r\n\r\n this.textureManager._allocateTextures(this.optimizeTextureAllocation ? this._tasks : undefined);\r\n\r\n for (const task of this._tasks) {\r\n task._checkTask();\r\n }\r\n\r\n for (const task of this._tasks) {\r\n task.onTexturesAllocatedObservable.notifyObservers(this._renderContext);\r\n }\r\n\r\n for (const task of this._tasks) {\r\n task._initializePasses();\r\n }\r\n\r\n this._built = true;\r\n\r\n this.onBuildObservable.notifyObservers(this);\r\n\r\n if (waitForReadiness) {\r\n await this.whenReadyAsync();\r\n }\r\n } catch (e) {\r\n this._tasks.length = 0;\r\n this._currentProcessedTask = null;\r\n this.textureManager._isRecordingTask = false;\r\n throw e;\r\n } finally {\r\n this.pausedExecution = false;\r\n this._built = true;\r\n }\r\n }\r\n\r\n /**\r\n * Checks if the frame graph is ready to be executed.\r\n * Note that you can use the whenReadyAsync method to wait for the frame graph to be ready.\r\n * @returns True if the frame graph is ready to be executed, else false\r\n */\r\n public isReady(): boolean {\r\n let ready = this._renderContext._isReady();\r\n for (const task of this._tasks) {\r\n ready &&= task.isReady();\r\n }\r\n return ready;\r\n }\r\n\r\n /**\r\n * Returns a promise that resolves when the frame graph is ready to be executed.\r\n * In general, calling “await buildAsync()” should suffice, as this function also waits for readiness by default.\r\n * @param timeStep Time step in ms between retries (default is 16)\r\n * @param maxTimeout Maximum time in ms to wait for the graph to be ready (default is 10000)\r\n * @returns The promise that resolves when the graph is ready\r\n */\r\n public async whenReadyAsync(timeStep = 16, maxTimeout = 10000): Promise<void> {\r\n let firstNotReadyTask: FrameGraphTask | null = null;\r\n\r\n // TODO: to be removed when build() is removed\r\n await new Promise((resolve) => {\r\n const checkBuilt = () => {\r\n if (this._built) {\r\n resolve(void 0);\r\n return;\r\n }\r\n setTimeout(checkBuilt, 16);\r\n };\r\n checkBuilt();\r\n });\r\n // END TODO\r\n\r\n return await new Promise((resolve, reject) => {\r\n this._whenReadyAsyncCancel = _RetryWithInterval(\r\n () => {\r\n let ready = this._renderContext._isReady();\r\n for (const task of this._tasks) {\r\n const taskIsReady = task.isReady();\r\n if (!taskIsReady && !firstNotReadyTask) {\r\n firstNotReadyTask = task;\r\n }\r\n ready &&= taskIsReady;\r\n }\r\n return ready;\r\n },\r\n () => {\r\n this._whenReadyAsyncCancel = null;\r\n resolve();\r\n },\r\n (err, isTimeout) => {\r\n this._whenReadyAsyncCancel = null;\r\n if (!isTimeout) {\r\n Logger.Error(\"FrameGraph: An unexpected error occurred while waiting for the frame graph to be ready.\");\r\n if (err) {\r\n Logger.Error(err);\r\n if (err.stack) {\r\n Logger.Error(err.stack);\r\n }\r\n }\r\n } else {\r\n Logger.Error(\r\n `FrameGraph: Timeout while waiting for the frame graph to be ready.${firstNotReadyTask ? ` First task not ready: ${firstNotReadyTask.name}` : \"\"}`\r\n );\r\n if (err) {\r\n Logger.Error(err);\r\n }\r\n }\r\n reject(new Error(err));\r\n },\r\n timeStep,\r\n maxTimeout\r\n );\r\n });\r\n }\r\n\r\n /**\r\n * Executes the frame graph.\r\n */\r\n public execute(): void {\r\n if (this.pausedExecution) {\r\n return;\r\n }\r\n\r\n this._renderContext.bindRenderTarget();\r\n\r\n this.textureManager._updateHistoryTextures();\r\n\r\n for (const task of this._tasks) {\r\n task._execute();\r\n }\r\n\r\n this._renderContext.bindRenderTarget(undefined, undefined, true); // restore default framebuffer\r\n }\r\n\r\n /**\r\n * Clears the frame graph (remove the tasks and release the textures).\r\n * The frame graph can be built again after this method is called.\r\n */\r\n public clear(): void {\r\n this._whenReadyAsyncCancel?.();\r\n this._whenReadyAsyncCancel = null;\r\n\r\n for (const task of this._tasks) {\r\n task._reset();\r\n }\r\n\r\n this._tasks.length = 0;\r\n this.textureManager._releaseTextures();\r\n this._currentProcessedTask = null;\r\n }\r\n\r\n /**\r\n * Disposes the frame graph\r\n */\r\n public dispose(): void {\r\n this._whenReadyAsyncCancel?.();\r\n this._whenReadyAsyncCancel = null;\r\n this.clear();\r\n this.textureManager._dispose();\r\n this._renderContext._dispose();\r\n\r\n this._scene.removeFrameGraph(this);\r\n }\r\n}\r\n"]}
@@ -37,6 +37,7 @@ export class FrameGraphRenderTarget {
37
37
  if (!texture) {
38
38
  throw new Error(`FrameGraphRenderTarget.renderTargetWrapper: Failed to get texture from handle. handle: ${handle}, name: ${this.name}, index: ${i}, renderTargets: ${this._renderTargets}`);
39
39
  }
40
+ texture.incrementReferences();
40
41
  this._renderTargetWrapper.setTexture(texture, i, false);
41
42
  }
42
43
  if (this._renderTargetDepth !== undefined) {
@@ -1 +1 @@
1
- {"version":3,"file":"frameGraphRenderTarget.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/frameGraphRenderTarget.ts"],"names":[],"mappings":"AAEA;;;GAGG;A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S,EAAE,CAAC;YACzC,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,CAAC,MAAM,EAAE,CAAC;gBAC5B,OAAO,KAAK,CAAC;YACjB,CAAC;YAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBAClC,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;oBACpB,OAAO,KAAK,CAAC;gBACjB,CAAC;YACL,CAAC;QACL,CAAC;aAAM,IAAI,CAAC,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,SAAS,CAAC,IAAI,CAAC,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,SAAS,CAAC,EAAE,CAAC;YAC9F,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,OAAO,IAAI,CAAC,kBAAkB,KAAK,KAAK,CAAC,kBAAkB,CAAC;IAChE,CAAC;IAEM,OAAO;QACV,IAAI,CAAC,oBAAoB,EAAE,OAAO,EAAE,CAAC;IACzC,CAAC;CACJ","sourcesContent":["import type { FrameGraphTextureHandle, FrameGraphTextureManager, IMultiRenderTargetOptions, RenderTargetWrapper } from \"core/index\";\r\n\r\n/**\r\n * @internal\r\n * @experimental\r\n */\r\nexport class FrameGraphRenderTarget {\r\n protected readonly _textureManager: FrameGraphTextureManager;\r\n protected readonly _renderTargets: FrameGraphTextureHandle[] | undefined;\r\n protected readonly _renderTargetDepth: FrameGraphTextureHandle | undefined;\r\n protected _renderTargetWrapper: RenderTargetWrapper | undefined;\r\n protected _isBackBuffer = false;\r\n\r\n public readonly name: string;\r\n\r\n constructor(\r\n name: string,\r\n textureManager: FrameGraphTextureManager,\r\n renderTargets?: FrameGraphTextureHandle | FrameGraphTextureHandle[],\r\n renderTargetDepth?: FrameGraphTextureHandle\r\n ) {\r\n this.name = name;\r\n this._textureManager = textureManager;\r\n this._renderTargets = renderTargets === undefined ? undefined : Array.isArray(renderTargets) ? renderTargets : [renderTargets];\r\n this._renderTargetDepth = renderTargetDepth;\r\n }\r\n\r\n public get renderTargetWrapper() {\r\n if (this._isBackBuffer) {\r\n return undefined;\r\n }\r\n\r\n if (!this._renderTargetWrapper) {\r\n const engine = this._textureManager.engine;\r\n\r\n // _renderTargets and _renderTargetDepth cannot both be undefined\r\n const textureHandle = this._renderTargets === undefined || this._renderTargets.length === 0 ? this._renderTargetDepth! : this._renderTargets[0];\r\n\r\n if (this._textureManager.isBackbuffer(textureHandle)) {\r\n this._isBackBuffer = true;\r\n return undefined;\r\n }\r\n\r\n const textureDescription = this._textureManager.getTextureDescription(textureHandle);\r\n\r\n const creationOptionsForTexture: IMultiRenderTargetOptions = {\r\n textureCount: this._renderTargets?.length ?? 0,\r\n generateDepthBuffer: false,\r\n label: this.name,\r\n samples: textureDescription.options.samples ?? 1,\r\n dontCreateTextures: true,\r\n };\r\n\r\n this._renderTargetWrapper = engine.createMultipleRenderTarget(textureDescription.size, creationOptionsForTexture, true);\r\n\r\n for (let i = 0; i < creationOptionsForTexture.textureCount!; i++) {\r\n const handle = this._renderTargets![i];\r\n const texture = this._textureManager.getTextureFromHandle(handle);\r\n\r\n if (!texture) {\r\n throw new Error(\r\n `FrameGraphRenderTarget.renderTargetWrapper: Failed to get texture from handle. handle: ${handle}, name: ${this.name}, index: ${i}, renderTargets: ${this._renderTargets}`\r\n );\r\n }\r\n\r\n this._renderTargetWrapper.setTexture(texture, i, false);\r\n }\r\n\r\n if (this._renderTargetDepth !== undefined) {\r\n this._renderTargetWrapper.setDepthStencilTexture(this._textureManager.getTextureFromHandle(this._renderTargetDepth), false);\r\n }\r\n }\r\n\r\n return this._renderTargetWrapper;\r\n }\r\n\r\n public equals(other: FrameGraphRenderTarget): boolean {\r\n const src = this._renderTargets;\r\n const dst = other._renderTargets;\r\n\r\n if (src !== undefined && dst !== undefined) {\r\n if (src.length !== dst.length) {\r\n return false;\r\n }\r\n\r\n for (let i = 0; i < src.length; i++) {\r\n if (src[i] !== dst[i]) {\r\n return false;\r\n }\r\n }\r\n } else if ((src === undefined && dst !== undefined) || (src !== undefined && dst === undefined)) {\r\n return false;\r\n }\r\n\r\n return this._renderTargetDepth === other._renderTargetDepth;\r\n }\r\n\r\n public dispose() {\r\n this._renderTargetWrapper?.dispose();\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"frameGraphRenderTarget.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/frameGraphRenderTarget.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,OAAO,sBAAsB;IAS/B,YACI,IAAY,EACZ,cAAwC,EACxC,aAAmE,EACnE,iBAA2C;QARrC,kBAAa,GAAG,KAAK,CAAC;QAU5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;QACtC,IAAI,CAAC,cAAc,GAAG,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;QAC/H,IAAI,CAAC,kBAAkB,GAAG,iBAAiB,CAAC;IAChD,CAAC;IAED,IAAW,mBAAmB;QAC1B,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACrB,OAAO,SAAS,CAAC;QACrB,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC7B,MAAM,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC;YAE3C,iEAAiE;YACjE,MAAM,aAAa,GAAG,IAAI,CAAC,cAAc,KAAK,SAAS,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAmB,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;YAEhJ,IAAI,I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C,IAAI,CAAC,oBAAoB,CAAC,sBAAsB,CAAC,IAAI,CAAC,eAAe,CAAC,oBAAoB,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE,KAAK,CAAC,CAAC;YAChI,CAAC;QACL,CAAC;QAED,OAAO,IAAI,CAAC,oBAAoB,CAAC;IACrC,CAAC;IAEM,MAAM,CAAC,KAA6B;QACvC,MAAM,GAAG,GAAG,IAAI,CAAC,cAAc,CAAC;QAChC,MAAM,GAAG,GAAG,KAAK,CAAC,cAAc,CAAC;QAEjC,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YACzC,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,CAAC,MAAM,EAAE,CAAC;gBAC5B,OAAO,KAAK,CAAC;YACjB,CAAC;YAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBAClC,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;oBACpB,OAAO,KAAK,CAAC;gBACjB,CAAC;YACL,CAAC;QACL,CAAC;aAAM,IAAI,CAAC,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,SAAS,CAAC,IAAI,CAAC,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,SAAS,CAAC,EAAE,CAAC;YAC9F,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,OAAO,IAAI,CAAC,kBAAkB,KAAK,KAAK,CAAC,kBAAkB,CAAC;IAChE,CAAC;IAEM,OAAO;QACV,IAAI,CAAC,oBAAoB,EAAE,OAAO,EAAE,CAAC;IACzC,CAAC;CACJ","sourcesContent":["import type { FrameGraphTextureHandle, FrameGraphTextureManager, IMultiRenderTargetOptions, RenderTargetWrapper } from \"core/index\";\r\n\r\n/**\r\n * @internal\r\n * @experimental\r\n */\r\nexport class FrameGraphRenderTarget {\r\n protected readonly _textureManager: FrameGraphTextureManager;\r\n protected readonly _renderTargets: FrameGraphTextureHandle[] | undefined;\r\n protected readonly _renderTargetDepth: FrameGraphTextureHandle | undefined;\r\n protected _renderTargetWrapper: RenderTargetWrapper | undefined;\r\n protected _isBackBuffer = false;\r\n\r\n public readonly name: string;\r\n\r\n constructor(\r\n name: string,\r\n textureManager: FrameGraphTextureManager,\r\n renderTargets?: FrameGraphTextureHandle | FrameGraphTextureHandle[],\r\n renderTargetDepth?: FrameGraphTextureHandle\r\n ) {\r\n this.name = name;\r\n this._textureManager = textureManager;\r\n this._renderTargets = renderTargets === undefined ? undefined : Array.isArray(renderTargets) ? renderTargets : [renderTargets];\r\n this._renderTargetDepth = renderTargetDepth;\r\n }\r\n\r\n public get renderTargetWrapper() {\r\n if (this._isBackBuffer) {\r\n return undefined;\r\n }\r\n\r\n if (!this._renderTargetWrapper) {\r\n const engine = this._textureManager.engine;\r\n\r\n // _renderTargets and _renderTargetDepth cannot both be undefined\r\n const textureHandle = this._renderTargets === undefined || this._renderTargets.length === 0 ? this._renderTargetDepth! : this._renderTargets[0];\r\n\r\n if (this._textureManager.isBackbuffer(textureHandle)) {\r\n this._isBackBuffer = true;\r\n return undefined;\r\n }\r\n\r\n const textureDescription = this._textureManager.getTextureDescription(textureHandle);\r\n\r\n const creationOptionsForTexture: IMultiRenderTargetOptions = {\r\n textureCount: this._renderTargets?.length ?? 0,\r\n generateDepthBuffer: false,\r\n label: this.name,\r\n samples: textureDescription.options.samples ?? 1,\r\n dontCreateTextures: true,\r\n };\r\n\r\n this._renderTargetWrapper = engine.createMultipleRenderTarget(textureDescription.size, creationOptionsForTexture, true);\r\n\r\n for (let i = 0; i < creationOptionsForTexture.textureCount!; i++) {\r\n const handle = this._renderTargets![i];\r\n const texture = this._textureManager.getTextureFromHandle(handle);\r\n\r\n if (!texture) {\r\n throw new Error(\r\n `FrameGraphRenderTarget.renderTargetWrapper: Failed to get texture from handle. handle: ${handle}, name: ${this.name}, index: ${i}, renderTargets: ${this._renderTargets}`\r\n );\r\n }\r\n\r\n texture.incrementReferences();\r\n\r\n this._renderTargetWrapper.setTexture(texture, i, false);\r\n }\r\n\r\n if (this._renderTargetDepth !== undefined) {\r\n this._renderTargetWrapper.setDepthStencilTexture(this._textureManager.getTextureFromHandle(this._renderTargetDepth), false);\r\n }\r\n }\r\n\r\n return this._renderTargetWrapper;\r\n }\r\n\r\n public equals(other: FrameGraphRenderTarget): boolean {\r\n const src = this._renderTargets;\r\n const dst = other._renderTargets;\r\n\r\n if (src !== undefined && dst !== undefined) {\r\n if (src.length !== dst.length) {\r\n return false;\r\n }\r\n\r\n for (let i = 0; i < src.length; i++) {\r\n if (src[i] !== dst[i]) {\r\n return false;\r\n }\r\n }\r\n } else if ((src === undefined && dst !== undefined) || (src !== undefined && dst === undefined)) {\r\n return false;\r\n }\r\n\r\n return this._renderTargetDepth === other._renderTargetDepth;\r\n }\r\n\r\n public dispose() {\r\n this._renderTargetWrapper?.dispose();\r\n }\r\n}\r\n"]}
@@ -83,5 +83,7 @@ export declare abstract class FrameGraphTask {
83
83
  _checkTask(): void;
84
84
  /** @internal */
85
85
  _execute(): void;
86
+ /** @internal */
87
+ _initializePasses(): void;
86
88
  private _checkSameRenderTarget;
87
89
  }
@@ -193,6 +193,17 @@ export class FrameGraphTask {
193
193
  this._frameGraph.engine._debugPopGroup?.(2);
194
194
  this.onAfterTaskExecute.notifyObservers(this);
195
195
  }
196
+ /** @internal */
197
+ _initializePasses() {
198
+ this._frameGraph.engine._debugPushGroup?.(`${this.getClassName()} (${this.name})`, 2);
199
+ for (const pass of this._passes) {
200
+ pass._initialize();
201
+ }
202
+ for (const pass of this._passesDisabled) {
203
+ pass._initialize();
204
+ }
205
+ this._frameGraph.engine._debugPopGroup?.(2);
206
+ }
196
207
  _checkSameRenderTarget(src, dst) {
197
208
  if (src === null || dst === null) {
198
209
  return src === dst;
@@ -1 +1 @@
1
- {"version":3,"file":"frameGraphTask.js","sourceRoot":"","sources":["../../../../dev/core/src/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CAAC,IAAI,CAAC,CAAC;IAClD,CAAC;IAEO,sBAAsB,CAAC,GAA0C,EAAE,GAA0C;QACjH,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;YAC/B,OAAO,GAAG,KAAK,GAAG,CAAC;QACvB,CAAC;QAED,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,CAAC,MAAM,EAAE,CAAC;YAC5B,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAClC,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;gBACpB,OAAO,KAAK,CAAC;YACjB,CAAC;QACL,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ","sourcesContent":["import type { FrameGraph, FrameGraphObjectList, IFrameGraphPass, Nullable, FrameGraphTextureHandle, InternalTexture, FrameGraphRenderContext } from \"core/index\";\r\nimport { FrameGraphObjectListPass } from \"./Passes/objectListPass\";\r\nimport { FrameGraphRenderPass } from \"./Passes/renderPass\";\r\nimport { Observable } from \"core/Misc/observable\";\r\n\r\n/**\r\n * Represents a task in a frame graph.\r\n * @experimental\r\n */\r\nexport abstract class FrameGraphTask {\r\n protected readonly _frameGraph: FrameGraph;\r\n\r\n private readonly _passes: IFrameGraphPass[] = [];\r\n private readonly _passesDisabled: IFrameGraphPass[] = [];\r\n\r\n // Note: must be a getter/setter even if there's no specific processing, otherwise inherited classes can't make it a getter/setter!\r\n // Same thing for the disabled property\r\n protected _name: string;\r\n\r\n /**\r\n * The name of the task.\r\n */\r\n public get name() {\r\n return this._name;\r\n }\r\n\r\n public set name(value: string) {\r\n this._name = value;\r\n }\r\n\r\n protected _disabled = false;\r\n\r\n /**\r\n * Whether the task is disabled.\r\n */\r\n public get disabled() {\r\n return this._disabled;\r\n }\r\n\r\n public set disabled(value: boolean) {\r\n this._disabled = value;\r\n }\r\n\r\n /**\r\n * Gets the render passes of the task.\r\n */\r\n public get passes() {\r\n return this._passes;\r\n }\r\n\r\n /**\r\n * Gets the disabled render passes of the task.\r\n */\r\n public get passesDisabled() {\r\n return this._passesDisabled;\r\n }\r\n\r\n /**\r\n * The (texture) dependencies of the task (optional).\r\n */\r\n public dependencies?: Set<FrameGraphTextureHandle>;\r\n\r\n /**\r\n * Records the task in the frame graph. Use this function to add content (render passes, ...) to the task.\r\n * @param skipCreationOfDisabledPasses If true, the disabled passe(s) won't be created.\r\n */\r\n public abstract record(skipCreationOfDisabledPasses?: boolean): void;\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public getClassName(): string {\r\n return \"FrameGraphTask\";\r\n }\r\n\r\n /**\r\n * This function is called once after the task has been added to the frame graph and before the frame graph is built for the first time.\r\n * This allows you to initialize asynchronous resources, which is not possible in the constructor.\r\n * @returns A promise that resolves when the initialization is complete.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\r\n public initAsync(): Promise<unknown> {\r\n return Promise.resolve();\r\n }\r\n\r\n /**\r\n * An observable that is triggered after the textures have been allocated.\r\n */\r\n public onTexturesAllocatedObservable: Observable<FrameGraphRenderContext> = new Observable();\r\n\r\n /**\r\n * An observable that is triggered before the task is executed.\r\n */\r\n public onBeforeTaskExecute: Observable<FrameGraphTask> = new Observable();\r\n\r\n /**\r\n * An observable that is triggered after the task is executed.\r\n */\r\n public onAfterTaskExecute: Observable<FrameGraphTask> = new Observable();\r\n\r\n /**\r\n * Checks if the task is ready to be executed.\r\n * @returns True if the task is ready to be executed, else false.\r\n */\r\n public isReady(): boolean {\r\n return true;\r\n }\r\n\r\n /**\r\n * Disposes of the task.\r\n */\r\n public dispose() {\r\n this._reset();\r\n this.onTexturesAllocatedObservable.clear();\r\n this.onBeforeTaskExecute.clear();\r\n this.onAfterTaskExecute.clear();\r\n }\r\n\r\n /**\r\n * Constructs a new frame graph task.\r\n * @param name The name of the task.\r\n * @param frameGraph The frame graph this task is associated with.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph) {\r\n this.name = name;\r\n this._frameGraph = frameGraph;\r\n this._reset();\r\n }\r\n\r\n /** @internal */\r\n public _reset() {\r\n for (const pass of this._passes) {\r\n pass._dispose();\r\n }\r\n for (const pass of this._passesDisabled) {\r\n pass._dispose();\r\n }\r\n this._passes.length = 0;\r\n this._passesDisabled.length = 0;\r\n }\r\n\r\n /** @internal */\r\n public _addPass(pass: IFrameGraphPass, disabled: boolean) {\r\n if (disabled) {\r\n this._passesDisabled.push(pass);\r\n } else {\r\n this._passes.push(pass);\r\n }\r\n }\r\n\r\n /** @internal */\r\n public _checkTask() {\r\n let outputTexture: Nullable<Nullable<InternalTexture>[]> = null;\r\n let outputDepthTexture: Nullable<InternalTexture> = null;\r\n let outputObjectList: FrameGraphObjectList | undefined;\r\n\r\n for (const pass of this._passes) {\r\n const errMsg = pass._isValid();\r\n if (errMsg) {\r\n throw new Error(`Pass \"${pass.name}\" is not valid. ${errMsg}`);\r\n }\r\n if (FrameGraphRenderPass.IsRenderPass(pass)) {\r\n const handles = Array.isArray(pass.renderTarget) ? pass.renderTarget : [pass.renderTarget];\r\n outputTexture = [];\r\n for (const handle of handles) {\r\n if (handle !== undefined) {\r\n outputTexture.push(this._frameGraph.textureManager.getTextureFromHandle(handle));\r\n }\r\n }\r\n outputDepthTexture = pass.renderTargetDepth !== undefined ? this._frameGraph.textureManager.getTextureFromHandle(pass.renderTargetDepth) : null;\r\n } else if (FrameGraphObjectListPass.IsObjectListPass(pass)) {\r\n outputObjectList = pass.objectList;\r\n }\r\n }\r\n\r\n let disabledOutputTexture: Nullable<Nullable<InternalTexture>[]> = null;\r\n let disabledOutputTextureHandle: (FrameGraphTextureHandle | undefined)[] = [];\r\n let disabledOutputDepthTexture: Nullable<InternalTexture> = null;\r\n let disabledOutputObjectList: FrameGraphObjectList | undefined;\r\n\r\n for (const pass of this._passesDisabled) {\r\n const errMsg = pass._isValid();\r\n if (errMsg) {\r\n throw new Error(`Pass \"${pass.name}\" is not valid. ${errMsg}`);\r\n }\r\n if (FrameGraphRenderPass.IsRenderPass(pass)) {\r\n const handles = Array.isArray(pass.renderTarget) ? pass.renderTarget : [pass.renderTarget];\r\n disabledOutputTexture = [];\r\n for (const handle of handles) {\r\n if (handle !== undefined) {\r\n disabledOutputTexture.push(this._frameGraph.textureManager.getTextureFromHandle(handle));\r\n }\r\n }\r\n disabledOutputTextureHandle = handles;\r\n disabledOutputDepthTexture = pass.renderTargetDepth !== undefined ? this._frameGraph.textureManager.getTextureFromHandle(pass.renderTargetDepth) : null;\r\n } else if (FrameGraphObjectListPass.IsObjectListPass(pass)) {\r\n disabledOutputObjectList = pass.objectList;\r\n }\r\n }\r\n\r\n if (this._passesDisabled.length > 0) {\r\n if (!this._checkSameRenderTarget(outputTexture, disabledOutputTexture)) {\r\n let ok = true;\r\n for (const handle of disabledOutputTextureHandle) {\r\n if (handle !== undefined && !this._frameGraph.textureManager.isHistoryTexture(handle)) {\r\n ok = false;\r\n break;\r\n }\r\n }\r\n if (!ok) {\r\n throw new Error(`The output texture of the task \"${this.name}\" is different when it is enabled or disabled.`);\r\n }\r\n }\r\n if (outputDepthTexture !== disabledOutputDepthTexture && disabledOutputDepthTexture !== null) {\r\n throw new Error(`The output depth texture of the task \"${this.name}\" is different when it is enabled or disabled.`);\r\n }\r\n if (outputObjectList !== disabledOutputObjectList && disabledOutputObjectList !== null) {\r\n throw new Error(`The output object list of the task \"${this.name}\" is different when it is enabled or disabled.`);\r\n }\r\n }\r\n }\r\n\r\n /** @internal */\r\n public _execute() {\r\n const passes = this._disabled && this._passesDisabled.length > 0 ? this._passesDisabled : this._passes;\r\n\r\n this.onBeforeTaskExecute.notifyObservers(this);\r\n\r\n this._frameGraph.engine._debugPushGroup?.(`${this.getClassName()} (${this.name})`, 2);\r\n\r\n for (const pass of passes) {\r\n pass._execute();\r\n }\r\n\r\n this._frameGraph.engine._debugPopGroup?.(2);\r\n\r\n this.onAfterTaskExecute.notifyObservers(this);\r\n }\r\n\r\n private _checkSameRenderTarget(src: Nullable<Nullable<InternalTexture>[]>, dst: Nullable<Nullable<InternalTexture>[]>) {\r\n if (src === null || dst === null) {\r\n return src === dst;\r\n }\r\n\r\n if (src.length !== dst.length) {\r\n return false;\r\n }\r\n\r\n for (let i = 0; i < src.length; i++) {\r\n if (src[i] !== dst[i]) {\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"frameGraphTask.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/frameGraphTask.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,8BAA6B;AAElD;;;GAGG;AACH,MAAM,OAAgB,cAAc;IAUhC;;OAEG;IACH,IAAW,IAAI;QACX,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAED,IAAW,IAAI,CAAC,KAAa;QACzB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;IAID;;OAEG;IACH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED,IAAW,QAAQ,CAAC,KAAc;QAC9B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,IAAW,cAAc;QACrB,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAaD;;;OAGG;IACI,YAAY;QACf,OAAO,gBAAgB,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACH,2FAA2F;IACpF,SAAS;QACZ,OAAO,OAAO,CAAC,O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AAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAClC,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;gBACpB,OAAO,KAAK,CAAC;YACjB,CAAC;QACL,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ","sourcesContent":["import type { FrameGraph, FrameGraphObjectList, IFrameGraphPass, Nullable, FrameGraphTextureHandle, InternalTexture, FrameGraphRenderContext } from \"core/index\";\r\nimport { FrameGraphObjectListPass } from \"./Passes/objectListPass\";\r\nimport { FrameGraphRenderPass } from \"./Passes/renderPass\";\r\nimport { Observable } from \"core/Misc/observable\";\r\n\r\n/**\r\n * Represents a task in a frame graph.\r\n * @experimental\r\n */\r\nexport abstract class FrameGraphTask {\r\n protected readonly _frameGraph: FrameGraph;\r\n\r\n private readonly _passes: IFrameGraphPass[] = [];\r\n private readonly _passesDisabled: IFrameGraphPass[] = [];\r\n\r\n // Note: must be a getter/setter even if there's no specific processing, otherwise inherited classes can't make it a getter/setter!\r\n // Same thing for the disabled property\r\n protected _name: string;\r\n\r\n /**\r\n * The name of the task.\r\n */\r\n public get name() {\r\n return this._name;\r\n }\r\n\r\n public set name(value: string) {\r\n this._name = value;\r\n }\r\n\r\n protected _disabled = false;\r\n\r\n /**\r\n * Whether the task is disabled.\r\n */\r\n public get disabled() {\r\n return this._disabled;\r\n }\r\n\r\n public set disabled(value: boolean) {\r\n this._disabled = value;\r\n }\r\n\r\n /**\r\n * Gets the render passes of the task.\r\n */\r\n public get passes() {\r\n return this._passes;\r\n }\r\n\r\n /**\r\n * Gets the disabled render passes of the task.\r\n */\r\n public get passesDisabled() {\r\n return this._passesDisabled;\r\n }\r\n\r\n /**\r\n * The (texture) dependencies of the task (optional).\r\n */\r\n public dependencies?: Set<FrameGraphTextureHandle>;\r\n\r\n /**\r\n * Records the task in the frame graph. Use this function to add content (render passes, ...) to the task.\r\n * @param skipCreationOfDisabledPasses If true, the disabled passe(s) won't be created.\r\n */\r\n public abstract record(skipCreationOfDisabledPasses?: boolean): void;\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public getClassName(): string {\r\n return \"FrameGraphTask\";\r\n }\r\n\r\n /**\r\n * This function is called once after the task has been added to the frame graph and before the frame graph is built for the first time.\r\n * This allows you to initialize asynchronous resources, which is not possible in the constructor.\r\n * @returns A promise that resolves when the initialization is complete.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\r\n public initAsync(): Promise<unknown> {\r\n return Promise.resolve();\r\n }\r\n\r\n /**\r\n * An observable that is triggered after the textures have been allocated.\r\n */\r\n public onTexturesAllocatedObservable: Observable<FrameGraphRenderContext> = new Observable();\r\n\r\n /**\r\n * An observable that is triggered before the task is executed.\r\n */\r\n public onBeforeTaskExecute: Observable<FrameGraphTask> = new Observable();\r\n\r\n /**\r\n * An observable that is triggered after the task is executed.\r\n */\r\n public onAfterTaskExecute: Observable<FrameGraphTask> = new Observable();\r\n\r\n /**\r\n * Checks if the task is ready to be executed.\r\n * @returns True if the task is ready to be executed, else false.\r\n */\r\n public isReady(): boolean {\r\n return true;\r\n }\r\n\r\n /**\r\n * Disposes of the task.\r\n */\r\n public dispose() {\r\n this._reset();\r\n this.onTexturesAllocatedObservable.clear();\r\n this.onBeforeTaskExecute.clear();\r\n this.onAfterTaskExecute.clear();\r\n }\r\n\r\n /**\r\n * Constructs a new frame graph task.\r\n * @param name The name of the task.\r\n * @param frameGraph The frame graph this task is associated with.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph) {\r\n this.name = name;\r\n this._frameGraph = frameGraph;\r\n this._reset();\r\n }\r\n\r\n /** @internal */\r\n public _reset() {\r\n for (const pass of this._passes) {\r\n pass._dispose();\r\n }\r\n for (const pass of this._passesDisabled) {\r\n pass._dispose();\r\n }\r\n this._passes.length = 0;\r\n this._passesDisabled.length = 0;\r\n }\r\n\r\n /** @internal */\r\n public _addPass(pass: IFrameGraphPass, disabled: boolean) {\r\n if (disabled) {\r\n this._passesDisabled.push(pass);\r\n } else {\r\n this._passes.push(pass);\r\n }\r\n }\r\n\r\n /** @internal */\r\n public _checkTask() {\r\n let outputTexture: Nullable<Nullable<InternalTexture>[]> = null;\r\n let outputDepthTexture: Nullable<InternalTexture> = null;\r\n let outputObjectList: FrameGraphObjectList | undefined;\r\n\r\n for (const pass of this._passes) {\r\n const errMsg = pass._isValid();\r\n if (errMsg) {\r\n throw new Error(`Pass \"${pass.name}\" is not valid. ${errMsg}`);\r\n }\r\n if (FrameGraphRenderPass.IsRenderPass(pass)) {\r\n const handles = Array.isArray(pass.renderTarget) ? pass.renderTarget : [pass.renderTarget];\r\n outputTexture = [];\r\n for (const handle of handles) {\r\n if (handle !== undefined) {\r\n outputTexture.push(this._frameGraph.textureManager.getTextureFromHandle(handle));\r\n }\r\n }\r\n outputDepthTexture = pass.renderTargetDepth !== undefined ? this._frameGraph.textureManager.getTextureFromHandle(pass.renderTargetDepth) : null;\r\n } else if (FrameGraphObjectListPass.IsObjectListPass(pass)) {\r\n outputObjectList = pass.objectList;\r\n }\r\n }\r\n\r\n let disabledOutputTexture: Nullable<Nullable<InternalTexture>[]> = null;\r\n let disabledOutputTextureHandle: (FrameGraphTextureHandle | undefined)[] = [];\r\n let disabledOutputDepthTexture: Nullable<InternalTexture> = null;\r\n let disabledOutputObjectList: FrameGraphObjectList | undefined;\r\n\r\n for (const pass of this._passesDisabled) {\r\n const errMsg = pass._isValid();\r\n if (errMsg) {\r\n throw new Error(`Pass \"${pass.name}\" is not valid. ${errMsg}`);\r\n }\r\n if (FrameGraphRenderPass.IsRenderPass(pass)) {\r\n const handles = Array.isArray(pass.renderTarget) ? pass.renderTarget : [pass.renderTarget];\r\n disabledOutputTexture = [];\r\n for (const handle of handles) {\r\n if (handle !== undefined) {\r\n disabledOutputTexture.push(this._frameGraph.textureManager.getTextureFromHandle(handle));\r\n }\r\n }\r\n disabledOutputTextureHandle = handles;\r\n disabledOutputDepthTexture = pass.renderTargetDepth !== undefined ? this._frameGraph.textureManager.getTextureFromHandle(pass.renderTargetDepth) : null;\r\n } else if (FrameGraphObjectListPass.IsObjectListPass(pass)) {\r\n disabledOutputObjectList = pass.objectList;\r\n }\r\n }\r\n\r\n if (this._passesDisabled.length > 0) {\r\n if (!this._checkSameRenderTarget(outputTexture, disabledOutputTexture)) {\r\n let ok = true;\r\n for (const handle of disabledOutputTextureHandle) {\r\n if (handle !== undefined && !this._frameGraph.textureManager.isHistoryTexture(handle)) {\r\n ok = false;\r\n break;\r\n }\r\n }\r\n if (!ok) {\r\n throw new Error(`The output texture of the task \"${this.name}\" is different when it is enabled or disabled.`);\r\n }\r\n }\r\n if (outputDepthTexture !== disabledOutputDepthTexture && disabledOutputDepthTexture !== null) {\r\n throw new Error(`The output depth texture of the task \"${this.name}\" is different when it is enabled or disabled.`);\r\n }\r\n if (outputObjectList !== disabledOutputObjectList && disabledOutputObjectList !== null) {\r\n throw new Error(`The output object list of the task \"${this.name}\" is different when it is enabled or disabled.`);\r\n }\r\n }\r\n }\r\n\r\n /** @internal */\r\n public _execute() {\r\n const passes = this._disabled && this._passesDisabled.length > 0 ? this._passesDisabled : this._passes;\r\n\r\n this.onBeforeTaskExecute.notifyObservers(this);\r\n\r\n this._frameGraph.engine._debugPushGroup?.(`${this.getClassName()} (${this.name})`, 2);\r\n\r\n for (const pass of passes) {\r\n pass._execute();\r\n }\r\n\r\n this._frameGraph.engine._debugPopGroup?.(2);\r\n\r\n this.onAfterTaskExecute.notifyObservers(this);\r\n }\r\n\r\n /** @internal */\r\n public _initializePasses() {\r\n this._frameGraph.engine._debugPushGroup?.(`${this.getClassName()} (${this.name})`, 2);\r\n\r\n for (const pass of this._passes) {\r\n pass._initialize();\r\n }\r\n\r\n for (const pass of this._passesDisabled) {\r\n pass._initialize();\r\n }\r\n\r\n this._frameGraph.engine._debugPopGroup?.(2);\r\n }\r\n\r\n private _checkSameRenderTarget(src: Nullable<Nullable<InternalTexture>[]>, dst: Nullable<Nullable<InternalTexture>[]>) {\r\n if (src === null || dst === null) {\r\n return src === dst;\r\n }\r\n\r\n if (src.length !== dst.length) {\r\n return false;\r\n }\r\n\r\n for (let i = 0; i < src.length; i++) {\r\n if (src[i] !== dst[i]) {\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n}\r\n"]}
@@ -68,12 +68,20 @@ export interface IFrameGraphPass {
68
68
  * Whether the pass is disabled.
69
69
  */
70
70
  disabled: boolean;
71
+ /**
72
+ * Initializes the pass.
73
+ * This function is called once before the first execution of the pass.
74
+ * @param func The function to initialize the pass.
75
+ */
76
+ setInitializeFunc(func: (context: FrameGraphContext) => void): void;
71
77
  /**
72
78
  * Sets the function to execute when the pass is executed
73
79
  * @param func The function to execute when the pass is executed
74
80
  */
75
81
  setExecuteFunc(func: (context: FrameGraphContext) => void): void;
76
82
  /** @internal */
83
+ _initialize(): void;
84
+ /** @internal */
77
85
  _execute(): void;
78
86
  /** @internal */
79
87
  _isValid(): Nullable<string>;
@@ -1 +1 @@
1
- {"version":3,"file":"frameGraphTypes.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/frameGraphTypes.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,4BAA4B,GAA4B,CAAC,CAAC;AAEvE;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,mCAAmC,GAA4B,CAAC,CAAC","sourcesContent":["import type { Nullable, TextureSize, FrameGraphContext } from \"core/index\";\r\n\r\n/**\r\n * Represents a texture handle in the frame graph.\r\n */\r\nexport type FrameGraphTextureHandle = number;\r\n\r\n/**\r\n * Represents a texture handle for the backbuffer color texture.\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const backbufferColorTextureHandle: FrameGraphTextureHandle = 0;\r\n\r\n/**\r\n * Represents a texture handle for the backbuffer depth/stencil texture.\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const backbufferDepthStencilTextureHandle: FrameGraphTextureHandle = 1;\r\n\r\n/**\r\n * Options used to describe a texture to be created in the frame graph.\r\n */\r\nexport type FrameGraphTextureOptions = {\r\n /** Specifies if mipmaps must be created for the textures (default: false) */\r\n createMipMaps?: boolean;\r\n\r\n /** Defines sample count (default: 1) */\r\n samples?: number;\r\n\r\n /** Defines the types of the textures */\r\n types?: number[];\r\n\r\n /** Defines the format of the textures (RED, RG, RGB, RGBA, ALPHA...) */\r\n formats?: number[];\r\n\r\n /** Defines if sRGB format should be used for each of texture */\r\n useSRGBBuffers?: boolean[];\r\n\r\n /** Defines the creation flags of the textures (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg) */\r\n creationFlags?: number[];\r\n\r\n /** Defines the names of the textures (used for debugging purpose) */\r\n labels?: string[];\r\n};\r\n\r\n/**\r\n * Options used to create a texture / list of textures in the frame graph.\r\n */\r\nexport type FrameGraphTextureCreationOptions = {\r\n /** Size of the textures. If sizeIsPercentage is true, these are percentages relative to the screen size (100 = 100%) */\r\n size: TextureSize;\r\n\r\n /** Options used to create the textures */\r\n options: FrameGraphTextureOptions;\r\n\r\n /** If true, indicates that \"size\" is percentages relative to the screen size */\r\n sizeIsPercentage: boolean;\r\n\r\n /** Indicates that the texture is a history texture (default: false) */\r\n isHistoryTexture?: boolean;\r\n};\r\n\r\n/**\r\n * Represents a texture description in the frame graph.\r\n * This is basically the same thing than FrameGraphTextureCreationOptions, but the size is never in percentage and always in pixels.\r\n */\r\nexport type FrameGraphTextureDescription = {\r\n /** Size of the texture */\r\n size: { width: number; height: number };\r\n\r\n /** Options used to create the texture */\r\n options: FrameGraphTextureOptions;\r\n};\r\n\r\n/**\r\n * Defines a pass in the frame graph.\r\n */\r\nexport interface IFrameGraphPass {\r\n /**\r\n * The name of the pass.\r\n */\r\n name: string;\r\n\r\n /**\r\n * Whether the pass is disabled.\r\n */\r\n disabled: boolean;\r\n\r\n /**\r\n * Sets the function to execute when the pass is executed\r\n * @param func The function to execute when the pass is executed\r\n */\r\n setExecuteFunc(func: (context: FrameGraphContext) => void): void;\r\n\r\n /** @internal */\r\n _execute(): void;\r\n\r\n /** @internal */\r\n _isValid(): Nullable<string>;\r\n\r\n /** @internal */\r\n _dispose(): void;\r\n}\r\n"]}
1
+ {"version":3,"file":"frameGraphTypes.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/frameGraphTypes.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,4BAA4B,GAA4B,CAAC,CAAC;AAEvE;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,mCAAmC,GAA4B,CAAC,CAAC","sourcesContent":["import type { Nullable, TextureSize, FrameGraphContext } from \"core/index\";\r\n\r\n/**\r\n * Represents a texture handle in the frame graph.\r\n */\r\nexport type FrameGraphTextureHandle = number;\r\n\r\n/**\r\n * Represents a texture handle for the backbuffer color texture.\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const backbufferColorTextureHandle: FrameGraphTextureHandle = 0;\r\n\r\n/**\r\n * Represents a texture handle for the backbuffer depth/stencil texture.\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const backbufferDepthStencilTextureHandle: FrameGraphTextureHandle = 1;\r\n\r\n/**\r\n * Options used to describe a texture to be created in the frame graph.\r\n */\r\nexport type FrameGraphTextureOptions = {\r\n /** Specifies if mipmaps must be created for the textures (default: false) */\r\n createMipMaps?: boolean;\r\n\r\n /** Defines sample count (default: 1) */\r\n samples?: number;\r\n\r\n /** Defines the types of the textures */\r\n types?: number[];\r\n\r\n /** Defines the format of the textures (RED, RG, RGB, RGBA, ALPHA...) */\r\n formats?: number[];\r\n\r\n /** Defines if sRGB format should be used for each of texture */\r\n useSRGBBuffers?: boolean[];\r\n\r\n /** Defines the creation flags of the textures (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg) */\r\n creationFlags?: number[];\r\n\r\n /** Defines the names of the textures (used for debugging purpose) */\r\n labels?: string[];\r\n};\r\n\r\n/**\r\n * Options used to create a texture / list of textures in the frame graph.\r\n */\r\nexport type FrameGraphTextureCreationOptions = {\r\n /** Size of the textures. If sizeIsPercentage is true, these are percentages relative to the screen size (100 = 100%) */\r\n size: TextureSize;\r\n\r\n /** Options used to create the textures */\r\n options: FrameGraphTextureOptions;\r\n\r\n /** If true, indicates that \"size\" is percentages relative to the screen size */\r\n sizeIsPercentage: boolean;\r\n\r\n /** Indicates that the texture is a history texture (default: false) */\r\n isHistoryTexture?: boolean;\r\n};\r\n\r\n/**\r\n * Represents a texture description in the frame graph.\r\n * This is basically the same thing than FrameGraphTextureCreationOptions, but the size is never in percentage and always in pixels.\r\n */\r\nexport type FrameGraphTextureDescription = {\r\n /** Size of the texture */\r\n size: { width: number; height: number };\r\n\r\n /** Options used to create the texture */\r\n options: FrameGraphTextureOptions;\r\n};\r\n\r\n/**\r\n * Defines a pass in the frame graph.\r\n */\r\nexport interface IFrameGraphPass {\r\n /**\r\n * The name of the pass.\r\n */\r\n name: string;\r\n\r\n /**\r\n * Whether the pass is disabled.\r\n */\r\n disabled: boolean;\r\n\r\n /**\r\n * Initializes the pass.\r\n * This function is called once before the first execution of the pass.\r\n * @param func The function to initialize the pass.\r\n */\r\n setInitializeFunc(func: (context: FrameGraphContext) => void): void;\r\n\r\n /**\r\n * Sets the function to execute when the pass is executed\r\n * @param func The function to execute when the pass is executed\r\n */\r\n setExecuteFunc(func: (context: FrameGraphContext) => void): void;\r\n\r\n /** @internal */\r\n _initialize(): void;\r\n\r\n /** @internal */\r\n _execute(): void;\r\n\r\n /** @internal */\r\n _isValid(): Nullable<string>;\r\n\r\n /** @internal */\r\n _dispose(): void;\r\n}\r\n"]}
@@ -60,7 +60,7 @@ export interface IEffectLayerOptions {
60
60
  */
61
61
  export declare abstract class EffectLayer {
62
62
  private _effectLayerOptions;
63
- private _mainTextureCreatedSize;
63
+ protected _mainTextureCreatedSize: ISize;
64
64
  protected _scene: Scene;
65
65
  protected _engine: AbstractEngine;
66
66
  protected _maxSize: number;
@@ -1 +1 @@
1
- {"version":3,"file":"effectLayer.js","sourceRoot":"","sources":["../../../../dev/core/src/Layers/effectLayer.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAC9F,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAOhD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAMrD,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAGhF,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,qCAAoC;AA4ChE;;;;;;;GAOG;AACH,MAAM,OAAgB,WAAW;IAS7B,IAAc,aAAa;QACvB,OAAO,IAAI,CAAC,gBAAgB,CAAC,aAAa,CAAC;IAC/C,CAAC;IACD,IAAc,aAAa,CAAC,KAAK;QAC7B,IAAI,CAAC,gBAAgB,CAAC,aAAa,GAAG,KAAK,CAAC;IAChD,CAAC;IAGD,IAAc,wBAAwB;QAClC,OAAO,IAAI,CAAC,gBAAgB,CAAC,wBAAwB,CAAC;IAC1D,CAAC;IACD,IAAc,wBAAwB,CAAC,KAAK;QACxC,IAAI,CAAC,gBAAgB,CAAC,wBAAwB,GAAG,KAAK,CAAC;IAC3D,CAAC;IACD,IAAc,gBAAgB;QAC1B,OAAO,IAAI,CAAC,gBAAgB,CAAC,gBAAgB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;IADC,SAAS,EAAE;4CAGX;AAUD;IADC,0BAA0B,EAAE;yCAG5B;AAMD;IADC,SAAS,EAAE;mDAGX;AASD;IADC,SAAS,EAAE;sEAGX","sourcesContent":["import { serialize, serializeAsColor4, serializeAsCameraReference } from \"../Misc/decorators\";\r\nimport { Tools } from \"../Misc/tools\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { ISize } from \"../Maths/math.size\";\r\nimport type { Color4 } from \"../Maths/math.color\";\r\nimport type { AbstractEngine } from \"../Engines/abstractEngine\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport type { SubMesh } from \"../Meshes/subMesh\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\nimport type { PostProcess } from \"../PostProcesses/postProcess\";\r\nimport type { BaseTexture } from \"../Materials/Textures/baseTexture\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { RenderTargetTexture } from \"../Materials/Textures/renderTargetTexture\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport type { Material } from \"../Materials/material\";\r\nimport { Constants } from \"../Engines/constants\";\r\n\r\nimport { _WarnImport } from \"../Misc/devTools\";\r\nimport { GetExponentOfTwo } from \"../Misc/tools.functions\";\r\nimport type { ShaderLanguage } from \"core/Materials/shaderLanguage\";\r\nimport { ThinEffectLayer } from \"./thinEffectLayer\";\r\nimport { UniqueIdGenerator } from \"core/Misc/uniqueIdGenerator\";\r\n\r\n/**\r\n * Effect layer options. This helps customizing the behaviour\r\n * of the effect layer.\r\n */\r\nexport interface IEffectLayerOptions {\r\n /**\r\n * Multiplication factor apply to the canvas size to compute the render target size\r\n * used to generated the objects (the smaller the faster). Default: 0.5\r\n */\r\n mainTextureRatio: number;\r\n\r\n /**\r\n * Enforces a fixed size texture to ensure effect stability across devices. Default: undefined\r\n */\r\n mainTextureFixedSize?: number;\r\n\r\n /**\r\n * Alpha blending mode used to apply the blur. Default depends of the implementation. Default: ALPHA_COMBINE\r\n */\r\n alphaBlendingMode: number;\r\n\r\n /**\r\n * The camera attached to the layer. Default: null\r\n */\r\n camera: Nullable<Camera>;\r\n\r\n /**\r\n * The rendering group to draw the layer in. Default: -1\r\n */\r\n renderingGroupId: number;\r\n\r\n /**\r\n * The type of the main texture. Default: TEXTURETYPE_UNSIGNED_BYTE\r\n */\r\n mainTextureType: number;\r\n\r\n /**\r\n * Whether or not to generate a stencil buffer. Default: false\r\n */\r\n generateStencilBuffer: boolean;\r\n}\r\n\r\n/**\r\n * The effect layer Helps adding post process effect blended with the main pass.\r\n *\r\n * This can be for instance use to generate glow or highlight effects on the scene.\r\n *\r\n * The effect layer class can not be used directly and is intented to inherited from to be\r\n * customized per effects.\r\n */\r\nexport abstract class EffectLayer {\r\n private _effectLayerOptions: IEffectLayerOptions;\r\n private _mainTextureCreatedSize: ISize = { width: 0, height: 0 };\r\n\r\n protected _scene: Scene;\r\n protected _engine: AbstractEngine;\r\n protected _maxSize: number = 0;\r\n protected _mainTextureDesiredSize: ISize = { width: 0, height: 0 };\r\n protected _mainTexture: RenderTargetTexture;\r\n protected get _shouldRender() {\r\n return this._thinEffectLayer._shouldRender;\r\n }\r\n protected set _shouldRender(value) {\r\n this._thinEffectLayer._shouldRender = value;\r\n }\r\n protected _postProcesses: PostProcess[] = [];\r\n protected _textures: BaseTexture[] = [];\r\n protected get _emissiveTextureAndColor(): { texture: Nullable<BaseTexture>; color: Color4 } {\r\n return this._thinEffectLayer._emissiveTextureAndColor;\r\n }\r\n protected set _emissiveTextureAndColor(value) {\r\n this._thinEffectLayer._emissiveTextureAndColor = value;\r\n }\r\n protected get _effectIntensity(): { [meshUniqueId: number]: number } {\r\n return this._thinEffectLayer._effectIntensity;\r\n }\r\n protected set _effectIntensity(value) {\r\n this._thinEffectLayer._effectIntensity = value;\r\n }\r\n protected readonly _thinEffectLayer: ThinEffectLayer;\r\n private readonly _internalThinEffectLayer: boolean;\r\n\r\n /**\r\n * Force all the effect layers to compile to glsl even on WebGPU engines.\r\n * False by default. This is mostly meant for backward compatibility.\r\n */\r\n public static get ForceGLSL() {\r\n return ThinEffectLayer.ForceGLSL;\r\n }\r\n\r\n public static set ForceGLSL(value: boolean) {\r\n ThinEffectLayer.ForceGLSL = value;\r\n }\r\n\r\n /**\r\n * The unique id of the layer\r\n */\r\n public readonly uniqueId = UniqueIdGenerator.UniqueId;\r\n\r\n /**\r\n * The name of the layer\r\n */\r\n @serialize()\r\n public get name() {\r\n return this._thinEffectLayer.name;\r\n }\r\n\r\n public set name(value: string) {\r\n this._thinEffectLayer.name = value;\r\n }\r\n\r\n /**\r\n * The clear color of the texture used to generate the glow map.\r\n */\r\n @serializeAsColor4()\r\n public get neutralColor(): Color4 {\r\n return this._thinEffectLayer.neutralColor;\r\n }\r\n\r\n public set neutralColor(value: Color4) {\r\n this._thinEffectLayer.neutralColor = value;\r\n }\r\n\r\n /**\r\n * Specifies whether the highlight layer is enabled or not.\r\n */\r\n @serialize()\r\n public get isEnabled(): boolean {\r\n return this._thinEffectLayer.isEnabled;\r\n }\r\n\r\n public set isEnabled(value: boolean) {\r\n this._thinEffectLayer.isEnabled = value;\r\n }\r\n\r\n /**\r\n * Gets the camera attached to the layer.\r\n */\r\n @serializeAsCameraReference()\r\n public get camera(): Nullable<Camera> {\r\n return this._thinEffectLayer.camera;\r\n }\r\n\r\n /**\r\n * Gets the rendering group id the layer should render in.\r\n */\r\n @serialize()\r\n public get renderingGroupId(): number {\r\n return this._thinEffectLayer.renderingGroupId;\r\n }\r\n public set renderingGroupId(renderingGroupId: number) {\r\n this._thinEffectLayer.renderingGroupId = renderingGroupId;\r\n }\r\n\r\n /**\r\n * Specifies if the bounding boxes should be rendered normally or if they should undergo the effect of the layer\r\n */\r\n @serialize()\r\n public get disableBoundingBoxesFromEffectLayer() {\r\n return this._thinEffectLayer.disableBoundingBoxesFromEffectLayer;\r\n }\r\n\r\n public set disableBoundingBoxesFromEffectLayer(value: boolean) {\r\n this._thinEffectLayer.disableBoundingBoxesFromEffectLayer = value;\r\n }\r\n\r\n /**\r\n * An event triggered when the effect layer has been disposed.\r\n */\r\n public onDisposeObservable = new Observable<EffectLayer>();\r\n\r\n /**\r\n * An event triggered when the effect layer is about rendering the main texture with the glowy parts.\r\n */\r\n public onBeforeRenderMainTextureObservable = new Observable<EffectLayer>();\r\n\r\n /**\r\n * An event triggered when the generated texture is being merged in the scene.\r\n */\r\n public onBeforeComposeObservable = new Observable<EffectLayer>();\r\n\r\n /**\r\n * An event triggered when the mesh is rendered into the effect render target.\r\n */\r\n public onBeforeRenderMeshToEffect = new Observable<AbstractMesh>();\r\n\r\n /**\r\n * An event triggered after the mesh has been rendered into the effect render target.\r\n */\r\n public onAfterRenderMeshToEffect = new Observable<AbstractMesh>();\r\n\r\n /**\r\n * An event triggered when the generated texture has been merged in the scene.\r\n */\r\n public onAfterComposeObservable = new Observable<EffectLayer>();\r\n\r\n /**\r\n * An event triggered when the effect layer changes its size.\r\n */\r\n public onSizeChangedObservable = new Observable<EffectLayer>();\r\n\r\n /**\r\n * Gets the main texture where the effect is rendered\r\n */\r\n public get mainTexture() {\r\n return this._mainTexture;\r\n }\r\n\r\n protected get _shaderLanguage(): ShaderLanguage {\r\n return this._thinEffectLayer.shaderLanguage;\r\n }\r\n\r\n /**\r\n * Gets the shader language used in this material.\r\n */\r\n public get shaderLanguage(): ShaderLanguage {\r\n return this._thinEffectLayer.shaderLanguage;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public static _SceneComponentInitialization: (scene: Scene) => void = (_) => {\r\n throw _WarnImport(\"EffectLayerSceneComponent\");\r\n };\r\n /**\r\n * Sets a specific material to be used to render a mesh/a list of meshes in the layer\r\n * @param mesh mesh or array of meshes\r\n * @param material material to use by the layer when rendering the mesh(es). If undefined is passed, the specific material created by the layer will be used.\r\n */\r\n public setMaterialForRendering(mesh: AbstractMesh | AbstractMesh[], material?: Material): void {\r\n this._thinEffectLayer.setMaterialForRendering(mesh, material);\r\n }\r\n\r\n /**\r\n * Gets the intensity of the effect for a specific mesh.\r\n * @param mesh The mesh to get the effect intensity for\r\n * @returns The intensity of the effect for the mesh\r\n */\r\n public getEffectIntensity(mesh: AbstractMesh) {\r\n return this._thinEffectLayer.getEffectIntensity(mesh);\r\n }\r\n\r\n /**\r\n * Sets the intensity of the effect for a specific mesh.\r\n * @param mesh The mesh to set the effect intensity for\r\n * @param intensity The intensity of the effect for the mesh\r\n */\r\n public setEffectIntensity(mesh: AbstractMesh, intensity: number): void {\r\n this._thinEffectLayer.setEffectIntensity(mesh, intensity);\r\n }\r\n\r\n /**\r\n * Instantiates a new effect Layer and references it in the scene.\r\n * @param name The name of the layer\r\n * @param scene The scene to use the layer in\r\n * @param forceGLSL Use the GLSL code generation for the shader (even on WebGPU). Default is false\r\n * @param thinEffectLayer The thin instance of the effect layer (optional)\r\n */\r\n constructor(\r\n /** The Friendly of the effect in the scene */\r\n name: string,\r\n scene?: Scene,\r\n forceGLSL = false,\r\n thinEffectLayer?: ThinEffectLayer\r\n ) {\r\n this._internalThinEffectLayer = !thinEffectLayer;\r\n if (!thinEffectLayer) {\r\n thinEffectLayer = new ThinEffectLayer(name, scene, forceGLSL, false, this._importShadersAsync.bind(this));\r\n thinEffectLayer.getEffectName = this.getEffectName.bind(this);\r\n thinEffectLayer.isReady = this.isReady.bind(this);\r\n thinEffectLayer._createMergeEffect = this._createMergeEffect.bind(this);\r\n thinEffectLayer._createTextureAndPostProcesses = this._createTextureAndPostProcesses.bind(this);\r\n thinEffectLayer._internalCompose = this._internalRender.bind(this);\r\n thinEffectLayer._setEmissiveTextureAndColor = this._setEmissiveTextureAndColor.bind(this);\r\n thinEffectLayer._numInternalDraws = this._numInternalDraws.bind(this);\r\n thinEffectLayer._addCustomEffectDefines = this._addCustomEffectDefines.bind(this);\r\n thinEffectLayer.hasMesh = this.hasMesh.bind(this);\r\n thinEffectLayer.shouldRender = this.shouldRender.bind(this);\r\n thinEffectLayer._shouldRenderMesh = this._shouldRenderMesh.bind(this);\r\n thinEffectLayer._canRenderMesh = this._canRenderMesh.bind(this);\r\n thinEffectLayer._useMeshMaterial = this._useMeshMaterial.bind(this);\r\n }\r\n\r\n this._thinEffectLayer = thinEffectLayer;\r\n this.name = name;\r\n\r\n this._scene = scene || <Scene>EngineStore.LastCreatedScene;\r\n EffectLayer._SceneComponentInitialization(this._scene);\r\n\r\n this._engine = this._scene.getEngine();\r\n this._maxSize = this._engine.getCaps().maxTextureSize;\r\n this._scene.addEffectLayer(this);\r\n\r\n this._thinEffectLayer.onDisposeObservable.add(() => {\r\n this.onDisposeObservable.notifyObservers(this);\r\n });\r\n\r\n this._thinEffectLayer.onBeforeRenderLayerObservable.add(() => {\r\n this.onBeforeRenderMainTextureObservable.notifyObservers(this);\r\n });\r\n\r\n this._thinEffectLayer.onBeforeComposeObservable.add(() => {\r\n this.onBeforeComposeObservable.notifyObservers(this);\r\n });\r\n\r\n this._thinEffectLayer.onBeforeRenderMeshToEffect.add((mesh) => {\r\n this.onBeforeRenderMeshToEffect.notifyObservers(mesh);\r\n });\r\n\r\n this._thinEffectLayer.onAfterRenderMeshToEffect.add((mesh) => {\r\n this.onAfterRenderMeshToEffect.notifyObservers(mesh);\r\n });\r\n\r\n this._thinEffectLayer.onAfterComposeObservable.add(() => {\r\n this.onAfterComposeObservable.notifyObservers(this);\r\n });\r\n }\r\n\r\n protected get _shadersLoaded() {\r\n return this._thinEffectLayer._shadersLoaded;\r\n }\r\n\r\n protected set _shadersLoaded(value: boolean) {\r\n this._thinEffectLayer._shadersLoaded = value;\r\n }\r\n\r\n /**\r\n * Get the effect name of the layer.\r\n * @returns The effect name\r\n */\r\n public abstract getEffectName(): string;\r\n\r\n /**\r\n * Checks for the readiness of the element composing the layer.\r\n * @param subMesh the mesh to check for\r\n * @param useInstances specify whether or not to use instances to render the mesh\r\n * @returns true if ready otherwise, false\r\n */\r\n public abstract isReady(subMesh: SubMesh, useInstances: boolean): boolean;\r\n\r\n /**\r\n * Returns whether or not the layer needs stencil enabled during the mesh rendering.\r\n * @returns true if the effect requires stencil during the main canvas render pass.\r\n */\r\n public abstract needStencil(): boolean;\r\n\r\n /**\r\n * Create the merge effect. This is the shader use to blit the information back\r\n * to the main canvas at the end of the scene rendering.\r\n * @returns The effect containing the shader used to merge the effect on the main canvas\r\n */\r\n protected abstract _createMergeEffect(): Effect;\r\n\r\n /**\r\n * Creates the render target textures and post processes used in the effect layer.\r\n */\r\n protected abstract _createTextureAndPostProcesses(): void;\r\n\r\n /**\r\n * Implementation specific of rendering the generating effect on the main canvas.\r\n * @param effect The effect used to render through\r\n * @param renderNum Index of the _internalRender call (0 for the first time _internalRender is called, 1 for the second time, etc. _internalRender is called the number of times returned by _numInternalDraws())\r\n */\r\n protected abstract _internalRender(effect: Effect, renderIndex: number): void;\r\n\r\n /**\r\n * Sets the required values for both the emissive texture and and the main color.\r\n */\r\n protected abstract _setEmissiveTextureAndColor(mesh: Mesh, subMesh: SubMesh, material: Material): void;\r\n\r\n /**\r\n * Free any resources and references associated to a mesh.\r\n * Internal use\r\n * @param mesh The mesh to free.\r\n */\r\n public abstract _disposeMesh(mesh: Mesh): void;\r\n\r\n /**\r\n * Serializes this layer (Glow or Highlight for example)\r\n * @returns a serialized layer object\r\n */\r\n public abstract serialize?(): any;\r\n\r\n /**\r\n * Number of times _internalRender will be called. Some effect layers need to render the mesh several times, so they should override this method with the number of times the mesh should be rendered\r\n * @returns Number of times a mesh must be rendered in the layer\r\n */\r\n protected _numInternalDraws(): number {\r\n return this._internalThinEffectLayer ? 1 : this._thinEffectLayer._numInternalDraws();\r\n }\r\n\r\n /**\r\n * Initializes the effect layer with the required options.\r\n * @param options Sets of none mandatory options to use with the layer (see IEffectLayerOptions for more information)\r\n */\r\n protected _init(options: Partial<IEffectLayerOptions>): void {\r\n // Adapt options\r\n this._effectLayerOptions = {\r\n mainTextureRatio: 0.5,\r\n alphaBlendingMode: Constants.ALPHA_COMBINE,\r\n camera: null,\r\n renderingGroupId: -1,\r\n mainTextureType: Constants.TEXTURETYPE_UNSIGNED_BYTE,\r\n generateStencilBuffer: false,\r\n ...options,\r\n };\r\n\r\n this._setMainTextureSize();\r\n this._thinEffectLayer._init(options);\r\n this._createMainTexture();\r\n this._createTextureAndPostProcesses();\r\n }\r\n\r\n /**\r\n * Sets the main texture desired size which is the closest power of two\r\n * of the engine canvas size.\r\n */\r\n private _setMainTextureSize(): void {\r\n if (this._effectLayerOptions.mainTextureFixedSize) {\r\n this._mainTextureDesiredSize.width = this._effectLayerOptions.mainTextureFixedSize;\r\n this._mainTextureDesiredSize.height = this._effectLayerOptions.mainTextureFixedSize;\r\n } else {\r\n this._mainTextureDesiredSize.width = this._engine.getRenderWidth() * this._effectLayerOptions.mainTextureRatio;\r\n this._mainTextureDesiredSize.height = this._engine.getRenderHeight() * this._effectLayerOptions.mainTextureRatio;\r\n\r\n this._mainTextureDesiredSize.width = this._engine.needPOTTextures\r\n ? GetExponentOfTwo(this._mainTextureDesiredSize.width, this._maxSize)\r\n : this._mainTextureDesiredSize.width;\r\n this._mainTextureDesiredSize.height = this._engine.needPOTTextures\r\n ? GetExponentOfTwo(this._mainTextureDesiredSize.height, this._maxSize)\r\n : this._mainTextureDesiredSize.height;\r\n }\r\n\r\n this._mainTextureDesiredSize.width = Math.floor(this._mainTextureDesiredSize.width);\r\n this._mainTextureDesiredSize.height = Math.floor(this._mainTextureDesiredSize.height);\r\n }\r\n\r\n /**\r\n * Creates the main texture for the effect layer.\r\n */\r\n protected _createMainTexture(): void {\r\n this._mainTexture = new RenderTargetTexture(\r\n \"EffectLayerMainRTT\",\r\n {\r\n width: this._mainTextureDesiredSize.width,\r\n height: this._mainTextureDesiredSize.height,\r\n },\r\n this._scene,\r\n {\r\n type: this._effectLayerOptions.mainTextureType,\r\n samplingMode: Texture.TRILINEAR_SAMPLINGMODE,\r\n generateStencilBuffer: this._effectLayerOptions.generateStencilBuffer,\r\n existingObjectRenderer: this._thinEffectLayer.objectRenderer,\r\n }\r\n );\r\n this._mainTexture.activeCamera = this._effectLayerOptions.camera;\r\n this._mainTexture.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n this._mainTexture.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n this._mainTexture.anisotropicFilteringLevel = 1;\r\n this._mainTexture.updateSamplingMode(Texture.BILINEAR_SAMPLINGMODE);\r\n this._mainTexture.renderParticles = false;\r\n this._mainTexture.renderList = null;\r\n this._mainTexture.ignoreCameraViewport = true;\r\n\r\n this._mainTexture.onClearObservable.add((engine: AbstractEngine) => {\r\n engine.clear(this.neutralColor, true, true, true);\r\n });\r\n }\r\n\r\n /**\r\n * Adds specific effects defines.\r\n * @param defines The defines to add specifics to.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n protected _addCustomEffectDefines(defines: string[]): void {\r\n // Nothing to add by default.\r\n }\r\n\r\n /**\r\n * Checks for the readiness of the element composing the layer.\r\n * @param subMesh the mesh to check for\r\n * @param useInstances specify whether or not to use instances to render the mesh\r\n * @param emissiveTexture the associated emissive texture used to generate the glow\r\n * @returns true if ready otherwise, false\r\n */\r\n protected _isReady(subMesh: SubMesh, useInstances: boolean, emissiveTexture: Nullable<BaseTexture>): boolean {\r\n return this._internalThinEffectLayer\r\n ? this._thinEffectLayer._internalIsSubMeshReady(subMesh, useInstances, emissiveTexture)\r\n : this._thinEffectLayer._isSubMeshReady(subMesh, useInstances, emissiveTexture);\r\n }\r\n\r\n protected async _importShadersAsync(): Promise<void> {}\r\n\r\n protected _arePostProcessAndMergeReady(): boolean {\r\n return this._internalThinEffectLayer ? this._thinEffectLayer._internalIsLayerReady() : this._thinEffectLayer.isLayerReady();\r\n }\r\n\r\n /**\r\n * Checks if the layer is ready to be used.\r\n * @returns true if the layer is ready to be used\r\n */\r\n public isLayerReady(): boolean {\r\n return this._arePostProcessAndMergeReady() && this._mainTexture.isReady();\r\n }\r\n\r\n /**\r\n * Renders the glowing part of the scene by blending the blurred glowing meshes on top of the rendered scene.\r\n */\r\n public render(): void {\r\n if (!this._thinEffectLayer.compose()) {\r\n return;\r\n }\r\n\r\n // Handle size changes.\r\n this._setMainTextureSize();\r\n if (\r\n (this._mainTextureCreatedSize.width !== this._mainTextureDesiredSize.width || this._mainTextureCreatedSize.height !== this._mainTextureDesiredSize.height) &&\r\n this._mainTextureDesiredSize.width !== 0 &&\r\n this._mainTextureDesiredSize.height !== 0\r\n ) {\r\n // Recreate RTT and post processes on size change.\r\n this.onSizeChangedObservable.notifyObservers(this);\r\n this._disposeTextureAndPostProcesses();\r\n this._createMainTexture();\r\n this._createTextureAndPostProcesses();\r\n this._mainTextureCreatedSize.width = this._mainTextureDesiredSize.width;\r\n this._mainTextureCreatedSize.height = this._mainTextureDesiredSize.height;\r\n }\r\n }\r\n\r\n /**\r\n * Determine if a given mesh will be used in the current effect.\r\n * @param mesh mesh to test\r\n * @returns true if the mesh will be used\r\n */\r\n public hasMesh(mesh: AbstractMesh): boolean {\r\n return this._internalThinEffectLayer ? this._thinEffectLayer._internalHasMesh(mesh) : this._thinEffectLayer.hasMesh(mesh);\r\n }\r\n\r\n /**\r\n * Returns true if the layer contains information to display, otherwise false.\r\n * @returns true if the glow layer should be rendered\r\n */\r\n public shouldRender(): boolean {\r\n return this._internalThinEffectLayer ? this._thinEffectLayer._internalShouldRender() : this._thinEffectLayer.shouldRender();\r\n }\r\n\r\n /**\r\n * Returns true if the mesh should render, otherwise false.\r\n * @param mesh The mesh to render\r\n * @returns true if it should render otherwise false\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n protected _shouldRenderMesh(mesh: AbstractMesh): boolean {\r\n return this._internalThinEffectLayer ? true : this._thinEffectLayer._shouldRenderMesh(mesh);\r\n }\r\n\r\n /**\r\n * Returns true if the mesh can be rendered, otherwise false.\r\n * @param mesh The mesh to render\r\n * @param material The material used on the mesh\r\n * @returns true if it can be rendered otherwise false\r\n */\r\n protected _canRenderMesh(mesh: AbstractMesh, material: Material): boolean {\r\n return this._internalThinEffectLayer ? this._thinEffectLayer._internalCanRenderMesh(mesh, material) : this._thinEffectLayer._canRenderMesh(mesh, material);\r\n }\r\n\r\n /**\r\n * Returns true if the mesh should render, otherwise false.\r\n * @returns true if it should render otherwise false\r\n */\r\n protected _shouldRenderEmissiveTextureForMesh(): boolean {\r\n return true;\r\n }\r\n\r\n /**\r\n * Defines whether the current material of the mesh should be use to render the effect.\r\n * @param mesh defines the current mesh to render\r\n * @returns true if the mesh material should be use\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n protected _useMeshMaterial(mesh: AbstractMesh): boolean {\r\n return this._internalThinEffectLayer ? false : this._thinEffectLayer._useMeshMaterial(mesh);\r\n }\r\n\r\n /**\r\n * Rebuild the required buffers.\r\n * @internal Internal use only.\r\n */\r\n public _rebuild(): void {\r\n this._thinEffectLayer._rebuild();\r\n }\r\n\r\n /**\r\n * Dispose only the render target textures and post process.\r\n */\r\n private _disposeTextureAndPostProcesses(): void {\r\n this._mainTexture.dispose();\r\n\r\n for (let i = 0; i < this._postProcesses.length; i++) {\r\n if (this._postProcesses[i]) {\r\n this._postProcesses[i].dispose();\r\n }\r\n }\r\n this._postProcesses = [];\r\n\r\n for (let i = 0; i < this._textures.length; i++) {\r\n if (this._textures[i]) {\r\n this._textures[i].dispose();\r\n }\r\n }\r\n this._textures = [];\r\n }\r\n\r\n /**\r\n * Dispose the highlight layer and free resources.\r\n */\r\n public dispose(): void {\r\n this._thinEffectLayer.dispose();\r\n\r\n // Clean textures and post processes\r\n this._disposeTextureAndPostProcesses();\r\n\r\n // Remove from scene\r\n this._scene.removeEffectLayer(this);\r\n\r\n // Callback\r\n this.onDisposeObservable.clear();\r\n this.onBeforeRenderMainTextureObservable.clear();\r\n this.onBeforeComposeObservable.clear();\r\n this.onBeforeRenderMeshToEffect.clear();\r\n this.onAfterRenderMeshToEffect.clear();\r\n this.onAfterComposeObservable.clear();\r\n this.onSizeChangedObservable.clear();\r\n }\r\n\r\n /**\r\n * Gets the class name of the effect layer\r\n * @returns the string with the class name of the effect layer\r\n */\r\n public getClassName(): string {\r\n return \"EffectLayer\";\r\n }\r\n\r\n /**\r\n * Creates an effect layer from parsed effect layer data\r\n * @param parsedEffectLayer defines effect layer data\r\n * @param scene defines the current scene\r\n * @param rootUrl defines the root URL containing the effect layer information\r\n * @returns a parsed effect Layer\r\n */\r\n public static Parse(parsedEffectLayer: any, scene: Scene, rootUrl: string): EffectLayer {\r\n const effectLayerType = Tools.Instantiate(parsedEffectLayer.customType);\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\r\n return effectLayerType.Parse(parsedEffectLayer, scene, rootUrl);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"effectLayer.js","sourceRoot":"","sources":["../../../../dev/core/src/Layers/effectLayer.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAC9F,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAOhD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAMrD,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAGhF,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,qCAAoC;AA4ChE;;;;;;;GAOG;AACH,MAAM,OAAgB,WAAW;IAS7B,IAAc,aAAa;QACvB,OAAO,IAAI,CA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E,OAAe;QACrE,MAAM,eAAe,GAAG,KAAK,CAAC,WAAW,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;QAExE,+DAA+D;QAC/D,OAAO,eAAe,CAAC,KAAK,CAAC,iBAAiB,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACpE,CAAC;;AAtbD;;GAEG;AACW,yCAA6B,GAA2B,CAAC,CAAC,EAAE,EAAE;IACxE,MAAM,WAAW,CAAC,2BAA2B,CAAC,CAAC;AACnD,CAAC,AAF0C,CAEzC;AAzHF;IADC,SAAS,EAAE;uCAGX;AAUD;IADC,iBAAiB,EAAE;+CAGnB;AAUD;IADC,SAAS,EAAE;4CAGX;AAUD;IADC,0BAA0B,EAAE;yCAG5B;AAMD;IADC,SAAS,EAAE;mDAGX;AASD;IADC,SAAS,EAAE;sEAGX","sourcesContent":["import { serialize, serializeAsColor4, serializeAsCameraReference } from \"../Misc/decorators\";\r\nimport { Tools } from \"../Misc/tools\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { ISize } from \"../Maths/math.size\";\r\nimport type { Color4 } from \"../Maths/math.color\";\r\nimport type { AbstractEngine } from \"../Engines/abstractEngine\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport type { SubMesh } from \"../Meshes/subMesh\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\nimport type { PostProcess } from \"../PostProcesses/postProcess\";\r\nimport type { BaseTexture } from \"../Materials/Textures/baseTexture\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { RenderTargetTexture } from \"../Materials/Textures/renderTargetTexture\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport type { Material } from \"../Materials/material\";\r\nimport { Constants } from \"../Engines/constants\";\r\n\r\nimport { _WarnImport } from \"../Misc/devTools\";\r\nimport { GetExponentOfTwo } from \"../Misc/tools.functions\";\r\nimport type { ShaderLanguage } from \"core/Materials/shaderLanguage\";\r\nimport { ThinEffectLayer } from \"./thinEffectLayer\";\r\nimport { UniqueIdGenerator } from \"core/Misc/uniqueIdGenerator\";\r\n\r\n/**\r\n * Effect layer options. This helps customizing the behaviour\r\n * of the effect layer.\r\n */\r\nexport interface IEffectLayerOptions {\r\n /**\r\n * Multiplication factor apply to the canvas size to compute the render target size\r\n * used to generated the objects (the smaller the faster). Default: 0.5\r\n */\r\n mainTextureRatio: number;\r\n\r\n /**\r\n * Enforces a fixed size texture to ensure effect stability across devices. Default: undefined\r\n */\r\n mainTextureFixedSize?: number;\r\n\r\n /**\r\n * Alpha blending mode used to apply the blur. Default depends of the implementation. Default: ALPHA_COMBINE\r\n */\r\n alphaBlendingMode: number;\r\n\r\n /**\r\n * The camera attached to the layer. Default: null\r\n */\r\n camera: Nullable<Camera>;\r\n\r\n /**\r\n * The rendering group to draw the layer in. Default: -1\r\n */\r\n renderingGroupId: number;\r\n\r\n /**\r\n * The type of the main texture. Default: TEXTURETYPE_UNSIGNED_BYTE\r\n */\r\n mainTextureType: number;\r\n\r\n /**\r\n * Whether or not to generate a stencil buffer. Default: false\r\n */\r\n generateStencilBuffer: boolean;\r\n}\r\n\r\n/**\r\n * The effect layer Helps adding post process effect blended with the main pass.\r\n *\r\n * This can be for instance use to generate glow or highlight effects on the scene.\r\n *\r\n * The effect layer class can not be used directly and is intented to inherited from to be\r\n * customized per effects.\r\n */\r\nexport abstract class EffectLayer {\r\n private _effectLayerOptions: IEffectLayerOptions;\r\n protected _mainTextureCreatedSize: ISize = { width: 0, height: 0 };\r\n\r\n protected _scene: Scene;\r\n protected _engine: AbstractEngine;\r\n protected _maxSize: number = 0;\r\n protected _mainTextureDesiredSize: ISize = { width: 0, height: 0 };\r\n protected _mainTexture: RenderTargetTexture;\r\n protected get _shouldRender() {\r\n return this._thinEffectLayer._shouldRender;\r\n }\r\n protected set _shouldRender(value) {\r\n this._thinEffectLayer._shouldRender = value;\r\n }\r\n protected _postProcesses: PostProcess[] = [];\r\n protected _textures: BaseTexture[] = [];\r\n protected get _emissiveTextureAndColor(): { texture: Nullable<BaseTexture>; color: Color4 } {\r\n return this._thinEffectLayer._emissiveTextureAndColor;\r\n }\r\n protected set _emissiveTextureAndColor(value) {\r\n this._thinEffectLayer._emissiveTextureAndColor = value;\r\n }\r\n protected get _effectIntensity(): { [meshUniqueId: number]: number } {\r\n return this._thinEffectLayer._effectIntensity;\r\n }\r\n protected set _effectIntensity(value) {\r\n this._thinEffectLayer._effectIntensity = value;\r\n }\r\n protected readonly _thinEffectLayer: ThinEffectLayer;\r\n private readonly _internalThinEffectLayer: boolean;\r\n\r\n /**\r\n * Force all the effect layers to compile to glsl even on WebGPU engines.\r\n * False by default. This is mostly meant for backward compatibility.\r\n */\r\n public static get ForceGLSL() {\r\n return ThinEffectLayer.ForceGLSL;\r\n }\r\n\r\n public static set ForceGLSL(value: boolean) {\r\n ThinEffectLayer.ForceGLSL = value;\r\n }\r\n\r\n /**\r\n * The unique id of the layer\r\n */\r\n public readonly uniqueId = UniqueIdGenerator.UniqueId;\r\n\r\n /**\r\n * The name of the layer\r\n */\r\n @serialize()\r\n public get name() {\r\n return this._thinEffectLayer.name;\r\n }\r\n\r\n public set name(value: string) {\r\n this._thinEffectLayer.name = value;\r\n }\r\n\r\n /**\r\n * The clear color of the texture used to generate the glow map.\r\n */\r\n @serializeAsColor4()\r\n public get neutralColor(): Color4 {\r\n return this._thinEffectLayer.neutralColor;\r\n }\r\n\r\n public set neutralColor(value: Color4) {\r\n this._thinEffectLayer.neutralColor = value;\r\n }\r\n\r\n /**\r\n * Specifies whether the highlight layer is enabled or not.\r\n */\r\n @serialize()\r\n public get isEnabled(): boolean {\r\n return this._thinEffectLayer.isEnabled;\r\n }\r\n\r\n public set isEnabled(value: boolean) {\r\n this._thinEffectLayer.isEnabled = value;\r\n }\r\n\r\n /**\r\n * Gets the camera attached to the layer.\r\n */\r\n @serializeAsCameraReference()\r\n public get camera(): Nullable<Camera> {\r\n return this._thinEffectLayer.camera;\r\n }\r\n\r\n /**\r\n * Gets the rendering group id the layer should render in.\r\n */\r\n @serialize()\r\n public get renderingGroupId(): number {\r\n return this._thinEffectLayer.renderingGroupId;\r\n }\r\n public set renderingGroupId(renderingGroupId: number) {\r\n this._thinEffectLayer.renderingGroupId = renderingGroupId;\r\n }\r\n\r\n /**\r\n * Specifies if the bounding boxes should be rendered normally or if they should undergo the effect of the layer\r\n */\r\n @serialize()\r\n public get disableBoundingBoxesFromEffectLayer() {\r\n return this._thinEffectLayer.disableBoundingBoxesFromEffectLayer;\r\n }\r\n\r\n public set disableBoundingBoxesFromEffectLayer(value: boolean) {\r\n this._thinEffectLayer.disableBoundingBoxesFromEffectLayer = value;\r\n }\r\n\r\n /**\r\n * An event triggered when the effect layer has been disposed.\r\n */\r\n public onDisposeObservable = new Observable<EffectLayer>();\r\n\r\n /**\r\n * An event triggered when the effect layer is about rendering the main texture with the glowy parts.\r\n */\r\n public onBeforeRenderMainTextureObservable = new Observable<EffectLayer>();\r\n\r\n /**\r\n * An event triggered when the generated texture is being merged in the scene.\r\n */\r\n public onBeforeComposeObservable = new Observable<EffectLayer>();\r\n\r\n /**\r\n * An event triggered when the mesh is rendered into the effect render target.\r\n */\r\n public onBeforeRenderMeshToEffect = new Observable<AbstractMesh>();\r\n\r\n /**\r\n * An event triggered after the mesh has been rendered into the effect render target.\r\n */\r\n public onAfterRenderMeshToEffect = new Observable<AbstractMesh>();\r\n\r\n /**\r\n * An event triggered when the generated texture has been merged in the scene.\r\n */\r\n public onAfterComposeObservable = new Observable<EffectLayer>();\r\n\r\n /**\r\n * An event triggered when the effect layer changes its size.\r\n */\r\n public onSizeChangedObservable = new Observable<EffectLayer>();\r\n\r\n /**\r\n * Gets the main texture where the effect is rendered\r\n */\r\n public get mainTexture() {\r\n return this._mainTexture;\r\n }\r\n\r\n protected get _shaderLanguage(): ShaderLanguage {\r\n return this._thinEffectLayer.shaderLanguage;\r\n }\r\n\r\n /**\r\n * Gets the shader language used in this material.\r\n */\r\n public get shaderLanguage(): ShaderLanguage {\r\n return this._thinEffectLayer.shaderLanguage;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public static _SceneComponentInitialization: (scene: Scene) => void = (_) => {\r\n throw _WarnImport(\"EffectLayerSceneComponent\");\r\n };\r\n /**\r\n * Sets a specific material to be used to render a mesh/a list of meshes in the layer\r\n * @param mesh mesh or array of meshes\r\n * @param material material to use by the layer when rendering the mesh(es). If undefined is passed, the specific material created by the layer will be used.\r\n */\r\n public setMaterialForRendering(mesh: AbstractMesh | AbstractMesh[], material?: Material): void {\r\n this._thinEffectLayer.setMaterialForRendering(mesh, material);\r\n }\r\n\r\n /**\r\n * Gets the intensity of the effect for a specific mesh.\r\n * @param mesh The mesh to get the effect intensity for\r\n * @returns The intensity of the effect for the mesh\r\n */\r\n public getEffectIntensity(mesh: AbstractMesh) {\r\n return this._thinEffectLayer.getEffectIntensity(mesh);\r\n }\r\n\r\n /**\r\n * Sets the intensity of the effect for a specific mesh.\r\n * @param mesh The mesh to set the effect intensity for\r\n * @param intensity The intensity of the effect for the mesh\r\n */\r\n public setEffectIntensity(mesh: AbstractMesh, intensity: number): void {\r\n this._thinEffectLayer.setEffectIntensity(mesh, intensity);\r\n }\r\n\r\n /**\r\n * Instantiates a new effect Layer and references it in the scene.\r\n * @param name The name of the layer\r\n * @param scene The scene to use the layer in\r\n * @param forceGLSL Use the GLSL code generation for the shader (even on WebGPU). Default is false\r\n * @param thinEffectLayer The thin instance of the effect layer (optional)\r\n */\r\n constructor(\r\n /** The Friendly of the effect in the scene */\r\n name: string,\r\n scene?: Scene,\r\n forceGLSL = false,\r\n thinEffectLayer?: ThinEffectLayer\r\n ) {\r\n this._internalThinEffectLayer = !thinEffectLayer;\r\n if (!thinEffectLayer) {\r\n thinEffectLayer = new ThinEffectLayer(name, scene, forceGLSL, false, this._importShadersAsync.bind(this));\r\n thinEffectLayer.getEffectName = this.getEffectName.bind(this);\r\n thinEffectLayer.isReady = this.isReady.bind(this);\r\n thinEffectLayer._createMergeEffect = this._createMergeEffect.bind(this);\r\n thinEffectLayer._createTextureAndPostProcesses = this._createTextureAndPostProcesses.bind(this);\r\n thinEffectLayer._internalCompose = this._internalRender.bind(this);\r\n thinEffectLayer._setEmissiveTextureAndColor = this._setEmissiveTextureAndColor.bind(this);\r\n thinEffectLayer._numInternalDraws = this._numInternalDraws.bind(this);\r\n thinEffectLayer._addCustomEffectDefines = this._addCustomEffectDefines.bind(this);\r\n thinEffectLayer.hasMesh = this.hasMesh.bind(this);\r\n thinEffectLayer.shouldRender = this.shouldRender.bind(this);\r\n thinEffectLayer._shouldRenderMesh = this._shouldRenderMesh.bind(this);\r\n thinEffectLayer._canRenderMesh = this._canRenderMesh.bind(this);\r\n thinEffectLayer._useMeshMaterial = this._useMeshMaterial.bind(this);\r\n }\r\n\r\n this._thinEffectLayer = thinEffectLayer;\r\n this.name = name;\r\n\r\n this._scene = scene || <Scene>EngineStore.LastCreatedScene;\r\n EffectLayer._SceneComponentInitialization(this._scene);\r\n\r\n this._engine = this._scene.getEngine();\r\n this._maxSize = this._engine.getCaps().maxTextureSize;\r\n this._scene.addEffectLayer(this);\r\n\r\n this._thinEffectLayer.onDisposeObservable.add(() => {\r\n this.onDisposeObservable.notifyObservers(this);\r\n });\r\n\r\n this._thinEffectLayer.onBeforeRenderLayerObservable.add(() => {\r\n this.onBeforeRenderMainTextureObservable.notifyObservers(this);\r\n });\r\n\r\n this._thinEffectLayer.onBeforeComposeObservable.add(() => {\r\n this.onBeforeComposeObservable.notifyObservers(this);\r\n });\r\n\r\n this._thinEffectLayer.onBeforeRenderMeshToEffect.add((mesh) => {\r\n this.onBeforeRenderMeshToEffect.notifyObservers(mesh);\r\n });\r\n\r\n this._thinEffectLayer.onAfterRenderMeshToEffect.add((mesh) => {\r\n this.onAfterRenderMeshToEffect.notifyObservers(mesh);\r\n });\r\n\r\n this._thinEffectLayer.onAfterComposeObservable.add(() => {\r\n this.onAfterComposeObservable.notifyObservers(this);\r\n });\r\n }\r\n\r\n protected get _shadersLoaded() {\r\n return this._thinEffectLayer._shadersLoaded;\r\n }\r\n\r\n protected set _shadersLoaded(value: boolean) {\r\n this._thinEffectLayer._shadersLoaded = value;\r\n }\r\n\r\n /**\r\n * Get the effect name of the layer.\r\n * @returns The effect name\r\n */\r\n public abstract getEffectName(): string;\r\n\r\n /**\r\n * Checks for the readiness of the element composing the layer.\r\n * @param subMesh the mesh to check for\r\n * @param useInstances specify whether or not to use instances to render the mesh\r\n * @returns true if ready otherwise, false\r\n */\r\n public abstract isReady(subMesh: SubMesh, useInstances: boolean): boolean;\r\n\r\n /**\r\n * Returns whether or not the layer needs stencil enabled during the mesh rendering.\r\n * @returns true if the effect requires stencil during the main canvas render pass.\r\n */\r\n public abstract needStencil(): boolean;\r\n\r\n /**\r\n * Create the merge effect. This is the shader use to blit the information back\r\n * to the main canvas at the end of the scene rendering.\r\n * @returns The effect containing the shader used to merge the effect on the main canvas\r\n */\r\n protected abstract _createMergeEffect(): Effect;\r\n\r\n /**\r\n * Creates the render target textures and post processes used in the effect layer.\r\n */\r\n protected abstract _createTextureAndPostProcesses(): void;\r\n\r\n /**\r\n * Implementation specific of rendering the generating effect on the main canvas.\r\n * @param effect The effect used to render through\r\n * @param renderNum Index of the _internalRender call (0 for the first time _internalRender is called, 1 for the second time, etc. _internalRender is called the number of times returned by _numInternalDraws())\r\n */\r\n protected abstract _internalRender(effect: Effect, renderIndex: number): void;\r\n\r\n /**\r\n * Sets the required values for both the emissive texture and and the main color.\r\n */\r\n protected abstract _setEmissiveTextureAndColor(mesh: Mesh, subMesh: SubMesh, material: Material): void;\r\n\r\n /**\r\n * Free any resources and references associated to a mesh.\r\n * Internal use\r\n * @param mesh The mesh to free.\r\n */\r\n public abstract _disposeMesh(mesh: Mesh): void;\r\n\r\n /**\r\n * Serializes this layer (Glow or Highlight for example)\r\n * @returns a serialized layer object\r\n */\r\n public abstract serialize?(): any;\r\n\r\n /**\r\n * Number of times _internalRender will be called. Some effect layers need to render the mesh several times, so they should override this method with the number of times the mesh should be rendered\r\n * @returns Number of times a mesh must be rendered in the layer\r\n */\r\n protected _numInternalDraws(): number {\r\n return this._internalThinEffectLayer ? 1 : this._thinEffectLayer._numInternalDraws();\r\n }\r\n\r\n /**\r\n * Initializes the effect layer with the required options.\r\n * @param options Sets of none mandatory options to use with the layer (see IEffectLayerOptions for more information)\r\n */\r\n protected _init(options: Partial<IEffectLayerOptions>): void {\r\n // Adapt options\r\n this._effectLayerOptions = {\r\n mainTextureRatio: 0.5,\r\n alphaBlendingMode: Constants.ALPHA_COMBINE,\r\n camera: null,\r\n renderingGroupId: -1,\r\n mainTextureType: Constants.TEXTURETYPE_UNSIGNED_BYTE,\r\n generateStencilBuffer: false,\r\n ...options,\r\n };\r\n\r\n this._setMainTextureSize();\r\n this._thinEffectLayer._init(options);\r\n this._createMainTexture();\r\n this._createTextureAndPostProcesses();\r\n }\r\n\r\n /**\r\n * Sets the main texture desired size which is the closest power of two\r\n * of the engine canvas size.\r\n */\r\n private _setMainTextureSize(): void {\r\n if (this._effectLayerOptions.mainTextureFixedSize) {\r\n this._mainTextureDesiredSize.width = this._effectLayerOptions.mainTextureFixedSize;\r\n this._mainTextureDesiredSize.height = this._effectLayerOptions.mainTextureFixedSize;\r\n } else {\r\n this._mainTextureDesiredSize.width = this._engine.getRenderWidth() * this._effectLayerOptions.mainTextureRatio;\r\n this._mainTextureDesiredSize.height = this._engine.getRenderHeight() * this._effectLayerOptions.mainTextureRatio;\r\n\r\n this._mainTextureDesiredSize.width = this._engine.needPOTTextures\r\n ? GetExponentOfTwo(this._mainTextureDesiredSize.width, this._maxSize)\r\n : this._mainTextureDesiredSize.width;\r\n this._mainTextureDesiredSize.height = this._engine.needPOTTextures\r\n ? GetExponentOfTwo(this._mainTextureDesiredSize.height, this._maxSize)\r\n : this._mainTextureDesiredSize.height;\r\n }\r\n\r\n this._mainTextureDesiredSize.width = Math.floor(this._mainTextureDesiredSize.width);\r\n this._mainTextureDesiredSize.height = Math.floor(this._mainTextureDesiredSize.height);\r\n }\r\n\r\n /**\r\n * Creates the main texture for the effect layer.\r\n */\r\n protected _createMainTexture(): void {\r\n this._mainTexture = new RenderTargetTexture(\r\n \"EffectLayerMainRTT\",\r\n {\r\n width: this._mainTextureDesiredSize.width,\r\n height: this._mainTextureDesiredSize.height,\r\n },\r\n this._scene,\r\n {\r\n type: this._effectLayerOptions.mainTextureType,\r\n samplingMode: Texture.TRILINEAR_SAMPLINGMODE,\r\n generateStencilBuffer: this._effectLayerOptions.generateStencilBuffer,\r\n existingObjectRenderer: this._thinEffectLayer.objectRenderer,\r\n }\r\n );\r\n this._mainTexture.activeCamera = this._effectLayerOptions.camera;\r\n this._mainTexture.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n this._mainTexture.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n this._mainTexture.anisotropicFilteringLevel = 1;\r\n this._mainTexture.updateSamplingMode(Texture.BILINEAR_SAMPLINGMODE);\r\n this._mainTexture.renderParticles = false;\r\n this._mainTexture.renderList = null;\r\n this._mainTexture.ignoreCameraViewport = true;\r\n\r\n this._mainTexture.onClearObservable.add((engine: AbstractEngine) => {\r\n engine.clear(this.neutralColor, true, true, true);\r\n });\r\n }\r\n\r\n /**\r\n * Adds specific effects defines.\r\n * @param defines The defines to add specifics to.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n protected _addCustomEffectDefines(defines: string[]): void {\r\n // Nothing to add by default.\r\n }\r\n\r\n /**\r\n * Checks for the readiness of the element composing the layer.\r\n * @param subMesh the mesh to check for\r\n * @param useInstances specify whether or not to use instances to render the mesh\r\n * @param emissiveTexture the associated emissive texture used to generate the glow\r\n * @returns true if ready otherwise, false\r\n */\r\n protected _isReady(subMesh: SubMesh, useInstances: boolean, emissiveTexture: Nullable<BaseTexture>): boolean {\r\n return this._internalThinEffectLayer\r\n ? this._thinEffectLayer._internalIsSubMeshReady(subMesh, useInstances, emissiveTexture)\r\n : this._thinEffectLayer._isSubMeshReady(subMesh, useInstances, emissiveTexture);\r\n }\r\n\r\n protected async _importShadersAsync(): Promise<void> {}\r\n\r\n protected _arePostProcessAndMergeReady(): boolean {\r\n return this._internalThinEffectLayer ? this._thinEffectLayer._internalIsLayerReady() : this._thinEffectLayer.isLayerReady();\r\n }\r\n\r\n /**\r\n * Checks if the layer is ready to be used.\r\n * @returns true if the layer is ready to be used\r\n */\r\n public isLayerReady(): boolean {\r\n return this._arePostProcessAndMergeReady() && this._mainTexture.isReady();\r\n }\r\n\r\n /**\r\n * Renders the glowing part of the scene by blending the blurred glowing meshes on top of the rendered scene.\r\n */\r\n public render(): void {\r\n if (!this._thinEffectLayer.compose()) {\r\n return;\r\n }\r\n\r\n // Handle size changes.\r\n this._setMainTextureSize();\r\n if (\r\n (this._mainTextureCreatedSize.width !== this._mainTextureDesiredSize.width || this._mainTextureCreatedSize.height !== this._mainTextureDesiredSize.height) &&\r\n this._mainTextureDesiredSize.width !== 0 &&\r\n this._mainTextureDesiredSize.height !== 0\r\n ) {\r\n // Recreate RTT and post processes on size change.\r\n this.onSizeChangedObservable.notifyObservers(this);\r\n this._disposeTextureAndPostProcesses();\r\n this._createMainTexture();\r\n this._createTextureAndPostProcesses();\r\n this._mainTextureCreatedSize.width = this._mainTextureDesiredSize.width;\r\n this._mainTextureCreatedSize.height = this._mainTextureDesiredSize.height;\r\n }\r\n }\r\n\r\n /**\r\n * Determine if a given mesh will be used in the current effect.\r\n * @param mesh mesh to test\r\n * @returns true if the mesh will be used\r\n */\r\n public hasMesh(mesh: AbstractMesh): boolean {\r\n return this._internalThinEffectLayer ? this._thinEffectLayer._internalHasMesh(mesh) : this._thinEffectLayer.hasMesh(mesh);\r\n }\r\n\r\n /**\r\n * Returns true if the layer contains information to display, otherwise false.\r\n * @returns true if the glow layer should be rendered\r\n */\r\n public shouldRender(): boolean {\r\n return this._internalThinEffectLayer ? this._thinEffectLayer._internalShouldRender() : this._thinEffectLayer.shouldRender();\r\n }\r\n\r\n /**\r\n * Returns true if the mesh should render, otherwise false.\r\n * @param mesh The mesh to render\r\n * @returns true if it should render otherwise false\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n protected _shouldRenderMesh(mesh: AbstractMesh): boolean {\r\n return this._internalThinEffectLayer ? true : this._thinEffectLayer._shouldRenderMesh(mesh);\r\n }\r\n\r\n /**\r\n * Returns true if the mesh can be rendered, otherwise false.\r\n * @param mesh The mesh to render\r\n * @param material The material used on the mesh\r\n * @returns true if it can be rendered otherwise false\r\n */\r\n protected _canRenderMesh(mesh: AbstractMesh, material: Material): boolean {\r\n return this._internalThinEffectLayer ? this._thinEffectLayer._internalCanRenderMesh(mesh, material) : this._thinEffectLayer._canRenderMesh(mesh, material);\r\n }\r\n\r\n /**\r\n * Returns true if the mesh should render, otherwise false.\r\n * @returns true if it should render otherwise false\r\n */\r\n protected _shouldRenderEmissiveTextureForMesh(): boolean {\r\n return true;\r\n }\r\n\r\n /**\r\n * Defines whether the current material of the mesh should be use to render the effect.\r\n * @param mesh defines the current mesh to render\r\n * @returns true if the mesh material should be use\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n protected _useMeshMaterial(mesh: AbstractMesh): boolean {\r\n return this._internalThinEffectLayer ? false : this._thinEffectLayer._useMeshMaterial(mesh);\r\n }\r\n\r\n /**\r\n * Rebuild the required buffers.\r\n * @internal Internal use only.\r\n */\r\n public _rebuild(): void {\r\n this._thinEffectLayer._rebuild();\r\n }\r\n\r\n /**\r\n * Dispose only the render target textures and post process.\r\n */\r\n private _disposeTextureAndPostProcesses(): void {\r\n this._mainTexture.dispose();\r\n\r\n for (let i = 0; i < this._postProcesses.length; i++) {\r\n if (this._postProcesses[i]) {\r\n this._postProcesses[i].dispose();\r\n }\r\n }\r\n this._postProcesses = [];\r\n\r\n for (let i = 0; i < this._textures.length; i++) {\r\n if (this._textures[i]) {\r\n this._textures[i].dispose();\r\n }\r\n }\r\n this._textures = [];\r\n }\r\n\r\n /**\r\n * Dispose the highlight layer and free resources.\r\n */\r\n public dispose(): void {\r\n this._thinEffectLayer.dispose();\r\n\r\n // Clean textures and post processes\r\n this._disposeTextureAndPostProcesses();\r\n\r\n // Remove from scene\r\n this._scene.removeEffectLayer(this);\r\n\r\n // Callback\r\n this.onDisposeObservable.clear();\r\n this.onBeforeRenderMainTextureObservable.clear();\r\n this.onBeforeComposeObservable.clear();\r\n this.onBeforeRenderMeshToEffect.clear();\r\n this.onAfterRenderMeshToEffect.clear();\r\n this.onAfterComposeObservable.clear();\r\n this.onSizeChangedObservable.clear();\r\n }\r\n\r\n /**\r\n * Gets the class name of the effect layer\r\n * @returns the string with the class name of the effect layer\r\n */\r\n public getClassName(): string {\r\n return \"EffectLayer\";\r\n }\r\n\r\n /**\r\n * Creates an effect layer from parsed effect layer data\r\n * @param parsedEffectLayer defines effect layer data\r\n * @param scene defines the current scene\r\n * @param rootUrl defines the root URL containing the effect layer information\r\n * @returns a parsed effect Layer\r\n */\r\n public static Parse(parsedEffectLayer: any, scene: Scene, rootUrl: string): EffectLayer {\r\n const effectLayerType = Tools.Instantiate(parsedEffectLayer.customType);\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\r\n return effectLayerType.Parse(parsedEffectLayer, scene, rootUrl);\r\n }\r\n}\r\n"]}
@@ -226,6 +226,8 @@ export class GlowLayer extends EffectLayer {
226
226
  this._postProcesses.map((pp) => {
227
227
  pp.autoClear = false;
228
228
  });
229
+ this._mainTextureCreatedSize.width = this._mainTextureDesiredSize.width;
230
+ this._mainTextureCreatedSize.height = this._mainTextureDesiredSize.height;
229
231
  }
230
232
  /**
231
233
  * Checks for the readiness of the element composing the layer.