diff options
| author | Fabrice <fabrice@schaub-dev.xyz> | 2026-02-12 16:37:43 +0100 |
|---|---|---|
| committer | Fabrice <fabrice@schaub-dev.xyz> | 2026-02-12 16:37:43 +0100 |
| commit | 8829759b77259e0c8cfb033f66ccbde0eb481471 (patch) | |
| tree | b4c883e6cc57022f6564e44f6a58ecb9cc445c2c /assets/text_shader.glsl | |
| parent | ee1d1eb500349423599c3a317d97dd5fe0d75580 (diff) | |
rename
Diffstat (limited to 'assets/text_shader.glsl')
| -rw-r--r-- | assets/text_shader.glsl | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/assets/text_shader.glsl b/assets/text_shader.glsl new file mode 100644 index 0000000..3b6ed18 --- /dev/null +++ b/assets/text_shader.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 |
