11var RenderTextureWebGL = {
22
3- fill : function ( rgb )
3+ fill : function ( rgb , alpha )
44 {
5+ if ( alpha === undefined ) { alpha = 1 ; }
6+
57 var ur = ( ( rgb >> 16 ) | 0 ) & 0xff ;
68 var ug = ( ( rgb >> 8 ) | 0 ) & 0xff ;
79 var ub = ( rgb | 0 ) & 0xff ;
810
911 this . renderer . setFramebuffer ( this . framebuffer ) ;
1012 var gl = this . gl ;
11- gl . clearColor ( ur / 255.0 , ug / 255.0 , ub / 255.0 , 1 ) ;
13+ gl . clearColor ( ur / 255.0 , ug / 255.0 , ub / 255.0 , alpha ) ;
1214 gl . clear ( gl . COLOR_BUFFER_BIT ) ;
1315 this . renderer . setFramebuffer ( null ) ;
1416 return this ;
@@ -24,23 +26,28 @@ var RenderTextureWebGL = {
2426 return this ;
2527 } ,
2628
27- draw : function ( texture , frame , x , y )
29+ draw : function ( texture , frame , x , y , tint )
2830 {
29- var glTexture = texture . source [ frame . sourceIndex ] . glTexture ;
30-
31- var tint = ( this . globalTint >> 16 ) + ( this . globalTint & 0xff00 ) + ( ( this . globalTint & 0xff ) << 16 ) ;
31+ if ( tint === undefined )
32+ {
33+ tint = ( this . globalTint >> 16 ) + ( this . globalTint & 0xff00 ) + ( ( this . globalTint & 0xff ) << 16 ) ;
34+ }
35+ else
36+ {
37+ tint = ( tint >> 16 ) + ( tint & 0xff00 ) + ( ( tint & 0xff ) << 16 ) ;
38+ }
3239
3340 this . renderer . setFramebuffer ( this . framebuffer ) ;
3441
35- var ttp = this . renderer . pipelines . TextureTintPipeline ;
42+ var pipeline = this . pipeline ;
3643
37- ttp . projOrtho ( 0 , ttp . width , 0 , ttp . height , - 1000.0 , 1000.0 ) ;
44+ pipeline . projOrtho ( 0 , pipeline . width , 0 , pipeline . height , - 1000.0 , 1000.0 ) ;
3845
39- ttp . drawTexture ( glTexture , x , y , tint , this . globalAlpha , frame . cutX , frame . cutY , frame . cutWidth , frame . cutHeight , this . currentMatrix , null , this ) ;
46+ pipeline . drawTextureFrame ( frame , x , y , tint , this . globalAlpha , this . currentMatrix , null ) ;
4047
4148 this . renderer . setFramebuffer ( null ) ;
4249
43- ttp . projOrtho ( 0 , ttp . width , ttp . height , 0 , - 1000.0 , 1000.0 ) ;
50+ pipeline . projOrtho ( 0 , pipeline . width , pipeline . height , 0 , - 1000.0 , 1000.0 ) ;
4451
4552 return this ;
4653 }
0 commit comments