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

+6
View File
@@ -193,6 +193,12 @@ impl Camera {
pub fn half_height(&self) -> f64 {
if self.fov > 0.0 { self.distance * (self.fov * 0.5).tan() } else { self.distance * 0.4 }
}
/// Model length one pixel spans at the target, in a view `height_px` pixels high (the scale
/// symbols of a fixed screen size are drawn at); `None` for a size or camera that has none.
pub fn length_per_pixel(&self, height_px: f64) -> Option<f64> {
let l = 2.0 * self.half_height() / height_px;
(height_px > 0.0 && l.is_finite() && l > 0.0).then_some(l)
}
/// Near/far planes that keep a scene of radius `radius` around the target visible.
pub fn clip(&self, radius: f64) -> (f64, f64) {
let r = radius.max(1e-3);