// MC930 - Trabalho final
// Luis Arthur Micai Nunes   RA: 971106
// Inicio em 14/12/2000

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

// CAMERA

camera {
    location <25,16,-50>
    look_at <25,6,0>
     }

//FUNDO

background{ color rgb <0,0,0> }

//ILUMINACAO

light_source { <10, 30.00, -50.00 >
    color rgb <6.00, 6.00, 6.00>
}

light_source { <50,10,-5>
   color rgb<2,2,2>
}

// ESTRUTURA DO PREDIO

#declare altura = 9;
#declare prof = 30;
#declare comp = 40;

#declare estrutura = 
 box {
     <0,0,0>,
     <comp,altura,prof>
     texture { pigment { color White }
             }
    }

//CHAO

plane {
        y, 0
        pigment { Green }
       }

//PLATAFORMA

#declare plataforma=
      box{
         <-2,0,-2>,
         <comp+2,2,prof+2>
         pigment{ White }    
   }

//SACADA

#declare sacada =
   box{
      <0,6,-2>,
      <comp+2,7,2>
      pigment {White}
    }

// PLACAS

#declare alt = 3;
#declare hipotenusa = 1.41*alt;


#declare placa =
union{
   box {
        <0,0,0>,
        <hipotenusa,0.2,prof+4>
        pigment {Brown}
        rotate<0,0,-45>        
        translate<0,1,0>
     }
   box {
        <0,0,0>,
        <0.2,alt,prof+4>
        pigment {Brown}
        translate<0,-1.55,0>
       }
}

//RAMPA

#declare rampa = 
     prism { 
        linear_sweep 
        linear_spline 
        0, 
        altura/3, 
        4 
        <0,0>, <altura/4,0>, <altura/4,-(altura/4)>,<0,0> 
        rotate<-90,90,0>         
        rotate<-90,0,0>
        translate <20,3.5,-4> 
        pigment { color rgb <1,0,0> } 
     } 

//TERRACO

#declare terraco =
   box { <-1,0,0>
         <5,3.3,2>
         pigment{  color rgb <1,0,0> }
         translate <18,0,-6>
       }


// TELHADO

#declare tx = 0;

#declare telhado =
union {

    #while (tx<14) 
    object{placa
            translate<tx*alt,altura+4,-2>
            }
    #declare tx = tx + 1;
    #end

} // union



//JANELAS E PORTAS

#declare janela_porta=

union{
   box{
       <1,0,-0.1>,
       <2,2.3,0.1>
       pigment { Black }
      }
   box{
       <2.5,0,-0.1>,
       <3.5,2.3,0.1>
       pigment { Green}
      }
}

#declare i = 0;

#declare janelas_e_portas = 

union{

     #while(i<10)
         #declare j=0;
         #while (j<2)
         object {janela_porta
         translate <i*4,j*5,0>
            }
         #declare j = j + 1;
         #end
     #declare j = 1;
     #declare i = i + 1;
  #end

}

union {
object{estrutura
       translate<0,2,0>}
object{janelas_e_portas
       translate<0,2.1,0>}
object{plataforma}
object{sacada}
object{telhado}
object{rampa}
object{rampa
       rotate<0,185,0>      
       translate<40,2.5,-7.5>
       }
object{terraco}



}