// 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, 50.00, 8.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, 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, 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_Azul = 
  texture {
    pigment { color rgb < 0.00, 0.0, 0.70 > }
    finish { diffuse 0.5 specular 0.5 roughness 0.005 ambient 0.1 }
  }

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



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

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

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

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


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

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

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

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



#declare peao_verde =
union{
     
     cone{
        <0.0,0.0,1.0>,
	2.7,
	<0.0,0.0,7.0>,
	0.5
	texture{tinta_Verde_Clara}
     }
     sphere{
	<0.0, 0.0, 7.0>,
	1.0
	texture{tinta_Verde_Escura}
     }
     cylinder{
	<0.0,0.0,0.0>,
	<0.0,0.0,1.0>,
	3.0
	texture{tinta_Verde_Escura}
     }
}


#declare peao_branco =
union{
     
     cone{
        <0.0,0.0,1.0>,
	2.7,
	<0.0,0.0,7.0>,
	0.5
	texture{tinta_Branca_Clara}
     }
     sphere{
	<0.0, 0.0, 7.0>,
	1.0
	texture{tinta_Branca_Escura}
     }
     cylinder{
	<0.0,0.0,0.0>,
	<0.0,0.0,1.0>,
	3.0
	texture{tinta_Branca_Escura}
     }
}


#declare peao_vermelho =
union{
     
     cone{
        <0.0,0.0,1.0>,
	2.7,
	<0.0,0.0,7.0>,
	0.5
	texture{tinta_Vermelha_Clara}
     }
     sphere{
	<0.0, 0.0, 7.0>,
	1.0
	texture{tinta_Vermelha_Escura}
     }
     cylinder{
	<0.0,0.0,0.0>,
	<0.0,0.0,1.0>,
	3.0
	texture{tinta_Vermelha_Escura}
     }
}

#declare peao_amarelo =
union{
     
     cone{
        <0.0,0.0,1.0>,
	2.7,
	<0.0,0.0,7.0>,
	0.5
	texture{tinta_Amarela_Clara}
     }
     sphere{
	<0.0, 0.0, 7.0>,
	1.0
	texture{tinta_Amarela_Escura}
     }
     cylinder{
	<0.0,0.0,0.0>,
	<0.0,0.0,1.0>,
	3.0
	texture{tinta_Amarela_Escura}
     }
}



#declare torre_verde =
union{
     
     difference{
     	cylinder{
		<0.0,0.0,7.0>,
		<0.0,0.0,8.0>,
		3.0
		texture{tinta_Verde_Escura}
     	}
	union{
		box{
			<-5.0,-0.5,0.2>
			<5.0,0.5,1.0>
			translate <0.0,0.0,7.0>
			rotate 90*z
			texture{tinta_Verde_Escura}
		}
		box{
			<-5.0,-0.5,0.2>
			<5.0,0.5,1.0>
			translate <0.0,0.0,7.0>
			rotate 180*z
			texture{tinta_Verde_Escura}
		}
		box{
			<-5.0,-0.5,0.2>
			<5.0,0.5,1.0>
			translate <0.0,0.0,7.0>
			rotate 45*z
			texture{tinta_Verde_Escura}
		}
		box{
			<-5.0,-0.5,0.2>
			<5.0,0.5,1.0>
			translate <0.0,0.0,7.0>
			rotate 135*z
			texture{tinta_Verde_Escura}
		}
	}
     }
     cylinder{
	<0.0,0.0,1.0>,
	<0.0,0.0,7.0>,
	2.5
	texture{tinta_Verde_Clara}
     }
     cylinder{
	<0.0,0.0,0.0>,
	<0.0,0.0,1.0>,
	3.0
	texture{tinta_Verde_Escura}
     }
}

#declare rei_verde =
union{
     
