pub struct SceneSpatialTree {
spatial_nodes: Store<SceneSpatialNode>,
spatial_node_map: FastHashMap<SpatialNodeUid, SpatialNodeEntry>,
root_reference_frame_index: SpatialNodeIndex,
frame_counter: u64,
updates: SpatialTreeUpdates,
spatial_nodes_set: HashSet<SpatialNodeUid, BuildHasherDefault<FxHasher>>,
}Expand description
The representation of the spatial tree during scene building, which is mostly write-only, with a small number of queries for snapping, picture cache building
Fields§
§spatial_nodes: Store<SceneSpatialNode>Nodes which determine the positions (offsets and transforms) for primitives and clips.
spatial_node_map: FastHashMap<SpatialNodeUid, SpatialNodeEntry>A set of the uids we’ve encountered for spatial nodes, used to assert that we’re not seeing duplicates. Likely to be removed once we rely on this feature.
root_reference_frame_index: SpatialNodeIndex§frame_counter: u64§updates: SpatialTreeUpdates§spatial_nodes_set: HashSet<SpatialNodeUid, BuildHasherDefault<FxHasher>>A debug check that the caller never adds a spatial node with duplicate uid, since that can cause badness if it occurs (e.g. a malformed spatial tree and infinite loops in is_ancestor etc)
Implementations§
Source§impl SceneSpatialTree
impl SceneSpatialTree
pub fn new() -> Self
pub fn is_root_coord_system(&self, index: SpatialNodeIndex) -> bool
Sourcepub fn end_frame_and_get_pending_updates(&mut self) -> SpatialTreeUpdates
pub fn end_frame_and_get_pending_updates(&mut self) -> SpatialTreeUpdates
Complete building this scene, return the updates to apply to the frame spatial tree
Sourcepub fn is_ancestor(
&self,
maybe_parent: SpatialNodeIndex,
maybe_child: SpatialNodeIndex,
) -> bool
pub fn is_ancestor( &self, maybe_parent: SpatialNodeIndex, maybe_child: SpatialNodeIndex, ) -> bool
Check if a given spatial node is an ancestor of another spatial node.
Sourcepub fn find_scroll_root(
&self,
spatial_node_index: SpatialNodeIndex,
allow_sticky_frames: bool,
) -> SpatialNodeIndex
pub fn find_scroll_root( &self, spatial_node_index: SpatialNodeIndex, allow_sticky_frames: bool, ) -> SpatialNodeIndex
Find the spatial node that is the scroll root for a given spatial node. A scroll root is the first spatial node when found travelling up the spatial node tree that is an explicit scroll frame.
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.
fn add_spatial_node( &mut self, node: SceneSpatialNode, uid: SpatialNodeUid, ) -> SpatialNodeIndex
pub fn add_reference_frame( &mut self, parent_index: SpatialNodeIndex, transform_style: TransformStyle, source_transform: PropertyBinding<LayoutTransform>, kind: ReferenceFrameKind, origin_in_parent_reference_frame: LayoutVector2D, pipeline_id: PipelineId, uid: SpatialNodeUid, ) -> SpatialNodeIndex
pub fn add_scroll_frame( &mut self, parent_index: SpatialNodeIndex, external_id: ExternalScrollId, pipeline_id: PipelineId, frame_rect: &LayoutRect, content_size: &LayoutSize, frame_kind: ScrollFrameKind, external_scroll_offset: LayoutVector2D, scroll_offset_generation: APZScrollGeneration, has_scroll_linked_effect: HasScrollLinkedEffect, uid: SpatialNodeUid, ) -> SpatialNodeIndex
pub fn add_sticky_frame( &mut self, parent_index: SpatialNodeIndex, sticky_frame_info: StickyFrameInfo, pipeline_id: PipelineId, key: SpatialTreeItemKey, instance_id: PipelineInstanceId, ) -> SpatialNodeIndex
Trait Implementations§
Source§impl Serialize for SceneSpatialTree
impl Serialize for SceneSpatialTree
Source§impl SpatialNodeContainer for SceneSpatialTree
impl SpatialNodeContainer for SceneSpatialTree
Source§fn get_node_info(&self, index: SpatialNodeIndex) -> SpatialNodeInfo<'_>
fn get_node_info(&self, index: SpatialNodeIndex) -> SpatialNodeInfo<'_>
Auto Trait Implementations§
impl Freeze for SceneSpatialTree
impl RefUnwindSafe for SceneSpatialTree
impl Send for SceneSpatialTree
impl Sync for SceneSpatialTree
impl Unpin for SceneSpatialTree
impl UnsafeUnpin for SceneSpatialTree
impl UnwindSafe for SceneSpatialTree
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