Skip to main content

RenderSettings

Struct RenderSettings 

Source
pub struct RenderSettings {
Show 37 fields pub theme: ThemeMode, pub ui_scale: f32, pub label_scale: f32, pub debug_grab_handles: bool, pub background: [f32; 3], pub face_color_mode: FaceColorMode, pub face_color: Rgba, pub face_selected_color: Rgba, pub hover_color: Rgba, pub edge_color: Rgba, pub edge_selected_color: Rgba, pub edge_width_px: f32, pub hidden_edge_alpha: f32, pub vertex_color: Rgba, pub vertex_selected_color: Rgba, pub vertex_size_px: f32, pub flat_shading: bool, pub wireframe: bool, pub axis_length_px: f32, pub viewcube_size_px: f32, pub pick_double_sided: bool, pub multi_select: MultiSelectMode, pub lod_factor: f64, pub sketch_movable_color: Rgba, pub sketch_locked_color: Rgba, pub sketch_geometry_color: Rgba, pub sketch_point_color: Rgba, pub sketch_construction_point_color: Rgba, pub sketch_under_constrained_point_color: Rgba, pub sketch_selected_color: Rgba, pub sketch_hovered_color: Rgba, pub sketch_preview_color: Rgba, pub sketch_constraint_color: Rgba, pub workbench: String, pub assembly_auto_solve: bool, pub show_constraint_graphics: bool, pub bom_columns: String,
}
Expand description

The viewer’s material palette + display toggles. Defaults are the CADmaterials values.

Fields§

§theme: ThemeMode

GUI chrome theme (egui panels/windows/toolbar/text). Defaults to Auto, following the OS light/dark preference.

§ui_scale: f32

Global UI size scale applied to the whole egui chrome via [egui::Context::set_zoom_factor]. 1.0 = native size; composes with the device pixel ratio. Clamped to [0.5, 3.0].

§label_scale: f32

Size multiplier for the floating TEXT LABELS the app overlays on the 3D model — the dimension-gizmo value chips (sketch + feature dimensions), the assembly-constraint chips, and the transform gizmo’s axis letters. 1.0 = the base monospace size; the label’s glyphs, its measured edit-box width, and its chip padding all scale together (see brep-app’s viewport::labels). A MULTIPLIER, not a point size, so labels stay consistent with each other and the setting survives a restyle. Clamped to [0.25, 3.0]: 0.25 is the smallest label that is still a LABEL rather than a smudge — a quarter of the 12pt base monospace is a ~3.8pt glyph row inside a ~4.5pt-tall chip, which is the point at which the double-click/drag target stops being something a pointer can reliably land on (and it composes with uiScale + the device pixel ratio, so it is not an absolute 3pt on screen). The 3.0 ceiling keeps a user from filling the viewport with one label. Independent of RenderSettings::ui_scale, which sizes the egui CHROME (panels/toolbar) and not the model overlay.

§debug_grab_handles: bool

Debug overlay: draw the 1px red outline of each gizmo grab handle’s hit region (arrows/leaders as capsules, balls as circles). Off by default; toggled from Settings to inspect exactly where a drag will grab.

§background: [f32; 3]§face_color_mode: FaceColorMode§face_color: Rgba§face_selected_color: Rgba§hover_color: Rgba§edge_color: Rgba§edge_selected_color: Rgba§edge_width_px: f32§hidden_edge_alpha: f32

Occluded edges render dimmed, not dropped (R17): alpha of the depth-failing edge pass. 0 disables the pass.

§vertex_color: Rgba§vertex_selected_color: Rgba§vertex_size_px: f32§flat_shading: bool§wireframe: bool

Wireframe display (R14): when true the shaded face-fill pass is skipped so only edges draw (the CAD wireframe look; back edges show through). Does NOT affect picking (CPU ray-based) or the overlay pass.

§axis_length_px: f32

World-axis helper (R20): screen length in CSS px; 0 disables.

§viewcube_size_px: f32

