10 #ifndef NANOVDB_CAMERA_H_HAS_BEEN_INCLUDED 11 #define NANOVDB_CAMERA_H_HAS_BEEN_INCLUDED 19 template<
typename RealT =
float,
typename Vec3T = Vec3<RealT>,
typename RayT = Ray<RealT>>
22 Vec3T mEye, mW, mU, mV;
26 const RealT halfHeight = RealT(tan(vfov * 3.14159265358979323846 / 360));
27 const RealT halfWidth = aspect * halfHeight;
28 mW = halfWidth * mU + halfHeight * mV + mW;
39 __hostdev__ Camera(
const Vec3T& eye,
const Vec3T& lookat,
const Vec3T& up, RealT vfov, RealT aspect)
45 this->init(vfov, aspect);
47 __hostdev__ void update(
const Vec3T& eye,
const Vec3T& lookat,
const Vec3T& up, RealT vfov, RealT aspect)
54 this->init(vfov, aspect);
58 auto dir = u * mU + v * mV - mW;
60 return RayT(mEye, dir);
72 #endif // NANOVDB_CAMERA_HAS_BEEN_INCLUDED __hostdev__ const Vec3T & U() const
Definition: Camera.h:64
__hostdev__ Camera(const Vec3T &eye, const Vec3T &lookat, const Vec3T &up, RealT vfov, RealT aspect)
Ctor. // vfov is top to bottom in degrees.
Definition: Camera.h:39
Implements a light-weight self-contained VDB data-structure in a single file! In other words...
Definition: NanoVDB.h:184
__hostdev__ void update(const Vec3T &eye, const Vec3T &lookat, const Vec3T &up, RealT vfov, RealT aspect)
Definition: Camera.h:47
__hostdev__ const Vec3T & P() const
Definition: Camera.h:63
__hostdev__ const Vec3T & V() const
Definition: Camera.h:65
__hostdev__ const Vec3T & W() const
Definition: Camera.h:66
__hostdev__ RayT getRay(RealT u, RealT v) const
{u,v} are are assumed to be [0,1]
Definition: Camera.h:57
#define __hostdev__
Definition: NanoVDB.h:168
A minimal perspective camera for ray generation.
Definition: Camera.h:20
Camera()=default
default Ctor.