@babylonjs/core 8.40.1 → 8.41.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Engines/Extensions/engine.computeShader.d.ts +2 -3
- package/Engines/Extensions/engine.computeShader.js.map +1 -1
- package/Engines/ICanvas.d.ts +3 -3
- package/Engines/ICanvas.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/webgpuEngine.js +2 -2
- package/Engines/webgpuEngine.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.d.ts +3 -0
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js +29 -14
- package/FrameGraph/Node/Blocks/Rendering/baseObjectRendererBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.d.ts +12 -41
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js +106 -184
- package/FrameGraph/Node/Blocks/Rendering/geometryRendererBlock.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraphBlock.js +4 -0
- package/FrameGraph/Node/nodeRenderGraphBlock.js.map +1 -1
- package/FrameGraph/Passes/renderPass.js +3 -1
- package/FrameGraph/Passes/renderPass.js.map +1 -1
- package/FrameGraph/Tasks/Misc/lightingVolumeTask.d.ts +1 -0
- package/FrameGraph/Tasks/Misc/lightingVolumeTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/volumetricLightingBlendVolumeTask.d.ts +1 -2
- package/FrameGraph/Tasks/PostProcesses/volumetricLightingBlendVolumeTask.js +10 -2
- package/FrameGraph/Tasks/PostProcesses/volumetricLightingBlendVolumeTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.d.ts +1 -4
- package/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.js +7 -4
- package/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.d.ts +17 -58
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +112 -122
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +11 -0
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js +62 -26
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/clearTextureTask.js +18 -8
- package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -1
- package/FrameGraph/frameGraph.d.ts +1 -2
- package/FrameGraph/frameGraph.js +2 -2
- package/FrameGraph/frameGraph.js.map +1 -1
- package/FrameGraph/frameGraphContext.js +2 -2
- package/FrameGraph/frameGraphContext.js.map +1 -1
- package/FrameGraph/frameGraphRenderContext.js +3 -3
- package/FrameGraph/frameGraphRenderContext.js.map +1 -1
- package/FrameGraph/frameGraphTask.d.ts +1 -1
- package/FrameGraph/frameGraphTask.js +2 -2
- package/FrameGraph/frameGraphTask.js.map +1 -1
- package/FrameGraph/frameGraphUtils.d.ts +2 -2
- package/FrameGraph/frameGraphUtils.js +6 -6
- package/FrameGraph/frameGraphUtils.js.map +1 -1
- package/Lights/lightingVolume.d.ts +1 -0
- package/Lights/lightingVolume.js +14 -13
- package/Lights/lightingVolume.js.map +1 -1
- package/Loading/Plugins/babylonFileLoader.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +2 -0
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
- package/Materials/Node/Blocks/triPlanarBlock.d.ts +1 -0
- package/Materials/Node/Blocks/triPlanarBlock.js +33 -4
- package/Materials/Node/Blocks/triPlanarBlock.js.map +1 -1
- package/Materials/materialHelper.geometryrendering.d.ts +5 -1
- package/Materials/materialHelper.geometryrendering.js +11 -2
- package/Materials/materialHelper.geometryrendering.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
- package/Rendering/objectRenderer.d.ts +6 -2
- package/Rendering/objectRenderer.js +69 -63
- package/Rendering/objectRenderer.js.map +1 -1
- package/Shaders/gaussianSplatting.vertex.js +2 -2
- package/Shaders/gaussianSplatting.vertex.js.map +1 -1
- package/ShadersWGSL/gaussianSplatting.vertex.js +3 -3
- package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometryRendererTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Rendering/geometryRendererTask.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,mCAAmC,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,MAAM,EAAE,qCAA8B;AAC/C,OAAO,EAAE,+BAA+B,EAAE,+DAAwD;AAClG,OAAO,EAAE,SAAS,EAAE,sCAA+B;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAuBnE,MAAM,WAAW,GAAa,CAAC,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAEvG;;GAEG;AACH,MAAM,OAAO,8BAA+B,SAAQ,cAAc;IAQ9D;;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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AC,CAAC;QAEH,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,oBAAoB,CAAC,CAAC;IACvF,CAAC;IAEO,wBAAwB,CAAC,YAAoB;QACjD,MAAM,aAAa,GAAG,+BAA+B,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC;QAExF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,mBAAmB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACvD,MAAM,WAAW,GAAG,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;YAChD,MAAM,KAAK,GAAG,+BAA+B,CAAC,2BAA2B,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC,IAAI,CAAC,CAAC;YACxH,MAAM,mBAAmB,GAAG,+BAA+B,CAAC,2BAA2B,CAAC,KAAK,CAAC,CAAC;YAE/F,aAAa,CAAC,OAAO,CAAC,mBAAmB,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAC/D,CAAC;QAED,aAAa,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;IACvD,CAAC;CACJ","sourcesContent":["import type {\r\n FrameGraphTextureHandle,\r\n Scene,\r\n Camera,\r\n AbstractEngine,\r\n FrameGraph,\r\n GeometryRenderingTextureClearType,\r\n FrameGraphObjectList,\r\n AbstractMesh,\r\n ObjectRendererOptions,\r\n} from \"core/index\";\r\nimport { backbufferDepthStencilTextureHandle } from \"../../frameGraphTypes\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { MaterialHelperGeometryRendering } from \"core/Materials/materialHelper.geometryrendering\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { FrameGraphTask } from \"../../frameGraphTask\";\r\nimport { ObjectRenderer } from \"../../../Rendering/objectRenderer\";\r\n\r\n/**\r\n * Description of a texture used by the geometry renderer task.\r\n */\r\nexport interface IFrameGraphGeometryRendererTextureDescription {\r\n /**\r\n * The type of the texture.\r\n * The value should be one of the Constants.PREPASS_XXX_TEXTURE_TYPE values.\r\n */\r\n type: number;\r\n\r\n /**\r\n * The type of the texture.\r\n */\r\n textureType: number;\r\n\r\n /**\r\n * The format of the texture.\r\n */\r\n textureFormat: number;\r\n}\r\n\r\nconst ClearColors: Color4[] = [new Color4(0, 0, 0, 0), new Color4(1, 1, 1, 1), new Color4(0, 0, 0, 0)];\r\n\r\n/**\r\n * Task used to render geometry to a set of textures.\r\n */\r\nexport class FrameGraphGeometryRendererTask extends FrameGraphTask {\r\n /**\r\n * The depth texture attachment to use for rendering (optional).\r\n */\r\n public depthTexture?: FrameGraphTextureHandle;\r\n\r\n private _camera: Camera;\r\n\r\n /**\r\n * Gets or sets the camera used for rendering.\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 object list used for rendering.\r\n */\r\n public objectList: FrameGraphObjectList;\r\n\r\n /**\r\n * Whether depth testing is enabled (default is true).\r\n */\r\n public depthTest = true;\r\n\r\n /**\r\n * Whether depth writing is enabled (default is true).\r\n */\r\n public depthWrite = true;\r\n\r\n /**\r\n * The size of the output textures (default is 100% of the back buffer texture size).\r\n */\r\n public size: { width: number; height: number } = { width: 100, height: 100 };\r\n\r\n /**\r\n * Whether the size is a percentage of the back buffer size (default is true).\r\n */\r\n public sizeIsPercentage = true;\r\n\r\n /**\r\n * The number of samples to use for the output textures (default is 1).\r\n */\r\n public samples = 1;\r\n\r\n private _reverseCulling = false;\r\n\r\n /**\r\n * Whether to reverse culling (default is false).\r\n */\r\n public get reverseCulling() {\r\n return this._reverseCulling;\r\n }\r\n\r\n public set reverseCulling(value: boolean) {\r\n this._reverseCulling = value;\r\n\r\n const configuration = MaterialHelperGeometryRendering.GetConfiguration(this._renderer.renderPassId);\r\n if (configuration) {\r\n configuration.reverseCulling = value;\r\n }\r\n }\r\n\r\n /**\r\n * Indicates if a mesh shouldn't be rendered when its material has depth write disabled (default is true).\r\n */\r\n public dontRenderWhenMaterialDepthWriteIsDisabled = true;\r\n\r\n /**\r\n * If true, the output geometry texture(s) will be resolved at the end of the render pass, if samples is greater than 1 (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 samples is greater than 1 (default: true)\r\n */\r\n public resolveMSAADepth = false;\r\n\r\n /**\r\n * The list of texture descriptions used by the geometry renderer task.\r\n */\r\n public textureDescriptions: IFrameGraphGeometryRendererTextureDescription[] = [];\r\n\r\n /**\r\n * The output depth texture 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 depth (in view space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryViewDepthTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The normalized depth (in view space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n * The normalization is (d - near) / (far - near), where d is the depth value in view space and near and far are the near and far planes of the camera.\r\n */\r\n public readonly geometryNormViewDepthTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The depth (in screen space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryScreenDepthTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The normal (in view space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryViewNormalTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The normal (in world space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryWorldNormalTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The position (in local space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryLocalPositionTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The position (in world space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryWorldPositionTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The albedo output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryAlbedoTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The reflectivity output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryReflectivityTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The velocity output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryVelocityTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The linear velocity output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryLinearVelocityTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The object renderer used by the geometry renderer task.\r\n */\r\n public get objectRenderer() {\r\n return this._renderer;\r\n }\r\n\r\n /**\r\n * Gets or sets the name of the task.\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 private _forceLayerMaskCheck = true;\r\n /**\r\n * Force 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 readonly _engine: AbstractEngine;\r\n private readonly _scene: Scene;\r\n private readonly _renderer: ObjectRenderer;\r\n private _textureWidth: number;\r\n private _textureHeight: number;\r\n private _clearAttachmentsLayout: Map<GeometryRenderingTextureClearType, number[]>;\r\n private _allAttachmentsLayout: number[];\r\n\r\n /**\r\n * Constructs a new geometry 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 */\r\n constructor(name: string, frameGraph: FrameGraph, scene: Scene, options?: ObjectRendererOptions) {\r\n super(name, frameGraph);\r\n\r\n this._scene = scene;\r\n this._engine = this._scene.getEngine();\r\n\r\n this._renderer = new ObjectRenderer(name, scene, options);\r\n this._renderer.renderSprites = false;\r\n this._renderer.renderParticles = false;\r\n this._renderer.enableBoundingBoxRendering = false;\r\n this._renderer.enableOutlineRendering = false;\r\n this._renderer.disableDepthPrePass = true;\r\n\r\n this._renderer.customIsReadyFunction = (mesh: AbstractMesh, refreshRate: number, preWarm?: boolean) => {\r\n if (this.dontRenderWhenMaterialDepthWriteIsDisabled && mesh.material && mesh.material.disableDepthWrite) {\r\n return !!preWarm;\r\n }\r\n\r\n return mesh.isReady(refreshRate === 0);\r\n };\r\n\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 this.name = name;\r\n this._clearAttachmentsLayout = new Map();\r\n this._allAttachmentsLayout = [];\r\n\r\n this.outputDepthTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryViewDepthTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryNormViewDepthTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryScreenDepthTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryViewNormalTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryWorldNormalTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryLocalPositionTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryWorldPositionTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryAlbedoTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryReflectivityTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryVelocityTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryLinearVelocityTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n }\r\n\r\n /**\r\n * Gets the list of excluded meshes from the velocity texture.\r\n */\r\n public get excludedSkinnedMeshFromVelocityTexture(): AbstractMesh[] {\r\n return MaterialHelperGeometryRendering.GetConfiguration(this._renderer.renderPassId).excludedSkinnedMesh;\r\n }\r\n\r\n /**\r\n * Excludes the given skinned mesh from computing bones velocities.\r\n * Computing bones velocities can have a cost. The cost can be saved by calling this function and by passing the skinned mesh to ignore.\r\n * @param skinnedMesh The mesh containing the skeleton to ignore when computing the velocity map.\r\n */\r\n public excludeSkinnedMeshFromVelocityTexture(skinnedMesh: AbstractMesh): void {\r\n if (skinnedMesh.skeleton) {\r\n const list = this.excludedSkinnedMeshFromVelocityTexture;\r\n if (list.indexOf(skinnedMesh) === -1) {\r\n list.push(skinnedMesh);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Removes the given skinned mesh from the excluded meshes to integrate bones velocities while rendering the velocity map.\r\n * @param skinnedMesh The mesh containing the skeleton that has been ignored previously.\r\n * @see excludeSkinnedMesh to exclude a skinned mesh from bones velocity computation.\r\n */\r\n public removeExcludedSkinnedMeshFromVelocityTexture(skinnedMesh: AbstractMesh): void {\r\n const list = this.excludedSkinnedMeshFromVelocityTexture;\r\n const index = list.indexOf(skinnedMesh);\r\n if (index !== -1) {\r\n list.splice(index, 1);\r\n }\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 \"FrameGraphGeometryRendererTask\";\r\n }\r\n\r\n public record() {\r\n if (this.objectList === undefined) {\r\n throw new Error(`FrameGraphGeometryRendererTask ${this.name}: object list must be provided`);\r\n }\r\n\r\n // Make sure the renderList / particleSystemList are set when FrameGraphGeometryRendererTask.isReady() is called!\r\n this._renderer.renderList = this.objectList.meshes;\r\n this._renderer.particleSystemList = this.objectList.particleSystems;\r\n\r\n const outputTextureHandle = this._createMultiRenderTargetTexture();\r\n\r\n const depthEnabled = this._checkDepthTextureCompatibility();\r\n\r\n this._buildClearAttachmentsLayout();\r\n\r\n this._registerForRenderPassId(this._renderer.renderPassId);\r\n\r\n const outputTextureDescription = outputTextureHandle.length > 0 ? this._frameGraph.textureManager.getTextureDescription(outputTextureHandle[0]) : null;\r\n\r\n this._textureWidth = outputTextureDescription?.size.width ?? 0;\r\n this._textureHeight = outputTextureDescription?.size.height ?? 0;\r\n\r\n // Create pass\r\n MaterialHelperGeometryRendering.MarkAsDirty(this._renderer.renderPassId, this.objectList.meshes || this._scene.meshes);\r\n\r\n const pass = this._frameGraph.addRenderPass(this.name);\r\n\r\n pass.setRenderTarget(outputTextureHandle);\r\n\r\n let needPreviousWorldMatrices = false;\r\n\r\n for (let i = 0; i < this.textureDescriptions.length; i++) {\r\n const description = this.textureDescriptions[i];\r\n const handle = outputTextureHandle[i];\r\n const index = MaterialHelperGeometryRendering.GeometryTextureDescriptions.findIndex((f) => f.type === description.type);\r\n const geometryDescription = MaterialHelperGeometryRendering.GeometryTextureDescriptions[index];\r\n\r\n switch (geometryDescription.type) {\r\n case Constants.PREPASS_DEPTH_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryViewDepthTexture, handle);\r\n break;\r\n case Constants.PREPASS_NORMALIZED_VIEW_DEPTH_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryNormViewDepthTexture, handle);\r\n break;\r\n case Constants.PREPASS_SCREENSPACE_DEPTH_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryScreenDepthTexture, handle);\r\n break;\r\n case Constants.PREPASS_NORMAL_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryViewNormalTexture, handle);\r\n break;\r\n case Constants.PREPASS_WORLD_NORMAL_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryWorldNormalTexture, handle);\r\n break;\r\n case Constants.PREPASS_LOCAL_POSITION_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryLocalPositionTexture, handle);\r\n break;\r\n case Constants.PREPASS_POSITION_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryWorldPositionTexture, handle);\r\n break;\r\n case Constants.PREPASS_ALBEDO_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryAlbedoTexture, handle);\r\n break;\r\n case Constants.PREPASS_REFLECTIVITY_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryReflectivityTexture, handle);\r\n break;\r\n case Constants.PREPASS_VELOCITY_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryVelocityTexture, handle);\r\n needPreviousWorldMatrices = true;\r\n break;\r\n case Constants.PREPASS_VELOCITY_LINEAR_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryLinearVelocityTexture, handle);\r\n needPreviousWorldMatrices = true;\r\n break;\r\n }\r\n }\r\n\r\n this._scene.needsPreviousWorldMatrices = needPreviousWorldMatrices;\r\n\r\n pass.setRenderTargetDepth(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 pass.frameGraphRenderTarget!.renderTargetWrapper!.resolveMSAAColors = this.resolveMSAAColors;\r\n pass.frameGraphRenderTarget!.renderTargetWrapper!.resolveMSAADepth = this.resolveMSAADepth;\r\n\r\n context.setDepthStates(this.depthTest && depthEnabled, this.depthWrite && depthEnabled);\r\n\r\n this._clearAttachmentsLayout.forEach((layout, clearType) => {\r\n context.clearColorAttachments(ClearColors[clearType], layout);\r\n });\r\n\r\n context.bindAttachments(this._allAttachmentsLayout);\r\n\r\n context.render(this._renderer, this._textureWidth, this._textureHeight);\r\n });\r\n\r\n const passDisabled = this._frameGraph.addRenderPass(this.name + \"_disabled\", true);\r\n\r\n passDisabled.setRenderTarget(outputTextureHandle);\r\n passDisabled.setRenderTargetDepth(this.depthTexture);\r\n passDisabled.setExecuteFunc((_context) => {});\r\n }\r\n\r\n public override dispose(): void {\r\n MaterialHelperGeometryRendering.DeleteConfiguration(this._renderer.renderPassId);\r\n this._renderer.dispose();\r\n super.dispose();\r\n }\r\n\r\n private _createMultiRenderTargetTexture(): FrameGraphTextureHandle[] {\r\n const types: number[] = [];\r\n const formats: number[] = [];\r\n const labels: string[] = [];\r\n const useSRGBBuffers: boolean[] = [];\r\n\r\n for (let i = 0; i < this.textureDescriptions.length; i++) {\r\n const description = this.textureDescriptions[i];\r\n const index = MaterialHelperGeometryRendering.GeometryTextureDescriptions.findIndex((f) => f.type === description.type);\r\n\r\n if (index === -1) {\r\n throw new Error(`FrameGraphGeometryRendererTask ${this.name}: unknown texture type ${description.type}`);\r\n }\r\n\r\n types[i] = description.textureType;\r\n formats[i] = description.textureFormat;\r\n labels[i] = MaterialHelperGeometryRendering.GeometryTextureDescriptions[index].name;\r\n useSRGBBuffers[i] = false;\r\n }\r\n\r\n const baseHandle = this._frameGraph.textureManager.createRenderTargetTexture(this.name, {\r\n size: this.size,\r\n sizeIsPercentage: this.sizeIsPercentage,\r\n options: {\r\n createMipMaps: false,\r\n samples: this.samples,\r\n types,\r\n formats,\r\n useSRGBBuffers,\r\n labels,\r\n },\r\n });\r\n\r\n const handles: FrameGraphTextureHandle[] = [];\r\n for (let i = 0; i < this.textureDescriptions.length; i++) {\r\n handles.push(baseHandle + i);\r\n }\r\n\r\n return handles;\r\n }\r\n\r\n private _checkDepthTextureCompatibility(): boolean {\r\n let depthEnabled = false;\r\n\r\n if (this.depthTexture !== undefined) {\r\n if (this.depthTexture === backbufferDepthStencilTextureHandle) {\r\n throw new Error(`FrameGraphGeometryRendererTask ${this.name}: the depth/stencil back buffer is not allowed as a depth texture`);\r\n }\r\n\r\n const depthTextureDescription = this._frameGraph.textureManager.getTextureDescription(this.depthTexture);\r\n if (depthTextureDescription.options.samples !== this.samples && this.textureDescriptions.length > 0) {\r\n throw new Error(`FrameGraphGeometryRendererTask ${this.name}: the depth texture and the output texture must have the same number of samples`);\r\n }\r\n\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputDepthTexture, this.depthTexture);\r\n\r\n depthEnabled = true;\r\n }\r\n\r\n return depthEnabled;\r\n }\r\n\r\n private _buildClearAttachmentsLayout() {\r\n const clearAttachmentsLayout = new Map<GeometryRenderingTextureClearType, boolean[]>();\r\n const allAttachmentsLayout: boolean[] = [];\r\n\r\n for (let i = 0; i < this.textureDescriptions.length; i++) {\r\n const description = this.textureDescriptions[i];\r\n const index = MaterialHelperGeometryRendering.GeometryTextureDescriptions.findIndex((f) => f.type === description.type);\r\n const geometryDescription = MaterialHelperGeometryRendering.GeometryTextureDescriptions[index];\r\n\r\n let layout = clearAttachmentsLayout.get(geometryDescription.clearType);\r\n if (layout === undefined) {\r\n layout = [];\r\n clearAttachmentsLayout.set(geometryDescription.clearType, layout);\r\n for (let j = 0; j < i; j++) {\r\n layout[j] = false;\r\n }\r\n }\r\n\r\n clearAttachmentsLayout.forEach((layout, clearType) => {\r\n layout.push(clearType === geometryDescription.clearType);\r\n });\r\n\r\n allAttachmentsLayout.push(true);\r\n }\r\n\r\n this._clearAttachmentsLayout = new Map();\r\n\r\n clearAttachmentsLayout.forEach((layout, clearType) => {\r\n this._clearAttachmentsLayout.set(clearType, this._engine.buildTextureLayout(layout));\r\n });\r\n\r\n this._allAttachmentsLayout = this._engine.buildTextureLayout(allAttachmentsLayout);\r\n }\r\n\r\n private _registerForRenderPassId(renderPassId: number) {\r\n const configuration = MaterialHelperGeometryRendering.CreateConfiguration(renderPassId);\r\n\r\n for (let i = 0; i < this.textureDescriptions.length; i++) {\r\n const description = this.textureDescriptions[i];\r\n const index = MaterialHelperGeometryRendering.GeometryTextureDescriptions.findIndex((f) => f.type === description.type);\r\n const geometryDescription = MaterialHelperGeometryRendering.GeometryTextureDescriptions[index];\r\n\r\n configuration.defines[geometryDescription.defineIndex] = i;\r\n }\r\n\r\n configuration.reverseCulling = this.reverseCulling;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"geometryRendererTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Rendering/geometryRendererTask.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,qCAA8B;AAC/C,OAAO,EAAE,+BAA+B,EAAqC,+DAAwD;AACrI,OAAO,EAAE,SAAS,EAAE,sCAA+B;AACnD,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AAuBpE,MAAM,WAAW,GAAa,CAAC,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAEvG;;GAEG;AACH,MAAM,OAAO,8BAA+B,SAAQ,4BAA4B;IAkB5E;;OAEG;IACH,IAAW,cAAc;QACrB,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAED,IAAW,cAAc,CAAC,KAAc;QACpC,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;QAE7B,MAAM,aAAa,GAAG,+BAA+B,CAAC,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;QACpG,IAAI,aAAa,EAAE,CAAC;YAChB,aAAa,CAAC,cAAc,GAAG,KAAK,CAAC;QACzC,CAAC;IACL,CA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C,uBAAuB,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC;QACzF,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,oBAAoB,CAAC,CAAC;IACvF,CAAC;IAEO,wBAAwB,CAAC,YAAoB;QACjD,MAAM,aAAa,GAAG,+BAA+B,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC;QAExF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,mBAAmB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACvD,MAAM,WAAW,GAAG,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;YAChD,MAAM,KAAK,GAAG,+BAA+B,CAAC,2BAA2B,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC,IAAI,CAAC,CAAC;YACxH,MAAM,mBAAmB,GAAG,+BAA+B,CAAC,2BAA2B,CAAC,KAAK,CAAC,CAAC;YAE/F,aAAa,CAAC,OAAO,CAAC,mBAAmB,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAC/D,CAAC;QAED,IAAI,IAAI,CAAC,aAAa,KAAK,SAAS,EAAE,CAAC;YACnC,aAAa,CAAC,OAAO,CAAC,qBAAqB,CAAC,GAAG,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC;QACnF,CAAC;QAED,aAAa,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;IACvD,CAAC;CACJ","sourcesContent":["import type { FrameGraphTextureHandle, Scene, FrameGraph, AbstractMesh, ObjectRendererOptions, FrameGraphRenderContext, FrameGraphRenderPass, ObjectRenderer } from \"core/index\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { MaterialHelperGeometryRendering, GeometryRenderingTextureClearType } from \"core/Materials/materialHelper.geometryrendering\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { FrameGraphObjectRendererTask } from \"./objectRendererTask\";\r\n\r\n/**\r\n * Description of a texture used by the geometry renderer task.\r\n */\r\nexport interface IFrameGraphGeometryRendererTextureDescription {\r\n /**\r\n * The type of the texture.\r\n * The value should be one of the Constants.PREPASS_XXX_TEXTURE_TYPE values.\r\n */\r\n type: number;\r\n\r\n /**\r\n * The type of the texture.\r\n */\r\n textureType: number;\r\n\r\n /**\r\n * The format of the texture.\r\n */\r\n textureFormat: number;\r\n}\r\n\r\nconst ClearColors: Color4[] = [new Color4(0, 0, 0, 0), new Color4(1, 1, 1, 1), new Color4(0, 0, 0, 0)];\r\n\r\n/**\r\n * Task used to render geometry to a set of textures.\r\n */\r\nexport class FrameGraphGeometryRendererTask extends FrameGraphObjectRendererTask {\r\n /**\r\n * The size of the output textures (default is 100% of the back buffer texture size).\r\n */\r\n public size: { width: number; height: number } = { width: 100, height: 100 };\r\n\r\n /**\r\n * Whether the size is a percentage of the back buffer size (default is true).\r\n */\r\n public sizeIsPercentage = true;\r\n\r\n /**\r\n * The number of samples to use for the output textures (default is 1).\r\n */\r\n public samples = 1;\r\n\r\n private _reverseCulling = false;\r\n\r\n /**\r\n * Whether to reverse culling (default is false).\r\n */\r\n public get reverseCulling() {\r\n return this._reverseCulling;\r\n }\r\n\r\n public set reverseCulling(value: boolean) {\r\n this._reverseCulling = value;\r\n\r\n const configuration = MaterialHelperGeometryRendering.GetConfiguration(this._renderer.renderPassId);\r\n if (configuration) {\r\n configuration.reverseCulling = value;\r\n }\r\n }\r\n\r\n /**\r\n * Indicates if a mesh shouldn't be rendered when its material has depth write disabled (default is true).\r\n */\r\n public dontRenderWhenMaterialDepthWriteIsDisabled = true;\r\n\r\n private _disableDepthPrePass = true;\r\n /**\r\n * Indicates whether the depth pre-pass is disabled (default is true).\r\n * Materials that require depth pre-pass (Material.needDepthPrePass == true) don't work with the geometry renderer, that's why this setting is true by default.\r\n * However, if the geometry renderer doesn't generate any geometry textures but only renders to the main target texture, then depth pre-pass can be enabled.\r\n */\r\n public get disableDepthPrePass() {\r\n return this._disableDepthPrePass;\r\n }\r\n\r\n public set disableDepthPrePass(value: boolean) {\r\n this._disableDepthPrePass = value;\r\n this._renderer.disableDepthPrePass = value;\r\n }\r\n\r\n /**\r\n * The list of texture descriptions used by the geometry renderer task.\r\n */\r\n public textureDescriptions: IFrameGraphGeometryRendererTextureDescription[] = [];\r\n\r\n /**\r\n * The depth (in view space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryViewDepthTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The normalized depth (in view space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n * The normalization is (d - near) / (far - near), where d is the depth value in view space and near and far are the near and far planes of the camera.\r\n */\r\n public readonly geometryNormViewDepthTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The depth (in screen space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryScreenDepthTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The normal (in view space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryViewNormalTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The normal (in world space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryWorldNormalTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The position (in local space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryLocalPositionTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The position (in world space) output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryWorldPositionTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The albedo output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryAlbedoTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The reflectivity output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryReflectivityTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The velocity output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryVelocityTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * The linear velocity output texture. Will point to a valid texture only if that texture has been requested in textureDescriptions!\r\n */\r\n public readonly geometryLinearVelocityTexture: FrameGraphTextureHandle;\r\n\r\n /**\r\n * Gets or sets the name of the task.\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 private _clearAttachmentsLayout: Map<GeometryRenderingTextureClearType, number[]>;\r\n private _allAttachmentsLayout: number[];\r\n\r\n /**\r\n * Constructs a new geometry 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, scene, options, existingObjectRenderer);\r\n\r\n this.renderSprites = false;\r\n this.renderParticles = false;\r\n this.enableBoundingBoxRendering = false;\r\n this.enableOutlineRendering = false;\r\n this._renderer.disableDepthPrePass = true;\r\n\r\n this._renderer.customIsReadyFunction = (mesh: AbstractMesh, refreshRate: number, preWarm?: boolean) => {\r\n if (this.dontRenderWhenMaterialDepthWriteIsDisabled && mesh.material && mesh.material.disableDepthWrite) {\r\n return !!preWarm;\r\n }\r\n\r\n return mesh.isReady(refreshRate === 0);\r\n };\r\n\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 this._clearAttachmentsLayout = new Map();\r\n this._allAttachmentsLayout = [];\r\n\r\n this.geometryViewDepthTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryNormViewDepthTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryScreenDepthTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryViewNormalTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryWorldNormalTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryLocalPositionTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryWorldPositionTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryAlbedoTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryReflectivityTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryVelocityTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n this.geometryLinearVelocityTexture = this._frameGraph.textureManager.createDanglingHandle();\r\n }\r\n\r\n /**\r\n * Gets the list of excluded meshes from the velocity texture.\r\n */\r\n public get excludedSkinnedMeshFromVelocityTexture(): AbstractMesh[] {\r\n return MaterialHelperGeometryRendering.GetConfiguration(this._renderer.renderPassId).excludedSkinnedMesh;\r\n }\r\n\r\n /**\r\n * Excludes the given skinned mesh from computing bones velocities.\r\n * Computing bones velocities can have a cost. The cost can be saved by calling this function and by passing the skinned mesh to ignore.\r\n * @param skinnedMesh The mesh containing the skeleton to ignore when computing the velocity map.\r\n */\r\n public excludeSkinnedMeshFromVelocityTexture(skinnedMesh: AbstractMesh): void {\r\n if (skinnedMesh.skeleton) {\r\n const list = this.excludedSkinnedMeshFromVelocityTexture;\r\n if (list.indexOf(skinnedMesh) === -1) {\r\n list.push(skinnedMesh);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Removes the given skinned mesh from the excluded meshes to integrate bones velocities while rendering the velocity map.\r\n * @param skinnedMesh The mesh containing the skeleton that has been ignored previously.\r\n * @see excludeSkinnedMesh to exclude a skinned mesh from bones velocity computation.\r\n */\r\n public removeExcludedSkinnedMeshFromVelocityTexture(skinnedMesh: AbstractMesh): void {\r\n const list = this.excludedSkinnedMeshFromVelocityTexture;\r\n const index = list.indexOf(skinnedMesh);\r\n if (index !== -1) {\r\n list.splice(index, 1);\r\n }\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"FrameGraphGeometryRendererTask\";\r\n }\r\n\r\n public override record(skipCreationOfDisabledPasses = false, additionalExecute?: (context: FrameGraphRenderContext) => void): FrameGraphRenderPass {\r\n this._buildClearAttachmentsLayout();\r\n\r\n this._registerForRenderPassId(this._renderer.renderPassId);\r\n\r\n MaterialHelperGeometryRendering.MarkAsDirty(this._renderer.renderPassId, this.objectList.meshes || this._scene.meshes);\r\n\r\n const pass = super.record(skipCreationOfDisabledPasses, additionalExecute) as FrameGraphRenderPass;\r\n\r\n const outputTextureHandles = pass.renderTarget as FrameGraphTextureHandle[];\r\n\r\n let needPreviousWorldMatrices = false;\r\n\r\n for (let i = 0; i < this.textureDescriptions.length; i++) {\r\n const description = this.textureDescriptions[i];\r\n const handle = outputTextureHandles[i];\r\n const index = MaterialHelperGeometryRendering.GeometryTextureDescriptions.findIndex((f) => f.type === description.type);\r\n const geometryDescription = MaterialHelperGeometryRendering.GeometryTextureDescriptions[index];\r\n\r\n switch (geometryDescription.type) {\r\n case Constants.PREPASS_DEPTH_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryViewDepthTexture, handle);\r\n break;\r\n case Constants.PREPASS_NORMALIZED_VIEW_DEPTH_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryNormViewDepthTexture, handle);\r\n break;\r\n case Constants.PREPASS_SCREENSPACE_DEPTH_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryScreenDepthTexture, handle);\r\n break;\r\n case Constants.PREPASS_NORMAL_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryViewNormalTexture, handle);\r\n break;\r\n case Constants.PREPASS_WORLD_NORMAL_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryWorldNormalTexture, handle);\r\n break;\r\n case Constants.PREPASS_LOCAL_POSITION_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryLocalPositionTexture, handle);\r\n break;\r\n case Constants.PREPASS_POSITION_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryWorldPositionTexture, handle);\r\n break;\r\n case Constants.PREPASS_ALBEDO_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryAlbedoTexture, handle);\r\n break;\r\n case Constants.PREPASS_REFLECTIVITY_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryReflectivityTexture, handle);\r\n break;\r\n case Constants.PREPASS_VELOCITY_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryVelocityTexture, handle);\r\n needPreviousWorldMatrices = true;\r\n break;\r\n case Constants.PREPASS_VELOCITY_LINEAR_TEXTURE_TYPE:\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.geometryLinearVelocityTexture, handle);\r\n needPreviousWorldMatrices = true;\r\n break;\r\n }\r\n }\r\n\r\n this._scene.needsPreviousWorldMatrices = needPreviousWorldMatrices;\r\n\r\n return pass;\r\n }\r\n\r\n public override dispose(): void {\r\n MaterialHelperGeometryRendering.DeleteConfiguration(this._renderer.renderPassId);\r\n this._renderer.dispose();\r\n super.dispose();\r\n }\r\n\r\n protected override _resolveDanglingHandles(_targetTextures: FrameGraphTextureHandle[]) {\r\n if (this.targetTexture !== undefined) {\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, Array.isArray(this.targetTexture) ? this.targetTexture[0] : this.targetTexture);\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 override _checkParameters() {\r\n if (this.objectList === undefined || this.camera === undefined) {\r\n throw new Error(`FrameGraphGeometryRendererTask ${this.name}: object list and camera must be provided`);\r\n }\r\n }\r\n\r\n protected override _checkTextureCompatibility(targetTextures: FrameGraphTextureHandle[]): boolean {\r\n let depthEnabled = false;\r\n\r\n let dimensions: { width: number; height: number } | null = null;\r\n\r\n if (this.targetTexture !== undefined) {\r\n const outputTextureDescription = this._frameGraph.textureManager.getTextureDescription(Array.isArray(this.targetTexture) ? this.targetTexture[0] : this.targetTexture);\r\n if (this.samples !== outputTextureDescription.options.samples) {\r\n throw new Error(`FrameGraphGeometryRendererTask ${this.name}: the target texture and the output geometry textures must have the same number of samples`);\r\n }\r\n dimensions = outputTextureDescription.size;\r\n }\r\n\r\n if (this.depthTexture !== undefined) {\r\n const depthTextureDescription = this._frameGraph.textureManager.getTextureDescription(this.depthTexture);\r\n if (depthTextureDescription.options.samples !== this.samples && this.textureDescriptions.length > 0) {\r\n throw new Error(`FrameGraphGeometryRendererTask ${this.name}: the depth texture and the output geometry textures must have the same number of samples`);\r\n }\r\n\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputDepthTexture, this.depthTexture);\r\n\r\n depthEnabled = true;\r\n dimensions = depthTextureDescription.size;\r\n }\r\n\r\n const geomTextureDimensions = this.sizeIsPercentage ? this._frameGraph.textureManager.getAbsoluteDimensions(this.size) : this.size;\r\n if (dimensions !== null) {\r\n if (geomTextureDimensions.width !== dimensions.width || geomTextureDimensions.height !== dimensions.height) {\r\n throw new Error(\r\n `FrameGraphGeometryRendererTask ${this.name}: the geometry textures (size: ${geomTextureDimensions.width}x${geomTextureDimensions.height}) and the target/depth texture (size: ${dimensions.width}x${dimensions.height}) must have the same dimensions.`\r\n );\r\n }\r\n }\r\n\r\n depthEnabled = depthEnabled || super._checkTextureCompatibility(targetTextures);\r\n\r\n return depthEnabled;\r\n }\r\n\r\n protected override _getTargetHandles(): FrameGraphTextureHandle[] {\r\n const types: number[] = [];\r\n const formats: number[] = [];\r\n const labels: string[] = [];\r\n const useSRGBBuffers: boolean[] = [];\r\n\r\n for (let i = 0; i < this.textureDescriptions.length; i++) {\r\n const description = this.textureDescriptions[i];\r\n const index = MaterialHelperGeometryRendering.GeometryTextureDescriptions.findIndex((f) => f.type === description.type);\r\n\r\n if (index === -1) {\r\n throw new Error(`FrameGraphGeometryRendererTask ${this.name}: unknown texture type ${description.type}`);\r\n }\r\n\r\n types[i] = description.textureType;\r\n formats[i] = description.textureFormat;\r\n labels[i] = MaterialHelperGeometryRendering.GeometryTextureDescriptions[index].name;\r\n useSRGBBuffers[i] = false;\r\n }\r\n\r\n const handles: FrameGraphTextureHandle[] = [];\r\n\r\n if (this.textureDescriptions.length > 0) {\r\n const baseHandle = this._frameGraph.textureManager.createRenderTargetTexture(this.name, {\r\n size: this.size,\r\n sizeIsPercentage: this.sizeIsPercentage,\r\n options: {\r\n createMipMaps: false,\r\n samples: this.samples,\r\n types,\r\n formats,\r\n useSRGBBuffers,\r\n labels,\r\n },\r\n });\r\n\r\n for (let i = 0; i < this.textureDescriptions.length; i++) {\r\n handles.push(baseHandle + i);\r\n }\r\n }\r\n\r\n if (this.targetTexture !== undefined) {\r\n if (Array.isArray(this.targetTexture)) {\r\n handles.push(...this.targetTexture);\r\n } else {\r\n handles.push(this.targetTexture);\r\n }\r\n }\r\n\r\n return handles;\r\n }\r\n\r\n protected override _prepareRendering(context: FrameGraphRenderContext, depthEnabled: boolean) {\r\n context.setDepthStates(this.depthTest && depthEnabled, this.depthWrite && depthEnabled);\r\n\r\n this._clearAttachmentsLayout.forEach((layout, clearType) => {\r\n context.clearColorAttachments(ClearColors[clearType], layout);\r\n });\r\n\r\n context.bindAttachments(this._allAttachmentsLayout);\r\n }\r\n\r\n private _buildClearAttachmentsLayout() {\r\n const clearAttachmentsLayout = new Map<GeometryRenderingTextureClearType, boolean[]>();\r\n const allAttachmentsLayout: boolean[] = [];\r\n\r\n for (let i = 0; i < this.textureDescriptions.length; i++) {\r\n const description = this.textureDescriptions[i];\r\n const index = MaterialHelperGeometryRendering.GeometryTextureDescriptions.findIndex((f) => f.type === description.type);\r\n const geometryDescription = MaterialHelperGeometryRendering.GeometryTextureDescriptions[index];\r\n\r\n let layout = clearAttachmentsLayout.get(geometryDescription.clearType);\r\n if (layout === undefined) {\r\n layout = [];\r\n clearAttachmentsLayout.set(geometryDescription.clearType, layout);\r\n for (let j = 0; j < i; j++) {\r\n layout[j] = false;\r\n }\r\n }\r\n\r\n clearAttachmentsLayout.forEach((layout, clearType) => {\r\n layout.push(clearType === geometryDescription.clearType);\r\n });\r\n\r\n allAttachmentsLayout.push(true);\r\n }\r\n\r\n if (this.targetTexture !== undefined) {\r\n let layout = clearAttachmentsLayout.get(GeometryRenderingTextureClearType.Zero);\r\n if (layout === undefined) {\r\n layout = [];\r\n clearAttachmentsLayout.set(GeometryRenderingTextureClearType.Zero, layout);\r\n for (let j = 0; j < this.textureDescriptions.length - 1; j++) {\r\n layout[j] = false;\r\n }\r\n }\r\n\r\n clearAttachmentsLayout.forEach((layout) => {\r\n layout.push(false);\r\n });\r\n\r\n allAttachmentsLayout.push(true);\r\n }\r\n\r\n this._clearAttachmentsLayout = new Map();\r\n\r\n clearAttachmentsLayout.forEach((layout, clearType) => {\r\n this._clearAttachmentsLayout.set(clearType, this._engine.buildTextureLayout(layout));\r\n });\r\n\r\n this._allAttachmentsLayout = this._engine.buildTextureLayout(allAttachmentsLayout);\r\n }\r\n\r\n private _registerForRenderPassId(renderPassId: number) {\r\n const configuration = MaterialHelperGeometryRendering.CreateConfiguration(renderPassId);\r\n\r\n for (let i = 0; i < this.textureDescriptions.length; i++) {\r\n const description = this.textureDescriptions[i];\r\n const index = MaterialHelperGeometryRendering.GeometryTextureDescriptions.findIndex((f) => f.type === description.type);\r\n const geometryDescription = MaterialHelperGeometryRendering.GeometryTextureDescriptions[index];\r\n\r\n configuration.defines[geometryDescription.defineIndex] = i;\r\n }\r\n\r\n if (this.targetTexture !== undefined) {\r\n configuration.defines[\"PREPASS_COLOR_INDEX\"] = this.textureDescriptions.length;\r\n }\r\n\r\n configuration.reverseCulling = this.reverseCulling;\r\n }\r\n}\r\n"]}
|
|
@@ -53,6 +53,12 @@ export declare class FrameGraphObjectRendererTask extends FrameGraphTask {
|
|
|
53
53
|
* It is also used to determine the main camera used by the frame graph: this is the camera used by the main object renderer.
|
|
54
54
|
*/
|
|
55
55
|
isMainObjectRenderer: boolean;
|
|
56
|
+
private _renderMeshes;
|
|
57
|
+
/**
|
|
58
|
+
* Defines if meshes should be rendered (default is true).
|
|
59
|
+
*/
|
|
60
|
+
get renderMeshes(): boolean;
|
|
61
|
+
set renderMeshes(value: boolean);
|
|
56
62
|
private _renderParticles;
|
|
57
63
|
/**
|
|
58
64
|
* Defines if particles should be rendered (default is true).
|
|
@@ -130,5 +136,10 @@ export declare class FrameGraphObjectRendererTask extends FrameGraphTask {
|
|
|
130
136
|
getClassName(): string;
|
|
131
137
|
record(skipCreationOfDisabledPasses?: boolean, additionalExecute?: (context: FrameGraphRenderContext) => void): FrameGraphRenderPass;
|
|
132
138
|
dispose(): void;
|
|
139
|
+
protected _resolveDanglingHandles(targetTextures: FrameGraphTextureHandle[]): void;
|
|
140
|
+
protected _checkParameters(): void;
|
|
141
|
+
protected _checkTextureCompatibility(targetTextures: FrameGraphTextureHandle[]): boolean;
|
|
142
|
+
protected _getTargetHandles(): FrameGraphTextureHandle[];
|
|
143
|
+
protected _prepareRendering(context: FrameGraphRenderContext, depthEnabled: boolean): void;
|
|
133
144
|
protected _setLightsForShadow(): void;
|
|
134
145
|
}
|
|
@@ -31,6 +31,19 @@ export class FrameGraphObjectRendererTask extends FrameGraphTask {
|
|
|
31
31
|
this._disableImageProcessing = value;
|
|
32
32
|
this._renderer.disableImageProcessing = value;
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Defines if meshes should be rendered (default is true).
|
|
36
|
+
*/
|
|
37
|
+
get renderMeshes() {
|
|
38
|
+
return this._renderMeshes;
|
|
39
|
+
}
|
|
40
|
+
set renderMeshes(value) {
|
|
41
|
+
if (value === this._renderMeshes) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
this._renderMeshes = value;
|
|
45
|
+
this._renderer.renderMeshes = value;
|
|
46
|
+
}
|
|
34
47
|
/**
|
|
35
48
|
* Defines if particles should be rendered (default is true).
|
|
36
49
|
*/
|
|
@@ -145,6 +158,7 @@ export class FrameGraphObjectRendererTask extends FrameGraphTask {
|
|
|
145
158
|
* It is also used to determine the main camera used by the frame graph: this is the camera used by the main object renderer.
|
|
146
159
|
*/
|
|
147
160
|
this.isMainObjectRenderer = false;
|
|
161
|
+
this._renderMeshes = true;
|
|
148
162
|
this._renderParticles = true;
|
|
149
163
|
this._renderSprites = true;
|
|
150
164
|
this._forceLayerMaskCheck = true;
|
|
@@ -188,34 +202,13 @@ export class FrameGraphObjectRendererTask extends FrameGraphTask {
|
|
|
188
202
|
return "FrameGraphObjectRendererTask";
|
|
189
203
|
}
|
|
190
204
|
record(skipCreationOfDisabledPasses = false, additionalExecute) {
|
|
191
|
-
|
|
192
|
-
throw new Error(`FrameGraphObjectRendererTask ${this.name}: targetTexture and objectList are required`);
|
|
193
|
-
}
|
|
205
|
+
this._checkParameters();
|
|
194
206
|
// Make sure the renderList / particleSystemList are set when FrameGraphObjectRendererTask.isReady() is called!
|
|
195
207
|
this._renderer.renderList = this.objectList.meshes;
|
|
196
208
|
this._renderer.particleSystemList = this.objectList.particleSystems;
|
|
197
|
-
const targetTextures =
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
if (this.depthTexture !== undefined) {
|
|
201
|
-
if (this.depthTexture === backbufferDepthStencilTextureHandle && (targetTextures[0] !== backbufferColorTextureHandle || targetTextures.length > 1)) {
|
|
202
|
-
throw new Error(`FrameGraphObjectRendererTask ${this.name}: the back buffer color texture is the only color texture allowed when the depth is the back buffer depth/stencil`);
|
|
203
|
-
}
|
|
204
|
-
if (this.depthTexture !== backbufferDepthStencilTextureHandle && targetTextures[0] === backbufferColorTextureHandle) {
|
|
205
|
-
throw new Error(`FrameGraphObjectRendererTask ${this.name}: the back buffer depth/stencil texture is the only depth texture allowed when the target is the back buffer color`);
|
|
206
|
-
}
|
|
207
|
-
const depthTextureDescription = this._frameGraph.textureManager.getTextureDescription(this.depthTexture);
|
|
208
|
-
if (depthTextureDescription.options.samples !== outputTextureDescription.options.samples) {
|
|
209
|
-
throw new Error(`FrameGraphObjectRendererTask ${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`);
|
|
210
|
-
}
|
|
211
|
-
depthEnabled = true;
|
|
212
|
-
}
|
|
213
|
-
this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, targetTextures[0]);
|
|
214
|
-
if (this.depthTexture !== undefined) {
|
|
215
|
-
this._frameGraph.textureManager.resolveDanglingHandle(this.outputDepthTexture, this.depthTexture);
|
|
216
|
-
}
|
|
217
|
-
this._textureWidth = outputTextureDescription.size.width;
|
|
218
|
-
this._textureHeight = outputTextureDescription.size.height;
|
|
209
|
+
const targetTextures = this._getTargetHandles();
|
|
210
|
+
const depthEnabled = this._checkTextureCompatibility(targetTextures);
|
|
211
|
+
this._resolveDanglingHandles(targetTextures);
|
|
219
212
|
this._setLightsForShadow();
|
|
220
213
|
const pass = this._frameGraph.addRenderPass(this.name);
|
|
221
214
|
pass.setRenderTarget(targetTextures);
|
|
@@ -234,7 +227,7 @@ export class FrameGraphObjectRendererTask extends FrameGraphTask {
|
|
|
234
227
|
if (boundingBoxRenderer) {
|
|
235
228
|
currentBoundingBoxMeshList.length = boundingBoxRenderer.renderList.length;
|
|
236
229
|
}
|
|
237
|
-
|
|
230
|
+
this._prepareRendering(context, depthEnabled);
|
|
238
231
|
const camera = this._renderer.activeCamera;
|
|
239
232
|
if (camera && camera.cameraRigMode !== 0 && !camera._renderingMultiview) {
|
|
240
233
|
for (let index = 0; index < camera._rigCameras.length; index++) {
|
|
@@ -271,6 +264,49 @@ export class FrameGraphObjectRendererTask extends FrameGraphTask {
|
|
|
271
264
|
}
|
|
272
265
|
super.dispose();
|
|
273
266
|
}
|
|
267
|
+
_resolveDanglingHandles(targetTextures) {
|
|
268
|
+
if (targetTextures.length > 0) {
|
|
269
|
+
this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, targetTextures[0]);
|
|
270
|
+
}
|
|
271
|
+
if (this.depthTexture !== undefined) {
|
|
272
|
+
this._frameGraph.textureManager.resolveDanglingHandle(this.outputDepthTexture, this.depthTexture);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
_checkParameters() {
|
|
276
|
+
if (this.targetTexture === undefined || this.objectList === undefined || this.camera === undefined) {
|
|
277
|
+
throw new Error(`FrameGraphObjectRendererTask ${this.name}: targetTexture, objectList, and camera are required`);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
_checkTextureCompatibility(targetTextures) {
|
|
281
|
+
const className = this.getClassName();
|
|
282
|
+
let outputTextureDescription = targetTextures.length > 0 ? this._frameGraph.textureManager.getTextureDescription(targetTextures[0]) : null;
|
|
283
|
+
let depthEnabled = false;
|
|
284
|
+
if (this.depthTexture !== undefined) {
|
|
285
|
+
if (outputTextureDescription && this.depthTexture !== backbufferDepthStencilTextureHandle && targetTextures[0] === backbufferColorTextureHandle) {
|
|
286
|
+
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`);
|
|
287
|
+
}
|
|
288
|
+
const depthTextureDescription = this._frameGraph.textureManager.getTextureDescription(this.depthTexture);
|
|
289
|
+
if (!outputTextureDescription) {
|
|
290
|
+
outputTextureDescription = depthTextureDescription;
|
|
291
|
+
}
|
|
292
|
+
if (depthTextureDescription.options.samples !== outputTextureDescription.options.samples) {
|
|
293
|
+
throw new Error(`${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`);
|
|
294
|
+
}
|
|
295
|
+
if (depthTextureDescription.size.width !== outputTextureDescription.size.width || depthTextureDescription.size.height !== outputTextureDescription.size.height) {
|
|
296
|
+
throw new Error(`${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.`);
|
|
297
|
+
}
|
|
298
|
+
depthEnabled = true;
|
|
299
|
+
}
|
|
300
|
+
this._textureWidth = outputTextureDescription?.size.width ?? 1;
|
|
301
|
+
this._textureHeight = outputTextureDescription?.size.height ?? 1;
|
|
302
|
+
return depthEnabled;
|
|
303
|
+
}
|
|
304
|
+
_getTargetHandles() {
|
|
305
|
+
return Array.isArray(this.targetTexture) ? this.targetTexture : [this.targetTexture];
|
|
306
|
+
}
|
|
307
|
+
_prepareRendering(context, depthEnabled) {
|
|
308
|
+
context.setDepthStates(this.depthTest && depthEnabled, this.depthWrite && depthEnabled);
|
|
309
|
+
}
|
|
274
310
|
_setLightsForShadow() {
|
|
275
311
|
const lightsForShadow = new Set();
|
|
276
312
|
const shadowEnabled = new Map();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"objectRendererTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Rendering/objectRendererTask.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,4BAA4B,EAAE,mCAAmC,EAAE,MAAM,uBAAuB,CAAC;AAC1G,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,mCAA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ACpD,SAAS,CAAC,yCAAyC;gBACvD,CAAC;gBACD,aAAa,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;gBAC9C,KAAK,CAAC,aAAa,GAAG,CAAC,IAAI,CAAC,cAAc,IAAI,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAC7E,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC,MAAM,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QAC7E,IAAI,CAAC,wBAAwB,GAAG,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC,GAAG,CAAC,GAAG,EAAE;YAC5E,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBACjD,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,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;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} 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\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 _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 _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\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.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 if (this.targetTexture === undefined || this.objectList === undefined) {\r\n throw new Error(`FrameGraphObjectRendererTask ${this.name}: targetTexture and objectList are required`);\r\n }\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 = Array.isArray(this.targetTexture) ? this.targetTexture : [this.targetTexture];\r\n\r\n const outputTextureDescription = this._frameGraph.textureManager.getTextureDescription(targetTextures[0]);\r\n\r\n let depthEnabled = false;\r\n\r\n if (this.depthTexture !== undefined) {\r\n if (this.depthTexture === backbufferDepthStencilTextureHandle && (targetTextures[0] !== backbufferColorTextureHandle || targetTextures.length > 1)) {\r\n throw new Error(\r\n `FrameGraphObjectRendererTask ${this.name}: the back buffer color texture is the only color texture allowed when the depth is the back buffer depth/stencil`\r\n );\r\n }\r\n if (this.depthTexture !== backbufferDepthStencilTextureHandle && targetTextures[0] === backbufferColorTextureHandle) {\r\n throw new Error(\r\n `FrameGraphObjectRendererTask ${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\r\n const depthTextureDescription = this._frameGraph.textureManager.getTextureDescription(this.depthTexture);\r\n if (depthTextureDescription.options.samples !== outputTextureDescription.options.samples) {\r\n throw new Error(\r\n `FrameGraphObjectRendererTask ${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 depthEnabled = true;\r\n }\r\n\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, targetTextures[0]);\r\n if (this.depthTexture !== undefined) {\r\n this._frameGraph.textureManager.resolveDanglingHandle(this.outputDepthTexture, this.depthTexture);\r\n }\r\n\r\n this._textureWidth = outputTextureDescription.size.width;\r\n this._textureHeight = outputTextureDescription.size.height;\r\n\r\n this._setLightsForShadow();\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 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 // 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 context.setDepthStates(this.depthTest && depthEnabled, this.depthWrite && depthEnabled);\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 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 super.dispose();\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"]}
|
|
1
|
+
{"version":3,"file":"objectRendererTask.js","sourceRoot":"","sources":["../../../../../../dev/core/src/FrameGraph/Tasks/Rendering/objectRendererTask.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,4BAA4B,EAA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,\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} 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\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 _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 _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\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.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 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 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 // 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 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 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 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"]}
|
|
@@ -46,19 +46,25 @@ export class FrameGraphClearTextureTask extends FrameGraphTask {
|
|
|
46
46
|
if (this.targetTexture === undefined && this.depthTexture === undefined) {
|
|
47
47
|
throw new Error(`FrameGraphClearTextureTask ${this.name}: targetTexture and depthTexture can't both be undefined.`);
|
|
48
48
|
}
|
|
49
|
+
const textureManager = this._frameGraph.textureManager;
|
|
49
50
|
const targetTextures = this.targetTexture !== undefined ? (Array.isArray(this.targetTexture) ? this.targetTexture : [this.targetTexture]) : undefined;
|
|
50
|
-
let textureSamples = 0;
|
|
51
|
-
let depthSamples = 0;
|
|
52
51
|
if (this.targetTexture !== undefined) {
|
|
53
|
-
|
|
54
|
-
this._frameGraph.textureManager.resolveDanglingHandle(this.outputTexture, targetTextures[0]);
|
|
52
|
+
textureManager.resolveDanglingHandle(this.outputTexture, targetTextures[0]);
|
|
55
53
|
}
|
|
56
54
|
if (this.depthTexture !== undefined) {
|
|
57
|
-
|
|
58
|
-
this._frameGraph.textureManager.resolveDanglingHandle(this.outputDepthTexture, this.depthTexture);
|
|
55
|
+
textureManager.resolveDanglingHandle(this.outputDepthTexture, this.depthTexture);
|
|
59
56
|
}
|
|
60
|
-
if (
|
|
61
|
-
|
|
57
|
+
if (this.targetTexture !== undefined && this.depthTexture !== undefined) {
|
|
58
|
+
const targetDescription = textureManager.getTextureDescription(targetTextures[0]);
|
|
59
|
+
const depthDescription = textureManager.getTextureDescription(this.depthTexture);
|
|
60
|
+
if (targetDescription.size.width !== depthDescription.size.width || targetDescription.size.height !== depthDescription.size.height) {
|
|
61
|
+
throw new Error(`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.`);
|
|
62
|
+
}
|
|
63
|
+
const textureSamples = targetDescription.options.samples || 1;
|
|
64
|
+
const depthSamples = depthDescription.options.samples || 1;
|
|
65
|
+
if (textureSamples !== depthSamples && textureSamples !== 0 && depthSamples !== 0) {
|
|
66
|
+
throw new Error(`FrameGraphClearTextureTask ${this.name}: the depth texture (${depthSamples} samples) and the target texture (${textureSamples} samples) must have the same number of samples.`);
|
|
67
|
+
}
|
|
62
68
|
}
|
|
63
69
|
const attachments = this._frameGraph.engine.buildTextureLayout(targetTextures ? Array(targetTextures.length).fill(true) : [], this.targetTexture === backbufferColorTextureHandle && !this._frameGraph.textureManager.backBufferTextureOverriden);
|
|
64
70
|
const color = TmpColors.Color4[0];
|
|
@@ -70,6 +76,10 @@ export class FrameGraphClearTextureTask extends FrameGraphTask {
|
|
|
70
76
|
if (this.convertColorToLinearSpace) {
|
|
71
77
|
color.toLinearSpaceToRef(color);
|
|
72
78
|
}
|
|
79
|
+
const renderTargetWrapper = pass.frameGraphRenderTarget.renderTargetWrapper;
|
|
80
|
+
if (renderTargetWrapper) {
|
|
81
|
+
renderTargetWrapper.disableAutomaticMSAAResolve = true;
|
|
82
|
+
}
|
|
73
83
|
context.clearAttachments(color, attachments, !!this.clearColor, !!this.clearDepth, !!this.clearStencil, this.stencilValue);
|
|
74
84
|
});
|
|
75
85
|
if (!skipCreationOfDisabledPasses) {
|
|
@@ -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,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;QAE5C;;WAEG;QACI,eAAU,GAAG,IAAI,CAAC;QAEzB;;WAEG;QACI,8BAAyB,GAAG,KAAK,CAAC;QAEzC;;WAEG;QACI,eAAU,GAAG,KAAK,CAAC;QAE1B;;WAEG;QACI,iBAAY,GAAG,KAAK,CAAC;QAE5B;;WAEG;QACI,iBAAY,GAAG,CAAC,CAAC;QA8BpB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,WAAW,CAAC,cAAc,CAA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AY,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"]}
|
|
@@ -5,8 +5,6 @@ import { FrameGraphObjectListPass } from "./Passes/objectListPass.js";
|
|
|
5
5
|
import { FrameGraphContext } from "./frameGraphContext.js";
|
|
6
6
|
import { FrameGraphTextureManager } from "./frameGraphTextureManager.js";
|
|
7
7
|
import { Observable } from "../Misc/observable.js";
|
|
8
|
-
import "../Engines/Extensions/engine.multiRender.js";
|
|
9
|
-
import "../Engines/WebGPU/Extensions/engine.multiRender.js";
|
|
10
8
|
/**
|
|
11
9
|
* Class used to implement a frame graph
|
|
12
10
|
* @experimental
|
|
@@ -25,6 +23,7 @@ export declare class FrameGraph implements IDisposable {
|
|
|
25
23
|
private readonly _initAsyncPromises;
|
|
26
24
|
private _currentProcessedTask;
|
|
27
25
|
private _whenReadyAsyncCancel;
|
|
26
|
+
private _importPromise;
|
|
28
27
|
/**
|
|
29
28
|
* Name of the frame graph
|
|
30
29
|
*/
|