     difference{
     	cylinder{
		<0.0,0.0,7.0>,
		<0.0,0.0,8.0>,
		3.0
		texture{tinta_Verde_Escura}
     	}
	union{
		cylinder{
			<0.0, 0.0,0.0>
			<0.0,0.0,4.0>
			1.0
			rotate 90*y
			translate <0.0,0.0,8.0>
			texture{tinta_Verde_Escura}
		}
		cylinder{
			<0.0, 0.0,0.0>
			<0.0,0.0,4.0>
			1.0
			rotate 90*y
			rotate 45*z
			translate <0.0,0.0,8.0>
			texture{tinta_Verde_Escura}
		}
		cylinder{
			<0.0, 0.0,0.0>
			<0.0,0.0,4.0>
			1.0
			rotate 90*y
			rotate 90*z
			translate <0.0,0.0,8.0>
			texture{tinta_Verde_Escura}
		}
		cylinder{
			<0.0, 0.0,0.0>
			<0.0,0.0,4.0>
			1.0
			rotate 90*y
			rotate 135*z
			translate <0.0,0.0,8.0>
			texture{tinta_Verde_Escura}
		}
		
	}
	
     }
     cylinder{
	<0.0,0.0,1.0>,
	<0.0,0.0,7.0>,
	2.5
	texture{tinta_Verde_Clara}
     }
     cylinder{
	<0.0,0.0,0.0>,
	<0.0,0.0,1.0>,
	3.0
	texture{tinta_Verde_Escura}
     }
}


#declare torre_branco =
union{
     
     difference{
     	cylinder{
		<0.0,0.0,7.0>,
		<0.0,0.0,8.0>,
		3.0
		texture{tinta_Branca_Escura}
     	}
	union{
		box{
			<-5.0,-0.5,0.2>
			<5.0,0.5,1.0>
			translate <0.0,0.0,7.0>
			rotate 90*z
			texture{tinta_Branca_Escura}
		}
		box{
			<-5.0,-0.5,0.2>
			<5.0,0.5,1.0>
			translate <0.0,0.0,7.0>
			rotate 180*z
			texture{tinta_Branca_Escura}
		}
		box{
			<-5.0,-0.5,0.2>
			<5.0,0.5,1.0>
			translate <0.0,0.0,7.0>
			rotate 45*z
			texture{tinta_Branca_Escura}
		}
		box{
			<-5.0,-0.5,0.2>
			<5.0,0.5,1.0>
			translate <0.0,0.0,7.0>
			rotate 135*z
			texture{tinta_Branca_Escura}
		}
	}
     }
     cylinder{
	<0.0,0.0,1.0>,
	<0.0,0.0,7.0>,
	2.5
	texture{tinta_Branca_Clara}
     }
     cylinder{
	<0.0,0.0,0.0>,
	<0.0,0.0,1.0>,
	3.0
	texture{tinta_Branca_Escura}
     }
}

#declare rei_branco =
union{
     
     difference{
     	cylinder{
		<0.0,0.0,7.0>,
		<0.0,0.0,8.0>,
		3.0
		texture{tinta_Branca_Escura}
     	}
	union{
		cylinder{
			<0.0, 0.0,0.0>
			<0.0,0.0,4.0>
			1.0
			rotate 90*y
			translate <0.0,0.0,8.0>
			texture{tinta_Branca_Escura}
		}
		cylinder{
			<0.0, 0.0,0.0>
			<0.0,0.0,4.0>
			1.0
			rotate 90*y
			rotate 45*z
			translate <0.0,0.0,8.0>
			texture{tinta_Branca_Escura}
		}
		cylinder{
			<0.0, 0.0,0.0>
			<0.0,0.0,4.0>
			1.0
			rotate 90*y
			rotate 90*z
			translate <0.0,0.0,8.0>
			texture{tinta_Branca_Escura}
		}
		cylinder{
			<0.0, 0.0,0.0>
			<0.0,0.0,4.0>
			1.0
			rotate 90*y
			rotate 135*z
			translate <0.0,0.0,8.0>
			texture{tinta_Branca_Escura}
		}
		
	}
	
     }
     cylinder{
	<0.0,0.0,1.0>,
	<0.0,0.0,7.0>,
	2.5
	texture{tinta_Branca_Clara}
     }
     cylinder{
	<0.0,0.0,0.0>,
	<0.0,0.0,1.0>,
	3.0
	texture{tinta_Branca_Escura}
     }
}


