Skip to main content

RenderScene

Struct RenderScene 

Source
pub struct RenderScene { /* private fields */ }
Expand description

The scene: insertion-ordered solids + an exact name index (R8 — the getObjectByName heuristic-scoring lookup is replaced by this map).

Implementations§

Source§

impl RenderScene

Source

pub fn new() -> Self

Source

pub fn insert_solid(&mut self, solid: SolidDisplay)

Insert or replace a solid by name (replacement keeps insertion order — a boolean result reusing its target’s name stays in place).

Source

pub fn clear(&mut self)

Drop every solid (the scene rebuild path clears then repopulates).

Source

pub fn drain(&mut self) -> Vec<SolidDisplay>

Empty the scene, RETURNING every solid by value (the name index is cleared and the vec is mem::take-n out). The history-apply seam MOVES existing displays out this way to reinsert the reused ones without cloning their meshes — a scene-free crate::pipeline::SceneRunner delta is applied by draining then reinserting in snapshot order.

Source

pub fn set_color_override( &mut self, name: &str, color: Option<[f32; 3]>, ) -> bool

Set (or clear) a solid’s metadata color override, bumping its revision so the renderer re-derives the base style. Returns false if unknown.

Source

pub fn apply_metadata_colors( &mut self, lookup: impl Fn(&str) -> Option<[f32; 3]>, ) -> bool

Re-derive every solid’s and face’s base colour from the name-keyed metadata store — the ONE seam through which the durable color attribute reaches the display.

lookup maps an object NAME (a solid’s or a face’s) to its resolved colour. It returns None both for “no colour recorded” and for “the display setting is overriding model colours”, so this method needs to know about neither.

SKETCH sheets are skipped: their color_override is the synthesized [crate::engine_state::SKETCH_SHEET_COLOR], not a metadata colour, and re-deriving it from a store that has no record for the sheet would blank it back to the global face colour.

A changed solid’s revision is bumped so the renderer re-uploads it — and ONLY when something actually changed. That no-op guarantee is load-bearing, not a nicety: this runs after EVERY history apply, and the R10 GPU-buffer reuse fast path keys off a stable revision.

Source

pub fn set_visible(&mut self, name: &str, visible: bool) -> bool

Set a solid’s visibility (R11). Returns false if unknown.

Source

pub fn listing_json(&self) -> String

Scene enumeration for the host scene-tree panel (R11): names, kind, visibility, child face/edge/vertex counts — as JSON.

Source

pub fn remove_solid(&mut self, name: &str) -> bool

Remove a solid by exact name.

Source

pub fn solid(&self, name: &str) -> Option<&SolidDisplay>

Source

pub fn solid_mut(&mut self, name: &str) -> Option<&mut SolidDisplay>

Source

pub fn solids(&self) -> &[SolidDisplay]

Insertion-ordered iteration (deterministic — drives draw order).

Source

pub fn edge_polyline_world(&self, name: &str) -> Option<Vec<[f64; 3]>>

The world-space polyline of the first display edge named name across all solids (widened to f64), or None when no edge carries that exact name. The engine-native sketch pickEdges tool (S6b-2) uses this to fetch a picked scene edge’s geometry for projection into the sketch plane. There is no name index for edges (only solids), so this is a linear scan — fine for the interactive per-click use.

Source

pub fn edge_solid_name(&self, name: &str) -> Option<&str>

The name of the solid owning the first display edge named name, or None (the companion of edge_polyline_world — the pickEdges tool stores it as external-ref metadata).

Source

pub fn face_plane_world(&self, name: &str) -> Option<([f64; 3], [f64; 3])>

The world plane of the first display face named name across all solids, as (centroid, unit outward normal): the area-weighted centroid of the face’s mesh triangles and the normalized sum of their cross products. The watertight tessellation winds every face’s triangles by same_sense, so the cross-product sum IS the outward normal (the stored per-vertex normals are shading normals and can be blended at shared boundary vertices). This is what lets an extrude/revolve whose profile is a resident solid FACE (not a sketch) anchor its dimension gizmo — the engine’s dimension refs fall back to it (EngineState::lookup_profile_plane). Hidden solids count too: a hidden source solid still anchors the gizmo. None when no face carries that exact name, it has no triangles, or the triangles are degenerate (zero area). Linear scan like edge_polyline_world.

Source

pub fn is_empty(&self) -> bool

Source

pub fn bbox(&self) -> Aabb

World bbox over every VISIBLE solid.

Source§

impl RenderScene

Source

pub fn set_entity_visible( &mut self, solid: &str, kind: EntityKind, index: usize, visible: bool, ) -> bool

Show/hide ONE face/edge/vertex of a solid. False if the solid is unknown.

Source

pub fn set_group_visible( &mut self, solid: &str, kind: EntityKind, visible: bool, ) -> bool

Show/hide a whole group (all faces / all edges / all vertices) of a solid. False if the solid is unknown.

Source

pub fn entity_visible( &self, solid: &str, kind: EntityKind, index: usize, ) -> Option<bool>

Whether entity index of kind on solid is shown (None if unknown).

Source

pub fn group_visibility( &self, solid: &str, kind: EntityKind, ) -> Option<GroupState>

The group tristate for solid’s kind (None if the solid is unknown).

Trait Implementations§

Source§

impl Debug for RenderScene

Source§

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

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

impl Default for RenderScene

Source§

fn default() -> RenderScene

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

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> 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, 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,