Skip to content

Commit 380d4af

Browse files
committed
Swapping to new camera effects system
1 parent 855f38c commit 380d4af

2 files changed

Lines changed: 7 additions & 35 deletions

File tree

src/renderer/canvas/CanvasRenderer.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -443,19 +443,8 @@ var CanvasRenderer = new Class({
443443
ctx.setTransform(1, 0, 0, 1, 0, 0);
444444
ctx.globalCompositeOperation = 'source-over';
445445

446-
if (camera._fadeAlpha > 0)
447-
{
448-
// fade rendering
449-
ctx.fillStyle = 'rgba(' + (camera._fadeRed * 255) + ',' + (camera._fadeGreen * 255) + ',' + (camera._fadeBlue * 255) + ',' + camera._fadeAlpha + ')';
450-
ctx.fillRect(camera.x, camera.y, camera.width, camera.height);
451-
}
452-
453-
if (camera._flashAlpha > 0)
454-
{
455-
// flash rendering
456-
ctx.fillStyle = 'rgba(' + (camera._flashRed * 255) + ',' + (camera._flashGreen * 255) + ',' + (camera._flashBlue * 255) + ',' + camera._flashAlpha + ')';
457-
ctx.fillRect(camera.x, camera.y, camera.width, camera.height);
458-
}
446+
camera.effects.flash.postRenderCanvas(ctx);
447+
camera.effects.fade.postRenderCanvas(ctx);
459448

460449
// Reset the camera scissor
461450
if (scissor)

src/renderer/webgl/WebGLRenderer.js

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1402,30 +1402,13 @@ var WebGLRenderer = new Class({
14021402
*/
14031403
postRenderCamera: function (camera)
14041404
{
1405-
if (camera._fadeAlpha > 0 || camera._flashAlpha > 0)
1406-
{
1407-
var FlatTintPipeline = this.pipelines.FlatTintPipeline;
1408-
1409-
// Fade
1410-
FlatTintPipeline.batchFillRect(
1411-
0, 0, 1, 1, 0,
1412-
camera.x, camera.y, camera.width, camera.height,
1413-
Utils.getTintFromFloats(camera._fadeRed, camera._fadeGreen, camera._fadeBlue, 1.0),
1414-
camera._fadeAlpha,
1415-
1, 0, 0, 1, 0, 0,
1416-
[ 1, 0, 0, 1, 0, 0 ]
1417-
);
1405+
var FlatTintPipeline = this.pipelines.FlatTintPipeline;
14181406

1419-
// Flash
1420-
FlatTintPipeline.batchFillRect(
1421-
0, 0, 1, 1, 0,
1422-
camera.x, camera.y, camera.width, camera.height,
1423-
Utils.getTintFromFloats(camera._flashRed, camera._flashGreen, camera._flashBlue, 1.0),
1424-
camera._flashAlpha,
1425-
1, 0, 0, 1, 0, 0,
1426-
[ 1, 0, 0, 1, 0, 0 ]
1427-
);
1407+
var isFlashing = camera.effects.flash.postRenderWebGL(FlatTintPipeline, Utils.getTintFromFloats);
1408+
var isFading = camera.effects.fade.postRenderWebGL(FlatTintPipeline, Utils.getTintFromFloats);
14281409

1410+
if (isFading || isFlashing)
1411+
{
14291412
FlatTintPipeline.flush();
14301413
}
14311414

0 commit comments

Comments
 (0)