/*
 * mirror.sl - offers a perfect reflection
 *
 * by Craig Mayhew Feb 1995
 * elements borrowed from shiny.sl
*/
surface
mirror(float Ka = 1;
       float Kd = 0.5;
       float Ks = 1;
       float roughness = 0.01;
       color specularcolor = 1;)
{
  point ffN = faceforward(normalize(N), I);
  point nI = normalize(I);
  point rDir = normalize(reflect(nI, ffN));
  float rv = trace(P, rDir);

  Oi = Os;
  Ci = Os * ( Cs * (Ka*ambient() + Kd*diffuse(ffN)) +
              specularcolor * (rv + Ks*specular(ffN,-nI,roughness)));
}