I can now apply shaders to any GUI element, but I need a shader manager that will allow for hot reloading and tracking input/output variables.

This commit is contained in:
Zed A. Shaw 2025-04-13 15:17:08 -04:00
parent 80b4faf940
commit a5b8e411e3
8 changed files with 121 additions and 16 deletions

22
shaders/ui_shader.frag Normal file
View file

@ -0,0 +1,22 @@
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_duration;
uniform float u_time;
uniform float u_time_end;
uniform sampler2D texture;
uniform bool is_shape;
void main() {
if(is_shape) {
float tick = (u_time_end - u_time) / u_duration;
float blink = smoothstep(1.0, 0.5, tick);
vec4 color = vec4(blink, blink, blink, 1.0);
gl_FragColor = gl_Color * color;
} else {
vec4 pixel = texture2D(texture, gl_TexCoord[0].xy);
float tick = (u_time_end - u_time) / u_duration;
float blink = smoothstep(1.0, 0.5, tick);
vec4 color = vec4(blink, blink, blink, 1.0);
gl_FragColor = gl_Color * color * pixel;
}
}