// 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  <  50.00, 20.00, 20.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   <  0.00, 10.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, 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 < 1.0, 1.0, 1.00 > }
    finish { diffuse 0.5 specular 0.5 roughness 0.005 ambient 0.1 }
  }

#declare tinta_B = 
  texture {
    pigment { color rgb < 0.00, 0.0, 0.0 > }
    finish { diffuse 0.5 specular 0.5 roughness 0.005 ambient 0.1 }
  }
#declare tinta_C = 
  texture {
    pigment { color rgb < 0.00, 1.0, 0.0 > }
    finish { diffuse 0.5 specular 0.5 roughness 0.005 ambient 0.1 }
  }
#declare tinta_D = 
  texture{
	pigment{ color rgb<0.00, 0.00, 1.0>}
	 finish { diffuse 0.5 specular 0.5 roughness 0.005 ambient 0.1 }
}

  

  
#declare peao =
union{
	cone{
	<0.00, 0.00, 2.00>, 0.00,
	<0.00, 0.00, 0.00>, 0.50
//	texture{tinta_C}
	}
	sphere{
	<0.00, 0.00, 2.25>, 0.125
//	texture{tinta_C}
	}
}


#declare rei =

union
{
	cone{
	  <0.00, 0.00, 2.00>, 0.25,
	  <0.00, 0.00, 0.00>, 0.50
//	  texture{tinta_C}
	}
	difference
	{
		cylinder{
	  	  <0.00, 0.00, 3.00>,
		  <0.00, 0.00, 2.00>,
		  0.50
	//	  texture{ tinta_C }
		}
		cylinder{
		 <2.00, 0.00, 3.00>,
		 <-2.00, 0.00, 3.00>,
		 0.50
		//  texture{ tinta_C }
		}
	}
}
	  		
#declare torre =
difference
{
    cylinder{
	<0.00, 0.00, 2.50>,
	<0.00, 0.00, 0.00>,
	0.50
//	texture{ tinta_C}
	}
    cylinder{
	<2.00, 0.00, 2.50>,
	<-2.00, 0.00, 2.50>,
	0.50
//	texture{ tinta_C }
	}
}



#declare i = 0;
#declare j = 0;
#declare roleta = seed(12345);
#while(j < 20)
#declare i = 0;
#while(i < 20)
#declare value  = int(100*rand(roleta));
union{
	#if(value < 20)
	  object{ peao
		translate <2*0.75*i, 2*0.75*j, 0.00>
		#if(mod(value, 2) = 1)
			texture{ tinta_C }
		#else
			texture{ tinta_D }
		#end
                }
	#end
	#if((value > 20) & (value < 30))
	  object{ torre
		translate<2*0.75*i, 2*0.75*j, 0.00>
		
		#if(mod(value, 2) = 1)
			texture{ tinta_C }
		#else
			texture{ tinta_D }
		#end
		
		
		}
        #end
	#if((value = 30) | (value = 31))
	  object{ rei
		translate<2*0.75*i, 2*0.75*j, 0.00>
		#if(mod(value, 2) = 1)
			texture{ tinta_C }
		#else
			texture{ tinta_D }
		#end
		}
	#end
	box{
	  <0.75 + 2*0.75*i, 0.75 + 2*0.75*j, -0.50>,
	  <-0.75 +2*0.75*i, -0.75 +2*0.75*j, 0.00>
	 #if(mod(j,2) = 0)
	 	 #if(mod(i, 2) = 0)
	 
			texture{ tinta_A }
	 	#else
			texture{ tinta_B }
		#end
	#else
		#if(mod(i,2) = 0)
			texture{tinta_B}
		#else
			texture{ tinta_A }
		#end
	#end

	}
	}
	#declare i = i+1;
#end
#declare j = j + 1;
#end