From 186970bd69d8651de7cbd2b61bc9f660662cbb4c Mon Sep 17 00:00:00 2001 From: Richard Davey Date: Thu, 11 Apr 2019 17:10:03 +0100 Subject: [PATCH] Render the Camera masks --- src/renderer/canvas/CanvasRenderer.js | 12 ++++++++++++ src/renderer/webgl/WebGLRenderer.js | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/renderer/canvas/CanvasRenderer.js b/src/renderer/canvas/CanvasRenderer.js index a88cd33e1..1b0ab9791 100644 --- a/src/renderer/canvas/CanvasRenderer.js +++ b/src/renderer/canvas/CanvasRenderer.js @@ -426,6 +426,13 @@ var CanvasRenderer = new Class({ this.currentContext = ctx; + var mask = camera.mask; + + if (mask) + { + mask.preRenderCanvas(this, null, camera._maskCamera); + } + if (!camera.transparent) { ctx.fillStyle = camera.backgroundColor.rgba; @@ -476,6 +483,11 @@ var CanvasRenderer = new Class({ camera.dirty = false; + if (mask) + { + mask.postRenderCanvas(this); + } + // Restore pre-clip context ctx.restore(); diff --git a/src/renderer/webgl/WebGLRenderer.js b/src/renderer/webgl/WebGLRenderer.js index 686ebdf2d..ed3895562 100644 --- a/src/renderer/webgl/WebGLRenderer.js +++ b/src/renderer/webgl/WebGLRenderer.js @@ -1723,7 +1723,7 @@ var WebGLRenderer = new Class({ if (mask) { - mask.preRenderWebGL(this, null, camera); + mask.preRenderWebGL(this, null, camera._maskCamera); } if (color.alphaGL > 0)