summaryrefslogtreecommitdiff
path: root/gfx/gl/camera.cpp
blob: c957b2c98f89d249f187e728d01e1667f89a6f65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include "camera.h"
#include <glm/gtx/transform.hpp>
#include <maths.h>

Camera::Camera(glm::vec3 pos, float fov, float aspect, float zNear, float zFar) :
	pos {pos}, forward {::north}, up {::up}, projection {glm::perspective(fov, aspect, zNear, zFar)}
{
}

glm::mat4
Camera::GetViewProjection() const
{
	return projection * glm::lookAt(pos, pos + forward, up);
}