use crate::matrix::Matrix; /// Creates a new perspective projection matrix. #[must_use] pub fn new_perspective( fov_radians: f32, aspect: f32, far: f32, near: f32, ) -> Matrix { let mut out = Matrix::new(); out.set_cell(0, 0, (1.0 / (fov_radians / 2.0).tan()) / aspect); out.set_cell(1, 1, 1.0 / (fov_radians / 2.0).tan()); out.set_cell(2, 2, (near + far) / (near - far)); out.set_cell(2, 3, (2.0 * near * far) / (near - far)); out.set_cell(3, 2, -1.0); out }