//Parpaing
#declare ParpLength = 12;
#declare ParpWidth = 4;
#declare ParpHeight = 4.5;
#declare HoleLength = 3; 
#declare ParpBorderWidth = ParpWidth * 0.125;
#declare ParpColor = color srgb < 148 / 255, 147 / 255, 152 / 255 >;

#declare MortarHeight = ParpHeight * 0.05;
#declare MortarSpacing = ParpLength * 0.05;
#declare MortarColor = color srgb 170 / 255;
#declare MortarNormal = normal{ agate 0.25 }
#declare MortarTexture = texture{ pigment{ MortarColor } normal{ MortarNormal } }

#declare ParpaingTexture = 
texture{
	pigment{ ParpColor }
	//normal{ granite 1.20 scale 0.2 }
	normal{ granite 0.8 scale 0.2 }
	finish{ specular 0.01 roughness 0.001 }
}

#declare HoleBox = box{ < -ParpWidth / 3 + ParpWidth * 0.15, -1, -HoleLength / 2 >,
						< ParpWidth / 3 - ParpWidth * 0.15, ParpHeight + 1, HoleLength / 2 > 
						texture{ ParpaingTexture }
					}

#declare Parpaing =
difference{
	prism{
		linear_sweep linear_spline
		0, ParpHeight, 13,
		< -ParpWidth / 2, ParpLength / 2 >,
		< -ParpWidth / 2 + ParpBorderWidth, ParpLength / 2 >,
		< -ParpWidth / 2 + ParpBorderWidth * 2, ParpLength / 2 - ParpBorderWidth >,
		< ParpWidth / 2 - ParpBorderWidth * 2, ParpLength / 2 - ParpBorderWidth >,
		< ParpWidth / 2 - ParpBorderWidth, ParpLength / 2 >,
		< ParpWidth / 2, ParpLength / 2 >,
		< ParpWidth / 2, -ParpLength / 2 >,
		< ParpWidth / 2 - ParpBorderWidth, -ParpLength / 2 >,
		< ParpWidth / 2 - ParpBorderWidth * 2, -ParpLength / 2 + ParpBorderWidth >,
		< -ParpWidth / 2 + ParpBorderWidth * 2, -ParpLength / 2 + ParpBorderWidth >,
		< -ParpWidth / 2 + ParpBorderWidth, -ParpLength / 2 >,
		< -ParpWidth / 2, -ParpLength / 2 > 
		< -ParpWidth / 2, ParpLength / 2 > 
		texture{ ParpaingTexture }
	}
	object{ HoleBox translate ParpWidth / 4.5 * x }
	object{ HoleBox translate -ParpWidth / 4.5 * x}
	object{ HoleBox translate < ParpWidth / 4.5, 0, (ParpLength / 3 - ParpBorderWidth) > }
	object{ HoleBox translate < -ParpWidth / 4.5, 0, (ParpLength / 3 - ParpBorderWidth) >}
	object{ HoleBox translate < ParpWidth / 4.5, 0, -(ParpLength / 3 - ParpBorderWidth) > }
	object{ HoleBox translate <-ParpWidth / 4.5, 0, -(ParpLength / 3 - ParpBorderWidth) >  }
}

#declare ParpaingWMortar =
union{
	object{ Parpaing }
	
	box{	< -ParpWidth / 2 * 0.99, 0, -ParpLength / 2 - MortarSpacing / 2 >, 
			< ParpWidth / 2 * 0.99, ParpHeight + MortarHeight, ParpLength / 2 + MortarSpacing / 2 > 
		texture{ MortarTexture }
	}
	scale 1 / 5
}