Struct Scene

Source
pub struct Scene { /* private fields */ }

Implementations§

Source§

impl Scene

Source

pub fn new() -> Scene

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn node(&self, id: NodeId) -> Result<&Node, SceneError>

Source

pub fn nodes(&self) -> impl Iterator<Item = (NodeId, &Node)>

Source

pub fn create( &mut self, name: impl Into<String>, local: Transform, parent: Option<NodeId>, ) -> Result<NodeId, SceneError>

Source

pub fn set_local( &mut self, id: NodeId, local: Transform, ) -> Result<(), SceneError>

Source

pub fn set_parent( &mut self, id: NodeId, parent: Option<NodeId>, ) -> Result<(), SceneError>

Reparent while retaining local TRS. Cycles and invalid handles are rejected before any links change. World-space position may change.

Source

pub fn world_matrix(&self, id: NodeId) -> Result<[f32; 16], SceneError>

Source

pub fn remove_subtree(&mut self, root: NodeId) -> Result<usize, SceneError>

Source

pub fn prefab(&self, root: NodeId) -> Result<Prefab, SceneError>

Captures local transforms and hierarchy; external parent links are omitted.

Source

pub fn instantiate( &mut self, prefab: &Prefab, parent: Option<NodeId>, ) -> Result<NodeId, SceneError>

Source

pub fn clone_subtree( &mut self, root: NodeId, parent: Option<NodeId>, ) -> Result<NodeId, SceneError>

Source

pub fn encode(&self) -> Result<Vec<u8>, SceneError>

GSC1 format: magic, u16 version, u32 count; each node has u32 parent (MAX=root), u16 UTF-8 name length, name bytes, and 10 little-endian f32 TRS values. Handles are remapped; serialized data never trusts slot generations.

Source

pub fn decode(bytes: &[u8]) -> Result<Scene, SceneError>

Trait Implementations§

Source§

impl Default for Scene

Source§

fn default() -> Scene

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Scene

§

impl RefUnwindSafe for Scene

§

impl Send for Scene

§

impl Sync for Scene

§

impl Unpin for Scene

§

impl UnwindSafe for Scene

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.