X-Git-Url: https://git.rohieb.name/MicroTrace.git/blobdiff_plain/0e3446ceb6fd6db0cb292671f37b46daaa2aed5b..430ddbc0e443b60b6d0c7893a96e045411368dbf:/InfinitePlane.cxx diff --git a/InfinitePlane.cxx b/InfinitePlane.cxx index 442da19..54c9570 100644 --- a/InfinitePlane.cxx +++ b/InfinitePlane.cxx @@ -1,11 +1,11 @@ #include "InfinitePlane.hxx" InfinitePlane::InfinitePlane(const Vec3f& a, const Vec3f& n, Shader* shader) - : Primitive(shader), + : Primitive(shader), m_a(a), m_n(n) { - + } InfinitePlane::~InfinitePlane() @@ -17,7 +17,7 @@ InfinitePlane::Intersect(Ray& ray) { Vec3f diff = m_a - ray.origin(); float t = diff.dot(m_n) / ray.direction().dot(m_n); - if (t < 1e-5 || t > ray.t()) + if (t < 1e-5 || t > ray.t()) return false; ray.setT(t); return true; @@ -26,5 +26,6 @@ InfinitePlane::Intersect(Ray& ray) Vec3f InfinitePlane::GetNormal(Ray& ray) { - return Vec3f(); + // We already have the surface normal + return m_n; }