forked from 1b-agent/fieldcraft-upstream
engine: one scene builder for the window and headless pictures
engine::view::build (Style, Show, Palette) is the viewport's builder, moved from ui-egui; ui-egui maps theme::Tokens onto a Palette and calls it. Palette::LIGHT now equals the light theme's tokens. Test: the app's scene and engine::view::frame's are identical for the same session. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UhhZMBTviDQxZvwnyP89fo
This commit is contained in:
1 parent
6136770c1c
commit
78b8fc8d6c
4 files changed
+156
-115
No files matched your search
@@ -6,6 +6,7 @@
|
||||
//! ATTRIBUTION.md. Widget states are coloured with craft-ui's `WidgetPalette`.
|
||||
|
||||
use egui::{Color32, Stroke};
|
||||
use fieldcraft_engine::view::Palette;
|
||||
use fieldcraft_model::ElementKind;
|
||||
use fieldcraft_render::Rgb;
|
||||
use fieldcraft_render::glyphs::GlyphColors;
|
||||
@@ -257,6 +258,28 @@ impl Tokens {
|
||||
}
|
||||
}
|
||||
|
||||
/// The viewport's colours for the scene builder ([`fieldcraft_engine::view::build`]).
|
||||
pub fn palette(&self) -> Palette {
|
||||
Palette {
|
||||
background: (rgb(self.viewport_top), rgb(self.viewport_bottom)),
|
||||
hex: rgb(self.hex),
|
||||
tet: rgb(self.tet),
|
||||
wedge: rgb(self.wedge),
|
||||
shell: rgb(self.shell),
|
||||
line_element: rgb(self.line_element),
|
||||
mesh_edge: rgb(self.mesh_edge),
|
||||
node: rgb(self.node),
|
||||
geometry: rgb(self.geometry),
|
||||
geometry_edge: rgb(self.geometry_edge),
|
||||
bodies: self.bodies.map(rgb),
|
||||
no_result: rgb(self.no_result),
|
||||
contour: self.contour_stops(),
|
||||
contour_over: rgb(self.contour_over),
|
||||
marked: rgb(self.error),
|
||||
glyphs: self.glyph_colors(),
|
||||
}
|
||||
}
|
||||
|
||||
/// The colour elements of this kind are drawn in.
|
||||
pub fn element(&self, kind: ElementKind) -> Color32 {
|
||||
match kind {
|
||||
|
||||
Reference in new issue
Block a user