frag.glsl (603B)
1 #version 460 core 2 3 out vec4 colour; 4 5 in VS_OUT { 6 vec2 tex_coord; 7 flat int index; 8 } fs_in; 9 10 uniform sampler2DArray u_texslot; 11 uniform int u_charmap[512]; 12 uniform vec2 u_texscale[512]; 13 uniform uvec2 u_texcolour[512]; 14 15 void main() 16 { 17 vec4 fg = unpackUnorm4x8(u_texcolour[fs_in.index].x).wzyx; 18 vec4 bg = unpackUnorm4x8(u_texcolour[fs_in.index].y).wzyx; 19 20 vec3 tex_coord = vec3(fs_in.tex_coord.xy, u_charmap[fs_in.index]); 21 tex_coord.xy *= u_texscale[fs_in.index]; 22 23 float a = u_texscale[fs_in.index].x == 0 ? 0 : texture(u_texslot, tex_coord).r; 24 colour = mix(bg, fg, a); 25 }