Skip to main content

Crate brep_render

Crate brep_render 

Source
Expand description

Rendering, picking, and sketch editing for native and WebAssembly hosts.

scene stores named geometry, pipeline evaluates feature histories, and render draws into a host-provided texture view. Cameras, picking, sketch state, and display settings are shared across presentation targets.

Re-exports§

pub use brep_kernel;

Modules§

assembly_status
The ONE assembly-constraint status → label/color map. 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
Orthographic artifact framing and orbit-camera math. Calculations use f64, converting to f32 at the GPU boundary.
color
Stable per-solid display colors + color-space helpers.
constraint_overlays
Assembly-constraint VIEWPORT overlays — 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 wasm Engine and the winit desktop shell both wrap this; it is fully unit-testable on native.
face_transform_help
Turning a Transform Face refusal into a sentence about the user’s model.
feature_dimensions
Draggable linear and angular annotations for selected feature parameters.
features
Map kernel feature schemas to the shared FormField representation.
formatting
Numeric formatting shared by annotations and app panels.
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 through crate::engine_state::EngineState methods. That keeps one engine-owned history (UI-agnostic) and converges with the in-flight “whole history in Rust” pipeline migration — later this sinks into brep-kernel-rs proper 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’s worldPerPixel * 6 is 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 a RenderScene from 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).
run_trace
The history-replay TRACE: a native instrument that counts and times every execute_history this crate performs, tagged with the SITE that asked for it and the thread it ran on.
runner
The history-run seam — the async RUN machine behind a trait, mirroring the platform-seam shape of brep-app/src/store.rs’s ModelStore (a trait with impls behind it, async surfaced via a poll idiom).
scene
Renderer-independent display objects keyed by kernel feature names. Rendering, picking, and feature-reference display share this scene map.
sheets
Drawing sheets — the document’s sheets block, the projection of a placed PMI view into paper millimetres, and the SVG writer.
sketch
Sketch documents, constraint solving, interaction state, and overlay geometry.
sketch3d
The engine-native 3D SKETCH editor’s session: the solved document, its diagnostics, the interaction state (selection, hover, armed tool, working plane), screen-space picking and the overlay tessellation.
style
Render settings (R14 — the CADmaterials semantics: 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’s SelectionFilter). Plain data, shared by the engine core and the wgpu renderer; JSON in/out at the R3 boundary.
thumbnail
Part thumbnails: a small CPU rasterizer over the RenderScene’s display meshes, the one picture producer that runs the same on native, in the browser and in the headless bake worker (which has no GPU device at all).
view
Interactive orthographic and perspective cameras with zoom-to-fit, depth-range fitting, and world/screen conversion shared by native and web.
visibility
Visibility masks for solid faces, edges, vertices, and named overlays.
widgets
In-scene overlay widgets: the engine-side registry that hosts the brep-gizmos gizmos 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 a GizmoCamera from the engine’s live ViewCamera each frame, and emits the brep-gizmos Overlay geometry 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.