pub struct Mat4 {
pub data: [f32; 16],
}Expand description
4x4 transformation matrix (column-major, like OpenGL/WebGL)
Fields§
§data: [f32; 16]Matrix data in column-major order
Implementations§
Source§impl Mat4
impl Mat4
Sourcepub fn from_translation(v: Vec3) -> Self
pub fn from_translation(v: Vec3) -> Self
Create translation matrix
Sourcepub fn from_scale(v: Vec3) -> Self
pub fn from_scale(v: Vec3) -> Self
Create scale matrix
Sourcepub fn from_rotation(q: Quat) -> Self
pub fn from_rotation(q: Quat) -> Self
Create rotation matrix from quaternion
Sourcepub fn from_rotation_translation_scale(
rotation: Quat,
translation: Vec3,
scale: Vec3,
) -> Self
pub fn from_rotation_translation_scale( rotation: Quat, translation: Vec3, scale: Vec3, ) -> Self
Create transformation matrix from rotation, translation, and scale
Sourcepub fn transform_point(&self, p: Vec3) -> Vec3
pub fn transform_point(&self, p: Vec3) -> Vec3
Transform a point by this matrix
Sourcepub fn transform_normal(&self, n: Vec3) -> Vec3
pub fn transform_normal(&self, n: Vec3) -> Vec3
Transform a normal (direction) by this matrix (ignores translation)
Trait Implementations§
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 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().