render: lines drawn on top, any number of overlay layers, length per pixel

A scene's `on_top` lines are drawn after every depth-tested layer, over the
model, so a concentrated load at a point inside the part can be seen from any
side (#78). `render_layers` takes a list of overlays (the setup's symbols and
the selection highlight become separate layers), and draws every layer's
labels. `Camera::length_per_pixel` is the model length a pixel spans at the
target: the scale symbols of a fixed screen size are drawn at.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UhhZMBTviDQxZvwnyP89fo
This commit is contained in:
jyvikoandClaude Opus 5.5 authored and Irakli Kourtis committed 2026-10-14 23:14:40 -04:00
1 parent 3aab588b8b
commit 1fcc7acf84
4 files changed
+64 -26

No files matched your search

+1 -1
View File
@@ -928,7 +928,7 @@ impl ModelApp {
let cam = self.cam;
let (_, overlay) = self.overlay();
let (_, scene) = self.scene();
fieldcraft_render::render_layers_png(scene, Some(&overlay), &cam, w, h)
fieldcraft_render::render_layers_png(scene, &[&overlay], &cam, w, h)
}
/// The geometry tags behind the drawn mesh, read again when the model changed.
+1 -1
View File
@@ -409,7 +409,7 @@ fn paint_cpu(app: &mut ModelApp, ui: &egui::Ui, painter: &egui::Painter, rect: R
let fresh = app.viewport.cpu.as_ref().is_some_and(|(_, k, c, s)| *k == key && *c == cam && *s == size);
// A scene the renderer refused is reported once and not retried until it changes.
if !fresh && app.viewport.cpu_failed != Some(key.0) {
let c = match fieldcraft_render::render_layers(&app.scene.1, Some(&overlay), &cam, w, h) {
let c = match fieldcraft_render::render_layers(&app.scene.1, &[&overlay], &cam, w, h) {
Ok(c) => c,
Err(e) => {
app.viewport.cpu = None;