#include "ReflectiveEyeLightShader.hxx"
+#include "Primitive.hxx"
+#include "Scene.hxx"
ReflectiveEyeLightShader::ReflectiveEyeLightShader(Scene* scene,
float reflectivity,
Vec3f
ReflectiveEyeLightShader::Shade(Ray& ray)
{
- return Vec3f();
+ Vec3f eyeColor = EyeLightShader::Shade(ray);
+ Vec3f reflColor;
+
+ // shoot secondary rays from intersection
+ Vec3f n = ray.hit()->GetNormal(ray);
+ Ray sec(ray.origin() + ray.direction() * ray.t(), ray.direction() + n * 2);
+ sec.setRecursionDepth(ray.recursionDepth() - 1);
+
+ if(ray.recursionDepth() > 0 && m_scene->Intersect(sec)) {
+ reflColor = Shade(sec);
+ }
+ return eyeColor + reflColor;
}