{
	Brick patterns

	A1	= Grout width
	A2	= Nominal layer height
	A3	= Nominal brick spacing
	A4	= Offset
	A5	= Brick brightness
	A6	= Grout brightness
}

brick_xy = if( f_brick_xy, A5, A6 );
brick_x = if( f_brick_x, A5, A6 );
brick_y = if( f_brick_y, A5, A6 );

f_brick_xy = and( brick_inv,
	if( brick_inx, brick_inh(Px+2*A1), brick_inh(Py+2*A1) ) );
f_brick_x = and( brick_inv, brick_inh(Px) ) ;
f_brick_y = and( brick_inv, brick_inh(Py) ) ;

brick_inx = .5 - Nx*Nx;
brick_inv = mod(Pz,A2) - A1 ;
brick_inh(h) = mod(h+floor(Pz/A2)*A4,A3) - A1;

brick_swx = if(brick_inx, 1, 0);
