pub struct Mat4<T = f32>(pub [[T; 4]; 4]);Expand description
A 4x4 matrix.
Tuple Fields§
§0: [[T; 4]; 4]Implementations§
Source§impl<T> Mat4<T>where
T: Float,
impl<T> Mat4<T>where
T: Float,
Sourcepub fn viewport(width: T, height: T) -> Mat4<T>
pub fn viewport(width: T, height: T) -> Mat4<T>
Creates viewport matrix mapping viewport top left to (0.0, 0.0) and bottom right to (width, height)
Sourcepub fn look_at<E, C, U>(eye: E, target: C, up: U) -> Mat4<T>
pub fn look_at<E, C, U>(eye: E, target: C, up: U) -> Mat4<T>
Creates a look-at matrix with the given eye position, target position, and up-vector.
Sourcepub fn ortho<R>(rectangle: R, near: T, far: T) -> Mat4<T>
pub fn ortho<R>(rectangle: R, near: T, far: T) -> Mat4<T>
Creates an orthogonal projection matrix with the given rectangular bounds at the near and far clipping plane.
Sourcepub fn frustum<R>(rectangle: R, near: T, far: T) -> Mat4<T>
pub fn frustum<R>(rectangle: R, near: T, far: T) -> Mat4<T>
Creates a frustum projection matrix with the given rectangular bounds at the near clipping plane and rectangle * (far / near) at the far clipping plane.
Sourcepub fn perspective(fov_y: T, aspect: T, near: T, far: T) -> Mat4<T>
pub fn perspective(fov_y: T, aspect: T, near: T, far: T) -> Mat4<T>
Creates a perspective projection matrix with the given field of view, aspect and near/far clipping planes.
Trait Implementations§
Source§impl<T> Matrix<T> for Mat4<T>where
T: Float,
4x4 Matrices.
impl<T> Matrix<T> for Mat4<T>where
T: Float,
4x4 Matrices.
Source§fn translate<V>(&mut self, translation_vector: V) -> &mut Selfwhere
V: Vector<T>,
fn translate<V>(&mut self, translation_vector: V) -> &mut Selfwhere
V: Vector<T>,
Translate matrix by given vector.
Source§fn scale<V>(&mut self, scaling_vector: V) -> &mut Selfwhere
V: Vector<T>,
fn scale<V>(&mut self, scaling_vector: V) -> &mut Selfwhere
V: Vector<T>,
Scale matrix by given vector.
Source§fn scale_at<P, V>(&mut self, position: P, scaling_vector: V) -> &mut Self
fn scale_at<P, V>(&mut self, position: P, scaling_vector: V) -> &mut Self
Scales at given position.
Source§fn rotate_at<P>(&mut self, position: P, radians: T) -> &mut Selfwhere
P: Vector<T>,
fn rotate_at<P>(&mut self, position: P, radians: T) -> &mut Selfwhere
P: Vector<T>,
Rotates around z at given position.
Source§fn rotate_axis<V>(&mut self, radians: T, axis: V) -> &mut Self
fn rotate_axis<V>(&mut self, radians: T, axis: V) -> &mut Self
Rotates around axis.
Source§fn rotate_axis_at<P, V>(
&mut self,
position: P,
radians: T,
axis: V,
) -> &mut Self
fn rotate_axis_at<P, V>( &mut self, position: P, radians: T, axis: V, ) -> &mut Self
Rotates around axis at given position.
Source§fn get_rotation(&self) -> Self
fn get_rotation(&self) -> Self
Returns a pure rotation matrix for given matrix
Source§fn get_translation(&self) -> Vec3<T>
fn get_translation(&self) -> Vec3<T>
Returns the matrix’s translation vector.
impl<T: Copy> Copy for Mat4<T>
Auto Trait Implementations§
impl<T> Freeze for Mat4<T>where
T: Freeze,
impl<T> RefUnwindSafe for Mat4<T>where
T: RefUnwindSafe,
impl<T> Send for Mat4<T>where
T: Send,
impl<T> Sync for Mat4<T>where
T: Sync,
impl<T> Unpin for Mat4<T>where
T: Unpin,
impl<T> UnwindSafe for Mat4<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more