45 template<
class t_type>
69 , (right + left) / (right - left), (top + bottom) / (top - bottom), -(far + near) / (far - near),
cast<t_type>(-1)
82 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)
98 template<
class t_angle_type>
101 t_type height = near *
tan(y_field_of_view / 2);
102 t_type width = height * aspect_ratio;
122 mat[3][2] = -(f + n) / (f - n);
126 to_vulkan[0][0] = 1.0f;
127 to_vulkan[1][1] = -1.0f;
128 to_vulkan[2][2] = 0.5f;
129 to_vulkan[3][2] = 0.5f;
130 to_vulkan[3][3] = 1.0f;
131 return to_vulkan * mat;
154 location[X], location[Y], location[Z],
cast<t_type>(1));
189 fovy / aspect, 0, 0, 0
191 , 0, 0, (far_plane + near_plane) / (near_plane - far_plane), (2 * near_plane * far_plane) / (near_plane - far_plane)
Stores an angle in an optimized internal format with support for efficient trigonometric operations.
Templated logic for doing matrix multiplication.
A fixed-size array with N dimensions used as the basis for geometric and mathematical types.
The primary namespace for the NDEVR SDK.
constexpr Vector< 1, t_type > cross(const Vector< 1, t_type > &, const Vector< 1, t_type > &)
static constexpr bool IsInvalid(const Angle< t_type > &value)
Checks whether the given Angle holds an invalid value.
std::enable_if<!ObjectInfo< t_type >::Float, fltp08 >::type tan(const Angle< t_type > &angle)
Performs optimized tangent operation on the given angle using pre-computed lookup table for optimal s...
constexpr t_to cast(const Angle< t_from > &value)
Casts an Angle from one backing type to another.
Provides common projection, view, and rotation matrix construction functions.
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 > 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 > 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 > 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.
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.
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 > 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.