rayzor
view src/camera.cc @ 0:2a5340a6eee4
rayzor first commit
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 05 Apr 2014 08:46:27 +0300 |
parents | |
children | a826bf0fb169 |
line source
1 #include "camera.h"
3 Camera::Camera()
4 : pos(0, 0, 10)
5 {
6 fov = M_PI;
7 }
9 void Camera::set_position(const Vector3 &pos)
10 {
11 this->pos = pos;
12 }
14 const Vector3 &Camera::get_position() const
15 {
16 return pos;
17 }
19 void Camera::set_target(const Vector3 &target)
20 {
21 this->target = target;
22 }
24 const Vector3 &Camera::get_target() const
25 {
26 return target;
27 }
29 void Camera::set_fov(float fov)
30 {
31 this->fov = fov;
32 }
34 float Camera::get_fov() const
35 {
36 return fov;
37 }
39 Matrix4x4 Camera::get_matrix() const
40 {
41 Matrix4x4 res;
42 res.lookat(pos, target, Vector3(0, 1, 0));
43 return res;
44 }
46 Matrix4x4 Camera::get_inv_matrix() const
47 {
48 Matrix4x4 res;
49 return res; // TODO
50 }