Skip to content

Commit

Permalink
refactor: add isActive in postProcessManager (#2176)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuxudong authored Jul 15, 2024
1 parent 33c4370 commit 5a47030
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/core/src/Camera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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."
);
Expand Down
7 changes: 6 additions & 1 deletion packages/core/src/postProcess/PostProcessManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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);
}

/**
Expand Down

0 comments on commit 5a47030

Please sign in to comment.