rayzor

annotate src/camera.cc @ 14:a9a948809c6f

starting the renderer screen, plus misc stuff
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 13 Apr 2014 08:06:21 +0300
parents d94a69933a71
children be616b58df99
rev   line source
nuclear@1 1 #include "camera.h"
nuclear@1 2
nuclear@1 3 Camera::Camera()
nuclear@1 4 {
nuclear@12 5 type = NODE_CAMERA;
nuclear@1 6 fov = M_PI;
nuclear@12 7 set_position(Vector3(0, 0, 10));
nuclear@1 8 }
nuclear@1 9
nuclear@1 10 void Camera::set_target(const Vector3 &target)
nuclear@1 11 {
nuclear@13 12 this->target.set_position(target);
nuclear@1 13 }
nuclear@1 14
nuclear@13 15 Vector3 Camera::get_target() const
nuclear@1 16 {
nuclear@13 17 return target.get_position();
nuclear@1 18 }
nuclear@1 19
nuclear@1 20 void Camera::set_fov(float fov)
nuclear@1 21 {
nuclear@1 22 this->fov = fov;
nuclear@1 23 }
nuclear@1 24
nuclear@1 25 float Camera::get_fov() const
nuclear@1 26 {
nuclear@1 27 return fov;
nuclear@1 28 }
nuclear@1 29
nuclear@12 30 void Camera::calc_matrix() const
nuclear@1 31 {
nuclear@12 32 xform.set_identity();
nuclear@13 33 xform.lookat(pos, target.get_position(), Vector3(0, 1, 0));
nuclear@12 34 xform_valid = true;
nuclear@1 35 }
nuclear@1 36
nuclear@12 37 void Camera::calc_inv_matrix() const
nuclear@1 38 {
nuclear@12 39 // TODO
nuclear@1 40 }
nuclear@12 41
nuclear@12 42 void Camera::draw() const
nuclear@12 43 {
nuclear@12 44 }
nuclear@12 45
nuclear@13 46 bool Camera::intersect(const Ray &ray, float *dist) const
nuclear@12 47 {
nuclear@12 48 return false;
nuclear@12 49 }