Skip to main content

Scene

Struct Scene 

Source
pub struct Scene {
    pub graph: Option<RenderGraph>,
    pub hits: Vec<HitRegion>,
    pub next_hit_z: usize,
    pub node_index: HashMap<NodeId, usize>,
    /* 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.

§hits: Vec<HitRegion>

Hit targets in draw order, the last drawn at the end.

§next_hit_z: usize

Draw order index that the next pushed hit target receives.

§node_index: HashMap<NodeId, usize>

Position in hits of the target of each node, for finding a target by node id.

Implementations§

Source§

impl Scene

Source

pub fn new() -> Self

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 and hit targets from the applier, reusing storage from the previous graph.

Source

pub fn update_from_applier( &mut self, applier: &MemoryApplier, root: NodeId, updates: SceneUpdates<'_>, refresh_hits: bool, )

Applies content and layer-property changes to the retained graph. Empty updates or an unavailable scoped update rebuild the scene. Hit targets are refreshed when their geometry changes or refresh_hits is true, as required after layout or pointer-handler changes.

Source

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

Adds an interactive target in draw order, ignoring targets that neither handle a pointer nor name a pointer icon.

Source

pub fn clear_hits(&mut self)

Removes all hit targets and releases their handlers while retaining vector capacity.

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() -> Self

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<Self::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<Self::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<Self::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<Self::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 collect_retained_visual_observation_nodes( &self, nodes: &mut HashSet<NodeId>, ) -> 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 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> 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.