Struct nalgebra::PerspMat3
[−]
[src]
pub struct PerspMat3<N> { // some fields omitted }
A 3D perspective projection stored as a 4D matrix.
Reading or modifying its individual properties is costly but applying the transformation is cheap.
Methods
impl<N: BaseFloat> PerspMat3<N>
fn new(aspect: N, fov: N, znear: N, zfar: N) -> PerspMat3<N>
Creates a new persepctive matrix from the aspect ratio, field of view, and near/far planes.
unsafe fn new_with_mat(mat: Mat4<N>) -> PerspMat3<N>
Creates a new perspective projection matrix from a 4D matrix.
This is unsafe because the input matrix is not checked to be a perspective projection.
fn as_mat<'a>(&'a self) -> &'a Mat4<N>
Returns a reference to the 4D matrix (using homogeneous coordinates) of this projection.
fn aspect(&self) -> N
Gets the width / height
aspect ratio of the view frustrum.
fn fov(&self) -> N
Gets the field of view of the view frustrum.
fn znear(&self) -> N
Gets the near plane offset of the view frustrum.
fn zfar(&self) -> N
Gets the far plane offset of the view frustrum.
fn set_aspect(&mut self, aspect: N)
Updates this projection matrix with a new width / height
aspect ratio of the view
frustrum.
fn set_fov(&mut self, fov: N)
Updates this projection with a new field of view of the view frustrum.
fn set_znear(&mut self, znear: N)
Updates this projection matrix with a new near plane offset of the view frustrum.
fn set_zfar(&mut self, zfar: N)
Updates this projection matrix with a new far plane offset of the view frustrum.
fn set_znear_and_zfar(&mut self, znear: N, zfar: N)
Updates this projection matrix with new near and far plane offsets of the view frustrum.
fn project_pnt(&self, p: &Pnt3<N>) -> Pnt3<N>
Projects a point.
fn project_vec(&self, p: &Vec3<N>) -> Vec3<N>
Projects a vector.
impl<N: BaseFloat + Clone> PerspMat3<N>
fn to_mat<'a>(&'a self) -> Mat4<N>
Returns the 4D matrix (using homogeneous coordinates) of this projection.