diff options
Diffstat (limited to 'source/shaders/ui_text_shader.fs.glsl')
-rw-r--r-- | source/shaders/ui_text_shader.fs.glsl | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/source/shaders/ui_text_shader.fs.glsl b/source/shaders/ui_text_shader.fs.glsl index d8bdcfb..bca9f7a 100644 --- a/source/shaders/ui_text_shader.fs.glsl +++ b/source/shaders/ui_text_shader.fs.glsl @@ -1,12 +1,16 @@ #version 330 core in vec2 TexCoords; -uniform sampler2D Texture; +flat in int Index; +uniform sampler2DArray TextureAtlas; +uniform int TextureMap[32]; uniform vec3 TextColor; out vec4 FragColor; void main() { - vec4 sampled = vec4(1.0, 1.0, 1.0, texture(Texture, TexCoords)); - FragColor = sampled * vec4(TextColor, 1.0); + 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); }; |