#declare torre_vermelho =
union{
     
     difference{
     	cylinder{
		<0.0,0.0,7.0>,
		<0.0,0.0,8.0>,
		3.0
		texture{tinta_Vermelha_Escura}
     	}
	union{
		box{
			<-5.0,-0.5,0.2>
			<5.0,0.5,1.0>
			translate <0.0,0.0,7.0>
			rotate 90*z
			texture{tinta_Vermelha_Escura}
		}
		box{
			<-5.0,-0.5,0.2>
			<5.0,0.5,1.0>
			translate <0.0,0.0,7.0>
			rotate 180*z
			texture{tinta_Vermelha_Escura}
		}
		box{
			<-5.0,-0.5,0.2>
			<5.0,0.5,1.0>
			translate <0.0,0.0,7.0>
			rotate 45*z
			texture{tinta_Vermelha_Escura}
		}
		box{
			<-5.0,-0.5,0.2>
			<5.0,0.5,1.0>
			translate <0.0,0.0,7.0>
			rotate 135*z
			texture{tinta_Vermelha_Escura}
		}
	}
     }
     cylinder{
	<0.0,0.0,1.0>,
	<0.0,0.0,7.0>,
	2.5
	texture{tinta_Vermelha_Clara}
     }
     cylinder{
	<0.0,0.0,0.0>,
	<0.0,0.0,1.0>,
	3.0
	texture{tinta_Vermelha_Escura}
     }
}

#declare rei_vermelho =
union{
     
     difference{
     	cylinder{
		<0.0,0.0,7.0>,
		<0.0,0.0,8.0>,
		3.0
		texture{tinta_Vermelha_Escura}
     	}
	union{
		cylinder{
			<0.0, 0.0,0.0>
			<0.0,0.0,4.0>
			1.0
			rotate 90*y
			translate <0.0,0.0,8.0>
			texture{tinta_Vermelha_Escura}
		}
		cylinder{
			<0.0, 0.0,0.0>
			<0.0,0.0,4.0>
			1.0
			rotate 90*y
			rotate 45*z
			translate <0.0,0.0,8.0>
			texture{tinta_Vermelha_Escura}
		}
		cylinder{
			<0.0, 0.0,0.0>
			<0.0,0.0,4.0>
			1.0
			rotate 90*y
			rotate 90*z
			translate <0.0,0.0,8.0>
			texture{tinta_Vermelha_Escura}
		}
		cylinder{
			<0.0, 0.0,0.0>
			<0.0,0.0,4.0>
			1.0
			rotate 90*y
			rotate 135*z
			translate <0.0,0.0,8.0>
			texture{tinta_Vermelha_Escura}
		}
		
	}
	
     }
     cylinder{
	<0.0,0.0,1.0>,
	<0.0,0.0,7.0>,
	2.5
	texture{tinta_Vermelha_Clara}
     }
     cylinder{
	<0.0,0.0,0.0>,
	<0.0,0.0,1.0>,
	3.0
	texture{tinta_Vermelha_Escura}
     }
}


#declare torre_amarelo =
union{
     
