Skip to main content

SceneGraph3D

Struct SceneGraph3D 

Source
pub struct SceneGraph3D { /* private fields */ }
Expand description

Flat depth-sorted 3D scene graph with zero-allocation dirty-bitset world-matrix propagation and Blender Collections.

Implementations§

Source§

impl SceneGraph3D

Hierarchy insertion, dirty bitset management, and zero-allocation propagation for SceneGraph3D.

Source

pub fn add_node(&mut self, node: SceneNode3D) -> u32

Appends node to the graph, marks it dirty, and returns its assigned node index.

§Arguments
  • &Self - Mutable scene graph.
  • SceneNode3D - Node descriptor to insert.
§Returns
  • u32 - Assigned node index inside nodes.
Source

pub fn attach_morph_weights(&mut self, node_id: u32, weights: &[f32])

Appends initial shape-key morph weights for node_id and records their slice range.

§Arguments
  • &Self - Mutable scene graph.
  • u32 - Target node index.
  • &[f32] - Initial morph target weights.
Source

pub fn set_local_trs( &mut self, node_id: u32, translation: Vec3, rotation: Quat, scale: Vec3, )

Updates a node’s local TRS transform and marks its subtree dirty without allocating.

§Arguments
  • &Self - Mutable scene graph.
  • u32 - Target node index.
  • Vec3 - Local translation.
  • Quat - Local rotation quaternion.
  • Vec3 - Local non-uniform scale.
Source

pub fn set_local_matrix(&mut self, node_id: u32, matrix: Mat4)

Decomposes a local 4x4 matrix into TRS and applies it to node_id.

§Arguments
  • &Self - Mutable scene graph.
  • u32 - Target node index.
  • Mat4 - Local 4x4 transformation matrix.
Source

pub fn mark_dirty(&mut self, node_id: u32)

Sets the dirty bit for node_id in O(1) with zero heap allocations.

§Arguments
  • &Self - Mutable scene graph.
  • u32 - Target node index.
Source

pub fn is_dirty(&self, node_id: u32) -> bool

Returns true when node_id is currently marked dirty.

§Arguments
  • &Self - Scene graph reference.
  • u32 - Node index.
§Returns
  • bool - Whether the node’s world matrix requires recomputation.
Source

pub fn morph_weights_for_node(&self, node_id: u32) -> &[f32]

Returns the borrowed slice of morph target weights owned by node_id.

§Arguments
  • &Self - Scene graph reference.
  • u32 - Target node index.
§Returns
  • &[f32] - Morph weights slice (empty when unattached).
Source

pub fn update_morph_weights(&mut self, node_id: u32, weights: &[f32])

Overwrites morph weights for node_id in place with zero heap allocations.

§Arguments
  • &Self - Mutable scene graph.
  • u32 - Target node index.
  • &[f32] - New morph target weights.
Source

pub fn ensure_topology_order(&mut self)

Rebuilds the depth-sorted topological traversal list when nodes were inserted or reparented.

§Arguments
  • &Self - Mutable scene graph.
Source

pub fn propagate_world_matrices(&mut self) -> usize

Propagates dirty local transforms down the hierarchy in topological order with zero steady-state allocations.

§Arguments
  • &Self - Mutable scene graph.
§Returns
  • usize - Number of node world matrices recomputed during this pass.
Source

pub fn is_node_effectively_visible(&self, node_id: u32) -> bool

Returns true when node_id and its entire ancestor chain are visible and pass collection masks.

§Arguments
  • &Self - Scene graph reference.
  • u32 - Target node index.
§Returns
  • bool - Effective scene visibility.
Source§

impl SceneGraph3D

Source

pub fn get_nodes(&self) -> &Vec<SceneNode3D>

Source

pub fn get_mut_nodes(&mut self) -> &mut Vec<SceneNode3D>

Source

pub fn set_nodes(&mut self, val: Vec<SceneNode3D>) -> &mut Self

Source

pub fn get_topo_order(&self) -> &Vec<u32>

Source

pub fn get_mut_topo_order(&mut self) -> &mut Vec<u32>

Source

pub fn set_topo_order(&mut self, val: Vec<u32>) -> &mut Self

Source

pub fn get_dirty_words(&self) -> &Vec<u64>

Source

pub fn get_mut_dirty_words(&mut self) -> &mut Vec<u64>

Source

pub fn set_dirty_words(&mut self, val: Vec<u64>) -> &mut Self

Source

pub fn get_morph_weights(&self) -> &Vec<f32>

Source

pub fn get_mut_morph_weights(&mut self) -> &mut Vec<f32>

Source

pub fn set_morph_weights(&mut self, val: Vec<f32>) -> &mut Self

Source

pub fn get_collections(&self) -> &CollectionRegistry3D

Source

pub fn get_mut_collections(&mut self) -> &mut CollectionRegistry3D

Source

pub fn set_collections(&mut self, val: CollectionRegistry3D) -> &mut Self

Source

pub fn get_topology_dirty(&self) -> bool

Source

pub fn get_mut_topology_dirty(&mut self) -> &mut bool

Source

pub fn set_topology_dirty(&mut self, val: bool) -> &mut Self

Source

pub fn get_revision(&self) -> u64

Source

pub fn get_mut_revision(&mut self) -> &mut u64

Source

pub fn set_revision(&mut self, val: u64) -> &mut Self

Trait Implementations§

Source§

impl Clone for SceneGraph3D

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SceneGraph3D

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SceneGraph3D

Default empty hierarchy for SceneGraph3D.

Source§

fn default() -> Self

Creates an empty SceneGraph3D with a default CollectionRegistry3D.

§Returns
  • Self - Empty scene graph.
Source§

impl PartialEq for SceneGraph3D

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SceneGraph3D

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.