forked from 1b-agent/fieldcraft-upstream
The pick module tests rays against triangles with the watertight ray-triangle intersection of Woop, Benthin and Wald (JCGT 2013): a ray through an edge or vertex two triangles share hits one of them, the nearest hit wins and ties go to the lower index, so picks are deterministic. A Projector holds the camera's projection for screen-space picks (Camera::to_screen and the CPU renderer use it too), and a DepthMap of the drawn faces, rasterised by the renderer's own triangle routine, tells which points are in front (box selection). Display triangles now carry their element and face number (numbered as ElementKind::faces numbers them; seen_face gives a shell's bottom side from behind), line elements their element, and geometry surface triangles their face tag, so a hit names what a set refers to. DisplayMesh::pick (results probing) uses the new test. render_layers draws a second scene over the first: its faces over the scene faces they repeat (a small depth allowance), then its lines and points. The viewport draws selection and hover highlights with it without rebuilding the model's scene. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NmAttHhUZTokgPeEJia8sm
25 lines
1.1 KiB
Rust
25 lines
1.1 KiB
Rust
//! Display data for FieldCraft, with no GPU dependency: what a finite element model looks like
|
|
//! on screen ([`DisplayMesh`]: the visible faces, element edges, line elements and nodes), an
|
|
//! orbit camera with perspective or orthographic projection, picking ([`pick`]: what a ray through
|
|
//! a pixel hits), and a CPU rasterizer for headless snapshots. The desktop viewport draws the
|
|
//! same [`Scene`] on the GPU.
|
|
#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
|
|
#![forbid(unsafe_code)]
|
|
|
|
mod camera;
|
|
pub mod contour;
|
|
mod display;
|
|
mod font;
|
|
pub mod glyphs;
|
|
pub mod pick;
|
|
mod raster;
|
|
mod vec;
|
|
|
|
pub use camera::{Camera, Mat4, Orientation, StandardView};
|
|
pub use display::{DisplayEdge, DisplayLine, DisplayMesh, DisplayNode, DisplayTri, SurfaceTri};
|
|
pub use raster::{
|
|
Canvas, LABEL_OFFSET, MAX_DIM, MAX_PIXELS, MAX_PRIMITIVES, RenderError, Rgb, Scene, SceneLabel, SceneLine, ScenePoint, SceneTri, fit_size, png,
|
|
render, render_layers, render_layers_png, render_png, shade,
|
|
};
|
|
pub use vec::{Aabb3, Vec3};
|