solution for 3.1a)
[MicroTrace.git] / PointLight.cxx
index 1ce5f0b..7b8c8d2 100644 (file)
@@ -21,7 +21,12 @@ PointLight::PointLight()
 bool
 PointLight::Illuminate(Ray& ray, Vec3f& intensity)
 {
+  float dist = ((ray.origin() + ray.direction() * ray.t()) - m_pos).norm();
 
+  float c1 = 1, c2 = 0.5, c3 = 0;
+  float in = 1 / (c1 + c2*dist + c3*dist*dist);
+
+  intensity = Vec3f(in, in, in);
   return false;
 }
 
This page took 0.028203 seconds and 4 git commands to generate.