summaryrefslogtreecommitdiff
path: root/camera.cpp
blob: 59a604ed2706a0aff2e7149019426abaff1aca56 (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
25
#include "camera.hpp"

void Camera::init(float vfov, const v3f& f, const v3f& p) {
	fov = vfov;
	forward = f;
	position = p;
	near = 0.1f;
	far = 1000.0f;
	asp = 1.0f;
}

void Camera::update() {
	v3f up(0.0f, 1.0f, 0.0f);
	view = m4f::lookat(position, position + forward, up);
	proj = m4f::pers(fov, asp, near, far);
}

const m4f& Camera::get_view() const {
	return view;
}

const m4f& Camera::get_proj() const {
	return proj;
}