ReflectiveEyeLightShader::Shade(Ray& ray)
{
Vec3f N = ray.hit()->GetNormal(ray);
+ // turn normal to front
+ if(N.dot(ray.direction()) > 0)
+ N *= -1;
- // diffuse color
- Vec3f color = EyeLightShader::Shade(ray);
+ float cos_phi = fabs(ray.direction().dot(N));
+
+ Vec3f color = m_color * cos_phi;
- // add reflection
if(ray.recursionDepth() < RecursionDepth)
{
// generate reflected ray