bool
PointLight::Illuminate(Ray& ray, Vec3f& intensity)
{
+ float dist = ((ray.origin() + ray.direction() * ray.t()) - m_pos).norm();
- return false;
+ float c1 = 1, c2 = 0.5, c3 = 0;
+ float f_att = 1 / (c1 + c2*dist + c3*dist*dist);
+
+ intensity = m_intensity * f_att;
+
+ // store direction from light to hitpoint
+ ray.setDir(ray.origin() + ray.direction() * (ray.t()-Epsilon) - m_pos);
+ return true;
}
const Vec3f&