+void RenderFrameEyeLight(const std::string& fileName)
+{
+ /* Scene definition */
+
+ Scene scene;
+
+ /* Flat shaders */
+ EyeLightShader shd1(&scene, Vec3f(1,0,0)); // red surface
+ EyeLightShader shd2(&scene, Vec3f(0,1,0)); // green surface
+ EyeLightShader shd3(&scene, Vec3f(0,0,1)); // blue surface
+ EyeLightShader shd4(&scene, Vec3f(1,1,0)); // yellow surface
+ EyeLightShader shd5(&scene, Vec3f(0,1,1)); // cyan surface
+ EyeLightShader shd6(&scene, Vec3f(1,1,1)); // white surface
+
+ /* scene objects */
+ Sphere s1(Vec3f(-2,1.7,0), 2, &shd1);
+ Sphere s2(Vec3f(1,-1,1), 2.2, &shd2);
+ Sphere s3(Vec3f(3,0.8,-2), 2, &shd3);
+ InfinitePlane p1(Vec3f(0,-1,0),Vec3f(0,1,0), &shd4);
+
+
+ Triangle t1(Vec3f(-2,3,1),Vec3f(1,2,1),Vec3f(3,2.8,3), &shd5);
+
+ /* add to scene */
+ scene.Add(&s1);
+ scene.Add(&s2);
+ scene.Add(&s3);
+ scene.Add(&p1);
+ scene.Add(&t1);
+
+ Image img(scene.camera()->resX(),scene.camera()->resY()); // image array
+ Ray ray; // primary ray
+
+ for(int y = 0; y < scene.camera()->resY(); y++)
+ {
+ for (int x = 0; x < scene.camera()->resX(); x++)
+ {
+
+ /* Initialize your ray here */
+ // shoot four rays for antialiasing
+ scene.camera()->InitRay(x+0.5,y+0.5, ray); // initialize ray
+ Vec3f col1 = scene.RayTrace(ray);
+ scene.camera()->InitRay(x-0.5,y+0.5, ray); // initialize ray
+ Vec3f col2 = scene.RayTrace(ray);
+ scene.camera()->InitRay(x-0.5,y-0.5, ray); // initialize ray
+ Vec3f col3 = scene.RayTrace(ray);
+ scene.camera()->InitRay(x-0.5,y-0.5, ray); // initialize ray
+ Vec3f col4 = scene.RayTrace(ray);
+
+ img(x,y) = (col1 + col2 + col3 + col4) / 4.0; // store pixel color
+ }
+ }
+ img.WritePPM(fileName); // write final image
+}
+
+void RenderFrameReflectiveEyeLight(const std::string& fileName)