shader/rectangle_frag.glsl

changeset 151
42960d0c879b
parent 137
f8e6e0ae61a8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shader/rectangle_frag.glsl	Sat Jun 14 14:02:16 2025 +0200
@@ -0,0 +1,20 @@
+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