Path Tracer
ray.hpp
1 #pragma once
2 #include <color/specutils.hpp>
3 #include <common.hpp>
4 #include <math3d/vec3.hpp>
5 
6 using namespace ptracey;
7 namespace ptracey {
8 class ray {
9 public:
10  ray() {}
11  ray(const point3 &o, const vec3 &d)
12  : orig(o), dir(d), tm(0),
13  wlength(static_cast<WaveLength>(random_int(
14  VISIBLE_LAMBDA_START, VISIBLE_LAMBDA_END))) {}
15 
16  ray(const point3 &o, const vec3 &d, Real time,
17  WaveLength wl)
18  : orig(o), dir(d), tm(time), wlength(wl) {}
19 
20  point3 origin() const { return orig; }
21  vec3 direction() const { return dir; }
22  WaveLength wavelength() const { return wlength; }
23  Real time() const { return tm; }
24 
25  point3 at(Real t) const { return orig + t * dir; }
26 
27 public:
28  point3 orig;
29  vec3 dir;
30  Real tm;
31  WaveLength wlength;
32 };
33 }
ptracey::ray
Definition: ray.hpp:8
ptracey::vec3
Definition: vec3.hpp:7