Enum gltf::scene::Transform

source ·
pub enum Transform {
    Matrix {
        matrix: [[f32; 4]; 4],
    },
    Decomposed {
        translation: [f32; 3],
        rotation: [f32; 4],
        scale: [f32; 3],
    },
}
Expand description

The transform for a Node.

Variants§

§

Matrix

Fields

§matrix: [[f32; 4]; 4]

4x4 matrix.

4x4 transformation matrix in column-major order.

§

Decomposed

Fields

§translation: [f32; 3]

[x, y, z] vector.

§rotation: [f32; 4]

[x, y, z, w] quaternion, where w is the scalar.

§scale: [f32; 3]

[x, y, z] vector.

Decomposed TRS properties.

Implementations§

source§

impl Transform

source

pub fn matrix(self) -> [[f32; 4]; 4]

Returns the matrix representation of this transform.

If the transform is Decomposed, then the matrix is generated with the equation matrix = translation * rotation * scale.

source

pub fn decomposed(self) -> ([f32; 3], [f32; 4], [f32; 3])

Returns a decomposed representation of this transform.

If the transform is Matrix, then the decomposition is extracted from the matrix.

Trait Implementations§

source§

impl Clone for Transform

source§

fn clone(&self) -> Transform

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 Transform

source§

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

Formats the value using the given formatter. Read more

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> 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,

§

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>,

§

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>,

§

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.