     difference{
     	cylinder{
		<0.0,0.0,7.0>,
		<0.0,0.0,8.0>,
		3.0
		texture{tinta_Amarela_Escura}
     	}
	union{
		box{
			<-5.0,-0.5,0.2>
			<5.0,0.5,1.0>
			translate <0.0,0.0,7.0>
			rotate 90*z
			texture{tinta_Amarela_Escura}
		}
		box{
			<-5.0,-0.5,0.2>
			<5.0,0.5,1.0>
			translate <0.0,0.0,7.0>
			rotate 180*z
			texture{tinta_Amarela_Escura}
		}
		box{
			<-5.0,-0.5,0.2>
			<5.0,0.5,1.0>
			translate <0.0,0.0,7.0>
			rotate 45*z
			texture{tinta_Amarela_Escura}
		}
		box{
			<-5.0,-0.5,0.2>
			<5.0,0.5,1.0>
			translate <0.0,0.0,7.0>
			rotate 135*z
			texture{tinta_Amarela_Escura}
		}
	}
     }
     cylinder{
	<0.0,0.0,1.0>,
	<0.0,0.0,7.0>,
	2.5
	texture{tinta_Amarela_Clara}
     }
     cylinder{
	<0.0,0.0,0.0>,
	<0.0,0.0,1.0>,
	3.0
	texture{tinta_Amarela_Escura}
     }
}

#declare rei_amarelo =
union{
     
     difference{
     	cylinder{
		<0.0,0.0,7.0>,
		<0.0,0.0,8.0>,
		3.0
		texture{tinta_Amarela_Escura}
     	}
	union{
		cylinder{
			<0.0, 0.0,0.0>
			<0.0,0.0,4.0>
			1.0
			rotate 90*y
			translate <0.0,0.0,8.0>
			texture{tinta_Amarela_Escura}
		}
		cylinder{
			<0.0, 0.0,0.0>
			<0.0,0.0,4.0>
			1.0
			rotate 90*y
			rotate 45*z
			translate <0.0,0.0,8.0>
			texture{tinta_Amarela_Escura}
		}
		cylinder{
			<0.0, 0.0,0.0>
			<0.0,0.0,4.0>
			1.0
			rotate 90*y
			rotate 90*z
			translate <0.0,0.0,8.0>
			texture{tinta_Amarela_Escura}
		}
		cylinder{
			<0.0, 0.0,0.0>
			<0.0,0.0,4.0>
			1.0
			rotate 90*y
			rotate 135*z
			translate <0.0,0.0,8.0>
			texture{tinta_Amarela_Escura}
		}
		
	}
	
     }
     cylinder{
	<0.0,0.0,1.0>,
	<0.0,0.0,7.0>,
	2.5
	texture{tinta_Amarela_Clara}
     }
     cylinder{
	<0.0,0.0,0.0>,
	<0.0,0.0,1.0>,
	3.0
	texture{tinta_Amarela_Escura}
     }
}



#declare quadrado_amarelo =
box {
    <-1.5,-1.5,0.0>,
    <1.5,1.5,1.0>
    texture{tinta_Amarela_Escura}
}

#declare quadrado_preto =
box {
    <-1.5,-1.5,0.0>,
    <1.5,1.5,1.0>
    texture{tinta_Preta}
}

#declare quadrado_verde =
box {
    <-1.5,-1.5,0.0>,
    <1.5,1.5,1.0>
    texture{tinta_Verde_Escura}
}

#declare quadrado_azul =
box {
    <-1.5,-1.5,0.0>,
    <1.5,1.5,1.0>
    texture{tinta_Azul}
}

#declare i = 0;
#declare j = 0;
#declare tab_size = 20;
#while ( (i < tab_size))
	#declare j = 0;
	#declare aux = mod(i,2);
	#while (j < tab_size)
		#if ((i > (tab_size/3)) & (i < (tab_size/3) + 3) &  (j < tab_size/2))
			object{quadrado_azul translate< 3*i, 3*j,-1.0> }
			#if (aux = 0)
				#declare aux = 1;
			#else
				#declare aux = 0;
			#end
		#else
			#if ((i > (tab_size* 2/3)) & (i < (tab_size*2/3) + 4) &  (j > tab_size/2))
				object{quadrado_verde translate< 3*i, 3*j,-1.0> }
				#if (aux = 0)
					#declare aux = 1;
				#else
					#declare aux = 0;
				#end	
			#else

				#if(aux = 0)
					object{quadrado_amarelo translate< 3*i, 3*j,-1.0> }
					#declare aux = 1;
				#else
					object{quadrado_preto translate< 3*i, 3*j,-1.0> }
					#declare aux = 0;
				#end
			#end
			
		#end
		#declare j = j+1;
	#end
	#declare i = i+1;
	
