@@ -10,24 +10,25 @@ uniform bool enableTexture;
1010uniform vec4 color;
1111uniform sampler2D texSampler;
1212
13- varying vec2 texCoord[2 ];
13+ varying vec2 texCoord;
14+ varying vec2 tileCoord;
1415
1516void main() {
1617 /* Using the second texture coordinate, compute a mask that's 1.0 when the fragment is inside the surface tile, and
1718 0.0 otherwise. */
18- float sMask = step (0.0 , texCoord[ 1 ] .s) * (1.0 - step (1.0 , texCoord[ 1 ] .s));
19- float tMask = step (0.0 , texCoord[ 1 ] .t) * (1.0 - step (1.0 , texCoord[ 1 ] .t));
19+ float sMask = step (0.0 , tileCoord .s) * (1.0 - step (1.0 , tileCoord .s));
20+ float tMask = step (0.0 , tileCoord .t) * (1.0 - step (1.0 , tileCoord .t));
2021 float tileMask = sMask * tMask;
2122
2223 if (enablePickMode && enableTexture) {
2324 /* Using the first texture coordinate, modulate the RGBA color with the 2D texture's Alpha component (rounded to
2425 0.0 or 1.0). Finally, modulate the result by the tile mask to suppress fragments outside the surface tile. */
25- float texMask = floor (texture2D (texSampler, texCoord[ 0 ] ).a + 0.5 );
26+ float texMask = floor (texture2D (texSampler, texCoord).a + 0.5 );
2627 gl_FragColor = color * texMask * tileMask;
2728 } else if (! enablePickMode && enableTexture) {
2829 /* Using the first texture coordinate, modulate the RGBA color with the 2D texture's RGBA color. Finally,
2930 modulate by the tile mask to suppress fragments outside the surface tile. */
30- gl_FragColor = color * texture2D (texSampler, texCoord[ 0 ] ) * tileMask;
31+ gl_FragColor = color * texture2D (texSampler, texCoord) * tileMask;
3132 } else {
3233 /* Modulate the RGBA color by the tile mask to suppress fragments outside the surface tile. */
3334 gl_FragColor = color * tileMask;
0 commit comments