1 #ifndef RAY_HXX
2 #define RAY_HXX
3
4 #include "Vec3f.hxx"
5
6 class Primitive; // forward declaration
7
8 class Ray
9 {
10 public:
11 Vec3f org; // origin
12 Vec3f dir; // direction
13 float t; // current/maximum hit distance
14 Primitive *hit; // currently closest primitive
15 float u,v; // barycentric u/v coordinates
16 float refrac_index; // refraction index of current medium
17
18 Ray(): u(0), v(0), refrac_index(1.0f)
19 {};
20 };
21
22 inline std::ostream &operator<<(std::ostream &o,const Ray &ray)
23 { o << "Ray[" << ray.org << "+t*" << ray.dir << "]"; return o; }
24
25 #endif
syntax highlighted by Code2HTML, v. 0.9.1