summaryrefslogtreecommitdiff
path: root/assets
diff options
context:
space:
mode:
Diffstat (limited to 'assets')
-rw-r--r--assets/text.glsl38
1 files changed, 38 insertions, 0 deletions
diff --git a/assets/text.glsl b/assets/text.glsl
index e69de29..3b6ed18 100644
--- a/assets/text.glsl
+++ b/assets/text.glsl
@@ -0,0 +1,38 @@
+@header #include "cglm/cglm.h"
+
+@vs vs_text
+in vec2 in_position;
+in vec2 in_uv;
+
+layout(binding = 0) uniform vs_text_params {
+ mat4 mvp;
+ vec4 color;
+}
+
+out vec2 out_uv;
+out vec4 out_color;
+
+void main() {
+ gl_Position = mvp * vec4(in_position, 0.0, 1.0);
+ out_uv = in_uv;
+ out_color = color;
+}
+
+@end
+
+@fs fs_text
+layout(binding = 0) uniform texture2D u_texture;
+layout(binding = 1) uniform sampler u_sampler;
+
+in vec2 in_uv;
+in vec4 in_color;
+
+out vec4 out_color;
+
+void main() {
+ float alpha = texture(sampler2D(u_texture, u_sampler), in_uv).r;
+ out_color = vec4(in_color.rgb, in_color.a * alpha);
+}
+
+@end
+@program text vs_text fs_text \ No newline at end of file