Skip to content

Commit 1f72355

Browse files
committed
Fixed issue with disabled vertex attribute
1 parent 601573b commit 1f72355

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

src/pixi/renderers/webgl/shaders/PixiShader.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)