pub struct Mat4 { /* private fields */ }Expand description
Column-major 4x4 transformation and perspective projection matrix.
Implementations§
Source§impl Mat4
Matrix constructors, projection, and point projection for Mat4.
impl Mat4
Matrix constructors, projection, and point projection for Mat4.
Sourcepub fn from_trs_euler(
position: Vec3,
yaw_rad: f32,
pitch_rad: f32,
roll_rad: f32,
scale: Vec3,
) -> Self
pub fn from_trs_euler( position: Vec3, yaw_rad: f32, pitch_rad: f32, roll_rad: f32, scale: Vec3, ) -> Self
Builds a full 3D Euler TRS model matrix (translate * rotate_y(yaw) * rotate_x(pitch) * rotate_z(roll) * scale).
§Arguments
Vec3- World translation.f32- Y-axis yaw rotation in radians.f32- X-axis pitch rotation in radians.f32- Z-axis roll rotation in radians.Vec3- Non-uniform scale.
§Returns
Self- Composed 3D model transform matrix.
Sourcepub fn mul_point4(&self, p: Vec3) -> [f32; 4]
pub fn mul_point4(&self, p: Vec3) -> [f32; 4]
Sourcepub fn mul_point3(&self, p: Vec3) -> Vec3
pub fn mul_point3(&self, p: Vec3) -> Vec3
Sourcepub fn transform_aabb(&self, local: Aabb3D) -> Aabb3D
pub fn transform_aabb(&self, local: Aabb3D) -> Aabb3D
Sourcepub fn inverse_trs_euler(
position: Vec3,
yaw_rad: f32,
pitch_rad: f32,
roll_rad: f32,
scale: Vec3,
) -> Self
pub fn inverse_trs_euler( position: Vec3, yaw_rad: f32, pitch_rad: f32, roll_rad: f32, scale: Vec3, ) -> Self
Computes the exact analytical inverse of a TRS Euler matrix (S^-1 * R^T * T^-1) for object-space raytracing.
§Arguments
Vec3- World translation.f32- Y-axis yaw rotation in radians.f32- X-axis pitch rotation in radians.f32- Z-axis roll rotation in radians.Vec3- Non-uniform scale.
§Returns
Self- Exact inverse model matrix mapping world space back to local object space.
Sourcepub fn normal_basis_from_euler_scale(
yaw_rad: f32,
pitch_rad: f32,
roll_rad: f32,
scale: Vec3,
) -> [Vec3; 3]
pub fn normal_basis_from_euler_scale( yaw_rad: f32, pitch_rad: f32, roll_rad: f32, scale: Vec3, ) -> [Vec3; 3]
Computes the inverse-transpose 3x3 normal transformation basis [col_x, col_y, col_z] (R * S^-1) once per object.
§Arguments
f32- Y-axis yaw rotation in radians.f32- X-axis pitch rotation in radians.f32- Z-axis roll rotation in radians.Vec3- Non-uniform scale.
§Returns
[Vec3; 3]- Three column vectors transforming local normals into world space.
Trait Implementations§
impl Copy for Mat4
impl StructuralPartialEq for Mat4
Auto Trait Implementations§
impl Forget for Mat4
impl Freeze for Mat4
impl Move 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