summaryrefslogtreecommitdiff
path: root/source/shaders/ui_text_shader.fs.glsl
blob: bca9f7aaa93b21987d9634f1e3cec4abaffe2ca3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#version 330 core

in vec2 TexCoords;
flat in int Index;
uniform sampler2DArray TextureAtlas;
uniform int TextureMap[32];
uniform vec3 TextColor;
out vec4 FragColor;

void main() {
  int TextureId = TextureMap[Index];
  vec3 TextureIndexCoords = vec3(TexCoords.xy, TextureId);
  vec4 sampled = vec4(1.0, 1.0, 1.0, texture(TextureAtlas, TextureIndexCoords).r);
  FragColor = sampled * vec4(TextColor, 1);
};