Struct rin_graphics::node::Node[][src]

pub struct Node { /* fields omitted */ }

Position + Orientation + Scale of an object

Represents a model matrix decomposed into it’s components and caches this values so the matrix only is recalculated when any of the original values changes

Also calculates a global matrix from an optional parent

The update of the matrices happens whenever any of the update_* functions is called so don’t forget to call one of them before using the matrices after a change

A node that has just been created contains the correct updated matrices

Implementations

impl Node[src]

pub fn new(pos: Pnt3, orientation: UnitQuat, scale: Vec3) -> Node[src]

pub fn from_position(pos: Pnt3) -> Node[src]

pub fn with_parent(
    parent: &Node,
    pos: Pnt3,
    orientation: UnitQuat,
    scale: Vec3
) -> Node
[src]

pub fn identity() -> Node[src]

A node that applies no transformation

pub fn has_changed(&self) -> bool[src]

pub fn reset_changed(&mut self)[src]

pub fn identity_with_parent(parent: &Node) -> Node[src]

A node that applies no transformation but the global transformation contains the parent’s

pub fn new_look_at(eye: Pnt3, at: Pnt3, up: Vec3) -> Result<Node>[src]

A node that orients an object to look at a certain target

  • eye: position of the object
  • at: where the object will be looking at
  • up: up vector

Returns an error if the look at direction and the up vector are parallel

pub fn with_preparent(
    parent_inv: Mat4,
    pos: Pnt3,
    orientation: UnitQuat,
    scale: Vec3
) -> Node
[src]

New node that stores the inverse of the current parent

When parenting a node at a certain position, orientation and scale allows for those to be absolute instead of relative to the parent.

This version of the method takes a Mat4 as preparent inverse global transformation

pub fn with_preparent_node(
    preparent: &Node,
    pos: Pnt3,
    orientation: UnitQuat,
    scale: Vec3
) -> Node
[src]

New node that stores the inverse of the current parent

When parenting a node at a certain position, orientation and scale allows for those to be absolute instead of relative to the parent.

This version of the method takes another node as preparent global transformation

pub fn identity_with_preparent(parent_inv: Mat4) -> Node[src]

New node that stores the inverse of the current parent and applies no transformation itself

When parenting a node at a certain position, orientation and scale allows for those to be absolute instead of relative to the parent.

This version of the method takes another node as preparent global transformation

pub fn identity_with_preparent_node(preparent: &Node) -> Node[src]

New node that stores the inverse of the current parent and applies no transformation itself

When parenting a node at a certain position, orientation and scale allows for those to be absolute instead of relative to the parent.

This version of the method takes a Mat4 as preparent inverse global transformation

pub fn clone_with_preparent(&self, preparent: &Node) -> Node[src]

Clones this node but applies a preparent transformation

Allows to parent this node with it’s current position, orientation and scale as absolute instead of relative to the parent.

pub fn set_position(&mut self, pos: Pnt3)[src]

Sets the local position of this node

pub fn position(&self) -> Pnt3[src]

Returns the local position of this node

pub fn preparent(&self) -> Option<Mat4>[src]

Returns the initial parent inverse transformation if there’s one

pub fn set_angle_axis(&mut self, angle: Rad<f32>, axis: &Unit<Vec3>)[src]

Sets the orientation for this node from an angle and axis of rotation

pub fn set_orientation(&mut self, q: UnitQuat)[src]

Sets the orientation for this node from a quaternion

pub fn orientation(&self) -> UnitQuat[src]

Returns the orientation of this node as a quaternion which is how it’s stored internally

pub fn rotation(&self) -> Rotation3<f32>[src]

Returns the orientation of this node as a Rotation3.

This method converts the internal quaternion into a Rotation3

pub fn look_at(&mut self, at: &Pnt3, up: &Vec3) -> Result<()>[src]

Changes the orientation of the node to look at the passed position using the up vector

Returns an error if the look at direction and the up vector are parallel

pub fn face_towards(&mut self, dir: &Vec3, up: &Vec3) -> Result<()>[src]

Changes the orientation of the node to look at the passed direction using the up vector

Returns an error if the look at direction and the up vector are parallel

pub fn look_at_node<N: NodeRef>(
    &mut self,
    node: &N,
    up: &Unit<Vec3>
) -> Result<()>
[src]

