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