NDEVR
API Documentation
MatrixDefinitions< t_type >

Provides common projection, view, and rotation matrix construction functions. More...

Static Public Member Functions

static constexpr Matrix< t_type > createOrtho (t_type left, t_type right, t_type bottom, t_type top, t_type near_plane, t_type far_plane)
 Creates an orthographic projection matrix from the given bounds.
template<class t_angle_type>
static constexpr Matrix< t_type > FrustumTransform (Angle< t_angle_type > y_field_of_view, t_type aspect_ratio, t_type near, t_type far)
 Creates a perspective projection matrix from a field of view and aspect ratio.
static constexpr Matrix< t_type > FrustumTransform (t_type left, t_type right, t_type bottom, t_type top, t_type near, t_type far)
 Creates a perspective projection matrix from frustum bounds.
static constexpr Matrix< t_type > OrthoFrustum (const Vector< 2, t_type > &span, t_type n, t_type f)
 Creates an orthographic frustum matrix adjusted for Vulkan coordinate conventions.
static constexpr Matrix< t_type > Perspective (t_type fovy, t_type aspect, t_type near_plane, t_type far_plane)
 Creates a symmetric perspective projection matrix.
static constexpr Matrix< t_type > RotationMatrix (const Vector< 3, t_type > &lookat, const Vector< 3, t_type > &up)
 Creates a rotation-only matrix from a look-at direction and up vector.
static constexpr Matrix< t_type > ViewMatrix (const Vector< 3, t_type > &location, const Vector< 3, t_type > &lookat, const Vector< 3, t_type > &up)
 Creates a view matrix from a camera position, look-at direction, and up vector.

Detailed Description

template<class t_type>
struct MatrixDefinitions< t_type >

Provides common projection, view, and rotation matrix construction functions.


Definition at line 46 of file MatrixDefinitions.h.

Member Function Documentation

◆ createOrtho()

template<class t_type>
constexpr Matrix< t_type > MatrixDefinitions< t_type >::createOrtho ( t_type left,
t_type right,
t_type bottom,
t_type top,
t_type near_plane,
t_type far_plane )
inlinestaticconstexpr

Creates an orthographic projection matrix from the given bounds.

Parameters
[in]leftThe left clipping plane coordinate.
[in]rightThe right clipping plane coordinate.
[in]bottomThe bottom clipping plane coordinate.
[in]topThe top clipping plane coordinate.
[in]near_planeThe near clipping plane distance.
[in]far_planeThe far clipping plane distance.
Returns
A 4x4 orthographic projection matrix.

Definition at line 82 of file MatrixDefinitions.h.

References cast().

◆ FrustumTransform() [1/2]

template<class t_type>
template<class t_angle_type>
constexpr Matrix< t_type > MatrixDefinitions< t_type >::FrustumTransform ( Angle< t_angle_type > y_field_of_view,
t_type aspect_ratio,
t_type near,
t_type far )
inlinestaticconstexpr

Creates a perspective projection matrix from a field of view and aspect ratio.

Parameters
[in]y_field_of_viewThe vertical field of view angle.
[in]aspect_ratioThe width-to-height aspect ratio.
[in]nearThe near clipping plane distance.
[in]farThe far clipping plane distance.
Returns
A 4x4 perspective projection matrix for the given field of view.

Definition at line 99 of file MatrixDefinitions.h.

References FrustumTransform(), and tan().

◆ FrustumTransform() [2/2]

template<class t_type>
constexpr Matrix< t_type > MatrixDefinitions< t_type >::FrustumTransform ( t_type left,
t_type right,
t_type bottom,
t_type top,
t_type near,
t_type far )
inlinestaticconstexpr

Creates a perspective projection matrix from frustum bounds.

Parameters
[in]leftThe left clipping plane coordinate.
[in]rightThe right clipping plane coordinate.
[in]bottomThe bottom clipping plane coordinate.
[in]topThe top clipping plane coordinate.
[in]nearThe near clipping plane distance.
[in]farThe far clipping plane distance.
Returns
A 4x4 perspective projection matrix for the given frustum.

Definition at line 58 of file MatrixDefinitions.h.

References cast().

Referenced by FrustumTransform().

◆ OrthoFrustum()

template<class t_type>
constexpr Matrix< t_type > MatrixDefinitions< t_type >::OrthoFrustum ( const Vector< 2, t_type > & span,
t_type n,
t_type f )
inlinestaticconstexpr

Creates an orthographic frustum matrix adjusted for Vulkan coordinate conventions.

Parameters
[in]spanThe width and height of the orthographic view volume.
[in]nThe near clipping plane distance.
[in]fThe far clipping plane distance.
Returns
A 4x4 orthographic projection matrix with Vulkan coordinate adjustments.

Definition at line 113 of file MatrixDefinitions.h.

References cast().

◆ Perspective()

template<class t_type>
constexpr Matrix< t_type > MatrixDefinitions< t_type >::Perspective ( t_type fovy,
t_type aspect,
t_type near_plane,
t_type far_plane )
inlinestaticconstexpr

Creates a symmetric perspective projection matrix.

Parameters
[in]fovyThe vertical field of view scale factor.
[in]aspectThe width-to-height aspect ratio.
[in]near_planeThe near clipping plane distance.
[in]far_planeThe far clipping plane distance.
Returns
A 4x4 perspective projection matrix.

Definition at line 186 of file MatrixDefinitions.h.

◆ RotationMatrix()

template<class t_type>
constexpr Matrix< t_type > MatrixDefinitions< t_type >::RotationMatrix ( const Vector< 3, t_type > & lookat,
const Vector< 3, t_type > & up )
inlinestaticconstexpr

Creates a rotation-only matrix from a look-at direction and up vector.

Parameters
[in]lookatThe direction to orient toward.
[in]upThe up direction vector.
Returns
A 4x4 rotation matrix with no translation component.

Definition at line 162 of file MatrixDefinitions.h.

References cast(), cross(), and IsInvalid().

◆ ViewMatrix()

template<class t_type>
constexpr Matrix< t_type > MatrixDefinitions< t_type >::ViewMatrix ( const Vector< 3, t_type > & location,
const Vector< 3, t_type > & lookat,
const Vector< 3, t_type > & up )
inlinestaticconstexpr

Creates a view matrix from a camera position, look-at direction, and up vector.

Parameters
[in]locationThe camera position in world space.
[in]lookatThe direction the camera is looking toward.
[in]upThe up direction vector for the camera.
Returns
A 4x4 view matrix encoding the camera orientation and position.

Definition at line 140 of file MatrixDefinitions.h.

References cast(), cross(), and IsInvalid().


The documentation for this struct was generated from the following file: