rayzor
diff src/camera.cc @ 12:d94a69933a71
lots of stuff, can't remember
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 12 Apr 2014 23:28:24 +0300 |
parents | a826bf0fb169 |
children | 964f8ea5f095 |
line diff
1.1 --- a/src/camera.cc Thu Apr 10 08:42:33 2014 +0300 1.2 +++ b/src/camera.cc Sat Apr 12 23:28:24 2014 +0300 1.3 @@ -1,29 +1,20 @@ 1.4 #include "camera.h" 1.5 1.6 Camera::Camera() 1.7 - : pos(0, 0, 10) 1.8 { 1.9 + type = NODE_CAMERA; 1.10 fov = M_PI; 1.11 -} 1.12 - 1.13 -void Camera::set_position(const Vector3 &pos) 1.14 -{ 1.15 - this->pos = pos; 1.16 -} 1.17 - 1.18 -const Vector3 &Camera::get_position() const 1.19 -{ 1.20 - return pos; 1.21 + set_position(Vector3(0, 0, 10)); 1.22 } 1.23 1.24 void Camera::set_target(const Vector3 &target) 1.25 { 1.26 - this->target = target; 1.27 + this->target->set_position(target); 1.28 } 1.29 1.30 const Vector3 &Camera::get_target() const 1.31 { 1.32 - return target; 1.33 + return target->get_position(); 1.34 } 1.35 1.36 void Camera::set_fov(float fov) 1.37 @@ -36,15 +27,23 @@ 1.38 return fov; 1.39 } 1.40 1.41 -Matrix4x4 Camera::get_matrix() const 1.42 +void Camera::calc_matrix() const 1.43 { 1.44 - Matrix4x4 res; 1.45 - res.lookat(pos, target, Vector3(0, 1, 0)); 1.46 - return res; 1.47 + xform.set_identity(); 1.48 + xform.lookat(pos, target, Vector3(0, 1, 0)); 1.49 + xform_valid = true; 1.50 } 1.51 1.52 -Matrix4x4 Camera::get_inv_matrix() const 1.53 +void Camera::calc_inv_matrix() const 1.54 { 1.55 - Matrix4x4 res; 1.56 - return res; // TODO 1.57 + // TODO 1.58 } 1.59 + 1.60 +void Camera::draw() const 1.61 +{ 1.62 +} 1.63 + 1.64 +bool Camera::intersect(const Ray &ray, float *dist) 1.65 +{ 1.66 + return false; 1.67 +}