Struct webrender::spatial_tree::SpatialTree
source · pub struct SpatialTree {
spatial_nodes: Vec<SpatialNode>,
coord_systems: Vec<CoordinateSystem>,
root_reference_frame_index: SpatialNodeIndex,
update_state_stack: Vec<TransformUpdateState>,
}
Expand description
Represents the spatial tree during frame building, which is mostly read-only, apart from the tree update at the start of the frame
Fields§
§spatial_nodes: Vec<SpatialNode>
Nodes which determine the positions (offsets and transforms) for primitives and clips.
coord_systems: Vec<CoordinateSystem>
A list of transforms that establish new coordinate systems. Spatial nodes only establish a new coordinate system when they have a transform that is not a simple 2d translation.
root_reference_frame_index: SpatialNodeIndex
§update_state_stack: Vec<TransformUpdateState>
Stack of current state for each parent node while traversing and updating tree
Implementations§
source§impl SpatialTree
impl SpatialTree
pub fn new() -> Self
fn visit_node_impl_mut<F>(&mut self, index: SpatialNodeIndex, f: &mut F)
fn visit_node_impl<F>(&self, index: SpatialNodeIndex, f: &mut F)
sourcepub fn visit_nodes<F>(&self, f: F)
pub fn visit_nodes<F>(&self, f: F)
Visit all nodes from the root of the tree, invoking a closure on each one
sourcepub fn visit_nodes_mut<F>(&mut self, f: F)
pub fn visit_nodes_mut<F>(&mut self, f: F)
Visit all nodes from the root of the tree, invoking a closure on each one
sourcepub fn apply_updates(&mut self, updates: SpatialTreeUpdates)
pub fn apply_updates(&mut self, updates: SpatialTreeUpdates)
Apply updates from a new scene to the frame spatial tree
pub fn get_last_sampled_scroll_offsets( &self, ) -> FastHashMap<ExternalScrollId, Vec<SampledScrollOffset>>
pub fn apply_last_sampled_scroll_offsets( &mut self, last_sampled_offsets: FastHashMap<ExternalScrollId, Vec<SampledScrollOffset>>, )
pub fn get_spatial_node(&self, index: SpatialNodeIndex) -> &SpatialNode
pub fn get_spatial_node_mut( &mut self, index: SpatialNodeIndex, ) -> &mut SpatialNode
sourcepub fn spatial_node_count(&self) -> usize
pub fn spatial_node_count(&self) -> usize
Get total number of spatial nodes
pub fn find_spatial_node_by_anim_id( &self, id: PropertyBindingId, ) -> Option<SpatialNodeIndex>
sourcepub fn get_relative_transform(
&self,
child_index: SpatialNodeIndex,
parent_index: SpatialNodeIndex,
) -> CoordinateSpaceMapping<LayoutPixel, LayoutPixel>
pub fn get_relative_transform( &self, child_index: SpatialNodeIndex, parent_index: SpatialNodeIndex, ) -> CoordinateSpaceMapping<LayoutPixel, LayoutPixel>
Calculate the relative transform from child_index
to parent_index
.
This method will panic if the nodes are not connected!
sourcepub fn get_relative_transform_with_face(
&self,
child_index: SpatialNodeIndex,
parent_index: SpatialNodeIndex,
visible_face: Option<&mut VisibleFace>,
) -> CoordinateSpaceMapping<LayoutPixel, LayoutPixel>
pub fn get_relative_transform_with_face( &self, child_index: SpatialNodeIndex, parent_index: SpatialNodeIndex, visible_face: Option<&mut VisibleFace>, ) -> CoordinateSpaceMapping<LayoutPixel, LayoutPixel>
Calculate the relative transform from child_index
to parent_index
.
This method will panic if the nodes are not connected!
Also, switch the visible face to Back
if at any stage where the
combined transform is flattened, we see the back face.
sourcepub fn is_matching_coord_system(
&self,
index0: SpatialNodeIndex,
index1: SpatialNodeIndex,
) -> bool
pub fn is_matching_coord_system( &self, index0: SpatialNodeIndex, index1: SpatialNodeIndex, ) -> bool
Returns true if both supplied spatial nodes are in the same coordinate system (implies the relative transform produce axis-aligned rects).
fn get_world_transform_impl( &self, index: SpatialNodeIndex, scroll: TransformScroll, ) -> CoordinateSpaceMapping<LayoutPixel, WorldPixel>
sourcepub fn get_world_transform(
&self,
index: SpatialNodeIndex,
) -> CoordinateSpaceMapping<LayoutPixel, WorldPixel>
pub fn get_world_transform( &self, index: SpatialNodeIndex, ) -> CoordinateSpaceMapping<LayoutPixel, WorldPixel>
Calculate the relative transform from index
to the root.
sourcepub fn get_world_viewport_transform(
&self,
index: SpatialNodeIndex,
) -> CoordinateSpaceMapping<LayoutPixel, WorldPixel>
pub fn get_world_viewport_transform( &self, index: SpatialNodeIndex, ) -> CoordinateSpaceMapping<LayoutPixel, WorldPixel>
Calculate the relative transform from index
to the root.
Unlike get_world_transform
, this variant doesn’t account for the local scroll offset.
sourcepub fn root_reference_frame_index(&self) -> SpatialNodeIndex
pub fn root_reference_frame_index(&self) -> SpatialNodeIndex
The root reference frame, which is the true root of the SpatialTree.
pub fn set_scroll_offsets( &mut self, id: ExternalScrollId, offsets: Vec<SampledScrollOffset>, ) -> bool
pub fn update_tree(&mut self, scene_properties: &SceneProperties)
fn update_node( &mut self, node_index: SpatialNodeIndex, scene_properties: &SceneProperties, )
pub fn build_transform_palette(&self) -> TransformPalette
fn print_node<T: PrintTreePrinter>(&self, index: SpatialNodeIndex, pt: &mut T)
sourcepub fn get_local_visible_face(
&self,
node_index: SpatialNodeIndex,
) -> VisibleFace
pub fn get_local_visible_face( &self, node_index: SpatialNodeIndex, ) -> VisibleFace
Get the visible face of the transfrom from the specified node to its parent.
pub fn print(&self)
Trait Implementations§
source§impl PrintableTree for SpatialTree
impl PrintableTree for SpatialTree
fn print_with<T: PrintTreePrinter>(&self, pt: &mut T)
source§impl Serialize for SpatialTree
impl Serialize for SpatialTree
source§impl SpatialNodeContainer for SpatialTree
impl SpatialNodeContainer for SpatialTree
source§fn get_node_info(&self, index: SpatialNodeIndex) -> SpatialNodeInfo<'_>
fn get_node_info(&self, index: SpatialNodeIndex) -> SpatialNodeInfo<'_>
Auto Trait Implementations§
impl Freeze for SpatialTree
impl RefUnwindSafe for SpatialTree
impl Send for SpatialTree
impl Sync for SpatialTree
impl Unpin for SpatialTree
impl UnwindSafe for SpatialTree
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more