// Exemplo de arquivo de descricao de cena para POV-ray
// Last edited on 2003-09-04 15:25:26 by stolfi

// ======================================================================
// CÂMERA 

camera {
  location  < 90.00, 90.00, 90.00 >  // Posição do observador.
  right     1.00*x                // Largura RELATIVA da imagem.
  up        -0.75*y                 // Altura RELATIVA da imagem.      
  sky       z                      // Qual direção é "para cima"?
  look_at   <  0.00, 0.00, 0.00 >  // Para onde a câmera está apontando.
} 
// Nota: os parâmetros "right" e "up" devem ter a mesma proporção
// que os parâmetros ${WIDTH} e ${HEIGHT} no Makefile.

// ======================================================================
// FONTES DE LUZ

light_source {
  10 * < +50.0, +30.0, +50.0 >              // Posição da lâmpada.
  color rgb 1.2 * < 1.00, 1.00, 1.00 >   // Intensidade e corda luz.
} 

light_source {
  10 * < -50.0, -10.0, +10.0 >             // Posição da lâmpada.
  color rgb 0.8 * < 1.00, 1.00, 0.00 >   // Intensidade e corda luz.
} 

light_source {
  10 * < +50.0, +30.0, +10.0 >             // Posição da lâmpada.
  color rgb 0.8 * < 1.00, 1.00, 0.00 >   // Intensidade e corda luz.
}

// ======================================================================
// DESCRIÇÃO DA CENA 

background{ color rgb < 0.75, 0.80, 0.85 > }

#declare raio = 3.000;

#declare tinta_A = 
  texture {
    pigment { color rgb < 0.30, 0.30, 1.00 > }
    finish { diffuse 0.5 specular 0.5 roughness 0.005 ambient 0.1 }
  }

#declare tinta_B = 
  texture {
    pigment { color rgb < 0.30, 0.30, 0.30 > }
    finish { diffuse 0.5 specular 0.5 roughness 0.005 ambient 0.1 }
  }

#declare tinta_C = 
  texture {
    pigment { color rgb < 1.00, 0.20, 0.20 > }
    finish { diffuse 0.5 specular 0.5 roughness 0.005 ambient 0.1 }
  }

#declare G = seed(12345);

#declare esquadria =
  box {
    <0,0,0>
    <10,10,1>
  }

#declare vidro =
  box {
   <0,0,-1>
   <3,3,2>
  }

#declare portao =
  difference {
    box {
      <0,0,0>
      <1,8,8>
      texture { tinta_C }
    }
    box {
      <-1,1,-1>
      <2,7,7>
      texture { tinta_C }
    }
  }

#declare janela =
  difference {
    object { esquadria }
    object { 
      vidro
      translate <1,1,0>
    }
    object {
      vidro
      translate <6,1,0>
    }
    object { 
      vidro
      translate <1,6,0>
    }
    object {
      vidro
      translate <6,6,0>
    }
    rotate -90*y
    scale 0.5
  }

#declare janela2 =
  object {
    janela
    rotate -90*z
  }

#declare pavimento =
  box {
   <0,0,1>
   <20,50,10>
   texture { tinta_A }
  }

#declare piso =
  box {
    <0,0,0>
    <20,50,1>
    texture { tinta_B }
  }

// Andar tem as janelas
#declare andar =
  union {
    object { 
      pavimento 
    }
    object { piso }
   
    #declare j = 0;
    #while (j < 3)
      # declare r = 3 + 6*j;
      # declare s = 45 - r;
      object { 
        janela
        texture {
          pigment { color <rand(G),rand(G),rand(G)> }
          finish { diffuse 1 }
        }
        translate <21,r,4>
      }
      object {
        janela
        texture {
          pigment { color <rand(G),rand(G),rand(G)> }
          finish { diffuse 1 }
        }
        translate <-1,r,4>
      }
      object { 
        janela
        texture {
          pigment { color <rand(G),rand(G),rand(G)> }
          finish { diffuse 1 }
        }
        translate <21,s,4>
      }
      object {
        janela
        texture {
          pigment { color <rand(G),rand(G),rand(G)> }
          finish { diffuse 1 }
        }
        translate <-1,s,4>
      }
      # declare j = j + 1;
    # end

   object {
     janela2
     texture {
       pigment { color <rand(G),rand(G),rand(G)> }
       finish { diffuse 1 }
     }
     translate <12,50,4>
   }
   object {
     janela2
      texture {
       pigment { color <rand(G),rand(G),rand(G)> }
       finish { diffuse 1 }
     }
     translate <3,50,4>
   }
   object {
     janela2
     texture {
       pigment { color <rand(G),rand(G),rand(G)> }
       finish { diffuse 1 }
     } 
     translate <12,-1,4>
   }
   object {
     janela2
     texture {
       pigment { color <rand(G),rand(G),rand(G)> }
       finish { diffuse 1 }
     }
     translate <3,-1,4>
   }
  }


#declare predio =
  union {
  # declare i = 0;
  # while (i < 5)
    # declare r = 10*i;
      object { 
        andar
        translate <0,0,r>
      }
    # declare i = i + 1;
  # end
    object {
      portao
      translate <20, 21, 0>
    }
  }

object { 
  predio
}