pub struct SceneGraph { /* private fields */ }Expand description
Arena of nodes for one scene run. Node 0 is the view (root).
Implementations§
Source§impl SceneGraph
impl SceneGraph
Sourcepub fn new(width: u32, height: u32) -> Rc<SceneGraph>
pub fn new(width: u32, height: u32) -> Rc<SceneGraph>
An empty scene of the given size in pixels, with only the root.
Sourcepub fn set_time(&self, seconds: f64)
pub fn set_time(&self, seconds: f64)
Time, in seconds, that the next draw_list paints.
The engine sets this after each frame.
Sourcepub fn measure(&self, id: NodeId) -> (f64, f64)
pub fn measure(&self, id: NodeId) -> (f64, f64)
Size of a node’s box in its own (unscaled) coordinates.
Sourcepub fn has_post(&self) -> bool
pub fn has_post(&self) -> bool
Some node reads or changes drawn pixels (an effect, or a shader that reads the frame). When false, the draw list has no markers and a renderer can draw it in one go.
Sourcepub fn shader_diags(&self) -> Vec<ShaderDiag>
pub fn shader_diags(&self) -> Vec<ShaderDiag>
WGSL problems from the last draw_list.
Sourcepub fn draw_drift(&self) -> Option<(String, Option<String>)>
pub fn draw_drift(&self) -> Option<(String, Option<String>)>
Some when painting this frame twice does not produce the same
primitives. The string is the node’s name, or its add call site.
Sourcepub fn pick(&self, p: Point) -> Option<NodeId>
pub fn pick(&self, p: Point) -> Option<NodeId>
Topmost node under p (scene coordinates), excluding the view.
Sourcepub fn world_transform(&self, id: NodeId) -> Option<Affine>
pub fn world_transform(&self, id: NodeId) -> Option<Affine>
World transform of a node (including layout offsets).
Sourcepub fn box_in(&self, id: NodeId, frame: NodeId) -> Option<Rect>
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.
Sourcepub fn frame_size(&self) -> (f64, f64)
pub fn frame_size(&self) -> (f64, f64)
Frame size in pixels.
Sourcepub fn tree(
&self,
) -> Vec<(NodeId, Option<NodeId>, &'static str, Option<String>)>
pub fn tree( &self, ) -> Vec<(NodeId, Option<NodeId>, &'static str, Option<String>)>
(id, parent, kind, name) of every attached node, depth-first.
Sourcepub fn describe(&self, id: NodeId) -> Vec<(String, String)>
pub fn describe(&self, id: NodeId) -> Vec<(String, String)>
Current signal values of a node, for the inspector.
Sourcepub fn inspect_nodes(&self) -> Vec<InspectNode>
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
impl SceneGraph
Sourcepub fn enter<R>(self: &Rc<SceneGraph>, f: impl FnOnce() -> R) -> R
pub fn enter<R>(self: &Rc<SceneGraph>, f: impl FnOnce() -> R) -> R
Makes this graph the target of node handles for the duration of f.