@@ -46,6 +46,7 @@ var RenderPass = new Class({
4646 this . renderTexture = null ;
4747 this . passShader = null ;
4848 this . uniforms = { } ;
49+ this . textures = { } ;
4950
5051 if ( resourceManager !== undefined )
5152 {
@@ -113,6 +114,37 @@ var RenderPass = new Class({
113114 {
114115 this . renderer . setRenderer ( this . renderer . spriteBatch , null , null ) ;
115116 this . renderer . spriteBatch . addSprite ( gameObject , camera ) ;
117+ for ( var key in this . textures )
118+ {
119+ var textureData = this . textures [ key ] ;
120+ this . setInt ( key , textureData . unit ) ;
121+ gl . activeTexture ( gl . TEXTURE0 + textureData . unit ) ;
122+ gl . bindTexture ( gl . TEXTURE_2D , textureData . texture ) ;
123+ gl . activeTexture ( gl . TEXTURE0 ) ;
124+ }
125+ this . renderer . spriteBatch . flush ( this . passShader , this . passRenderTarget . framebufferObject ) ;
126+ }
127+ } ,
128+
129+ renderRect : function ( x , y , width , height , camera )
130+ {
131+ var gl = this . renderer . gl ;
132+
133+ if ( gl )
134+ {
135+ this . renderer . setRenderer ( this . renderer . spriteBatch , null , null ) ;
136+ this . renderer . spriteBatch . addTileTextureRect (
137+ null , x , y , width , height , 1.0 , 0xFFFFFFFF , this . scrollFactorX , this . scrollFactorY ,
138+ width , height , 0 , 0 , width , height , camera , null
139+ ) ;
140+ for ( var key in this . textures )
141+ {
142+ var textureData = this . textures [ key ] ;
143+ this . setInt ( key , textureData . unit ) ;
144+ gl . activeTexture ( gl . TEXTURE0 + textureData . unit ) ;
145+ gl . bindTexture ( gl . TEXTURE_2D , textureData . texture ) ;
146+ gl . activeTexture ( gl . TEXTURE0 ) ;
147+ }
116148 this . renderer . spriteBatch . flush ( this . passShader , this . passRenderTarget . framebufferObject ) ;
117149 }
118150 } ,
@@ -125,10 +157,11 @@ var RenderPass = new Class({
125157 {
126158 /* Texture 1 is reserved for Phasers Main Renderer */
127159 unit = ( unit > 0 ) ? unit : 1 ;
128- this . setInt ( samplerName , unit ) ;
129- gl . activeTexture ( gl . TEXTURE0 + unit ) ;
130- gl . bindTexture ( gl . TEXTURE_2D , renderTexture . texture ) ;
131- gl . activeTexture ( gl . TEXTURE0 ) ;
160+ this . textures [ samplerName ] = { texture : renderTexture . texture , unit : unit } ;
161+ //this.setInt(samplerName, unit);
162+ //gl.activeTexture(gl.TEXTURE0 + unit);
163+ //gl.bindTexture(gl.TEXTURE_2D, renderTexture.texture);
164+ //gl.activeTexture(gl.TEXTURE0);
132165 }
133166 } ,
134167
0 commit comments