Archived
1
0
Fork 0
This repository has been archived on 2025-09-02. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
skcblitz/shaders/rect.fsh
2025-09-02 14:43:36 +02:00

20 lines
589 B
GLSL

out vec4 FragColor;
in vec2 tex_coord;
uniform vec2 size;
uniform sampler2D tex;
uniform bool use_tex;
uniform float border;
uniform vec4 fill_t;
uniform vec4 fill_b;
uniform vec4 border_t;
uniform vec4 border_b;
void main() {
vec2 tex_pos = tex_coord * size;
if(tex_pos.x < border || tex_pos.x > (size.x - border) || tex_pos.y < border || tex_pos.y > (size.y - border))
FragColor = mix(border_t, border_b, tex_coord.y);
else
FragColor = (use_tex ? texture(tex, (tex_coord - (border / size)) * (size / (size - (border * 2.0)))) : vec4(1.0)) * mix(fill_t, fill_b, tex_coord.y);
}