#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()
{
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;
Vec3f
InfinitePlane::GetNormal(Ray& ray)
{
- return Vec3f();
+ // We already have the surface normal
+ return m_n;
}