code for assignment 3
[MicroTrace.git] / EyeLightShader.cxx
index 8eae610..4f31b84 100644 (file)
@@ -21,9 +21,8 @@ EyeLightShader::EyeLightShader()
 Vec3f
 EyeLightShader::Shade(Ray& ray)
 {
-  // shade according to cos(theta)
-  Vec3f r = ray.direction();
-  Vec3f n = ray.hit()->GetNormal(ray);
-  float cos_theta = fabs(r.dot(n) / (r.norm() * n.norm()));
-  return m_color * cos_theta;
+  Vec3f N = ray.hit()->GetNormal(ray);
+  float cos_phi = fabs(ray.direction().dot(N));
+  
+  return m_color * cos_phi;
 }
This page took 0.021701 seconds and 4 git commands to generate.