@@ -633,13 +633,11 @@ var TextureTintPipeline = new Class({
633633 ty3 = Math . round ( ty3 ) ;
634634 }
635635
636- // Adds texture to batch (if not present)
637636 this . setTexture2D ( texture , 0 ) ;
638637
639638 var tintEffect = ( sprite . _isTinted && sprite . tintFill ) ;
640639
641- // Flushes batch if full, which can take the texture batch with it
642- this . batchQuad ( tx0 , ty0 , tx1 , ty1 , tx2 , ty2 , tx3 , ty3 , u0 , v0 , u1 , v1 , tintTL , tintTR , tintBL , tintBR , tintEffect ) ;
640+ this . batchQuad ( tx0 , ty0 , tx1 , ty1 , tx2 , ty2 , tx3 , ty3 , u0 , v0 , u1 , v1 , tintTL , tintTR , tintBL , tintBR , tintEffect , texture , 0 ) ;
643641 } ,
644642
645643 /**
@@ -679,10 +677,12 @@ var TextureTintPipeline = new Class({
679677 * @param {number } tintBL - The bottom-left tint color value.
680678 * @param {number } tintBR - The bottom-right tint color value.
681679 * @param {(number|boolean) } tintEffect - The tint effect for the shader to use.
680+ * @param {WebGLTexture } [texture] - WebGLTexture that will be assigned to the current batch if a flush occurs.
681+ * @param {integer } [unit=0] - Texture unit to which the texture needs to be bound.
682682 *
683683 * @return {boolean } `true` if this method caused the batch to flush, otherwise `false`.
684684 */
685- batchQuad : function ( x0 , y0 , x1 , y1 , x2 , y2 , x3 , y3 , u0 , v0 , u1 , v1 , tintTL , tintTR , tintBL , tintBR , tintEffect )
685+ batchQuad : function ( x0 , y0 , x1 , y1 , x2 , y2 , x3 , y3 , u0 , v0 , u1 , v1 , tintTL , tintTR , tintBL , tintBR , tintEffect , texture , unit )
686686 {
687687 var hasFlushed = false ;
688688
@@ -691,6 +691,8 @@ var TextureTintPipeline = new Class({
691691 this . flush ( ) ;
692692
693693 hasFlushed = true ;
694+
695+ this . setTexture2D ( texture , unit ) ;
694696 }
695697
696698 var vertexViewF32 = this . vertexViewF32 ;
@@ -777,17 +779,21 @@ var TextureTintPipeline = new Class({
777779 * @param {number } tintTR - The top-right tint color value.
778780 * @param {number } tintBL - The bottom-left tint color value.
779781 * @param {(number|boolean) } tintEffect - The tint effect for the shader to use.
782+ * @param {WebGLTexture } [texture] - WebGLTexture that will be assigned to the current batch if a flush occurs.
783+ * @param {integer } [unit=0] - Texture unit to which the texture needs to be bound.
780784 *
781785 * @return {boolean } `true` if this method caused the batch to flush, otherwise `false`.
782786 */
783- batchTri : function ( x1 , y1 , x2 , y2 , x3 , y3 , u0 , v0 , u1 , v1 , tintTL , tintTR , tintBL , tintEffect )
787+ batchTri : function ( x1 , y1 , x2 , y2 , x3 , y3 , u0 , v0 , u1 , v1 , tintTL , tintTR , tintBL , tintEffect , texture , unit )
784788 {
785789 var hasFlushed = false ;
786790
787791 if ( this . vertexCount + 3 > this . vertexCapacity )
788792 {
789793 this . flush ( ) ;
790794
795+ this . setTexture2D ( texture , unit ) ;
796+
791797 hasFlushed = true ;
792798 }
793799
@@ -1002,7 +1008,7 @@ var TextureTintPipeline = new Class({
10021008
10031009 this . setTexture2D ( texture , 0 ) ;
10041010
1005- this . batchQuad ( tx0 , ty0 , tx1 , ty1 , tx2 , ty2 , tx3 , ty3 , u0 , v0 , u1 , v1 , tintTL , tintTR , tintBL , tintBR , tintEffect ) ;
1011+ this . batchQuad ( tx0 , ty0 , tx1 , ty1 , tx2 , ty2 , tx3 , ty3 , u0 , v0 , u1 , v1 , tintTL , tintTR , tintBL , tintBR , tintEffect , texture , 0 ) ;
10061012 } ,
10071013
10081014 /**
@@ -1060,7 +1066,7 @@ var TextureTintPipeline = new Class({
10601066
10611067 tint = Utils . getTintAppendFloatAlpha ( tint , alpha ) ;
10621068
1063- this . batchQuad ( tx0 , ty0 , tx1 , ty1 , tx2 , ty2 , tx3 , ty3 , frame . u0 , frame . v0 , frame . u1 , frame . v1 , tint , tint , tint , tint , 0 ) ;
1069+ this . batchQuad ( tx0 , ty0 , tx1 , ty1 , tx2 , ty2 , tx3 , ty3 , frame . u0 , frame . v0 , frame . u1 , frame . v1 , tint , tint , tint , tint , 0 , frame . glTexture , 0 ) ;
10641070 } ,
10651071
10661072 /**
0 commit comments