On-screen edge length of the always-on corner ViewCube, in CSS px. Drives BOTH the rendered mini-camera viewport AND the hit-test corner rect (they read the same value), so the cube and its clickable region scale together. Defaults to [ViewCube::DEFAULT_SIZE_PX], so the cube is unchanged until edited.

§pick_double_sided: bool§multi_select: MultiSelectMode

How a plain viewport click builds a multi-selection (see MultiSelectMode).

§lod_factor: f64

Tessellation LOD factor (1.0 = the app’s “Normal” preset).

§sketch_movable_color: Rgba§sketch_locked_color: Rgba§sketch_geometry_color: Rgba§sketch_point_color: Rgba§sketch_construction_point_color: Rgba§sketch_under_constrained_point_color: Rgba§sketch_selected_color: Rgba§sketch_hovered_color: Rgba§sketch_preview_color: Rgba§sketch_constraint_color: Rgba§workbench: String

The active UI WORKBENCH id ("all" / "modeling" / "sheetMetal"), a plain string (NOT an enum) so the app-side per-file workbench registry stays the sole owner of the valid-id set — adding a workbench never touches this crate. This is purely a UI FILTER over feature-CREATION: it does not affect what the history executes or renders. Default "modeling". An unknown stored id is tolerated here and validated app-side (the registry’s resolver falls back to the default).

§assembly_auto_solve: bool

Assembly AUTO-SOLVE (build-spec §6 scheduling): when true (the default) every constraint mutation re-solves + re-runs immediately; when false the mutation paths only update state and the user drives the manual Solve button. Consulted by the app’s constraint-mutation path.

§show_constraint_graphics: bool

Show Constraint Graphics (build-spec §8.3/§8.4): the render toggle the viewport overlay lane consumes — per-constraint leader/label graphics draw only while this is on. Owned here so the panel toggle, persistence, and the overlay renderer all read ONE flag.

§bom_columns: String

The BOM’s COLUMN CONFIGURATION — the raw text of the Settings panel’s Assemblies textarea (one [*]prefix.Field per line). Stored VERBATIM, exactly as the user typed it: parsing, the known-field catalogue and the part. / occurrence. vocabulary all live app-side (panels::bom_columns), so adding a BOM field never touches this crate — the same division of labour that keeps workbench a plain string here.

Default EMPTY, which means “the app’s shipped default configuration”. A document that was never configured therefore persists byte-for-byte as before, and a later change to the shipped default still reaches every user who never overrode it.

Implementations§

Source§

impl RenderSettings

Source

pub fn artifact() -> Self

The artifact-corpus preset: byte-faithful to the slice-1 artifact look (per-solid hashed colors, 0x101418 background, 1.6px edges in 0x0d1030, no hidden-edge pass, no vertices, no axes).

Source

pub fn apply_json(&mut self, json: &str) -> Result<(), String>

Apply a partial JSON override (R3 settings entrypoint). Unknown keys are ignored; colors are CSS hex strings.

Source

pub fn to_json(&self) -> String

Serialize EVERY setting to the SAME camelCase / CSS-hex shape [apply_json] reads, so s.apply_json(&s.to_json()) is the identity. This is the counterpart the settings schema serializes/persists through (there was previously no serializer, only the partial-override reader).

Source

pub fn sketch_colors(&self) -> SketchColors

The live SketchColors view of the sketcher palette — the tessellation / overlay builders read their colors from THIS (via crate::sketch::SketchSession::colors) so the display settings are the one source of truth. Each Rgba is quantized back to 0xRRGGBB the SAME way [rgb_to_css_hex] serializes it, so a default settings value round-trips to the default SketchColors byte-exact.

Source

pub fn settings_schema_json(&self) -> String

The settings schema WITH the current value baked into each field, as JSON — mirrors the kernel’s feature_schemas_json export so a UI shell (egui here, a later brep-ui crate) can generate the whole form from data. The value of each field is pulled live from [to_json], so the export always reflects the current settings.

Trait Implementations§

Source§

impl Clone for RenderSettings

Source§

fn clone(&self) -> RenderSettings

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RenderSettings

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RenderSettings

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for RenderSettings

Source§

fn eq(&self, other: &RenderSettings) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for RenderSettings

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,