@onerjs/core 8.33.3 → 8.33.4
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.
- package/AudioV2/webAudio/components/webAudioParameterComponent.js +17 -5
- package/AudioV2/webAudio/components/webAudioParameterComponent.js.map +1 -1
- package/Cameras/Inputs/geospatialCameraPointersInput.d.ts +2 -2
- package/Cameras/Inputs/geospatialCameraPointersInput.js +3 -12
- package/Cameras/Inputs/geospatialCameraPointersInput.js.map +1 -1
- package/Cameras/cameraMovement.d.ts +4 -4
- package/Cameras/cameraMovement.js +13 -14
- package/Cameras/cameraMovement.js.map +1 -1
- package/Cameras/geospatialCamera.d.ts +1 -2
- package/Cameras/geospatialCamera.js +22 -19
- package/Cameras/geospatialCamera.js.map +1 -1
- package/Cameras/geospatialCameraMovement.d.ts +0 -5
- package/Cameras/geospatialCameraMovement.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js +1 -2
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
- package/FrameGraph/frameGraph.d.ts +6 -0
- package/FrameGraph/frameGraph.js +10 -0
- package/FrameGraph/frameGraph.js.map +1 -1
- package/Layers/glowLayer.d.ts +8 -0
- package/Layers/glowLayer.js +11 -0
- package/Layers/glowLayer.js.map +1 -1
- package/Layers/thinGlowLayer.d.ts +17 -0
- package/Layers/thinGlowLayer.js +18 -0
- package/Layers/thinGlowLayer.js.map +1 -1
- package/Lights/Clustered/clusteredLightContainer.js +7 -2
- package/Lights/Clustered/clusteredLightContainer.js.map +1 -1
- package/Materials/Node/Blocks/Dual/lightBlock.js +2 -1
- package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +2 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.js +2 -2
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.d.ts +1 -0
- package/Materials/PBR/pbrBaseMaterial.js +1 -0
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/Textures/envCubeTexture.js +4 -0
- package/Materials/Textures/envCubeTexture.js.map +1 -1
- package/Materials/materialHelper.functions.js +1 -0
- package/Materials/materialHelper.functions.js.map +1 -1
- package/Materials/standardMaterial.d.ts +1 -0
- package/Materials/standardMaterial.js +1 -0
- package/Materials/standardMaterial.js.map +1 -1
- package/Rendering/depthPeelingRenderer.d.ts +1 -0
- package/Rendering/depthPeelingRenderer.js +7 -0
- package/Rendering/depthPeelingRenderer.js.map +1 -1
- package/Rendering/thinDepthPeelingRenderer.d.ts +1 -0
- package/Rendering/thinDepthPeelingRenderer.js +2 -0
- package/Rendering/thinDepthPeelingRenderer.js.map +1 -1
- package/Shaders/default.vertex.js +4 -0
- package/Shaders/default.vertex.js.map +1 -1
- package/Shaders/lightProxy.vertex.js +7 -1
- package/Shaders/lightProxy.vertex.js.map +1 -1
- package/Shaders/pbr.vertex.js +4 -0
- package/Shaders/pbr.vertex.js.map +1 -1
- package/ShadersWGSL/default.vertex.js +4 -0
- package/ShadersWGSL/default.vertex.js.map +1 -1
- package/ShadersWGSL/lightProxy.vertex.js +7 -1
- package/ShadersWGSL/lightProxy.vertex.js.map +1 -1
- package/ShadersWGSL/pbr.vertex.js +4 -0
- package/ShadersWGSL/pbr.vertex.js.map +1 -1
- package/package.json +2 -5
- package/scene.js +2 -3
- package/scene.js.map +1 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { backbufferColorTextureHandle, backbufferDepthStencilTextureHandle } from "../../frameGraphTypes.js";
|
|
2
2
|
import { FrameGraphTask } from "../../frameGraphTask.js";
|
|
3
3
|
import { ObjectRenderer } from "../../../Rendering/objectRenderer.js";
|
|
4
|
-
import { FrameGraphCascadedShadowGeneratorTask } from "./csmShadowGeneratorTask.js";
|
|
5
4
|
|
|
6
5
|
import { ThinDepthPeelingRenderer } from "../../../Rendering/thinDepthPeelingRenderer.js";
|
|
7
6
|
import { RenderingManager } from "../../../Rendering/renderingManager.js";
|
|
@@ -420,7 +419,7 @@ export class FrameGraphObjectRendererTask extends FrameGraphTask {
|
|
|
420
419
|
const light = shadowGenerator.getLight();
|
|
421
420
|
if (light.isEnabled() && light.shadowEnabled) {
|
|
422
421
|
lightsForShadow.add(light);
|
|
423
|
-
if (
|
|
422
|
+
if (shadowGeneratorTask.getClassName() === "FrameGraphCascadedShadowGeneratorTask") {
|
|
424
423
|
light._shadowGenerators.set(shadowGeneratorTask.camera, shadowGenerator);
|
|
425
424
|
}
|
|
426
425
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"objectRendererTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Rendering/objectRendererTask.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,4BAA4B,EAAE,mCAAmC,EAAE,MAAM,uBAAuB,CAAC;AAC1G,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,qCAAqC,EAAE,MAAM,0BAA0B,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,6CAA6C,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEtE;;GAEG;AACH,MAAM,OAAO,4BAA6B,SAAQ,cAAc;IAkB5D;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,IAAW,MAAM,CAAC,MAAc;QAC5B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QAC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CAAC,CAAC;gBACpC,IAAI,CAAE,KAAqB,CAAC,yBAAyB,EAAE,CAAC;oBACpD,SAAS,CAAC,yCAAyC;gBACvD,CAAC;gBACD,KAAK,CAAC,aAAa,GAAG,aAAa,CAAC,GAAG,CAAC,KAAK,CAAE,CAAC;YACpD,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IAED,gEAAgE;IACtD,+BAA+B,CAAC,oBAAyC;QAC/E,MAAM,eAAe,GAAG,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,eAAe,CAAC;QACxE,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,gCAAgC,CAAC;QAE7D,IAAI,CAAC,MAAM,CAAC,gCAAgC,GAAG,IAAI,CAAC;QAEpD,KAAK,IAAI,KAAK,GAAG,gBAAgB,CAAC,mBAAmB,EAAE,KAAK,GAAG,gBAAgB,CAAC,mBAAmB,EAAE,KAAK,EAAE,EAAE,CAAC;YAC3G,MAAM,cAAc,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;YAC9C,IAAI,CAAC,cAAc,IAAI,cAAc,CAAC,MAAM,EAAE,CAAC;gBAC3C,SAAS;YACb,CAAC;YACD,MAAM,cAAc,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;YACtE,IAAI,cAAc,CAAC,MAAM,EAAE,CAAC;gBACxB,sEAAsE;gBACtE,cAAc,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAC;YACtD,CAAC;QACL,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,gCAAgC,GAAG,OAAO,CAAC;IAC3D,CAAC;CACJ","sourcesContent":["import type {\r\n FrameGraph,\r\n FrameGraphTextureHandle,\r\n Scene,\r\n Camera,\r\n FrameGraphObjectList,\r\n FrameGraphRenderContext,\r\n ObjectRendererOptions,\r\n Light,\r\n Nullable,\r\n Observer,\r\n FrameGraphShadowGeneratorTask,\r\n FrameGraphRenderPass,\r\n AbstractEngine,\r\n BoundingBoxRenderer,\r\n ShadowLight,\r\n SmartArray,\r\n SubMesh,\r\n} from \"core/index\";\r\nimport { backbufferColorTextureHandle, backbufferDepthStencilTextureHandle } from \"../../frameGraphTypes\";\r\nimport { FrameGraphTask } from \"../../frameGraphTask\";\r\nimport { ObjectRenderer } from \"../../../Rendering/objectRenderer\";\r\nimport { FrameGraphCascadedShadowGeneratorTask } from \"./csmShadowGeneratorTask\";\r\nimport { Constants } from \"../../../Engines/constants\";\r\nimport { ThinDepthPeelingRenderer } from \"../../../Rendering/thinDepthPeelingRenderer\";\r\nimport { RenderingManager } from \"../../../Rendering/renderingManager\";\r\nimport { FrameGraphRenderTarget } from \"../../frameGraphRenderTarget\";\r\n\r\n/**\r\n * Task used to render objects to a texture.\r\n */\r\nexport class FrameGraphObjectRendererTask extends FrameGraphTask {\r\n /**\r\n * The target texture where the objects will be rendered.\r\n */\r\n public targetTexture: FrameGraphTextureHandle | FrameGraphTextureHandle[];\r\n\r\n /**\r\n * The depth attachment texture where the objects will be rendered (optional).\r\n */\r\n public depthTexture?: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The shadow generators used to render the objects (optional).\r\n */\r\n public shadowGenerators?: FrameGraphShadowGeneratorTask[] = [];\r\n\r\n private _camera: Camera;\r\n\r\n /**\r\n * Gets or sets the camera used to render the objects.\r\n */\r\n public get camera() {\r\n return this._camera;\r\n }\r\n\r\n public set camera(camera: Camera) {\r\n this._camera = camera;\r\n this._renderer.activeCamera = this.camera;\r\n }\r\n\r\n /**\r\n * The list of objects to render.\r\n */\r\n public objectList: FrameGraphObjectList;\r\n\r\n /**\r\n * If depth testing should be enabled (default is true).\r\n */\r\n public depthTest = true;\r\n\r\n /**\r\n * If depth writing should be enabled (default is true).\r\n */\r\n public depthWrite = true;\r\n\r\n /**\r\n * If shadows should be disabled (default is false).\r\n */\r\n public disableShadows = false;\r\n\r\n private _disableImageProcessing = false;\r\n /**\r\n * If image processing should be disabled (default is false).\r\n * false means that the default image processing configuration will be applied (the one from the scene)\r\n */\r\n public get disableImageProcessing() {\r\n return this._disableImageProcessing;\r\n }\r\n\r\n public set disableImageProcessing(value: boolean) {\r\n if (value === this._disableImageProcessing) {\r\n return;\r\n }\r\n\r\n this._disableImageProcessing = value;\r\n this._renderer.disableImageProcessing = value;\r\n }\r\n\r\n /**\r\n * Sets this property to true if this task is the main object renderer of the frame graph.\r\n * It will help to locate the main object renderer in the frame graph when multiple object renderers are used.\r\n * This is useful for the inspector to know which object renderer to use for additional rendering features like wireframe rendering or frustum light debugging.\r\n * It is also used to determine the main camera used by the frame graph: this is the camera used by the main object renderer.\r\n */\r\n public isMainObjectRenderer = false;\r\n\r\n private _renderMeshes = true;\r\n /**\r\n * Defines if meshes should be rendered (default is true).\r\n */\r\n public get renderMeshes() {\r\n return this._renderMeshes;\r\n }\r\n\r\n public set renderMeshes(value: boolean) {\r\n if (value === this._renderMeshes) {\r\n return;\r\n }\r\n\r\n this._renderMeshes = value;\r\n this._renderer.renderMeshes = value;\r\n }\r\n\r\n private _renderDepthOnlyMeshes = true;\r\n /**\r\n * Defines if depth only meshes should be rendered (default is true). Always subject to the renderMeshes property, though.\r\n */\r\n public get renderDepthOnlyMeshes() {\r\n return this._renderDepthOnlyMeshes;\r\n }\r\n\r\n public set renderDepthOnlyMeshes(value: boolean) {\r\n if (value === this._renderDepthOnlyMeshes) {\r\n return;\r\n }\r\n this._renderDepthOnlyMeshes = value;\r\n this._renderer.renderDepthOnlyMeshes = value;\r\n }\r\n\r\n private _renderOpaqueMeshes = true;\r\n /**\r\n * Defines if opaque meshes should be rendered (default is true). Always subject to the renderMeshes property, though.\r\n */\r\n public get renderOpaqueMeshes() {\r\n return this._renderOpaqueMeshes;\r\n }\r\n\r\n public set renderOpaqueMeshes(value: boolean) {\r\n if (value === this._renderOpaqueMeshes) {\r\n return;\r\n }\r\n this._renderOpaqueMeshes = value;\r\n this._renderer.renderOpaqueMeshes = value;\r\n }\r\n\r\n private _renderAlphaTestMeshes = true;\r\n /**\r\n * Defines if alpha test meshes should be rendered (default is true). Always subject to the renderMeshes property, though.\r\n */\r\n public get renderAlphaTestMeshes() {\r\n return this._renderAlphaTestMeshes;\r\n }\r\n\r\n public set renderAlphaTestMeshes(value: boolean) {\r\n if (value === this._renderAlphaTestMeshes) {\r\n return;\r\n }\r\n this._renderAlphaTestMeshes = value;\r\n this._renderer.renderAlphaTestMeshes = value;\r\n }\r\n\r\n private _renderTransparentMeshes = true;\r\n /**\r\n * Defines if transparent meshes should be rendered (default is true). Always subject to the renderMeshes property, though.\r\n */\r\n public get renderTransparentMeshes() {\r\n return this._renderTransparentMeshes;\r\n }\r\n\r\n public set renderTransparentMeshes(value: boolean) {\r\n if (value === this._renderTransparentMeshes) {\r\n return;\r\n }\r\n this._renderTransparentMeshes = value;\r\n this._renderer.renderTransparentMeshes = value;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private _useOITForTransparentMeshes = false;\r\n /**\r\n * Defines if Order Independent Transparency should be used for transparent meshes (default is false).\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public get useOITForTransparentMeshes() {\r\n return this._useOITForTransparentMeshes;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public set useOITForTransparentMeshes(value: boolean) {\r\n if (value === this._useOITForTransparentMeshes) {\r\n return;\r\n }\r\n this._useOITForTransparentMeshes = value;\r\n this._renderer.customRenderTransparentSubMeshes = this._useOITForTransparentMeshes ? this._renderTransparentMeshesWithOIT.bind(this) : undefined;\r\n this._oitRenderer.blendOutput = value && this._rtForOrderIndependentTransparency ? this._rtForOrderIndependentTransparency.renderTargetWrapper! : null;\r\n }\r\n\r\n /**\r\n * Defines the number of passes to use for Order Independent Transparency (default is 5).\r\n */\r\n public get oitPassCount() {\r\n return this._oitRenderer.passCount;\r\n }\r\n\r\n public set oitPassCount(value: number) {\r\n if (value === this._oitRenderer.passCount) {\r\n return;\r\n }\r\n this._oitRenderer.passCount = value;\r\n }\r\n\r\n private _renderParticles = true;\r\n /**\r\n * Defines if particles should be rendered (default is true).\r\n */\r\n public get renderParticles() {\r\n return this._renderParticles;\r\n }\r\n\r\n public set renderParticles(value: boolean) {\r\n if (value === this._renderParticles) {\r\n return;\r\n }\r\n\r\n this._renderParticles = value;\r\n this._renderer.renderParticles = value;\r\n }\r\n\r\n private _renderSprites = true;\r\n /**\r\n * Defines if sprites should be rendered (default is true).\r\n */\r\n public get renderSprites() {\r\n return this._renderSprites;\r\n }\r\n\r\n public set renderSprites(value: boolean) {\r\n if (value === this._renderSprites) {\r\n return;\r\n }\r\n\r\n this._renderSprites = value;\r\n this._renderer.renderSprites = value;\r\n }\r\n\r\n private _forceLayerMaskCheck = true;\r\n /**\r\n * Forces checking the layerMask property even if a custom list of meshes is provided (ie. if renderList is not undefined). Default is true.\r\n */\r\n public get forceLayerMaskCheck() {\r\n return this._forceLayerMaskCheck;\r\n }\r\n\r\n public set forceLayerMaskCheck(value: boolean) {\r\n if (value === this._forceLayerMaskCheck) {\r\n return;\r\n }\r\n\r\n this._forceLayerMaskCheck = value;\r\n this._renderer.forceLayerMaskCheck = value;\r\n }\r\n\r\n private _enableBoundingBoxRendering = true;\r\n /**\r\n * Enables the rendering of bounding boxes for meshes (still subject to Mesh.showBoundingBox or scene.forceShowBoundingBoxes). Default is true.\r\n */\r\n public get enableBoundingBoxRendering() {\r\n return this._enableBoundingBoxRendering;\r\n }\r\n\r\n public set enableBoundingBoxRendering(value: boolean) {\r\n if (value === this._enableBoundingBoxRendering) {\r\n return;\r\n }\r\n\r\n this._enableBoundingBoxRendering = value;\r\n this._renderer.enableBoundingBoxRendering = value;\r\n }\r\n\r\n private _enableOutlineRendering = true;\r\n /**\r\n * Enables the rendering of outlines/overlays for meshes (still subject to Mesh.renderOutline/Mesh.renderOverlay). Default is true.\r\n */\r\n public get enableOutlineRendering() {\r\n return this._enableOutlineRendering;\r\n }\r\n\r\n public set enableOutlineRendering(value: boolean) {\r\n if (value === this._enableOutlineRendering) {\r\n return;\r\n }\r\n\r\n this._enableOutlineRendering = value;\r\n this._renderer.enableOutlineRendering = value;\r\n }\r\n\r\n /**\r\n * If true, targetTexture will be resolved at the end of the render pass, if this/these texture(s) is/are MSAA (default: true)\r\n */\r\n public resolveMSAAColors = true;\r\n\r\n /**\r\n * If true, depthTexture will be resolved at the end of the render pass, if this texture is provided and is MSAA (default: false).\r\n */\r\n public resolveMSAADepth = false;\r\n\r\n /**\r\n * The output texture.\r\n * This texture will point to the same texture than the targetTexture property.\r\n * Note, however, that the handle itself will be different!\r\n */\r\n public readonly outputTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The output depth attachment texture.\r\n * This texture will point to the same texture than the depthTexture property if it is set.\r\n * Note, however, that the handle itself will be different!\r\n */\r\n public readonly outputDepthTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The object renderer used to render the objects.\r\n */\r\n public get objectRenderer() {\r\n return this._renderer;\r\n }\r\n\r\n public override get name() {\r\n return this._name;\r\n }\r\n\r\n public override set name(value: string) {\r\n this._name = value;\r\n if (this._renderer) {\r\n this._renderer.name = value;\r\n }\r\n }\r\n\r\n protected readonly _engine: AbstractEngine;\r\n protected readonly _scene: Scene;\r\n protected readonly _renderer: ObjectRenderer;\r\n protected readonly _oitRenderer: ThinDepthPeelingRenderer;\r\n protected _textureWidth: number;\r\n protected _textureHeight: number;\r\n protected _onBeforeRenderObservable: Nullable<Observer<number>> = null;\r\n protected _onAfterRenderObservable: Nullable<Observer<number>> = null;\r\n protected _externalObjectRenderer = false;\r\n protected _rtForOrderIndependentTransparency: FrameGraphRenderTarget;\r\n\r\n /**\r\n * Constructs a new object renderer task.\r\n * @param name The name of the task.\r\n * @param frameGraph The frame graph the task belongs to.\r\n * @param scene The scene the frame graph is associated with.\r\n * @param options The options of the object renderer.\r\n * @param existingObjectRenderer An existing object renderer to use (optional). If provided, the options parameter will be ignored.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, scene: Scene, options?: ObjectRendererOptions, existingObjectRenderer?: ObjectRenderer) {\r\n super(name, frameGraph);\r\n\r\n this._scene = scene;\r\n this._engine = scene.getEngine();\r\n this._externalObjectRenderer = !!existingObjectRenderer;\r\n this._renderer = existingObjectRenderer ?? new ObjectRenderer(name, scene, options);\r\n this.name = name;\r\n\r\n this._renderer.disableImageProcessing = this._disableImageProcessing;\r\n this._renderer.renderParticles = this._renderParticles;\r\n this._renderer.renderSprites = this._renderSprites;\r\n this._renderer.enableBoundingBoxRendering = this._enableBoundingBoxRendering;\r\n this._renderer.forceLayerMaskCheck = this._forceLayerMaskCheck;\r\n\r\n if (!this._externalObjectRenderer) {\r\n this._renderer.onBeforeRenderingManagerRenderObservable.add(() => {\r\n if (!this._renderer.options.doNotChangeAspectRatio) {\r\n scene.updateTransformMatrix(true);\r\n }\r\n });\r\n }\r\n\r\n this._oitRenderer = new ThinDepthPeelingRenderer(scene);\r\n this._oitRenderer.useRenderPasses = true;\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 isReady() {\r\n return this._renderer.isReadyForRendering(this._textureWidth, this._textureHeight);\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"FrameGraphObjectRendererTask\";\r\n }\r\n\r\n public record(skipCreationOfDisabledPasses = false, additionalExecute?: (context: FrameGraphRenderContext) => void): FrameGraphRenderPass {\r\n this._checkParameters();\r\n\r\n // Make sure the renderList / particleSystemList are set when FrameGraphObjectRendererTask.isReady() is called!\r\n this._renderer.renderList = this.objectList.meshes;\r\n this._renderer.particleSystemList = this.objectList.particleSystems;\r\n\r\n const targetTextures = this._getTargetHandles();\r\n\r\n const depthEnabled = this._checkTextureCompatibility(targetTextures);\r\n\r\n this._resolveDanglingHandles(targetTextures);\r\n this._setLightsForShadow();\r\n\r\n this._rtForOrderIndependentTransparency?.dispose();\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 // Note: we don't use pass.frameGraphRenderTarget.renderTargetWrapper for OIT but recreate our own render target wrapper because this.targetTexture may not be the first one of the wrapper in the geometry renderer task case\r\n this._rtForOrderIndependentTransparency = new FrameGraphRenderTarget(this.name + \"_oitRT\", this._frameGraph.textureManager, this.targetTexture, this.depthTexture);\r\n });\r\n pass.setExecuteFunc((context) => {\r\n this._renderer.renderList = this.objectList.meshes;\r\n this._renderer.particleSystemList = this.objectList.particleSystems;\r\n\r\n const renderTargetWrapper = pass.frameGraphRenderTarget!.renderTargetWrapper;\r\n if (renderTargetWrapper) {\r\n renderTargetWrapper.resolveMSAAColors = this.resolveMSAAColors;\r\n renderTargetWrapper.resolveMSAADepth = this.resolveMSAADepth;\r\n }\r\n\r\n if (this._useOITForTransparentMeshes && this._oitRenderer.blendOutput !== this._rtForOrderIndependentTransparency.renderTargetWrapper) {\r\n this._oitRenderer.blendOutput = this._rtForOrderIndependentTransparency.renderTargetWrapper!;\r\n }\r\n\r\n // The cast to \"any\" is to avoid an error in ES6 in case you don't import boundingBoxRenderer\r\n const boundingBoxRenderer = (this as any).getBoundingBoxRenderer?.() as Nullable<BoundingBoxRenderer>;\r\n\r\n const currentBoundingBoxMeshList = boundingBoxRenderer && boundingBoxRenderer.renderList.length > 0 ? boundingBoxRenderer.renderList.data.slice() : [];\r\n if (boundingBoxRenderer) {\r\n currentBoundingBoxMeshList.length = boundingBoxRenderer.renderList.length;\r\n }\r\n\r\n this._prepareRendering(context, depthEnabled);\r\n\r\n const currentOITRenderer = this._scene.depthPeelingRenderer;\r\n this._scene._depthPeelingRenderer = this._oitRenderer;\r\n\r\n const camera = this._renderer.activeCamera;\r\n if (camera && camera.cameraRigMode !== Constants.RIG_MODE_NONE && !camera._renderingMultiview) {\r\n for (let index = 0; index < camera._rigCameras.length; index++) {\r\n const rigCamera = camera._rigCameras[index];\r\n\r\n rigCamera.rigParent = undefined; // for some reasons, ObjectRenderer uses the rigParent viewport if rigParent is defined (we want to use rigCamera.viewport instead)\r\n\r\n this._renderer.activeCamera = rigCamera;\r\n\r\n context.render(this._renderer, this._textureWidth, this._textureHeight);\r\n\r\n rigCamera.rigParent = camera;\r\n }\r\n this._renderer.activeCamera = camera;\r\n } else {\r\n context.render(this._renderer, this._textureWidth, this._textureHeight);\r\n }\r\n\r\n additionalExecute?.(context);\r\n\r\n this._scene._depthPeelingRenderer = currentOITRenderer;\r\n\r\n if (boundingBoxRenderer) {\r\n boundingBoxRenderer.renderList.data = currentBoundingBoxMeshList;\r\n boundingBoxRenderer.renderList.length = currentBoundingBoxMeshList.length;\r\n }\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 public override dispose(): void {\r\n this._renderer.onBeforeRenderObservable.remove(this._onBeforeRenderObservable);\r\n this._renderer.onAfterRenderObservable.remove(this._onAfterRenderObservable);\r\n if (!this._externalObjectRenderer) {\r\n this._renderer.dispose();\r\n }\r\n this._oitRenderer.dispose();\r\n this._rtForOrderIndependentTransparency?.dispose();\r\n super.dispose();\r\n }\r\n\r\n protected _resolveDanglingHandles(targetTextures: FrameGraphTextureHandle[]) {\r\n if (targetTextures.length > 0) {\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, targetTextures[0]);\r\n }\r\n\r\n if (this.depthTexture !== undefined) {\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputDepthTexture, this.depthTexture);\r\n }\r\n }\r\n\r\n protected _checkParameters() {\r\n if (this.targetTexture === undefined || this.objectList === undefined || this.camera === undefined) {\r\n throw new Error(`FrameGraphObjectRendererTask ${this.name}: targetTexture, objectList, and camera are required`);\r\n }\r\n }\r\n\r\n protected _checkTextureCompatibility(targetTextures: FrameGraphTextureHandle[]): boolean {\r\n const className = this.getClassName();\r\n\r\n let outputTextureDescription = targetTextures.length > 0 ? this._frameGraph.textureManager.getTextureDescription(targetTextures[0]) : null;\r\n let depthEnabled = false;\r\n\r\n if (this.depthTexture !== undefined) {\r\n if (outputTextureDescription && this.depthTexture !== backbufferDepthStencilTextureHandle && targetTextures[0] === backbufferColorTextureHandle) {\r\n throw new Error(`${className} ${this.name}: the back buffer depth/stencil texture is the only depth texture allowed when the target is the back buffer color`);\r\n }\r\n\r\n const depthTextureDescription = this._frameGraph.textureManager.getTextureDescription(this.depthTexture);\r\n if (!outputTextureDescription) {\r\n outputTextureDescription = depthTextureDescription;\r\n }\r\n if (depthTextureDescription.options.samples !== outputTextureDescription.options.samples) {\r\n throw new Error(\r\n `${className} ${this.name}: the depth texture \"${depthTextureDescription.options.labels?.[0] ?? \"noname\"}\" (${depthTextureDescription.options.samples} samples) and the output texture \"${outputTextureDescription.options.labels?.[0] ?? \"noname\"}\" (${outputTextureDescription.options.samples} samples) must have the same number of samples`\r\n );\r\n }\r\n\r\n if (depthTextureDescription.size.width !== outputTextureDescription.size.width || depthTextureDescription.size.height !== outputTextureDescription.size.height) {\r\n throw new Error(\r\n `${className} ${this.name}: the depth texture (size: ${depthTextureDescription.size.width}x${depthTextureDescription.size.height}) and the target texture (size: ${outputTextureDescription.size.width}x${outputTextureDescription.size.height}) must have the same dimensions.`\r\n );\r\n }\r\n\r\n depthEnabled = true;\r\n }\r\n\r\n this._textureWidth = outputTextureDescription?.size.width ?? 1;\r\n this._textureHeight = outputTextureDescription?.size.height ?? 1;\r\n\r\n return depthEnabled;\r\n }\r\n\r\n protected _getTargetHandles(): FrameGraphTextureHandle[] {\r\n return Array.isArray(this.targetTexture) ? this.targetTexture : [this.targetTexture];\r\n }\r\n\r\n protected _prepareRendering(context: FrameGraphRenderContext, depthEnabled: boolean) {\r\n context.setDepthStates(this.depthTest && depthEnabled, this.depthWrite && depthEnabled);\r\n }\r\n\r\n protected _setLightsForShadow() {\r\n const lightsForShadow: Set<Light> = new Set();\r\n const shadowEnabled: Map<Light, boolean> = new Map();\r\n\r\n if (this.shadowGenerators) {\r\n for (const shadowGeneratorTask of this.shadowGenerators) {\r\n const shadowGenerator = shadowGeneratorTask.shadowGenerator;\r\n const light = shadowGenerator.getLight();\r\n if (light.isEnabled() && light.shadowEnabled) {\r\n lightsForShadow.add(light);\r\n if (FrameGraphCascadedShadowGeneratorTask.IsCascadedShadowGenerator(shadowGeneratorTask)) {\r\n light._shadowGenerators!.set(shadowGeneratorTask.camera, shadowGenerator);\r\n } else {\r\n light._shadowGenerators!.set(null, shadowGenerator);\r\n }\r\n }\r\n }\r\n }\r\n\r\n this._renderer.onBeforeRenderObservable.remove(this._onBeforeRenderObservable);\r\n this._onBeforeRenderObservable = this._renderer.onBeforeRenderObservable.add(() => {\r\n for (let i = 0; i < this._scene.lights.length; i++) {\r\n const light = this._scene.lights[i];\r\n if (!(light as ShadowLight).setShadowProjectionMatrix) {\r\n continue; // Ignore lights that cannot cast shadows\r\n }\r\n shadowEnabled.set(light, light.shadowEnabled);\r\n light.shadowEnabled = !this.disableShadows && lightsForShadow.has(light);\r\n }\r\n });\r\n\r\n this._renderer.onAfterRenderObservable.remove(this._onAfterRenderObservable);\r\n this._onAfterRenderObservable = this._renderer.onAfterRenderObservable.add(() => {\r\n for (let i = 0; i < this._scene.lights.length; i++) {\r\n const light = this._scene.lights[i];\r\n if (!(light as ShadowLight).setShadowProjectionMatrix) {\r\n continue; // Ignore lights that cannot cast shadows\r\n }\r\n light.shadowEnabled = shadowEnabled.get(light)!;\r\n }\r\n });\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n protected _renderTransparentMeshesWithOIT(transparentSubMeshes: SmartArray<SubMesh>): void {\r\n const renderingGroups = this._renderer.renderingManager.renderingGroups;\r\n const saveOIT = this._scene._useOrderIndependentTransparency;\r\n\r\n this._scene._useOrderIndependentTransparency = true;\r\n\r\n for (let index = RenderingManager.MIN_RENDERINGGROUPS; index < RenderingManager.MAX_RENDERINGGROUPS; index++) {\r\n const renderingGroup = renderingGroups[index];\r\n if (!renderingGroup || renderingGroup._empty) {\r\n continue;\r\n }\r\n const excludedMeshes = this._oitRenderer.render(transparentSubMeshes);\r\n if (excludedMeshes.length) {\r\n // Render leftover meshes that could not be processed by depth peeling\r\n renderingGroup._renderTransparent(excludedMeshes);\r\n }\r\n }\r\n\r\n this._scene._useOrderIndependentTransparency = saveOIT;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"objectRendererTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Rendering/objectRendererTask.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,4BAA4B,EAAE,mCAAmC,EAAE,MAAM,uBAAuB,CAAC;AAC1G,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,6CAA6C,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEtE;;GAEG;AACH,MAAM,OAAO,4BAA6B,SAAQ,cAAc;IAkB5D;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,IAAW,MAAM,CAAC,MAAc;QAC5B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,SAAS,CAAC,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC;IAC9C,CAAC;IAuBD;;;OAGG;IACH,IAAW,sBAAsB;QAC7B,OAAO,IAAI,CAAC,uBAAuB,CAAC;IACxC,CAAC;IAED,IAA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AC;YACpD,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IAED,gEAAgE;IACtD,+BAA+B,CAAC,oBAAyC;QAC/E,MAAM,eAAe,GAAG,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,eAAe,CAAC;QACxE,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,gCAAgC,CAAC;QAE7D,IAAI,CAAC,MAAM,CAAC,gCAAgC,GAAG,IAAI,CAAC;QAEpD,KAAK,IAAI,KAAK,GAAG,gBAAgB,CAAC,mBAAmB,EAAE,KAAK,GAAG,gBAAgB,CAAC,mBAAmB,EAAE,KAAK,EAAE,EAAE,CAAC;YAC3G,MAAM,cAAc,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;YAC9C,IAAI,CAAC,cAAc,IAAI,cAAc,CAAC,MAAM,EAAE,CAAC;gBAC3C,SAAS;YACb,CAAC;YACD,MAAM,cAAc,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;YACtE,IAAI,cAAc,CAAC,MAAM,EAAE,CAAC;gBACxB,sEAAsE;gBACtE,cAAc,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAC;YACtD,CAAC;QACL,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,gCAAgC,GAAG,OAAO,CAAC;IAC3D,CAAC;CACJ","sourcesContent":["import type {\r\n FrameGraph,\r\n FrameGraphTextureHandle,\r\n Scene,\r\n Camera,\r\n FrameGraphObjectList,\r\n FrameGraphRenderContext,\r\n ObjectRendererOptions,\r\n Light,\r\n Nullable,\r\n Observer,\r\n FrameGraphShadowGeneratorTask,\r\n FrameGraphRenderPass,\r\n AbstractEngine,\r\n BoundingBoxRenderer,\r\n ShadowLight,\r\n SmartArray,\r\n SubMesh,\r\n} from \"core/index\";\r\nimport { backbufferColorTextureHandle, backbufferDepthStencilTextureHandle } from \"../../frameGraphTypes\";\r\nimport { FrameGraphTask } from \"../../frameGraphTask\";\r\nimport { ObjectRenderer } from \"../../../Rendering/objectRenderer\";\r\nimport { Constants } from \"../../../Engines/constants\";\r\nimport { ThinDepthPeelingRenderer } from \"../../../Rendering/thinDepthPeelingRenderer\";\r\nimport { RenderingManager } from \"../../../Rendering/renderingManager\";\r\nimport { FrameGraphRenderTarget } from \"../../frameGraphRenderTarget\";\r\n\r\n/**\r\n * Task used to render objects to a texture.\r\n */\r\nexport class FrameGraphObjectRendererTask extends FrameGraphTask {\r\n /**\r\n * The target texture where the objects will be rendered.\r\n */\r\n public targetTexture: FrameGraphTextureHandle | FrameGraphTextureHandle[];\r\n\r\n /**\r\n * The depth attachment texture where the objects will be rendered (optional).\r\n */\r\n public depthTexture?: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The shadow generators used to render the objects (optional).\r\n */\r\n public shadowGenerators?: FrameGraphShadowGeneratorTask[] = [];\r\n\r\n private _camera: Camera;\r\n\r\n /**\r\n * Gets or sets the camera used to render the objects.\r\n */\r\n public get camera() {\r\n return this._camera;\r\n }\r\n\r\n public set camera(camera: Camera) {\r\n this._camera = camera;\r\n this._renderer.activeCamera = this.camera;\r\n }\r\n\r\n /**\r\n * The list of objects to render.\r\n */\r\n public objectList: FrameGraphObjectList;\r\n\r\n /**\r\n * If depth testing should be enabled (default is true).\r\n */\r\n public depthTest = true;\r\n\r\n /**\r\n * If depth writing should be enabled (default is true).\r\n */\r\n public depthWrite = true;\r\n\r\n /**\r\n * If shadows should be disabled (default is false).\r\n */\r\n public disableShadows = false;\r\n\r\n private _disableImageProcessing = false;\r\n /**\r\n * If image processing should be disabled (default is false).\r\n * false means that the default image processing configuration will be applied (the one from the scene)\r\n */\r\n public get disableImageProcessing() {\r\n return this._disableImageProcessing;\r\n }\r\n\r\n public set disableImageProcessing(value: boolean) {\r\n if (value === this._disableImageProcessing) {\r\n return;\r\n }\r\n\r\n this._disableImageProcessing = value;\r\n this._renderer.disableImageProcessing = value;\r\n }\r\n\r\n /**\r\n * Sets this property to true if this task is the main object renderer of the frame graph.\r\n * It will help to locate the main object renderer in the frame graph when multiple object renderers are used.\r\n * This is useful for the inspector to know which object renderer to use for additional rendering features like wireframe rendering or frustum light debugging.\r\n * It is also used to determine the main camera used by the frame graph: this is the camera used by the main object renderer.\r\n */\r\n public isMainObjectRenderer = false;\r\n\r\n private _renderMeshes = true;\r\n /**\r\n * Defines if meshes should be rendered (default is true).\r\n */\r\n public get renderMeshes() {\r\n return this._renderMeshes;\r\n }\r\n\r\n public set renderMeshes(value: boolean) {\r\n if (value === this._renderMeshes) {\r\n return;\r\n }\r\n\r\n this._renderMeshes = value;\r\n this._renderer.renderMeshes = value;\r\n }\r\n\r\n private _renderDepthOnlyMeshes = true;\r\n /**\r\n * Defines if depth only meshes should be rendered (default is true). Always subject to the renderMeshes property, though.\r\n */\r\n public get renderDepthOnlyMeshes() {\r\n return this._renderDepthOnlyMeshes;\r\n }\r\n\r\n public set renderDepthOnlyMeshes(value: boolean) {\r\n if (value === this._renderDepthOnlyMeshes) {\r\n return;\r\n }\r\n this._renderDepthOnlyMeshes = value;\r\n this._renderer.renderDepthOnlyMeshes = value;\r\n }\r\n\r\n private _renderOpaqueMeshes = true;\r\n /**\r\n * Defines if opaque meshes should be rendered (default is true). Always subject to the renderMeshes property, though.\r\n */\r\n public get renderOpaqueMeshes() {\r\n return this._renderOpaqueMeshes;\r\n }\r\n\r\n public set renderOpaqueMeshes(value: boolean) {\r\n if (value === this._renderOpaqueMeshes) {\r\n return;\r\n }\r\n this._renderOpaqueMeshes = value;\r\n this._renderer.renderOpaqueMeshes = value;\r\n }\r\n\r\n private _renderAlphaTestMeshes = true;\r\n /**\r\n * Defines if alpha test meshes should be rendered (default is true). Always subject to the renderMeshes property, though.\r\n */\r\n public get renderAlphaTestMeshes() {\r\n return this._renderAlphaTestMeshes;\r\n }\r\n\r\n public set renderAlphaTestMeshes(value: boolean) {\r\n if (value === this._renderAlphaTestMeshes) {\r\n return;\r\n }\r\n this._renderAlphaTestMeshes = value;\r\n this._renderer.renderAlphaTestMeshes = value;\r\n }\r\n\r\n private _renderTransparentMeshes = true;\r\n /**\r\n * Defines if transparent meshes should be rendered (default is true). Always subject to the renderMeshes property, though.\r\n */\r\n public get renderTransparentMeshes() {\r\n return this._renderTransparentMeshes;\r\n }\r\n\r\n public set renderTransparentMeshes(value: boolean) {\r\n if (value === this._renderTransparentMeshes) {\r\n return;\r\n }\r\n this._renderTransparentMeshes = value;\r\n this._renderer.renderTransparentMeshes = value;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private _useOITForTransparentMeshes = false;\r\n /**\r\n * Defines if Order Independent Transparency should be used for transparent meshes (default is false).\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public get useOITForTransparentMeshes() {\r\n return this._useOITForTransparentMeshes;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public set useOITForTransparentMeshes(value: boolean) {\r\n if (value === this._useOITForTransparentMeshes) {\r\n return;\r\n }\r\n this._useOITForTransparentMeshes = value;\r\n this._renderer.customRenderTransparentSubMeshes = this._useOITForTransparentMeshes ? this._renderTransparentMeshesWithOIT.bind(this) : undefined;\r\n this._oitRenderer.blendOutput = value && this._rtForOrderIndependentTransparency ? this._rtForOrderIndependentTransparency.renderTargetWrapper! : null;\r\n }\r\n\r\n /**\r\n * Defines the number of passes to use for Order Independent Transparency (default is 5).\r\n */\r\n public get oitPassCount() {\r\n return this._oitRenderer.passCount;\r\n }\r\n\r\n public set oitPassCount(value: number) {\r\n if (value === this._oitRenderer.passCount) {\r\n return;\r\n }\r\n this._oitRenderer.passCount = value;\r\n }\r\n\r\n private _renderParticles = true;\r\n /**\r\n * Defines if particles should be rendered (default is true).\r\n */\r\n public get renderParticles() {\r\n return this._renderParticles;\r\n }\r\n\r\n public set renderParticles(value: boolean) {\r\n if (value === this._renderParticles) {\r\n return;\r\n }\r\n\r\n this._renderParticles = value;\r\n this._renderer.renderParticles = value;\r\n }\r\n\r\n private _renderSprites = true;\r\n /**\r\n * Defines if sprites should be rendered (default is true).\r\n */\r\n public get renderSprites() {\r\n return this._renderSprites;\r\n }\r\n\r\n public set renderSprites(value: boolean) {\r\n if (value === this._renderSprites) {\r\n return;\r\n }\r\n\r\n this._renderSprites = value;\r\n this._renderer.renderSprites = value;\r\n }\r\n\r\n private _forceLayerMaskCheck = true;\r\n /**\r\n * Forces checking the layerMask property even if a custom list of meshes is provided (ie. if renderList is not undefined). Default is true.\r\n */\r\n public get forceLayerMaskCheck() {\r\n return this._forceLayerMaskCheck;\r\n }\r\n\r\n public set forceLayerMaskCheck(value: boolean) {\r\n if (value === this._forceLayerMaskCheck) {\r\n return;\r\n }\r\n\r\n this._forceLayerMaskCheck = value;\r\n this._renderer.forceLayerMaskCheck = value;\r\n }\r\n\r\n private _enableBoundingBoxRendering = true;\r\n /**\r\n * Enables the rendering of bounding boxes for meshes (still subject to Mesh.showBoundingBox or scene.forceShowBoundingBoxes). Default is true.\r\n */\r\n public get enableBoundingBoxRendering() {\r\n return this._enableBoundingBoxRendering;\r\n }\r\n\r\n public set enableBoundingBoxRendering(value: boolean) {\r\n if (value === this._enableBoundingBoxRendering) {\r\n return;\r\n }\r\n\r\n this._enableBoundingBoxRendering = value;\r\n this._renderer.enableBoundingBoxRendering = value;\r\n }\r\n\r\n private _enableOutlineRendering = true;\r\n /**\r\n * Enables the rendering of outlines/overlays for meshes (still subject to Mesh.renderOutline/Mesh.renderOverlay). Default is true.\r\n */\r\n public get enableOutlineRendering() {\r\n return this._enableOutlineRendering;\r\n }\r\n\r\n public set enableOutlineRendering(value: boolean) {\r\n if (value === this._enableOutlineRendering) {\r\n return;\r\n }\r\n\r\n this._enableOutlineRendering = value;\r\n this._renderer.enableOutlineRendering = value;\r\n }\r\n\r\n /**\r\n * If true, targetTexture will be resolved at the end of the render pass, if this/these texture(s) is/are MSAA (default: true)\r\n */\r\n public resolveMSAAColors = true;\r\n\r\n /**\r\n * If true, depthTexture will be resolved at the end of the render pass, if this texture is provided and is MSAA (default: false).\r\n */\r\n public resolveMSAADepth = false;\r\n\r\n /**\r\n * The output texture.\r\n * This texture will point to the same texture than the targetTexture property.\r\n * Note, however, that the handle itself will be different!\r\n */\r\n public readonly outputTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The output depth attachment texture.\r\n * This texture will point to the same texture than the depthTexture property if it is set.\r\n * Note, however, that the handle itself will be different!\r\n */\r\n public readonly outputDepthTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The object renderer used to render the objects.\r\n */\r\n public get objectRenderer() {\r\n return this._renderer;\r\n }\r\n\r\n public override get name() {\r\n return this._name;\r\n }\r\n\r\n public override set name(value: string) {\r\n this._name = value;\r\n if (this._renderer) {\r\n this._renderer.name = value;\r\n }\r\n }\r\n\r\n protected readonly _engine: AbstractEngine;\r\n protected readonly _scene: Scene;\r\n protected readonly _renderer: ObjectRenderer;\r\n protected readonly _oitRenderer: ThinDepthPeelingRenderer;\r\n protected _textureWidth: number;\r\n protected _textureHeight: number;\r\n protected _onBeforeRenderObservable: Nullable<Observer<number>> = null;\r\n protected _onAfterRenderObservable: Nullable<Observer<number>> = null;\r\n protected _externalObjectRenderer = false;\r\n protected _rtForOrderIndependentTransparency: FrameGraphRenderTarget;\r\n\r\n /**\r\n * Constructs a new object renderer task.\r\n * @param name The name of the task.\r\n * @param frameGraph The frame graph the task belongs to.\r\n * @param scene The scene the frame graph is associated with.\r\n * @param options The options of the object renderer.\r\n * @param existingObjectRenderer An existing object renderer to use (optional). If provided, the options parameter will be ignored.\r\n */\r\n constructor(name: string, frameGraph: FrameGraph, scene: Scene, options?: ObjectRendererOptions, existingObjectRenderer?: ObjectRenderer) {\r\n super(name, frameGraph);\r\n\r\n this._scene = scene;\r\n this._engine = scene.getEngine();\r\n this._externalObjectRenderer = !!existingObjectRenderer;\r\n this._renderer = existingObjectRenderer ?? new ObjectRenderer(name, scene, options);\r\n this.name = name;\r\n\r\n this._renderer.disableImageProcessing = this._disableImageProcessing;\r\n this._renderer.renderParticles = this._renderParticles;\r\n this._renderer.renderSprites = this._renderSprites;\r\n this._renderer.enableBoundingBoxRendering = this._enableBoundingBoxRendering;\r\n this._renderer.forceLayerMaskCheck = this._forceLayerMaskCheck;\r\n\r\n if (!this._externalObjectRenderer) {\r\n this._renderer.onBeforeRenderingManagerRenderObservable.add(() => {\r\n if (!this._renderer.options.doNotChangeAspectRatio) {\r\n scene.updateTransformMatrix(true);\r\n }\r\n });\r\n }\r\n\r\n this._oitRenderer = new ThinDepthPeelingRenderer(scene);\r\n this._oitRenderer.useRenderPasses = true;\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 isReady() {\r\n return this._renderer.isReadyForRendering(this._textureWidth, this._textureHeight);\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"FrameGraphObjectRendererTask\";\r\n }\r\n\r\n public record(skipCreationOfDisabledPasses = false, additionalExecute?: (context: FrameGraphRenderContext) => void): FrameGraphRenderPass {\r\n this._checkParameters();\r\n\r\n // Make sure the renderList / particleSystemList are set when FrameGraphObjectRendererTask.isReady() is called!\r\n this._renderer.renderList = this.objectList.meshes;\r\n this._renderer.particleSystemList = this.objectList.particleSystems;\r\n\r\n const targetTextures = this._getTargetHandles();\r\n\r\n const depthEnabled = this._checkTextureCompatibility(targetTextures);\r\n\r\n this._resolveDanglingHandles(targetTextures);\r\n this._setLightsForShadow();\r\n\r\n this._rtForOrderIndependentTransparency?.dispose();\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 // Note: we don't use pass.frameGraphRenderTarget.renderTargetWrapper for OIT but recreate our own render target wrapper because this.targetTexture may not be the first one of the wrapper in the geometry renderer task case\r\n this._rtForOrderIndependentTransparency = new FrameGraphRenderTarget(this.name + \"_oitRT\", this._frameGraph.textureManager, this.targetTexture, this.depthTexture);\r\n });\r\n pass.setExecuteFunc((context) => {\r\n this._renderer.renderList = this.objectList.meshes;\r\n this._renderer.particleSystemList = this.objectList.particleSystems;\r\n\r\n const renderTargetWrapper = pass.frameGraphRenderTarget!.renderTargetWrapper;\r\n if (renderTargetWrapper) {\r\n renderTargetWrapper.resolveMSAAColors = this.resolveMSAAColors;\r\n renderTargetWrapper.resolveMSAADepth = this.resolveMSAADepth;\r\n }\r\n\r\n if (this._useOITForTransparentMeshes && this._oitRenderer.blendOutput !== this._rtForOrderIndependentTransparency.renderTargetWrapper) {\r\n this._oitRenderer.blendOutput = this._rtForOrderIndependentTransparency.renderTargetWrapper!;\r\n }\r\n\r\n // The cast to \"any\" is to avoid an error in ES6 in case you don't import boundingBoxRenderer\r\n const boundingBoxRenderer = (this as any).getBoundingBoxRenderer?.() as Nullable<BoundingBoxRenderer>;\r\n\r\n const currentBoundingBoxMeshList = boundingBoxRenderer && boundingBoxRenderer.renderList.length > 0 ? boundingBoxRenderer.renderList.data.slice() : [];\r\n if (boundingBoxRenderer) {\r\n currentBoundingBoxMeshList.length = boundingBoxRenderer.renderList.length;\r\n }\r\n\r\n this._prepareRendering(context, depthEnabled);\r\n\r\n const currentOITRenderer = this._scene.depthPeelingRenderer;\r\n this._scene._depthPeelingRenderer = this._oitRenderer;\r\n\r\n const camera = this._renderer.activeCamera;\r\n if (camera && camera.cameraRigMode !== Constants.RIG_MODE_NONE && !camera._renderingMultiview) {\r\n for (let index = 0; index < camera._rigCameras.length; index++) {\r\n const rigCamera = camera._rigCameras[index];\r\n\r\n rigCamera.rigParent = undefined; // for some reasons, ObjectRenderer uses the rigParent viewport if rigParent is defined (we want to use rigCamera.viewport instead)\r\n\r\n this._renderer.activeCamera = rigCamera;\r\n\r\n context.render(this._renderer, this._textureWidth, this._textureHeight);\r\n\r\n rigCamera.rigParent = camera;\r\n }\r\n this._renderer.activeCamera = camera;\r\n } else {\r\n context.render(this._renderer, this._textureWidth, this._textureHeight);\r\n }\r\n\r\n additionalExecute?.(context);\r\n\r\n this._scene._depthPeelingRenderer = currentOITRenderer;\r\n\r\n if (boundingBoxRenderer) {\r\n boundingBoxRenderer.renderList.data = currentBoundingBoxMeshList;\r\n boundingBoxRenderer.renderList.length = currentBoundingBoxMeshList.length;\r\n }\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 public override dispose(): void {\r\n this._renderer.onBeforeRenderObservable.remove(this._onBeforeRenderObservable);\r\n this._renderer.onAfterRenderObservable.remove(this._onAfterRenderObservable);\r\n if (!this._externalObjectRenderer) {\r\n this._renderer.dispose();\r\n }\r\n this._oitRenderer.dispose();\r\n this._rtForOrderIndependentTransparency?.dispose();\r\n super.dispose();\r\n }\r\n\r\n protected _resolveDanglingHandles(targetTextures: FrameGraphTextureHandle[]) {\r\n if (targetTextures.length > 0) {\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, targetTextures[0]);\r\n }\r\n\r\n if (this.depthTexture !== undefined) {\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputDepthTexture, this.depthTexture);\r\n }\r\n }\r\n\r\n protected _checkParameters() {\r\n if (this.targetTexture === undefined || this.objectList === undefined || this.camera === undefined) {\r\n throw new Error(`FrameGraphObjectRendererTask ${this.name}: targetTexture, objectList, and camera are required`);\r\n }\r\n }\r\n\r\n protected _checkTextureCompatibility(targetTextures: FrameGraphTextureHandle[]): boolean {\r\n const className = this.getClassName();\r\n\r\n let outputTextureDescription = targetTextures.length > 0 ? this._frameGraph.textureManager.getTextureDescription(targetTextures[0]) : null;\r\n let depthEnabled = false;\r\n\r\n if (this.depthTexture !== undefined) {\r\n if (outputTextureDescription && this.depthTexture !== backbufferDepthStencilTextureHandle && targetTextures[0] === backbufferColorTextureHandle) {\r\n throw new Error(`${className} ${this.name}: the back buffer depth/stencil texture is the only depth texture allowed when the target is the back buffer color`);\r\n }\r\n\r\n const depthTextureDescription = this._frameGraph.textureManager.getTextureDescription(this.depthTexture);\r\n if (!outputTextureDescription) {\r\n outputTextureDescription = depthTextureDescription;\r\n }\r\n if (depthTextureDescription.options.samples !== outputTextureDescription.options.samples) {\r\n throw new Error(\r\n `${className} ${this.name}: the depth texture \"${depthTextureDescription.options.labels?.[0] ?? \"noname\"}\" (${depthTextureDescription.options.samples} samples) and the output texture \"${outputTextureDescription.options.labels?.[0] ?? \"noname\"}\" (${outputTextureDescription.options.samples} samples) must have the same number of samples`\r\n );\r\n }\r\n\r\n if (depthTextureDescription.size.width !== outputTextureDescription.size.width || depthTextureDescription.size.height !== outputTextureDescription.size.height) {\r\n throw new Error(\r\n `${className} ${this.name}: the depth texture (size: ${depthTextureDescription.size.width}x${depthTextureDescription.size.height}) and the target texture (size: ${outputTextureDescription.size.width}x${outputTextureDescription.size.height}) must have the same dimensions.`\r\n );\r\n }\r\n\r\n depthEnabled = true;\r\n }\r\n\r\n this._textureWidth = outputTextureDescription?.size.width ?? 1;\r\n this._textureHeight = outputTextureDescription?.size.height ?? 1;\r\n\r\n return depthEnabled;\r\n }\r\n\r\n protected _getTargetHandles(): FrameGraphTextureHandle[] {\r\n return Array.isArray(this.targetTexture) ? this.targetTexture : [this.targetTexture];\r\n }\r\n\r\n protected _prepareRendering(context: FrameGraphRenderContext, depthEnabled: boolean) {\r\n context.setDepthStates(this.depthTest && depthEnabled, this.depthWrite && depthEnabled);\r\n }\r\n\r\n protected _setLightsForShadow() {\r\n const lightsForShadow: Set<Light> = new Set();\r\n const shadowEnabled: Map<Light, boolean> = new Map();\r\n\r\n if (this.shadowGenerators) {\r\n for (const shadowGeneratorTask of this.shadowGenerators) {\r\n const shadowGenerator = shadowGeneratorTask.shadowGenerator;\r\n const light = shadowGenerator.getLight();\r\n if (light.isEnabled() && light.shadowEnabled) {\r\n lightsForShadow.add(light);\r\n if (shadowGeneratorTask.getClassName() === \"FrameGraphCascadedShadowGeneratorTask\") {\r\n light._shadowGenerators!.set(shadowGeneratorTask.camera, shadowGenerator);\r\n } else {\r\n light._shadowGenerators!.set(null, shadowGenerator);\r\n }\r\n }\r\n }\r\n }\r\n\r\n this._renderer.onBeforeRenderObservable.remove(this._onBeforeRenderObservable);\r\n this._onBeforeRenderObservable = this._renderer.onBeforeRenderObservable.add(() => {\r\n for (let i = 0; i < this._scene.lights.length; i++) {\r\n const light = this._scene.lights[i];\r\n if (!(light as ShadowLight).setShadowProjectionMatrix) {\r\n continue; // Ignore lights that cannot cast shadows\r\n }\r\n shadowEnabled.set(light, light.shadowEnabled);\r\n light.shadowEnabled = !this.disableShadows && lightsForShadow.has(light);\r\n }\r\n });\r\n\r\n this._renderer.onAfterRenderObservable.remove(this._onAfterRenderObservable);\r\n this._onAfterRenderObservable = this._renderer.onAfterRenderObservable.add(() => {\r\n for (let i = 0; i < this._scene.lights.length; i++) {\r\n const light = this._scene.lights[i];\r\n if (!(light as ShadowLight).setShadowProjectionMatrix) {\r\n continue; // Ignore lights that cannot cast shadows\r\n }\r\n light.shadowEnabled = shadowEnabled.get(light)!;\r\n }\r\n });\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n protected _renderTransparentMeshesWithOIT(transparentSubMeshes: SmartArray<SubMesh>): void {\r\n const renderingGroups = this._renderer.renderingManager.renderingGroups;\r\n const saveOIT = this._scene._useOrderIndependentTransparency;\r\n\r\n this._scene._useOrderIndependentTransparency = true;\r\n\r\n for (let index = RenderingManager.MIN_RENDERINGGROUPS; index < RenderingManager.MAX_RENDERINGGROUPS; index++) {\r\n const renderingGroup = renderingGroups[index];\r\n if (!renderingGroup || renderingGroup._empty) {\r\n continue;\r\n }\r\n const excludedMeshes = this._oitRenderer.render(transparentSubMeshes);\r\n if (excludedMeshes.length) {\r\n // Render leftover meshes that could not be processed by depth peeling\r\n renderingGroup._renderTransparent(excludedMeshes);\r\n }\r\n }\r\n\r\n this._scene._useOrderIndependentTransparency = saveOIT;\r\n }\r\n}\r\n"]}
|
|
@@ -85,6 +85,12 @@ export declare class FrameGraph implements IDisposable {
|
|
|
85
85
|
* @returns The list of tasks of the specified type
|
|
86
86
|
*/
|
|
87
87
|
getTasksByType<T extends FrameGraphTask>(taskType: new (...args: any[]) => T): T[];
|
|
88
|
+
/**
|
|
89
|
+
* Gets all tasks of a specific type, based on their class name
|
|
90
|
+
* @param taskClassName Class name(s) of the task(s) to get
|
|
91
|
+
* @returns The list of tasks of the specified type
|
|
92
|
+
*/
|
|
93
|
+
getTasksByClassName<T extends FrameGraphTask>(taskClassName: string | string[]): T[];
|
|
88
94
|
/**
|
|
89
95
|
* Adds a task to the frame graph
|
|
90
96
|
* @param task Task to add
|
package/FrameGraph/frameGraph.js
CHANGED
|
@@ -108,6 +108,16 @@ export class FrameGraph {
|
|
|
108
108
|
getTasksByType(taskType) {
|
|
109
109
|
return this._tasks.filter((t) => t instanceof taskType);
|
|
110
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* Gets all tasks of a specific type, based on their class name
|
|
113
|
+
* @param taskClassName Class name(s) of the task(s) to get
|
|
114
|
+
* @returns The list of tasks of the specified type
|
|
115
|
+
*/
|
|
116
|
+
getTasksByClassName(taskClassName) {
|
|
117
|
+
return Array.isArray(taskClassName)
|
|
118
|
+
? this._tasks.filter((t) => taskClassName.includes(t.getClassName()))
|
|
119
|
+
: this._tasks.filter((t) => t.getClassName() === taskClassName);
|
|
120
|
+
}
|
|
111
121
|
/**
|
|
112
122
|
* Adds a task to the frame graph
|
|
113
123
|
* @param task Task to add
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frameGraph.js","sourceRoot":"","sources":["../../../../dev/core/src/FrameGraph/frameGraph.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC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EAAE,CAAC;QAEvC,IAAI,CAAC,cAAc,CAAC,sBAAsB,EAAE,CAAC;QAE7C,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 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"]}
|
|
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,E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C;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 * Gets all tasks of a specific type, based on their class name\r\n * @param taskClassName Class name(s) of the task(s) to get\r\n * @returns The list of tasks of the specified type\r\n */\r\n public getTasksByClassName<T extends FrameGraphTask>(taskClassName: string | string[]): T[] {\r\n return Array.isArray(taskClassName)\r\n ? (this._tasks.filter((t) => taskClassName.includes(t.getClassName())) as T[])\r\n : (this._tasks.filter((t) => t.getClassName() === taskClassName) 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"]}
|
package/Layers/glowLayer.d.ts
CHANGED
|
@@ -156,11 +156,13 @@ export declare class GlowLayer extends EffectLayer {
|
|
|
156
156
|
protected _addCustomEffectDefines(defines: string[]): void;
|
|
157
157
|
/**
|
|
158
158
|
* Add a mesh in the exclusion list to prevent it to impact or being impacted by the glow layer.
|
|
159
|
+
* This will not have an effect if meshes are excluded by default (see setExcludedByDefault).
|
|
159
160
|
* @param mesh The mesh to exclude from the glow layer
|
|
160
161
|
*/
|
|
161
162
|
addExcludedMesh(mesh: Mesh): void;
|
|
162
163
|
/**
|
|
163
164
|
* Remove a mesh from the exclusion list to let it impact or being impacted by the glow layer.
|
|
165
|
+
* This will not have an effect if meshes are excluded by default (see setExcludedByDefault).
|
|
164
166
|
* @param mesh The mesh to remove
|
|
165
167
|
*/
|
|
166
168
|
removeExcludedMesh(mesh: Mesh): void;
|
|
@@ -174,6 +176,12 @@ export declare class GlowLayer extends EffectLayer {
|
|
|
174
176
|
* @param mesh The mesh to remove
|
|
175
177
|
*/
|
|
176
178
|
removeIncludedOnlyMesh(mesh: Mesh): void;
|
|
179
|
+
/**
|
|
180
|
+
* Set the excluded by default option.
|
|
181
|
+
* If true, all meshes will be excluded by default unless they are added to the inclusion list.
|
|
182
|
+
* @param value The boolean value to set the excluded by default option to
|
|
183
|
+
*/
|
|
184
|
+
setExcludedByDefault(value: boolean): void;
|
|
177
185
|
/**
|
|
178
186
|
* Determine if a given mesh will be used in the glow layer
|
|
179
187
|
* @param mesh The mesh to test
|
package/Layers/glowLayer.js
CHANGED
|
@@ -96,6 +96,7 @@ export class GlowLayer extends EffectLayer {
|
|
|
96
96
|
alphaBlendingMode: 1,
|
|
97
97
|
mainTextureType: 0,
|
|
98
98
|
generateStencilBuffer: false,
|
|
99
|
+
excludeByDefault: false,
|
|
99
100
|
...options,
|
|
100
101
|
};
|
|
101
102
|
// Initialize the layer
|
|
@@ -286,6 +287,7 @@ export class GlowLayer extends EffectLayer {
|
|
|
286
287
|
}
|
|
287
288
|
/**
|
|
288
289
|
* Add a mesh in the exclusion list to prevent it to impact or being impacted by the glow layer.
|
|
290
|
+
* This will not have an effect if meshes are excluded by default (see setExcludedByDefault).
|
|
289
291
|
* @param mesh The mesh to exclude from the glow layer
|
|
290
292
|
*/
|
|
291
293
|
addExcludedMesh(mesh) {
|
|
@@ -293,6 +295,7 @@ export class GlowLayer extends EffectLayer {
|
|
|
293
295
|
}
|
|
294
296
|
/**
|
|
295
297
|
* Remove a mesh from the exclusion list to let it impact or being impacted by the glow layer.
|
|
298
|
+
* This will not have an effect if meshes are excluded by default (see setExcludedByDefault).
|
|
296
299
|
* @param mesh The mesh to remove
|
|
297
300
|
*/
|
|
298
301
|
removeExcludedMesh(mesh) {
|
|
@@ -312,6 +315,14 @@ export class GlowLayer extends EffectLayer {
|
|
|
312
315
|
removeIncludedOnlyMesh(mesh) {
|
|
313
316
|
this._thinEffectLayer.removeIncludedOnlyMesh(mesh);
|
|
314
317
|
}
|
|
318
|
+
/**
|
|
319
|
+
* Set the excluded by default option.
|
|
320
|
+
* If true, all meshes will be excluded by default unless they are added to the inclusion list.
|
|
321
|
+
* @param value The boolean value to set the excluded by default option to
|
|
322
|
+
*/
|
|
323
|
+
setExcludedByDefault(value) {
|
|
324
|
+
this._thinEffectLayer.setExcludedByDefault(value);
|
|
325
|
+
}
|
|
315
326
|
/**
|
|
316
327
|
* Determine if a given mesh will be used in the glow layer
|
|
317
328
|
* @param mesh The mesh to test
|