git.lucas.co / cce-ui
GPU-accelerated UI toolkit (Vulkan)
git clone https://git.lucas.co/cce-ui.git

commit6e80c9ba244c6ff16187188a421ef841e2287386
parent769f385738
authorLucas Galante <[email protected]>
date2026-08-26 15:50
plates: an accent-tinted plate tints its WHOLE rolled edge

The focused-pane treatment used to color only the roll's specular glint;
the free-carve path already had the stronger convention (p_spec_tint.w =
1 tints highlight AND counter-tints shadow — the focused well). MODE_PLATE
now honors the same flag: the roll's material mixes toward the tint
across its coverage (full at the silhouette, gone on the face), with the
light/shade profile intact. The tessellator raises w for any non-neutral
Bevel tint; neutral white plates keep w = 0 and shade byte-identically.

Co-Authored-By: Claude Fable 5 <[email protected]>

 src/backend/window_runner.rs |  8 +++++++-
 src/vk/shader2d.wgsl         | 10 +++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/backend/window_runner.rs b/src/backend/window_runner.rs
index 085dc85..494a8cc 100644
--- a/src/backend/window_runner.rs
+++ b/src/backend/window_runner.rs
@@ -1693,7 +1693,13 @@ pub fn tessellate_display_list(
                 // curvature-matched span.
                 verts.extend(quad_vertices(rect.x, rect.y, rect.width, rect.height, sw, sh, *color));
                 let mut p = plate_push_raised(rect, *radii, *depth, scale, plate_light, plate_mat, false);
-                p.specular_tint = [tint[0], tint[1], tint[2], 0.0];
+                // w = 1 marks an accent-tinted plate (the focused-pane
+                // treatment): the shader then colors the WHOLE rolled edge
+                // with the tint, not just the specular glint — matching the
+                // free-carve path's tinted-well convention. Neutral white
+                // keeps w = 0 (spec-only, a no-op multiply).
+                let full = if *tint == [1.0, 1.0, 1.0] { 0.0 } else { 1.0 };
+                p.specular_tint = [tint[0], tint[1], tint[2], full];
                 plate = Some(p);
                 made_plate = Some(*rect);
             }
diff --git a/src/vk/shader2d.wgsl b/src/vk/shader2d.wgsl
index 30c8109..0a66d23 100644
--- a/src/vk/shader2d.wgsl
+++ b/src/vk/shader2d.wgsl
@@ -513,7 +513,15 @@ fn plate_shade(frag: vec2f, vcol: vec4f) -> vec4f {
         let diff = PLATE_AMBIENT + (1.0 - PLATE_AMBIENT) * max(dot(n, l), 0.0);
         let shade = 1.0 + (diff / flat_shade - 1.0 + extra) * strength;
         let spec = roll_spec(sv);
-        return vec4f(base.rgb * shade + rrect_clip.p_spec_tint.rgb * (spec * strength), abs(base.a) * aa);
+        // p_spec_tint.w = 1 marks an accent-tinted plate (the focused-pane
+        // treatment): the ENTIRE rolled edge takes the accent color — the
+        // roll's material mixes toward the tint across its coverage (f = 1 at
+        // the silhouette, 0 on the face) with the light/shade profile intact —
+        // instead of only the specular glint. Neutral plates (w = 0) shade
+        // exactly as before.
+        let tw = rrect_clip.p_spec_tint.w;
+        let rgb = mix(base.rgb, rrect_clip.p_spec_tint.rgb, tw * f);
+        return vec4f(rgb * shade + rrect_clip.p_spec_tint.rgb * (spec * strength), abs(base.a) * aa);
     }
 
     // Free-floating recess, boss, or ridge (one not grouped into a host plate —