Struct radiant_utils::Mat4
[−]
[src]
pub struct Mat4<T = f32>(pub [[T; 4]; 4]);
A 4x4 matrix.
Methods
impl<T> Mat4<T> where
T: Float,
[src]
T: Float,
pub fn new() -> Mat4<T>
[src]
Creates a zero matrix.
pub fn identity() -> Mat4<T>
[src]
Creates an identity matrix.
pub fn viewport(width: T, height: T) -> Mat4<T>
[src]
Creates viewport matrix mapping viewport top left to (0.0, 0.0) and bottom right to (width, height)
pub fn look_at<E, C, U>(eye: E, target: C, up: U) -> Mat4<T> where
E: Vector<T>,
C: Vector<T>,
U: Vector<T>,
[src]
E: Vector<T>,
C: Vector<T>,
U: Vector<T>,
Creates a look-at matrix with the given eye position, target position, and up-vector.
pub fn ortho<R>(rectangle: R, near: T, far: T) -> Mat4<T> where
((T, T), (T, T)): From<R>,
[src]
((T, T), (T, T)): From<R>,
Creates an orthogonal projection matrix with the given rectangular bounds at the near and far clipping plane.
pub fn frustum<R>(rectangle: R, near: T, far: T) -> Mat4<T> where
((T, T), (T, T)): From<R>,
[src]
((T, T), (T, T)): From<R>,
Creates a frustum projection matrix with the given rectangular bounds at the near clipping plane and rectangle * (far / near) at the far clipping plane.
pub fn perspective(fov_y: T, aspect: T, near: T, far: T) -> Mat4<T>
[src]
Creates a perspective projection matrix with the given field of view, aspect and near/far clipping planes.
Trait Implementations
impl<T: Copy> Copy for Mat4<T>
[src]
impl<T: Clone> Clone for Mat4<T>
[src]
fn clone(&self) -> Mat4<T>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T> Matrix<T> for Mat4<T> where
T: Float,
[src]
T: Float,
4x4 Matrices.
ⓘImportant traits for &'a mut Wfn set<M>(&mut self, other: M) -> &mut Self where
[[T; 4]; 4]: From<M>,
[src]
[[T; 4]; 4]: From<M>,
Sets the matrix value from another matrix.
ⓘImportant traits for &'a mut Wfn translate<V>(&mut self, translation_vector: V) -> &mut Self where
V: Vector<T>,
[src]
V: Vector<T>,
Translate matrix by given vector.
ⓘImportant traits for &'a mut Wfn scale<V>(&mut self, scaling_vector: V) -> &mut Self where
V: Vector<T>,
[src]
V: Vector<T>,
Scale matrix by given vector.
ⓘImportant traits for &'a mut Wfn scale_at<P, V>(&mut self, position: P, scaling_vector: V) -> &mut Self where
P: Vector<T>,
V: Vector<T>,
[src]
P: Vector<T>,
V: Vector<T>,
Scales at given position.
ⓘImportant traits for &'a mut Wfn rotate(&mut self, radians: T) -> &mut Self
[src]
Rotates the origin around z.
ⓘImportant traits for &'a mut Wfn rotate_at<P>(&mut self, position: P, radians: T) -> &mut Self where
P: Vector<T>,
[src]
P: Vector<T>,
Rotates around z at given position.
ⓘImportant traits for &'a mut Wfn rotate_axis<V>(&mut self, radians: T, axis: V) -> &mut Self where
Vec3<T>: From<V>,
[src]
Vec3<T>: From<V>,
Rotates around axis.
ⓘImportant traits for &'a mut Wfn rotate_axis_at<P, V>(
&mut self,
position: P,
radians: T,
axis: V
) -> &mut Self where
P: Vector<T>,
Vec3<T>: From<V>,
[src]
&mut self,
position: P,
radians: T,
axis: V
) -> &mut Self where
P: Vector<T>,
Vec3<T>: From<V>,
Rotates around axis at given position.
fn get_rotation(&self) -> Self
[src]
Returns a pure rotation matrix for given matrix
fn get_translation(&self) -> Vec3<T>
[src]
Returns the matrix's translation vector.
fn get_scale(&self) -> Vec3<T>
[src]
Returns the matrix's scaling vector.
fn get_euler(&self) -> Vec3<T>
[src]
Get rotation matrix euler angles.
impl<T> From<[[T; 4]; 4]> for Mat4<T> where
T: Copy,
[src]
T: Copy,
impl<T> Default for Mat4<T> where
T: Float,
[src]
T: Float,
impl<T> Mul<T> for Mat4<T> where
T: Float,
[src]
T: Float,
type Output = Mat4<T>
The resulting type after applying the *
operator.
fn mul(self, other: T) -> Mat4<T>
[src]
Performs the *
operation.
impl<T> Mul<Vec2<T>> for Mat4<T> where
T: Float,
[src]
T: Float,
type Output = Vec2<T>
The resulting type after applying the *
operator.
fn mul(self, other: Vec2<T>) -> Vec2<T>
[src]
Multiplies the matrix with given vector operand, using 0 as z-component and 1 as w-component of the vector.
impl<T> Mul<Vec3<T>> for Mat4<T> where
T: Float,
[src]
T: Float,
type Output = Vec3<T>
The resulting type after applying the *
operator.
fn mul(self, other: Vec3<T>) -> Vec3<T>
[src]
Multiplies the matrix with given vector operand using 1 as w-component of the vector.
impl<T> Mul<Mat4<T>> for Mat4<T> where
T: Float,
[src]
T: Float,
type Output = Mat4<T>
The resulting type after applying the *
operator.
fn mul(self, other: Mat4<T>) -> Mat4<T>
[src]
Performs the *
operation.
impl AsUniform for Mat4<f32>
[src]
fn as_uniform(&self) -> Uniform
[src]
impl AsUniform for Mat4<f64>
[src]
fn as_uniform(&self) -> Uniform
[src]
impl<T> Debug for Mat4<T> where
T: Debug,
[src]
T: Debug,