c11fb8acceb5ac845f1be08178f49b09d22df080
[MicroTrace.git] / InfinitePlane.cxx
1 #include "InfinitePlane.hxx"
2
3 InfinitePlane::InfinitePlane(const Vec3f& a, const Vec3f& n, Shader* shader)
4 : Primitive(shader),
5 m_a(a),
6 m_n(n)
7 {
8
9 }
10
11 InfinitePlane::~InfinitePlane()
12 {
13 }
14
15 bool
16 InfinitePlane::Intersect(Ray& ray)
17 {
18 Vec3f diff = m_a - ray.origin();
19 float t = diff.dot(m_n) / ray.direction().dot(m_n);
20 if (t < Epsilon || t > ray.t())
21 return false;
22
23 ray.setT(t);
24 ray.setHit(this);
25
26 return true;
27 }
28
29 Vec3f
30 InfinitePlane::GetNormal(Ray& ray)
31 {
32 return m_n;
33 }
34
35 Box
36 InfinitePlane::CalcBounds()
37 {
38 return Box();
39 }
40
41 bool
42 InfinitePlane::InVoxel(const Box& box)
43 {
44 return false;
45 }
This page took 0.042855 seconds and 3 git commands to generate.