From 5a47030ea480c9a5f743ccac797970d02884a133 Mon Sep 17 00:00:00 2001 From: zhuxudong Date: Mon, 15 Jul 2024 17:02:49 +0800 Subject: [PATCH] refactor: add `isActive` in postProcessManager (#2176) --- packages/core/src/Camera.ts | 6 +++++- packages/core/src/postProcess/PostProcessManager.ts | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/core/src/Camera.ts b/packages/core/src/Camera.ts index d2ecd294b9..de6f78a562 100644 --- a/packages/core/src/Camera.ts +++ b/packages/core/src/Camera.ts @@ -825,7 +825,11 @@ export class Camera extends Component { } private _checkMainCanvasAntialiasWaste(): void { - if (this.independentCanvasEnabled && Vector4.equals(this._viewport, PipelineUtils.defaultViewport)) { + if ( + this._phasedActiveInScene && + this.independentCanvasEnabled && + Vector4.equals(this._viewport, PipelineUtils.defaultViewport) + ) { Logger.warn( "Camera use independent canvas and viewport cover the whole screen, it is recommended to disable antialias, depth and stencil to save memory when create engine." ); diff --git a/packages/core/src/postProcess/PostProcessManager.ts b/packages/core/src/postProcess/PostProcessManager.ts index b973aecd36..46819d7319 100644 --- a/packages/core/src/postProcess/PostProcessManager.ts +++ b/packages/core/src/postProcess/PostProcessManager.ts @@ -12,6 +12,11 @@ import { BloomEffect, TonemappingEffect } from "./effects"; export class _PostProcessManager { static readonly UBER_SHADER_NAME = "UberPost"; + /** + * Whether the post process manager is active. + */ + isActive = true; + /** @internal */ _uberMaterial: Material; /** @internal */ @@ -23,7 +28,7 @@ export class _PostProcessManager { * Whether has active post process effect. */ get hasActiveEffect(): boolean { - return this._bloomEffect.enabled || this._tonemappingEffect.enabled; + return this.isActive && (this._bloomEffect.enabled || this._tonemappingEffect.enabled); } /**