/*Evan Pon
  cs184-ej
  Jenny Huang
  cs184-bd
  M 3-4 */

/* This is our surface shader for the blocks.   */

surface
colorH(	
	float 	Ka = 0.5, 
		Kd = 0.75, 
		Ks = 0.25,
		roughness = 0.1;  
	color 	specularcolor = 1,
	 	border = color (1, 0, 0),
	      	letter = color (1, 1, 0),
     	      	background = color (0, 0, 1);
)
{
	color currentcolor = background;
	normal Nf;

	if (s < .05 || t < .05 || s > .35 || t > .35) {
		currentcolor = border;
	}
	else if (t > .17 && t < .22 && s > .1 && s < .3) {
		currentcolor = letter;
	}
	else if (t > .1 && t < .3) {
		if (s > .1 && s < .14) {
			currentcolor = letter;
		}
		else if (s > .26 && s < .3) {
			currentcolor = letter;
		}
	}
	Nf = faceforward (normalize(N),I);
	Oi = Os;
	Ci = Os * (currentcolor * (Ka*ambient() + Kd*diffuse(Nf)) +
	      specularcolor * Ks*specular(Nf,-normalize(I),roughness));
}