Expand description
brep-render — the Rust rendering engine that replaced the retired viewer.
Slice 1 (requirements doc §11 R40(1)/R41): engine core + solid/face/edge display fed by the kernel feature pipeline, with native headless artifact rendering for the test suite.
Layering (the dual-target requirement — web AND desktop from one codebase):
scene: the renderer-agnostic scene store (scene::RenderScene), keyed by kernel names. No GPU, no window, no renderer assumptions.pipeline: history request JSON →execute_history(in-process kernel call) → scene population via the kernel’s native display accessors.camera: pure-math cameras (orthographic artifact framing, orbit).render: the wgpu core —SceneRenderer::render_to_view(scene, camera, view, size)draws into ANYwgpu::TextureView. It never owns a window or canvas; presentation shells are thin:- headless: render-to-texture → readback → PNG (
render_to_png), used by thebrep-render-artifactbinary and the test suite; - desktop:
brep-render-desktop(featuredesktop) wraps a winit window- surface around the same core;
- web (later slice): a wasm canvas surface around the same core.
- headless: render-to-texture → readback → PNG (
color: the name-hashed stable solid colors (byte-compatible with the previous artifact renderer’ssolidColor) + sRGB helpers.
Re-exports§
pub use brep_kernel;
Modules§
- assembly_
status - The ONE assembly-constraint status → label/color map (requirements §5 vocabulary). Both the Assembly Constraints panel’s row status labels AND the viewport overlay labels (lane G) read THIS module — the status vocabulary and its colors are never re-declared anywhere else (the UI-consistency directive).
- camera
- Pure-math cameras: the artifact framing (a faithful port of the retired artifact page’s orthographic isometric camera) and a small orbit helper for the desktop shell. f64 math throughout; f32 only at the GPU boundary.
- color
- Stable per-solid display colors + color-space helpers.
- constraint_
overlays - Assembly-constraint VIEWPORT overlays (build-spec §8.4) — the CONSTRAINT twin
of
crate::feature_dimensions. - controls
- Arcball orbit/pan/zoom (R22) — the ArcballControls feel the user base has
muscle memory for, as a pure state machine over
ViewCamera: - engine_
state EngineState— the windowing-agnostic viewer state machine the host UI programs against (R3): scene + camera + controls + settings + emphasis, plus the whole event/command/query surface (run-history feed, pointer/wheel ingestion, camera commands, picking, world→screen, visibility). No GPU, no canvas — the wasmEngineand the winit desktop shell both wrap this; it is fully unit-testable on native.- feature_
dimensions - Feature-dimension annotations (FD-1) — the engine-native port of the original
FeatureDimensionAnnotationBuilder. - features
- Feature-schema access + the feature-schema →
FormFieldmapping. - history
History— the engine-owned, editable model recipe: the ordered feature history plus the rollback index (the feature the model is currently built up to). This is the SINGLE SOURCE OF TRUTH for the model — the UI keeps NO copy; it mutates and reads the history only throughcrate::engine_state::EngineStatemethods. That keeps one engine-owned history (UI-agnostic) and converges with the in-flight “whole history in Rust” pipeline migration — later this sinks intobrep-kernel-rsproper without touching the UI.- metadata
- The Properties-panel DATA layer (UI comes later): a name-keyed metadata store, per-entity measurements, and object provenance — all engine-native, all crossing the R3 boundary as plain JSON/scalars.
- pick
- Picking in Rust (R23/R24), replacing the retired raycaster +
selectionMethods._pickAtEvent: returns KERNEL NAMES with the candidate priority order VERTEX > EDGE > FACE > … > SOLID, CSS-pixel thresholds for lines/points (the earlier picker’sworldPerPixel * 6is exactly 6 CSS px), a double-sided face toggle, and a ranked candidate list feeding the host’s multi-candidate popup. Selection-filter filtering stays in the UI layer where the filter state lives — the engine reports everything under the cursor. - pipeline
- History → scene: run a whole feature history through the kernel’s native
execute_history(same process, same thread — the solid registry is thread-local) and populate aRenderScenefrom the resident handles via the kernel’s native display payload accessor. No JSON, no typed-array boundary — the R1 promise. - render
- The wgpu render core — windowing-agnostic (the dual-target seam).
- runner
- The history-run seam — the async RUN machine behind a trait, mirroring the
platform-seam shape of
brep-app/src/store.rs’sModelStore(a trait with impls behind it, async surfaced via a poll idiom). - scene
- The renderer-agnostic scene store (requirements R8–R9): display objects
keyed by the SAME kernel names the feature pipeline mints, with typed
metadata — no
userDatagrab-bag, no renderer objects. Rendering, picking and feature-reference display all resolve against this one map. - sketch
- Engine-native sketch mode — S0 (data model + solver plumbing + read-only
display). See
docs/developer/sketch-mode-rust-plan.md. - style
- Render settings (R14 — the
CADmaterialssemantics: per-kind material variants, hover color, flat-shading toggle, user-persisted overrides) and the selection/hover emphasis state (R17/R24 — name-keyed, fed by the host’sSelectionFilter). Plain data, shared by the engine core and the wgpu renderer; JSON in/out at the R3 boundary. - view
- The interactive viewer camera (R21/R25): orthographic default + perspective toggle with state-preserving switch, zoom-to-fit, dynamic depth-range fit, world-per-pixel and world→screen queries. Pure f64 math — shared verbatim by the wasm canvas shell and the winit desktop shell (dual-target directive).
- visibility
- Per-entity + group visibility for a solid’s faces / edges / vertices.
- widgets
- In-scene overlay widgets: the engine-side registry that hosts the
brep-gizmosgizmos natively. It owns the widget STATE (fed as plain JSON over the R3 boundary — datum planes/axes/frames, curve display, feature dimensions, the transform gizmo, the always-on ViewCube), constructs aGizmoCamerafrom the engine’s liveViewCameraeach frame, and emits thebrep-gizmosOverlaygeometry the render core converts into overlay GPU buffers. It also answers pointer hit-tests (ViewCube snap target, datum pick, transform-gizmo hover/pick) and computes transform drag deltas.