summaryrefslogtreecommitdiff
path: root/source/shaders/ui_text.fs.glsl
diff options
context:
space:
mode:
authortalha <sarcxd@gmail.com>2024-10-08 21:15:38 +0500
committertalha <sarcxd@gmail.com>2024-10-08 21:15:38 +0500
commit7c0ca92da0d2d0fd7e7f4da957ef7d1ea9f15e41 (patch)
treec5db10f770781a2a7bff76ef9330de4779416eb6 /source/shaders/ui_text.fs.glsl
Saving draft, added collision detection so far
Diffstat (limited to 'source/shaders/ui_text.fs.glsl')
-rwxr-xr-xsource/shaders/ui_text.fs.glsl15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/shaders/ui_text.fs.glsl b/source/shaders/ui_text.fs.glsl
new file mode 100755
index 0000000..ca2c249
--- /dev/null
+++ b/source/shaders/ui_text.fs.glsl
@@ -0,0 +1,15 @@
+#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);
+};