Skip to main content

Scene

Struct Scene 

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

The records a window draws together with the hit targets built from them.

Implementations§

Source§

impl Scene

Source

pub fn new() -> Scene

Creates an empty scene with no records and no hit targets.

Source

pub fn diagnostics(&self) -> &RenderDiagnostics

The diagnostics shared by the scene and its hit targets.

Source

pub fn store(&self) -> &SceneStore

The records the scene draws.

Source

pub fn follow(&mut self, events: RecordEvents)

Keeps the changes of the kinds in events for the scene’s readers from the next update on, beside the leaves the scene reads itself; see SceneStore::follow.

Source

pub fn refresh_reach(&mut self)

Works out the reach of the records a change left stale; see SceneStore::refresh_reach.

Source

pub fn root_layer(&self) -> Option<LayerRef<'_>>

The root record, None while the scene is empty.

Source

pub fn describe(&mut self, root: &LayerNode)

Writes the layer tree root describes in place of the scene’s records. The hit targets follow it.

Source

pub fn edit_store(&mut self, edit: impl FnOnce(&mut SceneStore))

Runs edit on the scene’s records in a new update. The hit targets follow them.

Source

pub fn rebuild_from_applier(&mut self, applier: &MemoryApplier, root: NodeId)

Lowers the layout tree below root again from the applier, its records reusing the scene’s storage. The hit targets follow it.

Source

pub fn hit_targets(&self) -> Vec<HitRegion>

The hit targets in draw order, the last drawn at the end.

Source

pub fn hit_storage(&self) -> HitStorage

How much storage the hit targets take.

Source

pub fn update_from_applier( &mut self, applier: &MemoryApplier, root: NodeId, updates: &[(NodeId, NodeUpdate)], ) -> bool

Applies content and layer-property changes to the scene’s records in place and returns true, or rebuilds the scene and returns false: for empty updates, an empty scene or an update that cannot be applied in place. The hit targets follow the records when the update changed a hit target or the geometry above one: each updated layer compares its hit state, and the layers beneath one built again, before and after.

Trait Implementations§

Source§

impl Default for Scene

Source§

fn default() -> Scene

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

impl HitGraphSink for Scene

Source§

fn push_hit( &mut self, node_id: NodeId, capture_path: &[NodeId], geometry: HitGeometry<'_>, hit: &HitTestNode, )

Records an interactive node. capture_path lists the node first and then its pointer-input ancestors from the nearest outward, and geometry is in window space.
Source§

impl RenderScene for Scene

Source§

type HitTarget = HitRegion

The hit target type that hit testing returns.
Source§

fn clear(&mut self)

Removes the scene’s records and all hit targets.
Source§

fn trim(&mut self) -> bool

Gives back the room the scene’s storage holds past what it draws. Its owner calls it at rest, when no frame waits. Returns whether the scene let every record go to give that room back: the owner builds it anew before anything reads it.
Source§

fn hit_test(&self, x: f32, y: f32) -> Vec<<Scene as RenderScene>::HitTarget>

Performs hit testing at the given coordinates. Returns hit targets ordered by z-index (top-to-bottom).
Source§

fn hit_test_near( &self, x: f32, y: f32, ) -> Option<<Scene as RenderScene>::HitTarget>

The one target a press reaches when it misses every target but lands inside a small target grown to the minimum touch size: the nearest such target, and none when the point is outside every grown target.
Source§

fn find_target( &self, node_id: NodeId, ) -> Option<<Scene as RenderScene>::HitTarget>

Finds a hit target by NodeId with fresh geometry from the current scene. Read more
Source§

fn hit_test_ray( &self, scene: NodeId, ray: Ray, ) -> Vec<<Scene as RenderScene>::HitTarget>

The hit targets on the mesh surfaces of the scene the node scene shows that ray reaches, in the space the scene’s eye stands in, ordered by z-index (top-to-bottom): a controller’s, a hand’s or a gaze’s, which need not start at the eye.
Source§

fn surface_windows(&self, visit: &mut dyn FnMut(NodeId, ProjectiveTransform))

Visits each mesh surface the eyes of the window’s scenes see, by its node, with the map from its content to the window as the eye shows it, through the doorways it lies behind: where the nodes on it show.
Source§

fn surface_window_bounds(&self, node_id: NodeId) -> Option<Rect>

Where the hit target of node_id shows in the window when it lies on a mesh surface of a 3D scene: its bounds as the scene’s camera shows them, also through a doorway and for an eye that walked through one. None for a flat target, a target behind the eye or no target.
Source§

fn node_window_bounds(&self, visit: &mut dyn FnMut(NodeId, Rect))

Visits each layout node the scene draws with the bounds of its rect in the window, through the graphics layers above it and its own, and on a mesh surface as the scene’s camera shows it: where it shows.
Source§

fn layer_moves(&self) -> u64

A count that grows when an update moves a layer in its parent without a layout pass, as an animated graphics layer or offset_with does: what read Self::node_window_bounds reads them again when it changes.
Source§

fn draws(&self, node: NodeId) -> bool

Whether the scene draws node. A scene that keeps no record of the nodes it draws says it does.
Source§

fn drawn_parent(&self, node: NodeId) -> Option<NodeId>

The node whose record holds what the scene draws for node: the node the scene draws again for node to leave it. None when the scene draws no record for node, or that record is its root.
Source§

fn read_left_nodes(&mut self, left: &mut Vec<NodeId>) -> bool

Adds to left the layout nodes whose records the scene dropped since the last call; a node may draw through another record since, as Self::draws tells. Returns whether the scene can tell: a scene handed a store built from scratch since cannot, and the caller asks Self::draws of every node instead.
Source§

fn hit_test_nodes(&self, x: f32, y: f32) -> Vec<NodeId>

Returns NodeIds of all hit regions at the given coordinates. This is a convenience method equivalent to hit_test().map(|h| h.node_id()).

Auto Trait Implementations§

§

impl !Freeze for Scene

§

impl !RefUnwindSafe for Scene

§

impl !Send for Scene

§

impl !Sync for Scene

§

impl !UnwindSafe for Scene

§

impl Forget for Scene

§

impl Move for Scene

§

impl Unpin for Scene

§

impl UnsafeUnpin for Scene

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> 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<T> Upcast<T> for T

Source§

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