#[repr(C)]pub struct Mat4(pub [f32; 16]);Expand description
A 4x4 matrix
Tuple Fields§
§0: [f32; 16]Implementations§
Source§impl Mat4
impl Mat4
Sourcepub fn mult(&mut self, mat: Mat4)
pub fn mult(&mut self, mat: Mat4)
Multiplies this Mat4 (self) with another one (mat), further from the initial vertex position vector, so the resulting transformation will be the chaining of both matrices’ transformations: first self, then mat.
Sourcepub fn interpolate(&mut self, mat: Mat4, advancement: f32)
pub fn interpolate(&mut self, mat: Mat4, advancement: f32)
Interpolates self with mat given the advancement (0.0 to 1.0)
Sourcepub fn scale(x_scale: f32, y_scale: f32, z_scale: f32) -> Self
pub fn scale(x_scale: f32, y_scale: f32, z_scale: f32) -> Self
Add a scale transformation to the Mat4, for each axis. The scale center is (0.0, 0.0, 0.0).
Sourcepub fn rotate_x(angle: f32) -> Self
pub fn rotate_x(angle: f32) -> Self
Add a rotation transformation to the Mat4 around the X axis, clockiwse. The rotation center is (0.0, 0.0, 0.0).
Sourcepub fn rotate_y(angle: f32) -> Self
pub fn rotate_y(angle: f32) -> Self
Add a rotation transformation to the Mat4 around the Y axis, clockiwse. The rotation center is (0.0, 0.0, 0.0).
Sourcepub fn rotate_z(angle: f32) -> Self
pub fn rotate_z(angle: f32) -> Self
Add a rotation transformation to the Mat4 around the Z axis, clockiwse. The rotation center is (0.0, 0.0, 0.0).
Sourcepub fn translate(x_move: f32, y_move: f32, z_move: f32) -> Self
pub fn translate(x_move: f32, y_move: f32, z_move: f32) -> Self
Add a translation transformation to the Mat4.
Sourcepub fn lookat(
eye_x: f32,
eye_y: f32,
eye_z: f32,
target_x: f32,
target_y: f32,
target_z: f32,
up_x: f32,
up_y: f32,
up_z: f32,
) -> Self
pub fn lookat( eye_x: f32, eye_y: f32, eye_z: f32, target_x: f32, target_y: f32, target_z: f32, up_x: f32, up_y: f32, up_z: f32, ) -> Self
For view matrix. Moves the “camera” to (eye_x, eye_y, eye_z), looking at (target_x, target_y, target_z), with athe (up_x, up_y, up_z) up vector.
Sourcepub fn project_orthographic(
l: f32,
r: f32,
b: f32,
t: f32,
n: f32,
f: f32,
) -> Self
pub fn project_orthographic( l: f32, r: f32, b: f32, t: f32, n: f32, f: f32, ) -> Self
For projection matrix. Defines an orthographic projection matrix with the given [left-right] - [top-bottom] - [near-far] frustrum. The default Frustrum is set to left-right: [-1.0, 1.0], top-bottom: [-1.0, 1.0], near-far: [-1.0, 1.0]
Sourcepub fn project_perspective(
l: f32,
r: f32,
b: f32,
t: f32,
n: f32,
f: f32,
) -> Self
pub fn project_perspective( l: f32, r: f32, b: f32, t: f32, n: f32, f: f32, ) -> Self
For projection matrix. Defines an perspective projection matrix with the given [left-right] - [top-bottom] - [near-far] frustrum. The default Frustrum is set to left-right: [-1.0, 1.0], top-bottom: [-1.0, 1.0], near-far: [-1.0, 1.0]