// Exemplo de arquivo de descricao de ANIMAÇÃO para POV-ray // Last edited on 2009-09-24 15:40:22 by stolfi #macro quadro(tt) // Gera o quadro do filme (cena, luzes e câmera) // para o instante {tt} -- um número real entre 0 e 1. // ====================================================================== // CÂMERA camera { location < 8.00, 4.00, 2.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, 1.00 > // Intensidade e corda luz. } // ====================================================================== // DESCRIÇÃO DA CENA background{ color rgb < 0.75, 0.80, 0.85 > } #declare raio = 2.000; // Um parãmetro que varia {+1, 00, -1, 00, +1}: #declare ctt = cos(2*pi*tt); // Um parâmetro que varia {00, +1, 00, -1, 00}: #declare stt = sin(2*pi*tt); #declare tinta_A = texture { pigment { color rgb < 0.55 + 0.45*ctt, 0.80, 0.55 - 0.5*ctt > } 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 } } #macro pe(gama) object{ box{ <-.7,-.5,0> <.7,2.5,.3> } rotate gama*x texture{ tinta_B } }#end #macro anteperna(beta,gama) union{ object{ cylinder{ <0,0,0> <0,0,-2.5> .5 } texture{ tinta_B } } object{ pe(gama) translate -2.5*z } rotate -beta*x } #end #macro perna(alfa,beta,gama) union{ object{ cylinder{ <0,0,0> <0,0,-3> .7 } texture{ tinta_B } } object{ sphere{ <0,0,-3> .7 } texture{ tinta_B } } object{ anteperna(beta,gama) translate -3*z } rotate alfa*x } #end #macro veiculo(alfa,beta,gama) union{ object{ sphere{ <0,0,0> 4 } texture{ tinta_B } } #declare i=0; #while(i<6) object{ perna(alfa,beta,gama) translate 3.5*y rotate 60*i*z } #declare i=i+1; #end } #end #macro interpolar(ta,va,tb,vb,ttt) (va+(vb-va)*(ttt-ta)/(tb-ta)) #end #macro armacao(fase)// 0 <= fase <= 1 #declare k=6*tt-3; #declare alfa=k*k*10; #declare beta=k*k*10; #declare gama=-90+k*k*10; object{ veiculo(alfa,beta,gama) } //rotate tt*360*x #declare w=8; #declare p=(2*tt-0.5)*pi; //translate <0,w*cos(p),w*sin(p)> #end #macro voo(fase) #declare alfa=interpolar(0.0, 90, 1.0, 5, fase); #declare beta=interpolar(0.0, 0, 1.0, 30, fase); #declare gama=interpolar(0.0, 0, 1.0, 30, fase); object{ veiculo(alfa, beta, gama) } #end #macro voo_geral(fase) #declare r=28; #switch(tt) #range(0.0,0.25) object{ voo(4*tt) } rotate x*interpolar(0.0, 0, 0.25, 90, tt) translate interpolar(0.0,<0,0,-r>,0.25,<0,r,0>,tt) #break #range(0.25,0.50) object{ voo(4*(tt-0.25)) } rotate x*interpolar(0.25 ,90, 0.50, 180, tt) translate interpolar(0.25,<0,r,0>,0.50,<0,0,r>,tt) #break #range(0.50,0.75) object{ voo(4*(tt-0.50)) } rotate x*interpolar(0.50, 180, 0.75, 270, tt) translate interpolar(0.50,<0,0,r>,0.75,<0,-r,0>,tt) #break #range(0.75,1.00) object{ voo(4*(tt-0.75)) } rotate x*interpolar(0.75, 270, 1.00, 360, tt) translate interpolar(0.75,<0,-r,0>,1.00,<0,0,-r>,tt) #break #end #end #include "eixos.inc" // Aqui está a cena, finalmente: union{ object{ eixos(3.00) } voo_geral(tt) scale .1 //translate <0,k,-1+.4*(9-1*k*k)> } #end // gera o quadro correspondente ao instante dado {clock}: quadro(clock)