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

commitf494991be186f0f6af8c496fa81936ae97f9d98f
parenta07cab153e
authorLucas Galante <[email protected]>
date2026-07-29 12:22
feat: Prim::Boss carries a specular tint like Recess

A rim-only pane (the designer viewport: a Boss ring over the 3D scene,
since a fill-less surface can't carry Bevel's tint) needs the focused-pane
treatment on its lit rim. Boss gains the same optional tint Recess has —
boss_edges_tinted constructor, threaded through the free-carve overlay
path's specular_tint. Like a tinted recess it never groups into a host
plate's CSG features. The legacy banded path ignores it.

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

 src/backend/window_runner.rs |  5 +++--
 src/scene/paint.rs           | 23 ++++++++++++++++++++---
 src/widget/model.rs          |  5 ++++-
 3 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/src/backend/window_runner.rs b/src/backend/window_runner.rs
index 98af890..3eadc85 100644
--- a/src/backend/window_runner.rs
+++ b/src/backend/window_runner.rs
@@ -1547,12 +1547,13 @@ pub fn tessellate_display_list(
                 made_plate = Some(*rect);
             }
             Prim::Recess { rect, radii, depth, edges, .. }
-            | Prim::Boss { rect, radii, depth, edges }
+            | Prim::Boss { rect, radii, depth, edges, .. }
             | Prim::Ridge { rect, radii, depth, edges }
                 if shader_plates =>
             {
                 let tint = match &item.prim {
                     Prim::Recess { tint, .. } => *tint,
+                    Prim::Boss { tint, .. } => *tint,
                     _ => None,
                 };
                 // Recess carves down into the surface; Boss raises a plateau out
@@ -1715,7 +1716,7 @@ pub fn tessellate_display_list(
                     EdgeKind::Step, &mut verts,
                 );
             }
-            Prim::Boss { rect, radii, depth, edges } => {
+            Prim::Boss { rect, radii, depth, edges, .. } => {
                 // Legacy raised step: the recess overlay with the light sign upright.
                 push_bevel_edge_vertices_banded(
                     rect.x, rect.y, rect.width, rect.height, *radii, *depth,
diff --git a/src/scene/paint.rs b/src/scene/paint.rs
index f0b0ee4..097fb7f 100644
--- a/src/scene/paint.rs
+++ b/src/scene/paint.rs
@@ -71,8 +71,11 @@ pub enum Prim {
     /// untouched surface underneath — so a region outlined by raised rolled bumps
     /// keeps the backplate's own color and translucency. Same wall semantics as
     /// `Recess` (`edges` = top/right/bottom/left); the lighting is the raised sign,
-    /// so the edges facing `light_source_position` catch the light.
-    Boss { rect: Rect, radii: Radii, depth: f32, edges: (bool, bool, bool, bool) },
+    /// so the edges facing `light_source_position` catch the light. `tint` colors
+    /// the lit rim like [`Prim::Recess`]'s — the focused-pane treatment for a
+    /// rim-only pane (a fill-less surface can't carry [`Prim::Bevel`]'s tint).
+    /// Like a tinted recess it never groups into a host plate's CSG features.
+    Boss { rect: Rect, radii: Radii, depth: f32, edges: (bool, bool, bool, bool), tint: Option<[f32; 3]> },
     /// A raised RIM riding the rect's boundary: a bump profile straddling the
     /// outline (span ±depth/2), rising from the surrounding surface to a crest on
     /// the boundary and falling back to the same level inside — an elevated border
@@ -435,7 +438,21 @@ impl PaintCtx {
         edges: (bool, bool, bool, bool),
     ) {
         let rect = self.apply_offset(rect);
-        self.push(Prim::Boss { rect, radii, depth, edges });
+        self.push(Prim::Boss { rect, radii, depth, edges, tint: None });
+    }
+
+    /// [`PaintCtx::boss_edges`] with a specular tint on the lit rim — see
+    /// `Prim::Boss::tint`.
+    pub fn boss_edges_tinted(
+        &mut self,
+        rect: Rect,
+        radii: Radii,
+        depth: f32,
+        edges: (bool, bool, bool, bool),
+        tint: [f32; 3],
+    ) {
+        let rect = self.apply_offset(rect);
+        self.push(Prim::Boss { rect, radii, depth, edges, tint: Some(tint) });
     }
 
     /// A flush inset control: `rect`'s plate sits SUNKEN into the surface with
diff --git a/src/widget/model.rs b/src/widget/model.rs
index 6e292b1..1afb9ff 100644
--- a/src/widget/model.rs
+++ b/src/widget/model.rs
@@ -1239,7 +1239,10 @@ impl<W: Layout + Paint + Input + 'static> WidgetHost for Adapted<W> {
                     Some(t) => ctx.recess_tinted(rect, radii, depth, t),
                     None => ctx.recess_edges(rect, radii, depth, edges),
                 },
-                Prim::Boss { rect, radii, depth, edges } => ctx.boss_edges(rect, radii, depth, edges),
+                Prim::Boss { rect, radii, depth, edges, tint } => match tint {
+                    Some(t) => ctx.boss_edges_tinted(rect, radii, depth, edges, t),
+                    None => ctx.boss_edges(rect, radii, depth, edges),
+                },
                 Prim::Ridge { rect, radii, depth, edges } => ctx.ridge_edges(rect, radii, depth, edges),
                 Prim::Plate { rect, radii, color, depth } => ctx.plate(rect, radii, color, depth),
                 Prim::Arc { cx, cy, radius, thickness, start, end, color } => ctx.arc(cx, cy, radius, thickness, start, end, color),