// MC930 - Trabalho final
// Fabio Abreu Hashimoto  RA 970640

// Predio do Imecc

#include "colors.inc"
#include "textures.inc"
#include "stones.inc"

#declare centro = < -2, 0, 0 >;


// CÂMERA

camera {
  location <15, 0, 10>
  sky       z
  look_at   centro
}

// ILUMINAÇÃO 

light_source { < 100, 0, 20 > color White  }

// Blocos Principais

plane { z, -2
    pigment {
      color Green
    }
  }

// ceu
//plane { x, -30
//	texture { Bright_Blue_Sky }
//}

#declare bloco_f1 =
	box {
		<-4,-2,-2>,
		<-0.5,2,2.5>
		texture { White_Marble }
	}

#declare faixasv_f1 =
union {
	#declare n=0;
	#while (n < 3) // 3 faixas vermelhas
		box {
			<-0.5,-2,-1.2+(n*1)>,
			<-0.4,2,-0.7+(n*1)>
			texture {
				
				pigment { color  Red }
			}
		}
		#declare n = n+1;
	#end
}

#declare faixasp_f1 =
union {
	#declare n=0;
	#while (n < 3) // 3 faixas brancas
		box {
			<-0.5,-2,-0.7+(n*1)>,
			<-0.4,2,-0.2+(n*1)>
			texture {
				 T_Stone8
			}
		}
		#declare n = n+1;
	#end
}

#declare bloco_f =
  union {
	object { bloco_f1 }
	object { faixasv_f1 }
	object { faixasp_f1 }
  }

#declare bloco_f2 =
	box {
		<-4,-4.4,-2>,
		<0,-2,2.5>
		texture { White_Marble }
	}

#declare faixasv_f2 =
union {
	#declare n=0;
	#while (n < 3) // 3 faixas vermelhas
		box {
			<0,-4.4,-1.2+(n*1)>,
			<0.1,-2,-0.7+(n*1)>
			pigment { color  Red }
		}
		#declare n = n+1;
	#end
}

#declare faixasp_f2 =
union {
	#declare n=0;
	#while (n < 3) // 3 faixas brancas
		box {
			<0,-4.4,-0.7+(n*1)>,
			<0.1,-2,-0.2+(n*1)>
			texture {
				T_Stone8
				//finish { reflection .85 }
			}
		}
		#declare n = n+1;
	#end
}

#declare bloco_d =
union {
	object { bloco_f2 }
	object { faixasv_f2 }
	object { faixasp_f2 }
}

#declare bloco_e =
	object { bloco_d translate <0,6.4,0> }

#declare bloco_f3 =
	box {
		<-4,-6,-2>,
		<0,-4.4,3>
		texture { White_Marble }
	}

#declare faixasv_f3 =
union {
	#declare n=0;
	#while (n < 4) // 4 faixas vermelhas
		box {
			<0,-6,-1.8+(n*1)>,
			<0.1,-4.4,-1.3+(n*1)>
			pigment { color  Red }
		}
		#declare n = n+1;
	#end
}

#declare faixasp_f3 =
union {
	#declare n=0;
	#while (n < 4) // 4 faixas brancas
		box {
			<0,-6,-1.3+(n*1)>,
			<0.1,-4.4,-.8+(n*1)>
			texture {
				T_Stone8
			}
		}
		#declare n = n+1;
	#end
}

#declare bloco_d2 =
union {
	object { bloco_f3 }
	object { faixasv_f3 }
	object { faixasp_f3 }
}

#declare bloco_e2 =
	object { bloco_d2 translate <0,10.4,0> }

#declare coluna =
	box {
		<-2,-7,-2>,
		<0,-6,4.5>
		texture { White_Marble }
	}

#declare f_coluna =
        box {
		<0,-6.8,-1.8>,
		<0.1,-6.1,3>
		texture {
				T_Stone8
			}
	}

#declare coluna_e =
union {
	object { coluna }
	object { f_coluna }
}

#declare coluna_d =
	object { coluna_e translate <0,12.2,0> }

// blocos laterais

#declare lat_f1 =
	box {
		<-2,-2,-2>,
		<2,2,3>
		texture { White_Marble }
	}

#declare faixaslv_f1 =
union {
	#declare n=0;
	#while (n < 4) // 4 faixas vermelhas
		box {
			<-2.1,-2.1,-1.8+(n*1)>,
			<2.1,2.1,-1.3+(n*1)>
			pigment { color  Red }
		}
		#declare n = n+1;
	#end
}

#declare faixaslp_f1 =
union {
	#declare n=0;
	#while (n < 4) // 4 faixas brancas
		box {
			<-2.1,-2.1,-1.3+(n*1)>,
			<2.1,2.1,-.8+(n*1)>
			texture {
				T_Stone8
			}
		}
		#declare n = n+1;
	#end
}

#declare lat_f =
  union {
	object { lat_f1 }
	object { faixaslv_f1 }
	object { faixaslp_f1 }
}

#declare lat1 =
  object { lat_f rotate z*45 translate <-3.2,-6.5,0> }

#declare lat2 =
  object { lat_f rotate z*(-45) translate <-3.2,6.5,0>}

#declare frente =
  union {
	object { bloco_f }
	object { bloco_d }
	object { bloco_e }
	object { bloco_d2 }
	object { bloco_e2 }
}

#declare frente_colunas =
  union {
	object { frente }
	object { coluna_e }
	object { coluna_d }
}

#declare porta =
  union {
	box {
		<-0.5, -2, -2>,
		<-0.45,2,-1.2>
		texture { Soft_Silver }
	}
	box {
		<-0.45,-1.8,-1.8>,
		<-0.4,-1.2,-1.1>
		pigment { color Black }
	}
  	box {
		<-0.45,1.1,-1.8>,
		<-0.4,1.8,-1.1>
		pigment { color Black }
	}
	box {
		<-0.45,-0.9,-1.8>,
		<-0.4,0.9,-1.1>
		pigment { color Black }
	}	
  }

#declare frente_lat_col =
  union {
	object { frente_colunas }
	object { lat1 }
	object { lat2 }
	object { porta }
}

#declare frente_lateral =
  union {
	object { frente }
	object { lat1 }
	object { lat2 }
}
	

#declare atras_lateral =
  object { frente_lateral
	translate <2,0,0.2>
	rotate z*180
	translate <-2,0,-0.2>
	translate <-15,0,0>
}

#declare lateral1 =
  object { frente	
	translate <2,0,0.2>
	rotate z*90
	translate <-2,0,-0.2>
	translate <-8,-8,0>
}

#declare lateral2 =
  object { frente	
	translate <2,0,0.2>
	rotate z*(-90)
	translate <-2,0,-0.2>
	translate <-8,8,0>
}

#declare meio =
  box { <-4,-6,-2>,
	<-15,6,2.5>
	texture { White_Marble }
}

#declare imecc =
union {
	object { meio }
	object { frente_lat_col }
	object { atras_lateral }
	object { lateral1 }
	object { lateral2 }
}

object { imecc }