cloudy-raytracer/camera/perspectivecamera.cpp

9 lines
369 B
C++
Raw Normal View History

2022-10-28 09:31:13 +02:00
#include "camera/perspectivecamera.h"
2022-11-11 14:27:43 +01:00
PerspectiveCamera::PerspectiveCamera() : forwardDirection(0, 0, 1), upDirection(0, 1, 0), rightDirection(1, 0, 0) { setFovAngle(70); }
2022-10-28 09:31:13 +02:00
Ray PerspectiveCamera::createRay(float x, float y) const {
2022-11-11 14:27:43 +01:00
// Create the ray
return Ray(this->position, x * this->rightDirection + y * this->upDirection + focus * this->forwardDirection);
2022-10-28 09:31:13 +02:00
}