cloudy-raytracer/camera/perspectivecamera.cpp
2022-11-11 14:27:43 +01:00

8 lines
369 B
C++

#include "camera/perspectivecamera.h"
PerspectiveCamera::PerspectiveCamera() : forwardDirection(0, 0, 1), upDirection(0, 1, 0), rightDirection(1, 0, 0) { setFovAngle(70); }
Ray PerspectiveCamera::createRay(float x, float y) const {
// Create the ray
return Ray(this->position, x * this->rightDirection + y * this->upDirection + focus * this->forwardDirection);
}