// CORES E TEXTURAS

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


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


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

#declare tx_fosca = 
  texture{
    pigment{ color rgb < 1.00, 0.80, 0.10 > }
    finish{ diffuse 0.9 ambient 0.1 }
  }

// ======================================================================
// DESCRICAO DA CENA 
		
#macro gerar_circulo(voltas, r, espacamento)
	union{
		#declare tt = 0;
		#while(tt < 360)
			#declare x_ = r*cos(tt/180*pi);
			#declare y_ = r*sin(tt/180*pi);
			sphere{<x_, y_, 0>, 0.05 texture{tx_grey}}
			#declare tt = tt + espacamento;
		#end
	}
#end


#macro gerar_quadrado(espacamento)
	union{
		#declare tt = -pi/4;
		#while(tt <= 7*pi/4)
			#if(tt >= -pi/4 & tt <= pi/4)
				sphere{<1, tan(tt), 0>, 0.05 texture{tx_grey}}
			#end
			#if(tt >= pi/4 & tt <= 3*pi/4)
				sphere{<cos(tt)/sin(tt), 1, 0>, 0.05 texture{tx_grey}}
			#end
			#if(tt >= 3*pi/4 & tt <= 5*pi/4)
				sphere{<-1, -tan(tt), 0>, 0.05 texture{tx_grey}}
			#end
			#if(tt >= 5*pi/4 & tt <= 7*pi/4)
				sphere{<-cos(tt)/sin(tt), -1, 0>, 0.05 texture{tx_grey}}
			#end
			#declare tt = tt + espacamento/180*pi;
		#end
	}
#end


// CONSTRUCAO DA CENA

object{ gerar_quadrado(1)}
object{ gerar_circulo(1, 1, 0.5)}


// camera and light:

#include "camlight.inc"
#declare centro_cena = < 0.00, 0.00, 0.00 >;
#declare raio_cena = 3;
#declare dir_camera = < 0.00, 2.00, 4.00 >;
#declare dist_camera = 5*raio_cena;
#declare intens_luz = 1.20;
camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)