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