29 lines
792 B
C++
29 lines
792 B
C++
#ifndef PERSPECTIVECAMERA_H
|
|
#define PERSPECTIVECAMERA_H
|
|
|
|
#include "camera/camera.h"
|
|
|
|
class PerspectiveCamera : public Camera {
|
|
|
|
public:
|
|
// Constructor / Destructor
|
|
PerspectiveCamera();
|
|
~PerspectiveCamera() override = default;
|
|
|
|
// Set
|
|
void setPosition(Vector3d const &position) { this->position = position; }
|
|
void setForwardDirection(Vector3d const &forwardDirection) { this->forwardDirection = normalized(forwardDirection); }
|
|
void setUpDirection(Vector3d const &upDirection) { this->upDirection = normalized(upDirection); }
|
|
void setFovAngle(float fovAngle) { this->fovAngle = fovAngle; }
|
|
|
|
// Camera functions
|
|
Ray createRay(float x, float y) const override;
|
|
|
|
protected:
|
|
Vector3d position;
|
|
Vector3d forwardDirection;
|
|
Vector3d upDirection;
|
|
float fovAngle;
|
|
};
|
|
|
|
#endif
|