@@ -98,10 +98,8 @@ PIXI.PixiShader.prototype.init = function()
9898 'const vec4 PINK = vec4(1.0, 0.0, 1.0, 1.0);' ,
9999 'const vec4 GREEN = vec4(0.0, 1.0, 0.0, 1.0);' ,
100100 'void main(void) {' ,
101- //dynamicIfs,
102- 'if (vTextureIndex == 0.0) gl_FragColor = texture2D(uSamplerArray[0], vTextureCoord) * vColor;' ,
103- 'else if(vTextureIndex == 1.0) gl_FragColor = PINK;' ,
104- 'else gl_FragColor = GREEN;' ,
101+ dynamicIfs ,
102+ 'else gl_FragColor = PINK;' ,
105103 '}'
106104 ] ;
107105
@@ -144,7 +142,7 @@ PIXI.PixiShader.prototype.init = function()
144142 this . colorAttribute = 2 ;
145143 }
146144
147- this . attributes = [ this . aVertexPosition , this . aTextureCoord , this . colorAttribute ] ;
145+ this . attributes = [ this . aVertexPosition , this . aTextureCoord , this . colorAttribute , this . aTextureIndex ] ;
148146
149147 // End worst hack eva //
150148
@@ -417,6 +415,7 @@ PIXI.PixiShader.defaultVertexSrc = [
417415 'const vec2 center = vec2(-1.0, 1.0);' ,
418416
419417 'void main(void) {' ,
418+ ' if (aTextureIndex > 0.0) gl_Position = vec4(0.0);' ,
420419 ' gl_Position = vec4( ((aVertexPosition + offsetVector) / projectionVector) + center , 0.0, 1.0);' ,
421420 ' vTextureCoord = aTextureCoord;' ,
422421 ' vColor = vec4(aColor.rgb * aColor.a, aColor.a);' ,
0 commit comments