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

commitcff74576567e87b20f70de63ad95230443d29468
parent318d08b2ae
authorLucas Galante <[email protected]>
date2026-08-27 12:20
carves: a tinted carve renders the wrapped glint alone — one focus language

The tinted free-carve treatment (p_spec_tint.w = 1: focused wells, the
viewport rim, standalone focus rings) now draws roll_spec_wrap's
specular line by itself — the same accent glint the focused plates wear,
swept around the whole outline — instead of the lit-step overlay with a
tinted screen. Focus reads identically whether it sits on a plate roll,
a well rim, or a free ring. Untinted carves are untouched.

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

 src/vk/shader2d.wgsl | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/vk/shader2d.wgsl b/src/vk/shader2d.wgsl
index 356b01f..261f170 100644
--- a/src/vk/shader2d.wgsl
+++ b/src/vk/shader2d.wgsl
@@ -639,9 +639,17 @@ fn plate_shade(frag: vec2f, vcol: vec4f) -> vec4f {
     let hb = rrect_clip.p_host;
     let host_d = min(hb.z - abs(frag.x - hb.x), hb.w - abs(frag.y - hb.y));
     let att = clamp(host_d / t, 0.0, 1.0) * wedge;
-    let v = (diff / flat_shade - 1.0 + curv + spec) * strength * att;
-    // p_spec_tint.w = 1 marks a tinted carve (a focused well); plates leave w at 0.
+    var v = (diff / flat_shade - 1.0 + curv + spec) * strength * att;
+    // p_spec_tint.w = 1 marks a tinted carve — the FOCUS treatment. It
+    // renders as the wrapped specular line alone (roll_spec_wrap: the glint
+    // the light-facing edges normally carry, swept around the whole
+    // outline), matching the focused plates' accent glint exactly; the
+    // relief's diffuse/curvature terms drop so a standalone focus ring reads
+    // as the line, not a lit step. Plates leave w at 0.
     let tw = rrect_clip.p_spec_tint.w;
+    if (tw > 0.0) {
+        v = roll_spec_wrap(sv) * strength * att;
+    }
     if (v >= 0.0) {
         // Highlight: the white screen mixes toward the tint color, slightly
         // boosted so the accent reads at the rim's low alphas.