shader/rectangle_frag.glsl

Sun, 15 Jun 2025 19:50:51 +0200

author
Mike Becker <universe@uap-core.de>
date
Sun, 15 Jun 2025 19:50:51 +0200
changeset 153
4116e2bd501b
parent 151
42960d0c879b
child 157
d6c2f028d8c9
permissions
-rw-r--r--

since we cannot pass NULL strings anyway, we do not need cxstring

layout(location = 0) out vec4 diffuse;
in vec2 uvcoord;

uniform vec4 color;
uniform vec2 size;
#ifndef FILL
uniform float thickness;
#endif

void main(void) {
#ifdef FILL
    diffuse = color;
#else
    if (uvcoord.x < thickness || uvcoord.x >= size.x - thickness || uvcoord.y < thickness || uvcoord.y >= size.y-thickness) {
        diffuse = color;
    } else {
        discard;
    }
#endif
}

mercurial