summaryrefslogtreecommitdiff
path: root/camera.hpp
blob: 15537f0eac7bce933549f8d1a08f0e4f8e690e70 (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
26
27
28
29
30
31
32
33
34
35
36
#ifndef camera_hpp
#define camera_hpp

#include "hashmap.hpp"
#include "maths.hpp"
#include "video.hpp"

struct Camera {
	float fov, near, far, asp;
	v3f forward, position;
	m4f view, proj;
	int type;
	void init(float vfov, const v3f& f, const v3f& p);
	void init_shadow(
		const v3f& dir,
		const v3f& mic,
		const v3f& mac
	);
	void update();
	const m4f& get_view() const;
	const m4f& get_proj() const;
};

struct Camera_Id : public Primitive_Id<uint32_t> {
	using Primitive_Id<uint32_t>::Primitive_Id;
};

template<>
struct Hash_Function<Camera_Id> {
	size_t operator()(Camera_Id id) const {
		return id.index;
	}
};


#endif