charles/src/camera.h

61 lines
1.3 KiB
C
Raw Normal View History

2013-09-06 19:00:28 -07:00
/* camera.h
*
* The Camera is the eye into the scene. It defines several parameters and a single compute_primary_ray method
* that generates rays with which the ray tracer draws the scene.
2013-09-06 19:00:28 -07:00
*
* Eryn Wells <eryn@erynwells.me>
*/
#ifndef __CAMERA_H__
#define __CAMERA_H__
2013-09-06 19:00:28 -07:00
#include "basics.h"
#include "object.h"
2013-09-06 19:00:28 -07:00
class Camera
: public Object
{
public:
Camera();
virtual ~Camera();
2013-09-06 19:00:28 -07:00
2013-09-17 10:15:35 -07:00
const Vector3 &get_width() const;
2013-09-20 09:21:25 -07:00
void set_width(const Vector3 &w);
const Vector3 &get_height() const;
void set_height(const Vector3 &h);
2013-09-17 10:15:35 -07:00
const Vector3 &get_direction() const;
2013-09-20 09:21:25 -07:00
void set_direction(const Vector3 &d);
2013-09-17 10:15:35 -07:00
float get_angle() const;
const Vector3& GetRight() const;
void SetRight(const Vector3& right);
const Vector3& GetUp() const;
void SetUp(const Vector3& up);
2013-09-06 19:00:28 -07:00
virtual Ray compute_primary_ray(const int x, const int width,
const int y, const int height) const = 0;
2013-09-17 10:15:35 -07:00
private:
// Size of the image plane.
Vector3 height, width;
2013-09-17 10:15:35 -07:00
// Direction. A normalized vector defining where the camera is pointed.
Vector3 direction;
Vector3 mRight;
Vector3 mUp;
2013-09-06 19:00:28 -07:00
};
2013-09-06 19:00:28 -07:00
class OrthographicCamera
2013-09-20 09:21:25 -07:00
: public Camera
{
public:
Ray compute_primary_ray(const int x, const int width,
const int y, const int height) const;
};
2013-09-06 19:00:28 -07:00
#endif