summaryrefslogtreecommitdiff
path: root/shaders/decor.frag.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'shaders/decor.frag.glsl')
-rw-r--r--shaders/decor.frag.glsl13
1 files changed, 13 insertions, 0 deletions
diff --git a/shaders/decor.frag.glsl b/shaders/decor.frag.glsl
index 3e2c286f..bb1ef0d6 100644
--- a/shaders/decor.frag.glsl
+++ b/shaders/decor.frag.glsl
@@ -8,6 +8,8 @@
// colour rides in the cell's ground (a_bg), its coverage in a_fg.r, so the
// result is the overlay pipeline's exactly.
//
+// Checker (flag 0x08000000): two colours in squares, or in stripes, see main.
+//
// Soft (flag 0x10000000): a rectangle's shadow, rim or glow blurred by a Gaussian,
// in closed form (the product of two erf edges), on one quad grown by 3
// sigma: no blur pass. Everything is in the quad's own 0..1 space, so a
@@ -51,6 +53,17 @@ void main() {
if (v_clip.z >= v_clip.x && (gl_FragCoord.x < v_clip.x || gl_FragCoord.x >= v_clip.z ||
gl_FragCoord.y < v_clip.y || gl_FragCoord.y >= v_clip.w)) discard;
float opacity = clamp(u_ui.background_opacity, 0.0, 1.0);
+ // Checker (flag 0x08000000): squares of v_uv.x pixels from the quad's
+ // own corner, so it moves with its rail, in the ground's colour and the
+ // ink's (lapis's scroll track).
+ vec2 in_quad = v_cell_uv / max(vec2(dFdx(v_cell_uv.x), dFdy(v_cell_uv.y)), vec2(1e-6));
+ if ((v_effect.x & 0x08000000u) != 0u) {
+ ivec2 q = ivec2(floor(in_quad / max(v_uv.x, 1.0)));
+ // v_uv.y set: stripes across the quad (lapis's title bar), not squares.
+ int k = v_uv.y > 0.5 ? q.y : q.x + q.y;
+ o_col = vec4(((k & 1) == 0 ? v_bg : v_fg) * opacity, 1.0);
+ return;
+ }
if ((v_effect.x & 0x10000000u) == 0u) {
o_col = vec4(v_bg * opacity, v_fg.r);
return;