a3c76cb04bec441b22991fe782f9d408bb1a2ea2
[MicroTrace.git] / Ray.cxx
1 #include <limits>
2
3 #include "Ray.hxx"
4
5 Ray::Ray()
6 : m_org(Vec3f()),
7 m_dir(Vec3f()),
8 m_hit(0),
9 m_level(10)
10 {
11 m_t = std::numeric_limits<float>::max();
12 }
13
14 Ray::Ray(const Vec3f& org,
15 const Vec3f& dir)
16 : m_org(org),
17 m_dir(dir),
18 m_hit(0),
19 m_level(10)
20 {
21 m_t = std::numeric_limits<float>::max();
22 }
23
24 Ray::~Ray()
25 {
26 }
27
28 Ray::Ray(const Ray& r)
29 {
30 m_org = r.m_org;
31 m_dir = r.m_dir;
32 m_t = r.m_t;
33 m_hit = r.m_hit;
34 m_level = r.m_level;
35 }
36
37 Ray&
38 Ray::operator=(const Ray& r)
39 {
40 if(this != &r)
41 {
42 m_org = r.m_org;
43 m_dir = r.m_dir;
44 m_t = r.m_t;
45 m_hit = r.m_hit;
46 }
47 return *this;
48 }
49
50 const Vec3f&
51 Ray::origin() const
52 {
53 return m_org;
54 }
55
56 const Vec3f&
57 Ray::direction() const
58 {
59 return m_dir;
60 }
61
62 float
63 Ray::t() const
64 {
65 return m_t;
66 }
67
68 void
69 Ray::setOrigin(const Vec3f& o)
70 {
71 m_org = o;
72 }
73
74 void
75 Ray::setDir(const Vec3f& d)
76 {
77 m_dir = d;
78 }
79
80 void
81 Ray::setT(float t)
82 {
83 m_t = t;
84 }
85
86 void
87 Ray::setHit(Primitive * p)
88 {
89 m_hit = p;
90 }
91
92 Primitive*
93 Ray::hit()
94 {
95 return m_hit;
96 }
97
98 unsigned int
99 Ray::recursionDepth() const
100 {
101 return m_level;
102 }
103
104 void
105 Ray::setRecursionDepth(unsigned int i)
106 {
107 m_level = i;
108 }
This page took 0.049614 seconds and 3 git commands to generate.