Changes the orientation of the node to look at the passed node global position using the up vector

Returns an error if the look at direction and the up vector are parallel

pub fn rotate(&mut self, angle: Rad<f32>, axis: &Unit<Vec3>)[src]

Rotate this note a certain angle around the axis of rotation

pub fn append_orientation(&mut self, rot: &UnitQuat)[src]

Append the passed quaternion to the current local orientation

pub fn translate(&mut self, t: &Vec3)[src]

Append a translation to the current local position

pub fn scale(&self) -> Vec3[src]

Returns the current local scale

pub fn set_scale(&mut self, s: Vec3)[src]

Sets the local scale

pub fn local_x_axis(&self) -> Unit<Vec3>[src]

The node orientation x axis

pub fn local_y_axis(&self) -> Unit<Vec3>[src]

The node orientation y axis

pub fn local_z_axis(&self) -> Unit<Vec3>[src]

The node orientation z axis

pub fn global_x_axis(&self) -> Unit<Vec3>[src]

The node orientation x axis

pub fn global_y_axis(&self) -> Unit<Vec3>[src]

The node orientation y axis

pub fn global_z_axis(&self) -> Unit<Vec3>[src]

The node orientation z axis

pub fn tilt(&mut self, angle: Rad<f32>)[src]

rotate this node around it’s local x axis

pub fn pan(&mut self, angle: Rad<f32>)[src]

rotate this node around it’s local y axis

pub fn roll(&mut self, angle: Rad<f32>)[src]

rotate this node around it’s local z axis

pub fn local_transformation(&self) -> Mat4[src]

Local transformation matrix

pub fn global_transformation(&self) -> Mat4[src]

Global transformation matrix

pub fn global_position(&self) -> Pnt3[src]

Global position of this node

pub fn global_orientation(&self) -> UnitQuat[src]

Global orientation of this node

pub fn global_scale(&self) -> Vec3[src]

Global scale of this node

pub fn inv_local_transformation(&self) -> Mat4[src]

Inverse local transformation of this node

This is cacheed internally and uses the fastest version posible to calculate the inverse so it’s usually faster than calling local_transformation().try_inverse()

pub fn inv_global_transformation(&self) -> Mat4[src]

Inverse global transformation of this node

This is cacheed internally and uses the fastest version posible to calculate the inverse so it’s usually faster than calling global_transformation().try_inverse()

pub fn update_with_parent(&mut self, parent: Option<&Node>) -> bool[src]

Updates the internal matrices including the glonal matrices using the optional parent passed as argument

pub fn update_with_parent_parts(
    &mut self,
    parent_loc: Option<&Node>,
    parent_orientation: Option<&Node>,
    parent_scale: Option<&Node>
) -> bool
[src]

Updates the internal matrices including the glonal matrices using the optional parent passed as argument and flags

Trait Implementations

impl Clone for Node[src]

impl Component for Node[src]

type Storage = Changed<Forest<Node>, Node>

type MutStorageCacheGuard = ()

impl Debug for Node[src]

impl<'a> DebugParameter for Node[src]

impl Default for Node[src]

impl<'de> Deserialize<'de> for Node[src]

impl From<Isometry<f32, U3, Unit<Quaternion<f32>>>> for Node[src]

impl From<Node> for Model[src]

impl From<Point<f32, U3>> for Node[src]

impl From<Rotation<f32, U3>> for Node[src]

impl From<Translation<f32, U3>> for Node[src]

impl From<Unit<Quaternion<f32>>> for Node[src]

impl Mul<Node> for Node[src]

type Output = Node

The resulting type after applying the * operator.

impl NodeMut for Node[src]

impl NodeRef for Node[src]

impl One for Node[src]

impl Serialize for Node[src]

impl Copy for Node[src]

Auto Trait Implementations

impl RefUnwindSafe for Node

impl Send for Node

impl Sync for Node

impl Unpin for Node

impl UnwindSafe for Node

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Any for T where
    T: Any
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<V> IntoPnt<V> for V[src]

impl<V> IntoVec<V> for V[src]

impl<T> Pointable for T[src]

type Init = T

The type for initializers.

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T> Serialize for T where
    T: Serialize + ?Sized
[src]

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 
[src]

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

impl<C> ComponentSend for C where
    C: Component + Send
[src]

impl<C> ComponentThreadLocal for C where
    C: Component
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]