Skip to content

Commit 426bc4f

Browse files
committed
BitmapMaskPipeline jsdoc descriptions
1 parent ef24982 commit 426bc4f

1 file changed

Lines changed: 27 additions & 11 deletions

File tree

src/renderer/webgl/pipelines/BitmapMaskPipeline.js

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,25 @@ var WebGLPipeline = require('../WebGLPipeline');
1212

1313
/**
1414
* @classdesc
15-
* [pending] - explain the config object properties and what they control
15+
* BitmapMaskPipeline handles all bitmap masking rendering in WebGL. It works by using
16+
* sampling two texture on the fragment shader and using the fragment's alpha to clip the region.
17+
* The config properties are:
18+
* - game: Current game instance.
19+
* - renderer: Current WebGL renderer.
20+
* - topology: This indicates how the primitives are rendered. The default value is GL_TRIANGLES.
21+
* Here is the full list of rendering primitives (https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants).
22+
* - vertShader: Source for vertex shader as a string.
23+
* - fragShader: Source for fragment shader as a string.
24+
* - vertexCapacity: The amount of vertices that shall be allocated
25+
* - vertexSize: The size of a single vertex in bytes.
1626
*
1727
* @class BitmapMaskPipeline
1828
* @extends Phaser.Renderer.WebGL.WebGLPipeline
1929
* @memberOf Phaser.Renderer.WebGL.Pipelines
2030
* @constructor
2131
* @since 3.0.0
2232
*
23-
* @param {object} config - [pending]
33+
* @param {object} config - Used for overriding shader an pipeline properties if extending this pipeline.
2434
*/
2535
var BitmapMaskPipeline = new Class({
2636

@@ -58,7 +68,7 @@ var BitmapMaskPipeline = new Class({
5868
});
5969

6070
/**
61-
* [pending]
71+
* Float32 view of the array buffer containing the pipeline's vertices.
6272
*
6373
* @name Phaser.Renderer.WebGL.Pipelines.BitmapMaskPipeline#vertexViewF32
6474
* @type {Float32Array}
@@ -67,7 +77,7 @@ var BitmapMaskPipeline = new Class({
6777
this.vertexViewF32 = new Float32Array(this.vertexData);
6878

6979
/**
70-
* [pending]
80+
* Size of the batch.
7181
*
7282
* @name Phaser.Renderer.WebGL.Pipelines.BitmapMaskPipeline#maxQuads
7383
* @type {number}
@@ -77,7 +87,8 @@ var BitmapMaskPipeline = new Class({
7787
this.maxQuads = 1;
7888

7989
/**
80-
* [pending]
90+
* Dirty flag to check if resolution properties need to be updated on the
91+
* masking shader.
8192
*
8293
* @name Phaser.Renderer.WebGL.Pipelines.BitmapMaskPipeline#resolutionDirty
8394
* @type {boolean}
@@ -88,7 +99,8 @@ var BitmapMaskPipeline = new Class({
8899
},
89100

90101
/**
91-
* [pending]
102+
* Called every time the pipeline needs to be used.
103+
* It binds all necessary resources.
92104
*
93105
* @method Phaser.Renderer.WebGL.Pipelines.BitmapMaskPipeline#onBind
94106
* @since 3.0.0
@@ -133,13 +145,14 @@ var BitmapMaskPipeline = new Class({
133145
},
134146

135147
/**
136-
* [pending]
148+
* Binds necessary resources and renders the mask to a separated framebuffer.
149+
* The framebuffer for the masked object is also bound for further use.
137150
*
138151
* @method Phaser.Renderer.WebGL.Pipelines.BitmapMaskPipeline#beginMask
139152
* @since 3.0.0
140153
*
141-
* @param {Phaser.GameObjects.GameObject} mask - [pending]
142-
* @param {Phaser.GameObjects.GameObject} maskedObject - [pending]
154+
* @param {Phaser.GameObjects.GameObject} mask - GameObject used as mask.
155+
* @param {Phaser.GameObjects.GameObject} maskedObject - GameObject masked by the mask GameObject.
143156
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
144157
*/
145158
beginMask: function (mask, maskedObject, camera)
@@ -170,12 +183,15 @@ var BitmapMaskPipeline = new Class({
170183
},
171184

172185
/**
173-
* [pending]
186+
* The masked game object's framebuffer is unbound and it's texture
187+
* is bound together with the mask texture and the mask shader and
188+
* a draw call with a single quad is processed. Here is where the
189+
* masking effect is applied.
174190
*
175191
* @method Phaser.Renderer.WebGL.Pipelines.BitmapMaskPipeline#endMask
176192
* @since 3.0.0
177193
*
178-
* @param {Phaser.GameObjects.GameObject} mask - [pending]
194+
* @param {Phaser.GameObjects.GameObject} mask - GameObject used as a mask.
179195
*/
180196
endMask: function (mask)
181197
{

0 commit comments

Comments
 (0)