File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -284,6 +284,7 @@ PIXI.Tilemap.prototype._renderWholeTilemap = function(renderSession)
284284 // set the base offset (in screen units) (it's zero, scrolling is now handled by the batch buffer values)
285285 gl . uniform2f ( shader . uScrollOffset , 0 , 0 ) ;
286286 //gl.uniform2f( shader.uScrollOffset, this.scrollX * iWide, -this.scrollY * iHigh );
287+ gl . uniform1f ( shader . uAlpha , this . alpha ) ;
287288
288289
289290 // check if a texture is dirty..
Original file line number Diff line number Diff line change @@ -32,9 +32,12 @@ PIXI.TilemapShader = function(gl)
3232 this . fragmentSrc = [
3333 " precision lowp float;" ,
3434 " uniform sampler2D uImageSampler;" ,
35+ " uniform float uAlpha;" ,
3536 " varying vec2 vTexCoord;" ,
3637 " void main(void) {" ,
37- " gl_FragColor = texture2D(uImageSampler, vTexCoord);" ,
38+ " vec4 col = texture2D(uImageSampler, vTexCoord);" ,
39+ " col.a = uAlpha;" ,
40+ " gl_FragColor = col;" ,
3841 " }"
3942 ] ;
4043
@@ -79,9 +82,10 @@ PIXI.TilemapShader.prototype.init = function()
7982 this . aPosition = gl . getAttribLocation ( program , 'aPosition' ) ;
8083 this . uSampler = gl . getUniformLocation ( program , 'uImageSampler' ) ;
8184 this . uScrollOffset = gl . getUniformLocation ( program , 'uScrollOffset' ) ;
85+ this . uAlpha = gl . getUniformLocation ( program , 'uAlpha' ) ;
8286
8387 this . attributes = [ this . aPosition , this . uSampler ] ;
84- this . uniforms = [ this . uScrollOffset ] ;
88+ this . uniforms = [ this . uScrollOffset , this . uAlpha ] ;
8589
8690 this . program = program ;
8791} ;
You can’t perform that action at this time.
0 commit comments