Skip to content

Commit 07c63a1

Browse files
mvaligurskyMartin Valigursky
andauthored
[Fix] Handle CameraFrame script changing enabled state (playcanvas#7282)
* [Fix] Handle CameraFrame script changing enabled state * lint --------- Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>
1 parent 1cc91fc commit 07c63a1

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

scripts/utils/camera-frame.mjs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const RenderFormat = {
3030

3131
/** @enum {string} */
3232
const DebugType = {
33-
NONE: '',
33+
NONE: 'none',
3434
SCENE: 'scene',
3535
SSAO: 'ssao',
3636
BLOOM: 'bloom',
@@ -367,6 +367,10 @@ class CameraFrame extends Script {
367367
this.on('destroy', () => {
368368
this.engineCameraFrame.destroy();
369369
});
370+
371+
this.on('state', (enabled) => {
372+
this.engineCameraFrame.enabled = enabled;
373+
});
370374
}
371375

372376
postUpdate(dt) {

src/extras/render-passes/camera-frame.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Debug } from '../../core/debug.js';
22
import { Color } from '../../core/math/color.js';
33
import { math } from '../../core/math/math.js';
44
import { PIXELFORMAT_111110F, PIXELFORMAT_RGBA16F, PIXELFORMAT_RGBA32F } from '../../platform/graphics/constants.js';
5+
import { GAMMA_SRGB } from '../../scene/constants.js';
56
import { SSAOTYPE_NONE } from './constants.js';
67
import { CameraFrameOptions, RenderPassCameraFrame } from './render-pass-camera-frame.js';
78

@@ -330,6 +331,9 @@ class CameraFrame {
330331
cameraComponent.rendering = null;
331332

332333
cameraComponent.jitter = 0;
334+
335+
// no longer HDR rendering
336+
cameraComponent.gammaCorrection = GAMMA_SRGB;
333337
}
334338
}
335339

0 commit comments

Comments
 (0)