aboutsummaryrefslogtreecommitdiff
path: root/src/o3d/camera.hpp
blob: b3588fba01204e452d24b5136991a78cb0fd8098 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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::perspective(fov, aspect_ratio, min_z, max_z) * transform.to_inverse_mat4();
    }
};

}

#endif // O3D_CAMERA_H