#include "EyeLightShader.hxx"
+#include "Primitive.hxx"
EyeLightShader::EyeLightShader(Scene* scene,
const Vec3f& color)
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;
}