#[repr(C, align(16))]pub struct Mat4 {
pub cols: [[f32; 4]; 4],
}Expand description
4x4 column-major matrix.
Fields§
§cols: [[f32; 4]; 4]Column 0 (x-axis)
Implementations§
Source§impl Mat4
impl Mat4
Sourcepub fn from_translation(t: Vec3) -> Self
pub fn from_translation(t: Vec3) -> Self
Creates a translation matrix from a 3D offset.
Sourcepub fn from_scale(s: Vec3) -> Self
pub fn from_scale(s: Vec3) -> Self
Creates a non-uniform scale matrix.
Sourcepub fn from_rotation(q: Quat) -> Self
pub fn from_rotation(q: Quat) -> Self
Creates a rotation matrix from a unit quaternion.
Sourcepub fn from_scale_rotation_translation(s: Vec3, r: Quat, t: Vec3) -> Self
pub fn from_scale_rotation_translation(s: Vec3, r: Quat, t: Vec3) -> Self
Creates a combined scale-rotation-translation matrix.
Sourcepub fn orthographic_lh(
left: f32,
right: f32,
bottom: f32,
top: f32,
z_near: f32,
z_far: f32,
) -> Self
pub fn orthographic_lh( left: f32, right: f32, bottom: f32, top: f32, z_near: f32, z_far: f32, ) -> Self
Orthographic projection (left-handed, depth 0..1).
Sourcepub fn perspective_lh(
fov_y_radians: f32,
aspect: f32,
z_near: f32,
z_far: f32,
) -> Self
pub fn perspective_lh( fov_y_radians: f32, aspect: f32, z_near: f32, z_far: f32, ) -> Self
Perspective projection (left-handed, depth 0..1).
Sourcepub fn look_at_lh(eye: Vec3, target: Vec3, up: Vec3) -> Self
pub fn look_at_lh(eye: Vec3, target: Vec3, up: Vec3) -> Self
Left-handed look-at view matrix.
Sourcepub fn to_cols_array_2d(&self) -> [[f32; 4]; 4]
pub fn to_cols_array_2d(&self) -> [[f32; 4]; 4]
Convert to column-major 2D array (for GPU upload).
Sourcepub fn from_cols_array_2d(cols: &[[f32; 4]; 4]) -> Self
pub fn from_cols_array_2d(cols: &[[f32; 4]; 4]) -> Self
Create from a column-major 2D array.
Sourcepub fn transform_point3(&self, p: Vec3) -> Vec3
pub fn transform_point3(&self, p: Vec3) -> Vec3
Transform a point (w=1, applies translation).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Mat4
impl<'de> Deserialize<'de> for Mat4
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Copy for Mat4
impl StructuralPartialEq for Mat4
Auto Trait Implementations§
impl Freeze for Mat4
impl RefUnwindSafe for Mat4
impl Send for Mat4
impl Sync for Mat4
impl Unpin for Mat4
impl UnsafeUnpin 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