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