mirror of
https://github.com/photonstorm/phaser
synced 2024-11-28 07:31:11 +00:00
Merge pull request #4301 from tfelix/feat-invert-geo-mask
Adds invertAlpha flag to GeometryMask
This commit is contained in:
commit
87a83d4ff8
1 changed files with 23 additions and 4 deletions
|
@ -36,6 +36,16 @@ var GeometryMask = new Class({
|
|||
* @since 3.0.0
|
||||
*/
|
||||
this.geometryMask = graphicsGeometry;
|
||||
|
||||
/**
|
||||
* Similiar to the BitmapMasks invertAlpha setting this to true will then hide all pixels
|
||||
* drawn to the Geometry Mask.
|
||||
*
|
||||
* @name Phaser.Display.Masks.GeometryMask#invertAlpha
|
||||
* @type {boolean}
|
||||
* @since 3.16.0
|
||||
*/
|
||||
this.invertAlpha = false;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -82,7 +92,16 @@ var GeometryMask = new Class({
|
|||
|
||||
// Use stencil buffer to affect next rendering object
|
||||
gl.colorMask(true, true, true, true);
|
||||
gl.stencilFunc(gl.EQUAL, 1, 1);
|
||||
|
||||
if (this.invertAlpha)
|
||||
{
|
||||
gl.stencilFunc(gl.NOTEQUAL, 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
gl.stencilFunc(gl.EQUAL, 1, 1);
|
||||
}
|
||||
|
||||
gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP);
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue