Phong does not work yet, but saving here
[MicroTrace.git] / PointLight.cxx
index 7b8c8d2..2efe585 100644 (file)
@@ -24,10 +24,13 @@ 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);
+  float f_att = 1 / (c1 + c2*dist + c3*dist*dist);
 
-  intensity = Vec3f(in, in, in);
-  return false;
+  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&
This page took 0.02277 seconds and 4 git commands to generate.