C++ / OpenCL Raytracer
Camera Class Reference

#include <camera.h>

Public Member Functions

 Camera (const SDim &dims, Vector3D lookFrom, Vector3D lookAt=Vector3D(0), Vector3D viewUp=Vector3D(0, 1, 0), double aperture=0.1, double Fov=40)
 
virtual Ray GetRay (double s, double t)
 

Static Public Member Functions

static Vector3D RandomInUnitDisk ()
 

Public Attributes

Vector3D m_vU
 Vector3D distance from camera origin to target.
 
Vector3D m_vV
 Vector3D distance adjusted for viewup.
 
Vector3D m_vW
 Vector3D cross product of distance and viewUp.
 
Vector3D m_vLowerLeftCorner
 Vector3D lower left corner of grid.
 
Vector3D m_vHorizontal
 Vector3D width of grid.
 
Vector3D m_vVertical
 Vector3D height of grid.
 
Vector3D m_vOrigin
 Vector3D center of grid.
 
Vector3D m_vLookAt
 Vector3D center of grid.
 
Vector3D m_vViewUp
 Vector3D center of grid.
 
double m_dAperture
 Aperture of camera lens.
 
double m_dFov
 Aperture of camera lens.
 

Detailed Description

Perspective and ray generating functions.

Constructor & Destructor Documentation

◆ Camera()

Camera::Camera ( const SDim dims,
Vector3D  lookFrom,
Vector3D  lookAt = Vector3D(0),
Vector3D  viewUp = Vector3D(0, 1, 0),
double  aperture = 0.1,
double  Fov = 40 
)
inline

Sets perspective for output image.

Camera location, subject, viewport, field of view, focus and aperture can be adjusted.

Example:

Camera(dimensions, Vector3D(5,0,0));

Member Function Documentation

◆ GetRay()

Ray Camera::GetRay ( double  s,
double  t 
)
virtual

For each pixel sample, create a ray using a given x and y value, mapped from the camera to the target.

Example:

    GetRay(x, y);

◆ RandomInUnitDisk()

static Vector3D Camera::RandomInUnitDisk ( )
inlinestatic

Returns a random vector with a dot product greater than 1.0.

Example:

RandomInUnitDisk();

The documentation for this class was generated from the following files: