// 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  <  80.00, 80.00, 40.00 >  // Posição do observador.
  right     -0.75*x                // Largura RELATIVA da imagem.
  up        1.00*y                 // Altura RELATIVA da imagem.      
  sky       z                      // Qual direção é "para cima"?
  look_at   <  15.00, 15.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.5 * < 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, 1.00 >   // Intensidade e corda luz.
} 

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

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

#declare raio = 2.000;

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

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

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

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

#declare tinta_E = 
  texture {
    pigment { color rgb < 1.0, 1.0, 1.0 > }
    finish { diffuse 0.5 specular 0.5 roughness 0.005 ambient 0.1 }
  } 
 
#declare tinta_G = 
  texture {
    pigment { color rgb < .0, 1.0, .0 > }
    finish { diffuse 0.5 specular 0.5 roughness 0.005 ambient 0.1 }
  }
  
#declare tinta_R = 
  texture {
    pigment { color rgb < 1.0, .0, .0 > }
    finish { diffuse 0.5 specular 0.5 roughness 0.005 ambient 0.1 }
  }  
#declare bola =
  sphere {
    < 0.00, 0.00, 0.00 >, 2.00 
    texture { tinta_A }
  }
  
#declare furo = 
  cylinder {
    < -1.00, -2.00, -2.00 >,
    < +1.00, +2.00, +2.00 >,
    2.00
    texture { tinta_B }
  }
  
#declare torre = 
  cylinder {
    < .00, .00, .00 >,
    < +.00, .00, +4.00 >,
    0.55
    texture { tinta_A }
  }

#declare caixa = 
  box {
    < +2.00, -2.00, -1.00 >,
    < -2.00, +2.00, +1.00 >
    texture { tinta_C }
  }

#declare casa = 
  box {
    < +1.0, -1.0, .10 >,
    < -1.0, +1.0, -.10 >
    texture { tinta_C }
  }

#declare peao =
  cone {
	<0.00, 0.00, 1.00>, 2.5,
	<0.00, 2.00, 4.00>, 1.5
	texture { tinta_D }
	}
// Aqui está a cena, finalmente:


#declare i = 0;
#declare j = 0;
#declare dy = 0;
#declare dx = 0;
#declare flag = 1;

#declare roleta=seed(12345);

#while (j < 30)
   
   #while (i < 30)
     #if (flag = 1)
       #declare cor = tinta_C;
     #else
       #declare cor = tinta_E;
     #end

     box {
       < +1.0 + dx, -1.0 + dy, .10 >,
       < -1.0 + dx, +1.0 + dy, -.10 >
       texture { cor }
       //scale <0.5,0.5,0.5>
     }
     
    #declare a = rand(roleta);
    #declare b = rand(roleta);
    #declare c = rand(roleta);	

     #if (a > 0.5)
        #if (b > 0.5)
           cylinder {
             < dx ,dy , 0.0 >,
             < dx, dy , 3.0 >,
             0.30
             texture { tinta_G }
           }
        #else #if (c > 0.5)
	      cone {
	       < dx, dy, .00>, .45,
	       < dx, dy, 3.00>, .2
	       texture { tinta_R }
	      }
              #else
               cone {
	        < dx, dy, .00>, .45,
	        < dx, dy, 3.00>, .0
	        texture { tinta_A }
	       }
            #end
        #end
     #end

     #declare dy = dy + 2;
     #declare i = i + 1;
     #declare flag = flag * (-1);

   #end

   #declare dx = dx + 2;
   #declare j = j + 1;
   #declare dy = 0;
   #declare i = 0;
   #declare flag = (-1) * flag;

#end