pub struct Mat4 {
pub data: [f32; 16],
}Expand description
A 4x4 matrix. Data and operations are column-major.
Fields§
§data: [f32; 16]Implementations§
Source§impl Mat4
impl Mat4
pub fn new(data: [f32; 16]) -> Self
Sourcepub fn new_perspective_lh(
fov_y: f32,
aspect_ratio: f32,
z_near: f32,
z_far: f32,
) -> Self
pub fn new_perspective_lh( fov_y: f32, aspect_ratio: f32, z_near: f32, z_far: f32, ) -> Self
Creates a left-hand perspective projection matrix with 0-1 depth range. Field of view is in radians. Aspect is width / height. https://docs.rs/glam/latest/src/glam/$f/sse2/mat4.rs.html#818-830
Sourcepub fn new_rotation(val: Vec3) -> Self
pub fn new_rotation(val: Vec3) -> Self
https://learnopengl.com/Getting-started/Transformations
pub fn new_scaler(scale: f32) -> Self
pub fn new_scaler_partial(scale: Vec3) -> Self
Sourcepub fn new_translation(val: Vec3) -> Self
pub fn new_translation(val: Vec3) -> Self
Create a translation matrix. Note that the matrix is 4x4, but it takes len-3 vectors - this is so we can compose it with other 4x4 matrices.
pub const fn new_identity() -> Self
Sourcepub fn determinant(&self) -> f32
pub fn determinant(&self) -> f32
Calculate the matrix’s determinant.
pub fn inverse(&self) -> Option<Self>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Mat4
impl RefUnwindSafe for Mat4
impl Send for Mat4
impl Sync for Mat4
impl Unpin for Mat4
impl UnwindSafe for Mat4
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