pub struct Node {
pub transform: Transform,
pub visible: bool,
/* private fields */
}Expand description
A minimal scene node containing only essential hot data.
§Design Principles
- Only keeps data that must be traversed every frame (hierarchy and transform)
- Other attributes (Mesh, Camera, Light, Skin, etc.) are stored in Scene’s component maps
- Improves CPU cache hit rate by keeping nodes small and contiguous
§Hierarchy
Nodes form a tree structure through parent-child relationships:
parent: Optional handle to parent node (None for root nodes)children: List of child node handles
§Transform
Each node has a Transform component that manages:
- Local position, rotation, and scale
- Cached local and world matrices
- Dirty flag for efficient updates
Fields§
§transform: TransformTransform component (hot data accessed every frame)
visible: boolVisibility flag for culling
Implementations§
Source§impl Node
impl Node
Sourcepub fn parent(&self) -> Option<NodeHandle>
pub fn parent(&self) -> Option<NodeHandle>
Returns the parent node handle, if any.
Sourcepub fn children(&self) -> &[NodeHandle]
pub fn children(&self) -> &[NodeHandle]
Returns a read-only slice of child node handles.
Sourcepub fn set_parent(&mut self, parent: Option<NodeHandle>)
pub fn set_parent(&mut self, parent: Option<NodeHandle>)
Sets the parent of this node. Prefer using crate::Scene::attach which
keeps both parent and child in sync. This is exposed for low-level
construction (e.g., building hierarchies outside of a Scene).
Sourcepub fn push_child(&mut self, child: NodeHandle)
pub fn push_child(&mut self, child: NodeHandle)
Appends a child handle. Prefer using crate::Scene::attach which keeps
both parent and child in sync. This is exposed for low-level
construction (e.g., building hierarchies outside of a Scene).
Sourcepub fn world_matrix(&self) -> &Affine3A
pub fn world_matrix(&self) -> &Affine3A
Returns a reference to the world transformation matrix.
This matrix transforms local coordinates to world coordinates. It is automatically updated by the transform system each frame.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Node
impl RefUnwindSafe for Node
impl Send for Node
impl Sync for Node
impl Unpin for Node
impl UnsafeUnpin for Node
impl UnwindSafe for Node
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().