fixed Box::Extend(Vec3f&)
[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, unsigned int recursion_level = 0);
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 Primitive* hit();
21 unsigned int recursionDepth() const;
22 float indexOfRefraction() const;
23
24 void setOrigin(const Vec3f& o);
25 void setDir(const Vec3f& d);
26 void setT(float t);
27 void setHit(Primitive* p);
28 void setRecursionDepth(unsigned int i);
29 void setIndexOfRefraction(float ior);
30
31 private:
32 Vec3f m_org; //!< ray origin
33 Vec3f m_dir; //!< ray direction
34 float m_t; //!< current/maximum hit distance
35
36 unsigned int m_level; //!< level of recursion
37 float m_density; //!< index of refraction
38
39 Primitive* m_hit;
40 };
41
42 inline std::ostream &operator<<(std::ostream &o,const Ray &ray)
43 { o << "Ray [" << ray.origin() << "+t*" << ray.direction() << "]"; return o; }
44
45 #endif
This page took 0.058367 seconds and 5 git commands to generate.