main_f.glsl (482B)
1 #version 300 es 2 3 // NOTE(amin): this is necessary for webgl compat 4 precision highp float; 5 precision highp sampler2DArray; 6 7 // TODO: dynamically insert the version header after loading the file 8 9 in vec4 vertex_color; 10 in vec2 tex_coord; 11 12 out vec4 frag_color; 13 14 uniform float tex_interp; 15 uniform sampler2DArray tileset; 16 uniform float tile_id; 17 18 void main() 19 { 20 vec4 tile_texel = texture(tileset, vec3(tex_coord, tile_id)); 21 frag_color = mix(vertex_color, tile_texel, tex_interp); 22 }