solution for assignment 2.2: working flat shader
[MicroTrace.git] / Ray.hxx
1 #ifndef RAY_HXX
2 #define RAY_HXX
3
4 #include "Vec3f.hxx"
5
6 class Primitive;
7
8 class Ray
9 {
10 public:
11 Ray();
12 Ray(const Vec3f& org, const Vec3f& dir);
13 ~Ray();
14 Ray(const Ray& r);
15 Ray& operator=(const Ray& r);
16
17 const Vec3f& origin() const;
18 const Vec3f& direction() const;
19 float t() const;
20 void setHit(Primitive * p);
21 Primitive* hit();
22 unsigned int recursionDepth() const;
23
24 void setOrigin(const Vec3f& o);
25 void setDir(const Vec3f& d);
26 void setT(float t);
27 void setRecursionDepth(unsigned int i);
28
29 private:
30 Vec3f m_org; //!< ray origin
31 Vec3f m_dir; //!< ray direction
32 float m_t; //!< current/maximum hit distance
33
34 unsigned int m_level; //!< level of recursion
35
36 Primitive* m_hit;
37 };
38
39 inline std::ostream &operator<<(std::ostream &o,const Ray &ray)
40 { o << "Ray [" << ray.origin() << "+t*" << ray.direction() << "]"; return o; }
41
42 #endif
This page took 0.044695 seconds and 5 git commands to generate.