simple anti-aliasing
[MicroTrace.git] / EyeLightShader.cxx
index 12578d7..8eae610 100644 (file)
@@ -1,4 +1,5 @@
 #include "EyeLightShader.hxx"
+#include "Primitive.hxx"
 
 EyeLightShader::EyeLightShader(Scene* scene,
                               const Vec3f& color)
@@ -20,5 +21,9 @@ EyeLightShader::EyeLightShader()
 Vec3f
 EyeLightShader::Shade(Ray& ray)
 {
-  return Vec3f();
+  // 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;
 }
This page took 0.021828 seconds and 4 git commands to generate.