#end
//coloca os verdes
#declare roleta = seed(4610);
#declare roleta_peca = seed(353);
#declare quant_pecas = 10;

#declare k = 0;
#declare offsetx = 0;
#declare offsety = 0;
#while ( k < quant_pecas)
	#declare i = rand(roleta);
	#declare i = i*(tab_size/2);
	#declare i = int(i)  + offsetx;
	#declare j = rand(roleta);
	#declare j = j*(tab_size/2);
	#declare j = int(j)  + offsety;
	
	#declare peca = rand(roleta_peca)*3;
	#if(peca  < 1)
		object{ peao_verde scale <0.35, 0.35,0.35> translate< i*3, j*3,0.0> }
	#end
	#if((peca > 1) & (peca <2))
		object{ torre_verde scale <0.35, 0.35,0.35> translate< i*3, j*3,0.0>}
	#end
	#if((peca > 2))
		object{ rei_verde scale <0.35, 0.35,0.35> translate< i*3, j*3,0.0>  }
	#end
	#declare k = k+1;
#end


#declare k = 0;
#declare offsetx = 0;
#declare offsety = tab_size/2;
#while ( k < quant_pecas)
	#declare i = rand(roleta);
	#declare i = i*(tab_size/2);
	#declare i = int(i)  + offsetx;
	#declare j = rand(roleta);
	#declare j = j*(tab_size/2);
	#declare j = int(j)  + offsety;
	#if(peca  < 1)
		object{ peao_vermelho scale <0.35, 0.35,0.35> translate< i*3, j*3,0.0> }
	#end
	#if((peca > 1) & (peca <2))
		object{ torre_vermelho scale <0.35, 0.35,0.35> translate< i*3, j*3,0.0>}
	#end
	#if((peca > 2))
		object{ rei_vermelho scale <0.35, 0.35,0.35> translate< i*3, j*3,0.0>  }
	#end
	#declare k = k+1;
#end


#declare k = 0;
#declare offsetx = tab_size/2;
#declare offsety = 0 ;
#while ( k < quant_pecas)
	#declare i = rand(roleta);
	#declare i = i*(tab_size/2);
	#declare i = int(i)  + offsetx;
	#declare j = rand(roleta);
	#declare j = j*(tab_size/2);
	#declare j = int(j)  + offsety;
	#if(peca  < 1)
		object{ peao_branco scale <0.35, 0.35,0.35> translate< i*3, j*3,0.0> }
	#end
	#if((peca > 1) & (peca <2))
		object{ torre_branco scale <0.35, 0.35,0.35> translate< i*3, j*3,0.0>}
	#end
	#if((peca > 2))
		object{ rei_branco scale <0.35, 0.35,0.35> translate< i*3, j*3,0.0>  }
	#end
	#declare k = k+1;
#end

#declare k = 0;
#declare offsetx = tab_size/2;
#declare offsety = tab_size/2;
#while ( k < quant_pecas)
	#declare i = rand(roleta);
	#declare i = i*(tab_size/2);
	#declare i = int(i)  + offsetx;
	#declare j = rand(roleta);
	#declare j = j*(tab_size/2);
	#declare j = int(j)  + offsety;
	#if(peca  < 1)
		object{ peao_amarelo scale <0.35, 0.35,0.35> translate< i*3, j*3,0.0> }
	#end
	#if((peca > 1) & (peca <2))
		object{ torre_amarelo scale <0.35, 0.35,0.35> translate< i*3, j*3,0.0>}
	#end
	#if((peca > 2))
		object{ rei_amarelo scale <0.35, 0.35,0.35> translate< i*3, j*3,0.0>  }
	#end
	#declare k = k+1;
#end