[][src]Struct duku::Transform

pub struct Transform {
    pub position: Vector3,
    pub scale: Vector3,
    pub rotation: Quaternion,
}

Represents transformation in separate components.

Used as an easier way to operate with transformations than matrices

Example

This example is not tested
let transform = Transform {
    position: Vector3::new(1.0, 2.0, 3.0),
    scale: Vector3::uniform(5.0),
    rotation: Quaternion::euler_rotation(90.0, 0.0, 45.0),
};
let matrix = Matrix4::from(transform);
// use matrix as usual

Fields

position: Vector3

the position component

scale: Vector3

the scale component

rotation: Quaternion

the rotation component

Implementations

impl Transform[src]

pub fn up(self) -> Vector3[src]

local up direction for transformation

pub fn forward(self) -> Vector3[src]

local forward direction for transformation

pub fn right(self) -> Vector3[src]

local right direction for transformation

pub fn move_by(&mut self, amount: impl Into<Vector3>)[src]

move tranformation by specified amount

Note: this moves using global directions

pub fn move_up(&mut self, amount: f32)[src]

move transformation up by specified amount

Note: this moves using local directions

pub fn move_down(&mut self, amount: f32)[src]

move transformation down by specified amount

Note: this moves using local directions

pub fn move_right(&mut self, amount: f32)[src]

move transformation right by specified amount

Note: this moves using local directions

pub fn move_left(&mut self, amount: f32)[src]

move transformation left by specified amount

Note: this moves using local directions

pub fn move_forward(&mut self, amount: f32)[src]

move transformation forward by specified amount

Note: this moves using local directions

pub fn move_back(&mut self, amount: f32)[src]

move transformation back by specified amount

Note: this moves using local directions

pub fn move_around_point(
    &mut self,
    point: impl Into<Vector3>,
    angle: f32,
    axis: impl Into<Vector3>
)
[src]

move transformation rotating it around some point around an axis

pub fn look_dir(&mut self, dir: impl Into<Vector3>)[src]

rotates the transformation to look at specific direction

pub fn look_at(&mut self, pos: impl Into<Vector3>)[src]

rotates the transformation to look at specific position

Trait Implementations

impl Clone for Transform[src]

impl Copy for Transform[src]

impl Debug for Transform[src]

impl Default for Transform[src]

impl From<Matrix4> for Transform[src]

impl From<Transform> for Matrix4[src]

impl PartialEq<Transform> for Transform[src]

impl StructuralPartialEq for Transform[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[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<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.