Skip to main content

SceneGraph

Struct SceneGraph 

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

Arena of nodes for one scene run. Node 0 is the view (root).

Implementations§

Source§

impl SceneGraph

Source

pub const ROOT: NodeId

The root node (the scene’s view).

Source

pub fn new(width: u32, height: u32) -> Rc<Self>

An empty scene of the given size in pixels, with only the root.

Source

pub fn size(&self) -> (u32, u32)

Scene size in pixels.

Source

pub fn len(&self) -> usize

Number of nodes, including the root.

Source

pub fn is_empty(&self) -> bool

Never true: the root always exists.

Source

pub fn node(&self, id: NodeId) -> Ref<'_, NodeData>

Borrows a node’s stored state.

§Panics

If id is not a node of this graph.

Source

pub fn measure(&self, id: NodeId) -> (f64, f64)

Size of a node’s box in its own (unscaled) coordinates.

Source

pub fn draw_list(&self) -> Vec<DrawItem>

Flattened, paint-ordered list of everything to draw.

Source

pub fn pick(&self, p: Point) -> Option<NodeId>

Topmost node under p (scene coordinates), excluding the view.

Source

pub fn world_transform(&self, id: NodeId) -> Option<Affine>

World transform of a node (including layout offsets).

Source

pub fn box_in(&self, id: NodeId, frame: NodeId) -> Option<Rect>

The box of id (its size around its origin) in the coordinate frame of frame’s children: for a camera, where the node sits in the world the camera looks at. Axis-aligned.

Source

pub fn frame_size(&self) -> (f64, f64)

Frame size in pixels.

Source

pub fn tree( &self, ) -> Vec<(NodeId, Option<NodeId>, &'static str, Option<String>)>

(id, parent, kind, name) of every attached node, depth-first.

Source

pub fn describe(&self, id: NodeId) -> Vec<(String, String)>

Current signal values of a node, for the inspector.

Source

pub fn inspect_nodes(&self) -> Vec<InspectNode>

One record per attached node, in tree order, with scene-space bounds.

order is paint order (0 is the back). Nodes that are not drawn (fully transparent) get u32::MAX.

Source§

impl SceneGraph

Source

pub fn enter<R>(self: &Rc<Self>, f: impl FnOnce() -> R) -> R

Makes this graph the target of node handles for the duration of f.

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> ErasedDestructor for T
where T: 'static,

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> 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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V