Skip to content

Commit 5224985

Browse files
committed
Update BitmapMaskPipeline.js
1 parent bd19929 commit 5224985

1 file changed

Lines changed: 15 additions & 70 deletions

File tree

src/renderer/webgl/pipelines/BitmapMaskPipeline.js

Lines changed: 15 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,23 @@ var WebGLPipeline = require('../WebGLPipeline');
1414
/**
1515
* @classdesc
1616
*
17+
* The Bitmap Mask Pipeline handles all of the bitmap mask rendering in WebGL for applying
18+
* alpha masks to Game Objects. It works by sampling two texture on the fragment shader and
19+
* using the fragments alpha to clip the region.
1720
*
21+
* The fragment shader it uses can be found in `shaders/src/BitmapMask.frag`.
22+
* The vertex shader it uses can be found in `shaders/src/BitmapMask.vert`.
1823
*
19-
* BitmapMaskPipeline handles all bitmap masking rendering in WebGL. It works by using
20-
* sampling two texture on the fragment shader and using the fragment's alpha to clip the region.
24+
* The default shader attributes for this pipeline are:
25+
*
26+
* `inPosition` (vec2, offset 0)
27+
*
28+
* The default shader uniforms for this pipeline are:
29+
*
30+
* `uResolution` (vec2)
31+
* `uMainSampler` (sampler2D)
32+
* `uMaskSampler` (sampler2D)
33+
* `uInvertMaskAlpha` (bool)
2134
*
2235
* @class BitmapMaskPipeline
2336
* @extends Phaser.Renderer.WebGL.WebGLPipeline
@@ -53,55 +66,8 @@ var BitmapMaskPipeline = new Class({
5366
]);
5467

5568
WebGLPipeline.call(this, config);
56-
57-
/**
58-
* Float32 view of the array buffer containing the pipeline's vertices.
59-
*
60-
* @name Phaser.Renderer.WebGL.Pipelines.BitmapMaskPipeline#vertexViewF32
61-
* @type {Float32Array}
62-
* @since 3.0.0
63-
*/
64-
// this.vertexViewF32 = new Float32Array(this.vertexData);
65-
66-
/**
67-
* Dirty flag to check if resolution properties need to be updated on the
68-
* masking shader.
69-
*
70-
* @name Phaser.Renderer.WebGL.Pipelines.BitmapMaskPipeline#resolutionDirty
71-
* @type {boolean}
72-
* @default true
73-
* @since 3.0.0
74-
*/
75-
// this.resolutionDirty = true;
7669
},
7770

78-
/**
79-
* Called every time the pipeline needs to be used.
80-
* It binds all necessary resources.
81-
*
82-
* @method Phaser.Renderer.WebGL.Pipelines.BitmapMaskPipeline#onBind
83-
* @since 3.0.0
84-
*
85-
* @return {this} This WebGLPipeline instance.
86-
onBind: function ()
87-
{
88-
WebGLPipeline.prototype.onBind.call(this);
89-
90-
var renderer = this.renderer;
91-
var program = this.program;
92-
93-
if (this.resolutionDirty)
94-
{
95-
renderer.setFloat2(program, 'uResolution', this.width, this.height);
96-
renderer.setInt1(program, 'uMainSampler', 0);
97-
renderer.setInt1(program, 'uMaskSampler', 1);
98-
this.resolutionDirty = false;
99-
}
100-
101-
return this;
102-
},
103-
*/
104-
10571
/**
10672
* Called every time the pipeline is bound by the renderer.
10773
* Sets the shader program, vertex buffer and other resources.
@@ -130,27 +96,6 @@ var BitmapMaskPipeline = new Class({
13096
return this;
13197
},
13298

133-
/**
134-
* Resizes this pipeline and updates the projection.
135-
*
136-
* @method Phaser.Renderer.WebGL.Pipelines.BitmapMaskPipeline#resize
137-
* @since 3.0.0
138-
*
139-
* @param {number} width - The new width.
140-
* @param {number} height - The new height.
141-
* @param {number} resolution - The resolution.
142-
*
143-
* @return {this} This WebGLPipeline instance.
144-
*/
145-
resize: function (width, height, resolution)
146-
{
147-
WebGLPipeline.prototype.resize.call(this, width, height, resolution);
148-
149-
this.resolutionDirty = true;
150-
151-
return this;
152-
},
153-
15499
/**
155100
* Binds necessary resources and renders the mask to a separated framebuffer.
156101
* The framebuffer for the masked object is also bound for further use.

0 commit comments

Comments
 (0)