summaryrefslogtreecommitdiff
path: root/data/shaders/path-stroke-frag.glsl
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2023-12-30 19:32:19 -0500
committerDavid Thompson <dthompson2@worcester.edu>2024-07-24 21:54:32 -0400
commit76dc3f0af36775d2fdaab61134dd0f875ee48292 (patch)
tree33fe349038005f7e5f733856895903257a448b54 /data/shaders/path-stroke-frag.glsl
parent41e7e7152a66f40f3a23439fb0ea4b2b03acbf1c (diff)
WIP graphics engine rewrite.
Diffstat (limited to 'data/shaders/path-stroke-frag.glsl')
-rw-r--r--data/shaders/path-stroke-frag.glsl18
1 files changed, 16 insertions, 2 deletions
diff --git a/data/shaders/path-stroke-frag.glsl b/data/shaders/path-stroke-frag.glsl
index 9682c8f..324e3cf 100644
--- a/data/shaders/path-stroke-frag.glsl
+++ b/data/shaders/path-stroke-frag.glsl
@@ -14,6 +14,7 @@ in vec2 fragTex;
in float fragStrokeLength;
#endif
+#ifdef GLSL120
uniform vec4 color;
uniform float feather;
uniform int strokeClosed;
@@ -21,6 +22,19 @@ uniform float strokeWidth;
uniform int strokeCap;
uniform int strokeMiterStyle;
uniform float strokeMiterLimit;
+#else
+layout (std140) uniform Stroke
+{
+ mat4 mvp;
+ vec4 color;
+ float feather;
+ float strokeWidth;
+ float strokeMiterLimit;
+ int strokeClosed;
+ int strokeCap;
+ int strokeMiterStyle;
+};
+#endif
float infinity = 1.0 / 0.0;
@@ -47,7 +61,7 @@ void main(void) {
if (strokeCap == 0) { // none
d = infinity;
- } else if (strokeCap == 1) { // butt
+ } else if (strokeCap == 1) { // butt (huh huh)
d = max(dx + hw - 2 * feather, dy);
} else if (strokeCap == 2) { // square
d = max(dx, dy);
@@ -58,7 +72,7 @@ void main(void) {
} else if (strokeCap == 5) { // triangle in
d = max(dy, hw - feather + dx - dy);
}
- // Stroke inner/join
+ // Stroke inner/join
} else {
d = abs(v);
}