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

#include "colors.inc"
#include "textures.inc"
#include "skies.inc"
#include "glass.inc" 

// CAMERA

camera {
    location <25,16,-50>
    look_at <25,6,0>
//    location <42,3,-2>
//    look_at <0,3,-2>

     }

//CEU

sky_sphere {
    pigment {
        gradient y
        pigment_map {
            [0.00 rgb <0.847, 0.749, 0.847> ] // horizon
            [0.10 SkyBlue ]                   // horizon
            [0.20 P_Cloud4 ]
        }
    }
}



//FUNDO

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

#declare Branco = Gray50;
//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 Branco }
             }
    }

//CHAO

plane {
        y, 0
        pigment { Green }
       }

//PLATAFORMA

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

//SACADA

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

// 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>
       }
}

//GRADE

#declare ext_grade = 0;

#declare grade  =

#while (ext_grade < 80)
  #switch(ext_grade)
     #range(50,57)
      #break
      #else
  
      object {
          cylinder {
              <0,0,0>,
              <0,altura/3,0>,
              0.1
              pigment {DarkGreen}
           translate<0.5*ext_grade,2,-2>     
           }
    
        }
      #end

 #declare ext_grade = ext_grade +1;
 #end


//BLOCO FRONTAL

#declare bloco_frontal =

  box {
      <0,0,0>,
      <comp/5, 1+altura/2, -prof/6>
      pigment { color rgb <0.1,0.1,0.3>}
      }




//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 Branco } 
     } 

//TERRACO

#declare terraco =
   box { <-1,0,0>
         <5,3.3,2>
         pigment{  color Branco }
         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>
       texture {
       pigment { color rgbf <0.98, 1.0, 0.5, 0.75> }
       finish { F_Glass4 } }

       interior{ I_Glass}
      }

      
}

#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.0,-7.5>
       }
object{terraco}
object{bloco_frontal}
object{grade}

}