8#include "../utility/module.hpp"
10namespace hi {
inline namespace v1 {
18 perspective() =
delete;
19 constexpr perspective(perspective
const&)
noexcept =
default;
20 constexpr perspective(perspective&&)
noexcept =
default;
21 constexpr perspective& operator=(perspective
const&)
noexcept =
default;
22 constexpr perspective& operator=(perspective&&)
noexcept =
default;
32 perspective(
float fov_y,
float aspect_ratio,
float znear,
float zfar) noexcept :
33 _tan_half_fov_y(
std::tan(fov_y * 0.5f)), _aspect_ratio(aspect_ratio), _znear(znear), _zfar(zfar)
48 perspective(fov_y, view_port.width() / view_port.height(), znear, zfar)
52 [[nodiscard]]
constexpr operator matrix<3>() noexcept
54 hilet a = _aspect_ratio;
55 hilet t = _tan_half_fov_y;
61 1.0f / (a * t), 0.0f , 0.0f , 0.0f,
62 0.0f , 1.0f / t, 0.0f , 0.0f,
63 0.0f , 0.0f , f / (n - f), -(f * n) / (f - n),
64 0.0f , 0.0f , -1.0f , 0.0f
70 float _tan_half_fov_y;
#define hi_axiom(expression,...)
Specify an axiom; an expression that is true.
Definition assert.hpp:253
Defines geo::matrix, matrix2 and matrix3.
geo::extent< float, 2 > extent2
A 2D extent.
Definition extent.hpp:502
geometry/margins.hpp
Definition cache.hpp:11
The HikoGUI API version 1.
Definition cache.hpp:11
HikoGUI geometry types.
Definition axis_aligned_rectangle.hpp:22
A 2D or 3D homogenius matrix for transforming homogenious vectors and points.
Definition matrix.hpp:33
Perspective transform.
Definition perspective.hpp:16
perspective(float fov_y, extent2 view_port, float znear, float zfar) noexcept
Create a right-handed perspective transform.
Definition perspective.hpp:47
perspective(float fov_y, float aspect_ratio, float znear, float zfar) noexcept
Create a right-handed perspective transform.
Definition perspective.hpp:32