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