MatProjection

Trait MatProjection 

Source
pub trait MatProjection<T> {
    // Required methods
    fn get_frustum_planes(&self) -> [Vec4<T>; 6];
    fn get_frustum_corners(&self) -> [Vec3<T>; 8];
    fn create_ortho_matrix(
        left: T,
        right: T,
        bottom: T,
        top: T,
        near: T,
        far: T,
    ) -> Self;
    fn create_perspective_projection_lh_yup(
        fov: T,
        aspect: T,
        near: T,
        far: T,
    ) -> Self;
    fn create_perspective_projection_rh_yup(
        fov: T,
        aspect: T,
        near: T,
        far: T,
    ) -> Self;
}
Expand description

trait for 4x4 projection matrices

Required Methods§

Source

fn get_frustum_planes(&self) -> [Vec4<T>; 6]

returns 6 frustum planes as Vec4’s in the form .xyz = normal, .w = plane distance

Source

fn get_frustum_corners(&self) -> [Vec3<T>; 8]

returns 8 points which are the corners of the frustum first 4 near, second 4 far

Source

fn create_ortho_matrix( left: T, right: T, bottom: T, top: T, near: T, far: T, ) -> Self

returns an orthogrpahic projection matrix defined by left, right, top, bottom edges and near - far depth range

Source

fn create_perspective_projection_lh_yup( fov: T, aspect: T, near: T, far: T, ) -> Self

returns a perespective projection matrix (left hand coordinate system with y-up) from fov (radians), aspect ratio and near - far depth

Source

fn create_perspective_projection_rh_yup( fov: T, aspect: T, near: T, far: T, ) -> Self

returns a perespective projection matrix (right hand coordinate system with y-up) from fov (radians), aspect ratio and near - far depth

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T> MatProjection<T> for Mat4<T>
where T: Float + FloatOps<T>, Vec3<T>: FloatOps<T>,