diff options
Diffstat (limited to 'src/o3d/camera.hpp')
| -rw-r--r-- | src/o3d/camera.hpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/o3d/camera.hpp b/src/o3d/camera.hpp new file mode 100644 index 0000000..485c825 --- /dev/null +++ b/src/o3d/camera.hpp @@ -0,0 +1,24 @@ +#ifndef O3D_CAMERA_H +#define O3D_CAMERA_H + +#include "math/mat4.hpp" +#include "math/tform.hpp" + +using + engine::math::Matrix4, + engine::math::Transform; + +namespace engine::o3d { + +struct Camera { + float fov; + Transform transform; + + constexpr Matrix4 to_mat4(float aspect_ratio, float min_z, float max_z) const & { + return Matrix4::projection(fov, aspect_ratio, min_z, max_z) * transform.to_inverse_mat4(); + } +}; + +} + +#endif // O3D_CAMERA_H |
