/* Dan Schneider
 * Andrew Sun
 *
 * Project 2
 *
 *---------------------------------------------------------------------------
 * grille - displacement shader for a perpendicular cross-hatch ventilation
 * thing.  Horizontal cross-hatches are displaced downwards.
 *
 * width - width of crosshatches
 * spacing - space between crosshatches
 * depth - displacement depth for horizontal crosshatches
 *-------------------------------------------------------------------------*/

displacement
buttondisp( float hwidth=.01, vwidth = .005, hspacing=.002, vspacing=.005, height = .002) {

	point sN, Nf, PP;
	//color Pcolor;
	
	//sN = normalize(transform("shader",N)-transform("shader",(0,0,0)));
	sN = normalize(transform("shader",N));
	PP = transform("shader",P);
	
	if ((mod(s,(hwidth+hspacing)) < hspacing) || (mod(t,(vwidth+vspacing)) < vspacing)) {
		/* between buttons */
		P = P;
		N = N;
	} else {
		/*in a button*/
		P = transform("shader", (PP + (sN*height)));
		N = calculatenormal(P);
	}
}