Skip to main content

Scene

Struct Scene 

Source
pub struct Scene {
    pub graph: Option<RenderGraph>,
    /* private fields */
}
Expand description

The retained render graph of a window together with the hit targets built from it.

Fields§

§graph: Option<RenderGraph>

The retained render graph, or None before the first build.

Implementations§

Source§

impl Scene

Source

pub fn new() -> Scene

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

Source

pub fn diagnostics(&self) -> &RenderDiagnostics

The diagnostics shared by the scene and its hit targets.

Source

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

Rebuilds the retained graph from the applier, reusing storage from the previous graph. The hit targets follow the new graph.

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

Applies content and layer-property changes to the retained graph. Empty updates or an unavailable scoped update rebuild the scene. The hit targets follow the graph 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.

Source

pub fn replace_graph(&mut self, graph: RenderGraph)

Replaces the retained render graph and leaves the hit targets as they are.

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 render graph and all hit targets.
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 collect_retained_visual_observation_nodes( &self, nodes: &mut HashSet<NodeId, RandomState>, ) -> bool

Replaces the set with retained visual observation owners, preserving its capacity. Returns whether the scene provides this information.
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 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<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, 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.