Struct Node

Source
pub struct Node {
Show 14 fields pub id: Option<String>, pub name: Option<String>, pub sid: Option<String>, pub ty: NodeType, pub layer: Vec<String>, pub asset: Option<Box<Asset>>, pub transforms: Vec<Transform>, pub instance_camera: Vec<Instance<Camera>>, pub instance_controller: Vec<Instance<Controller>>, pub instance_geometry: Vec<Instance<Geometry>>, pub instance_light: Vec<Instance<Light>>, pub instance_node: Vec<Instance<Node>>, pub children: Vec<Node>, pub extra: Vec<Extra>,
}
Expand description

Embodies the hierarchical relationship of elements in a scene.

The Node element declares a point of interest in a scene. A node denotes one point on a branch of the scene graph. The Node element is essentially the root of a subgraph of the entire scene graph.

Fields§

§id: Option<String>

A text string containing the unique identifier of the element.

§name: Option<String>

The text string name of this element.

§sid: Option<String>

A text string value containing the subidentifier of this element. This value must be unique within the scope of the parent element.

§ty: NodeType

The type of the Node element.

§layer: Vec<String>

The layers to which this node belongs.

§asset: Option<Box<Asset>>

Asset management information about this element.

§transforms: Vec<Transform>

Any combination of geometric transforms.

§instance_camera: Vec<Instance<Camera>>

Allows the node to instantiate a camera object.

§instance_controller: Vec<Instance<Controller>>

Allows the node to instantiate a controller object.

§instance_geometry: Vec<Instance<Geometry>>

Allows the node to instantiate a geometry object.

§instance_light: Vec<Instance<Light>>

Allows the node to instantiate a light object.

§instance_node: Vec<Instance<Node>>

Allows the node to instantiate a hierarchy of other nodes.

§children: Vec<Node>

Allows the node to recursively define hierarchy.

§extra: Vec<Extra>

Provides arbitrary additional information about this element.

Implementations§

Source§

impl Node

Source

pub fn new(id: impl Into<String>, name: Option<String>) -> Self

Construct a new default node with the given id and name.

Source

pub fn push_transform(&mut self, transform: impl Into<Transform>)

Add a transform to this node’s transformation stack.

Source

pub fn is_empty(&self) -> bool

Returns true if this node has no sub-elements.

Trait Implementations§

Source§

impl Clone for Node

Source§

fn clone(&self) -> Node

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Node

Source§

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

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

impl HasId for Node

Source§

fn id(&self) -> Option<&str>

Get the ID of the node.
Source§

fn get_local_map<'a, 'b>( maps: &'b LocalMaps<'a>, ) -> &'b Option<LocalMap<'a, Self>>

Extract the relevant LocalMap field from a LocalMaps.
Source§

fn get_local_map_mut<'a, 'b>( maps: &'b mut LocalMaps<'a>, ) -> &'b mut Option<LocalMap<'a, Self>>

Extract the relevant LocalMap field from a LocalMaps.
Source§

impl ParseLibrary for Node

Source§

const LIBRARY: &'static str = "library_nodes"

The name of the library element. For example, the Geometry element has LIBRARY = "library_geometries", and the corresponding library type is Library<Geometry>.
Source§

fn extract_element(e: &LibraryElement) -> Option<&Library<Self>>

Extract the library from a single LibraryElement.
Source§

fn mk_element(lib: Library<Self>) -> LibraryElement

Make a LibraryElement from a Library.
Source§

impl Traversable for Node

Source§

fn traverse<'a, E>( doc: &'a Document, f: impl FnMut(&'a Node) -> Result<(), E>, ) -> Result<(), E>

Run the function f on all elements of type Self in the document doc.

Auto Trait Implementations§

§

impl Freeze for Node

§

impl RefUnwindSafe for Node

§

impl Send for Node

§

impl Sync for Node

§

impl Unpin for Node

§

impl UnwindSafe for Node

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 = 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.