Skip to main content

RenderScene

Trait RenderScene 

Source
pub trait RenderScene {
    type HitTarget: HitTestTarget + Clone;

Show 14 methods // Required methods fn clear(&mut self); fn hit_test(&self, x: f32, y: f32) -> Vec<Self::HitTarget>; fn find_target(&self, node_id: NodeId) -> Option<Self::HitTarget>; // Provided methods fn hit_test_near(&self, _x: f32, _y: f32) -> Option<Self::HitTarget> { ... } fn hit_test_nodes(&self, x: f32, y: f32) -> Vec<NodeId> { ... } fn hit_test_ray(&self, _scene: NodeId, _ray: Ray) -> Vec<Self::HitTarget> { ... } fn surface_windows( &self, _visit: &mut dyn FnMut(NodeId, ProjectiveTransform), ) { ... } fn surface_window_bounds(&self, _node_id: NodeId) -> Option<Rect> { ... } fn node_window_bounds(&self, _visit: &mut dyn FnMut(NodeId, Rect)) { ... } fn layer_moves(&self) -> u64 { ... } fn trim(&mut self) -> bool { ... } fn draws(&self, _node: NodeId) -> bool { ... } fn drawn_parent(&self, _node: NodeId) -> Option<NodeId> { ... } fn read_left_nodes(&mut self, _left: &mut Vec<NodeId>) -> bool { ... }
}
Expand description

Trait describing the minimal surface area required by the application shell to process pointer events and refresh the frame graph.

Required Associated Types§

Source

type HitTarget: HitTestTarget + Clone

The hit target type that hit testing returns.

Required Methods§

Source

fn clear(&mut self)

Removes the scene’s records 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 find_target(&self, node_id: NodeId) -> Option<Self::HitTarget>

Finds a hit target by NodeId with fresh geometry from the current scene.

This is the key method for HitPathTracker-style gesture handling:

  • On PointerDown, we cache NodeIds (not geometry)
  • On Move/Up/Cancel, we call this to get fresh HitTarget with current geometry
  • Handler closures are preserved (same Rc), so internal state survives

Returns None if the node no longer exists in the scene (e.g., removed during gesture).

Provided Methods§

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

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 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 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 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.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§