forked from 1b-agent/opencadstudio-upstream
fix(ui): theme remaining interface text
This commit is contained in:
1 parent
28d8246c68
commit
2ac61bf99a
9 files changed
+119
-35
No files matched your search
@@ -576,6 +576,7 @@ impl ViewCubeText {
|
||||
vp_w: u32,
|
||||
vp_h: u32,
|
||||
cube_px: u32,
|
||||
text_color: [f32; 4],
|
||||
) {
|
||||
let (vw, vh) = (vp_w as f32, vp_h as f32);
|
||||
let cube_half = cube_px as f32 * VIEWCUBE_SCALE;
|
||||
@@ -637,7 +638,12 @@ impl ViewCubeText {
|
||||
continue;
|
||||
}
|
||||
let alpha = ((dot - 0.12) / 0.88).clamp(0.0, 1.0);
|
||||
let color = [1.0, 1.0, 1.0, alpha];
|
||||
let color = [
|
||||
text_color[0],
|
||||
text_color[1],
|
||||
text_color[2],
|
||||
text_color[3] * alpha,
|
||||
];
|
||||
let u = Vec3::from(FACE_U[fi]);
|
||||
let v = Vec3::from(FACE_V[fi]);
|
||||
let center = face_n; // unit normal = face surface centre (distance E)
|
||||
@@ -714,7 +720,12 @@ impl ViewCubeText {
|
||||
} else {
|
||||
0.5
|
||||
};
|
||||
let color = [1.0, 1.0, 1.0, alpha];
|
||||
let color = [
|
||||
text_color[0],
|
||||
text_color[1],
|
||||
text_color[2],
|
||||
text_color[3] * alpha,
|
||||
];
|
||||
let (u0, v0, u1, v1) = glyph_uv(gi, self.atlas_w, self.atlas_h);
|
||||
let corner = |lx: f32, ly: f32| center + Vec3::X * lx + Vec3::Y * ly;
|
||||
let tl = project_world(corner(-CARD_GW * 0.5, CARD_GH * 0.5));
|
||||
@@ -1232,6 +1243,7 @@ impl ViewCubePipeline {
|
||||
vp_w: u32,
|
||||
vp_h: u32,
|
||||
hover: Option<usize>,
|
||||
text_color: [f32; 4],
|
||||
) {
|
||||
queue.write_buffer(
|
||||
&self.uniform_buffer,
|
||||
@@ -1245,7 +1257,15 @@ impl ViewCubePipeline {
|
||||
)),
|
||||
);
|
||||
self.text
|
||||
.update(queue, cam_rotation, compass_rotation, vp_w, vp_h, self.cube_px);
|
||||
.update(
|
||||
queue,
|
||||
cam_rotation,
|
||||
compass_rotation,
|
||||
vp_w,
|
||||
vp_h,
|
||||
self.cube_px,
|
||||
text_color,
|
||||
);
|
||||
}
|
||||
|
||||
pub fn ensure_depth_texture(&mut self, device: &wgpu::Device, size: Size<u32>) {
|
||||
|
||||
@@ -152,6 +152,8 @@ pub struct Primitive {
|
||||
pub(in crate::scene) viewports: Vec<ViewportData>,
|
||||
/// Background color used to clear each viewport's MSAA buffer.
|
||||
pub(in crate::scene) bg_color: [f32; 4],
|
||||
/// Active Iced theme text colour for GPU-rendered ViewCube labels.
|
||||
pub(in crate::scene) viewcube_text_color: [f32; 4],
|
||||
/// One input-to-render sample, carried only when PERF tracing is enabled.
|
||||
pub(in crate::scene) nav_perf: Option<NavPerfSample>,
|
||||
}
|
||||
@@ -327,6 +329,7 @@ impl shader::Primitive for Primitive {
|
||||
(vp.screen_rect.width * bounds.width) as u32,
|
||||
(vp.screen_rect.height * bounds.height) as u32,
|
||||
vp.hover_region,
|
||||
self.viewcube_text_color,
|
||||
);
|
||||
}
|
||||
continue;
|
||||
@@ -874,6 +877,7 @@ impl shader::Primitive for Primitive {
|
||||
(vp.screen_rect.width * bounds.width) as u32,
|
||||
(vp.screen_rect.height * bounds.height) as u32,
|
||||
vp.hover_region,
|
||||
self.viewcube_text_color,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1689,6 +1693,7 @@ impl Scene {
|
||||
model_render_mode: acadrust::entities::ViewportRenderMode,
|
||||
_hover_region: Option<usize>,
|
||||
show_viewcube: bool,
|
||||
viewcube_text_color: [f32; 4],
|
||||
) -> Primitive {
|
||||
let nav_build_started = iced::time::Instant::now();
|
||||
let perf_nav = self.take_nav_perf();
|
||||
@@ -1720,6 +1725,7 @@ impl Scene {
|
||||
Primitive {
|
||||
viewports,
|
||||
bg_color,
|
||||
viewcube_text_color,
|
||||
nav_perf: perf_nav,
|
||||
}
|
||||
}
|
||||
@@ -1736,6 +1742,7 @@ impl Scene {
|
||||
tile_idx: usize,
|
||||
model_render_mode: acadrust::entities::ViewportRenderMode,
|
||||
show_viewcube: bool,
|
||||
viewcube_text_color: [f32; 4],
|
||||
) -> Primitive {
|
||||
let hover_region = self.viewcube_hover.get();
|
||||
let canvas = (bounds.width.max(1.0), bounds.height.max(1.0));
|
||||
@@ -1745,6 +1752,7 @@ impl Scene {
|
||||
return Primitive {
|
||||
viewports: vec![],
|
||||
bg_color,
|
||||
viewcube_text_color,
|
||||
nav_perf: None,
|
||||
};
|
||||
};
|
||||
@@ -1792,6 +1800,7 @@ impl Scene {
|
||||
Primitive {
|
||||
viewports,
|
||||
bg_color,
|
||||
viewcube_text_color,
|
||||
nav_perf: perf_nav,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,9 @@ pub struct ViewportPane<'a> {
|
||||
/// per `pane_grid` pane, filling its own bounds). `None` → the unified
|
||||
/// full-canvas path (paper layout, or the whole-canvas Model fallback).
|
||||
pub pane: Option<usize>,
|
||||
/// Active Iced theme text colour, forwarded to the GPU-rendered ViewCube
|
||||
/// face and compass labels.
|
||||
pub viewcube_text_color: [f32; 4],
|
||||
}
|
||||
|
||||
impl<'a> ViewportPane<'a> {
|
||||
@@ -30,12 +33,14 @@ impl<'a> ViewportPane<'a> {
|
||||
scene: &'a Scene,
|
||||
show_viewcube: bool,
|
||||
render_mode: acadrust::entities::ViewportRenderMode,
|
||||
viewcube_text_color: [f32; 4],
|
||||
) -> Self {
|
||||
Self {
|
||||
scene,
|
||||
show_viewcube,
|
||||
render_mode,
|
||||
pane: None,
|
||||
viewcube_text_color,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,12 +51,14 @@ impl<'a> ViewportPane<'a> {
|
||||
show_viewcube: bool,
|
||||
render_mode: acadrust::entities::ViewportRenderMode,
|
||||
tile_idx: usize,
|
||||
viewcube_text_color: [f32; 4],
|
||||
) -> Self {
|
||||
Self {
|
||||
scene,
|
||||
show_viewcube,
|
||||
render_mode,
|
||||
pane: Some(tile_idx),
|
||||
viewcube_text_color,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -74,12 +81,14 @@ impl<'a, Msg: std::fmt::Debug + Clone> shader::Program<Msg> for ViewportPane<'a>
|
||||
idx,
|
||||
self.render_mode,
|
||||
self.show_viewcube,
|
||||
self.viewcube_text_color,
|
||||
),
|
||||
None => self.scene.build_viewports(
|
||||
bounds,
|
||||
self.render_mode,
|
||||
state.hover_region,
|
||||
self.show_viewcube,
|
||||
self.viewcube_text_color,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user