/* test swap parameter color shader */ surface col_swap(float Kd = 1, /* basic brightness */ swap = 0; color color1 =(1,1,1), color2 =(0,0,0)) { color surfcolor = color2; /* make a copy of the surface normal one unit in length */ normal n = normalize(N); normal nf = faceforward(n, I); /* set the apparent surface opacity */ Oi = Os; if (swap == 0) { if(n == nf) surfcolor = color1; }else { surfcolor = color1; if(n == nf) surfcolor = color2; } /* calculate the diffuse lighting component */ color diffusecolor = Kd * diffuse(nf); /* calculate the apparent surface color */ Ci = Oi * Cs * surfcolor * diffusecolor; }