// 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; // variacao da coxa #declare angCoxa = abs(40*sin(2*pi*tt)); // variacao da anteperna #declare angAnte = -abs(80*sin(2*pi*tt)); // variacao do pe #declare angPe = abs(40*sin(2*pi*tt)); #macro interpola(ta, va, tb, vb, tt) #local s = (tt-ta)/(tb-ta); ((1-s)*va + s*vb) #end // variacao da altura #declare t0 = 0.000; #declare t1 = 0.250; #declare t2 = 0.500; #declare t3 = 0.750; #declare t4 = 0.100; #declare v0 = 0.0; #declare v1 = -2; #declare v2 = 0; #declare v3 = 2; #declare v4 = 0; #if((tt >= t0) & (tt <= t1)) #declare trans = interpola(t0, v0 ,t1, v1, tt); #end #if((tt >= t1) & (tt <= t2)) trans = interpola(t1, v1, t2, v2, tt); #end #if((tt >= t2) & (tt <= t3)) trans = interpola(t2, v2, t3, v3, tt); #end #if((tt >= t3) & (tt <= t4)) trans = interpola(t3, v3, t4, v4, tt); #end #declare tx_vermelho = texture{ pigment{ color rgb < 1.00, 0.0, 0.10 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_amarelo = texture{ pigment{ color rgb < 1.00, 1.0, 0.00 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #macro pe() union{ box{ < 0, 0, 0 > < -1, -1, -0.2 > texture { tx_amarelo } } } #end #macro anteperna(ang1) union{ object{ cylinder{ < 0, 0, 0 > < 0, 0, -2 > 0.35 texture { tx_vermelho } } } object{ pe() rotate ang1*y translate <0,0.35,-2>} } #end #macro coxa(ang1, ang2) union{ object{ anteperna(ang1) rotate ang2*y translate -1*z} object{ cylinder{ < 0, 0, 0 > < 0, 0, -1 > 0.35 texture { tx_vermelho } } } } #end #macro chassis(ang1, ang2, ang3) union{ object{coxa(ang1,ang2) rotate ang3*y translate <-2,-2,-1>} object{coxa(ang1,ang2) rotate ang3*y translate <2,2,-1>} object{coxa(ang1,ang2) rotate ang3*y translate <2,-2,-1>} object{coxa(ang1,ang2) rotate ang3*y translate <-2,2,-1>} object{ box{ < -2, -2, 0 > < 2, 2, -1 > texture { tx_amarelo } } } } #end #macro animal(ang1,ang2,ang3,trans) union{ object{ chassis(ang1, ang2, ang3) translate trans*z } } #end // Aqui está a cena, finalmente: #include "eixos.inc" // Aqui está a cena union{ //eixos object{ eixos(3.00) } // object{ chassis } // object{ coxa } object{ animal(angCoxa,angAnte,angPe, trans) translate 2*z} //object{texto("UNICAMP", 1, 0.5, tinta_A) rotate 360*tt*z } //object{asa1 rotate<0,ctt,360*tt>} //object{asa2 rotate<0,-ctt,360*tt>} //scale 2 } #end //fim da macro // gera o quadro correspondente ao instante dado {clock}: quadro(clock)