// 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 #include "eixos.inc" camera { location < 50.00, 40*clock, 10.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, 40*clock, 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 > } background{ color rgb < 0.75, 0.80, 0.85 > } #declare marrom = texture{ pigment{ color rgb < 0.9, 0.2, 0.2 > } finish{ diffuse 0.8 ambient 0.01 specular 0.5 roughness 0.005 } } #declare lol = texture{ pigment{ color rgb < 0.0, 0.5, 0.8 > } finish{ diffuse 0.8 ambient 0.01 specular 0.5 roughness 0.005 } } #declare verde = texture{ pigment{ color rgb < 0.15, 0.90, 0.15 > } finish{ diffuse 0.8 ambient 0.01 specular 0.5 roughness 0.005 } } #declare tx_plastico = texture{ pigment{ color rgb < 0.80, 0.90, 0.90 > } finish{ diffuse 0.8 ambient 0.01 specular 0.5 roughness 0.005 } } #declare tx_plastico2 = texture{ pigment{ color rgb < 0.90, 0.90, 0.90 > } 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 } } #declare tx_fosca2 = texture{ pigment{ color rgb < 0.50, 0.50, 0.10 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_espelho = texture{ pigment{ color rgb < 1.00, 0.85, 0.30 > } finish{ diffuse 0.2 reflection 0.7*< 1.00, 0.85, 0.30 > ambient 0.1 } } #declare tx_vidro = texture{ pigment{ color rgb < 0.85, 0.95, 1.00 > filter 0.70 } finish{ diffuse 0.03 reflection 0.25 ambient 0.02 specular 0.25 roughness 0.05 } } #declare tx_xadrez = texture{ pigment{ checker color rgb < 0.10, 0.32, 0.60 >, color rgb < 1.00, 0.97, 0.90 > } finish{ diffuse 0.9 ambient 0.1 } scale 2.0 } #declare raio = 10.000; // Um parãmetro que varia {+1, 00, -1, 00, +1}: #declare ctt = cos(4*pi*tt); // Um parâmetro que varia {00, +1, 00, -1, 00}: #declare stt = sin(4*pi*tt); #declare caixa = box{<-5,-5,-5> <5,5,5>} #macro peh(fase) union { object { cylinder {<0,0,0> <0,4,0> 0.5}} rotate<30+30*sin(2*pi*fase+30),0,0> } #end #macro anteperna(fase) union { object{peh(fase) texture{tx_fosca}} object{cylinder{<0,0,0> <0,0,4> 0.5}} translate<0,0,-4> rotate<-60-60*sin(2*pi*fase+30),0,0> } #end #macro coxas(fase) union { object{anteperna(fase) texture{tx_fosca}} object{cylinder{<0,0,0> <0,0,4> 0.5}} translate<0,0,-4> rotate<+30+30*sin(2*pi*fase+30),0,0> } #end #macro armacao(fase) union { object{ box{ <-1,-1,-1> <1,1,1> } translate <0,0,2*cos(2*pi*fase)-2> } object{coxas(fase) translate <-1,0,2*cos(2*pi*fase)-2>} object{coxas(fase) translate<1,0,2*cos(2*pi*fase)-2>} } #end #macro voo(fase) union { object{box{ <-1,-1,-1> <1,1,1> translate <0,20*fase,10*fase+ 5-20*(fase-0.5)*(fase-0.5)>} } object{coxas(0) translate <-1,20*fase,10*fase+5-20*(fase-0.5)*(fase-0.5)>} object{coxas(0) translate<1,20*fase,10*fase+5-20*(fase-0.5)*(fase-0.5)>} } #end #macro armacao1(fase) union { object{ box{ <-1,-1,-1> <1,1,1> } translate <0,20,10+2*cos(2*pi*fase)-2> } object{coxas(fase) translate <-1,20,10+2*cos(2*pi*fase)-2>} object{coxas(fase) translate<1,20,10+2*cos(2*pi*fase)-2>} } #end #macro voo1(fase) union { object{box{ <-1,-1,-1> <1,1,1> rotate<-360*fase,0,0> translate <0,20+20*fase,10-10*fase+5-20*(fase-0.5)*(fase-0.5)>} } object{coxas(0) rotate<-360*fase,0,0> translate <-1,20+20*fase,10-10*fase+5-20*(fase-0.5)*(fase-0.5)>} object{coxas(0) rotate<-360*fase,0,0> translate<1,20+20*fase,10-10*fase+5-20*(fase-0.5)*(fase-0.5)>} } #end // Aqui está a cena, finalmente: //object{peh() texture{tx_fosca}} #if(clock <= 0.25 ) object{armacao(4*clock) texture{tx_fosca}} #end #if(clock>=0.25 & clock <= 0.5) object{voo(4*(clock-0.25)) texture{tx_fosca}} #end #if(clock >= 0.5 & clock <= 0.75) object{armacao1(4*clock) texture{tx_fosca}} #end #if(clock>=0.75) object{voo1(4*(clock-0.75)) texture{tx_fosca}} #end object{caixa texture{tx_plastico} translate<0,-20,-4>} object{caixa texture{tx_plastico} translate<0,0,-14>} object{caixa texture{tx_plastico} translate<0,20,-4>} object{caixa texture{tx_plastico} translate<0,40,-14>} object{caixa texture{tx_plastico} translate<0,60,-4>} //object{chassi(1,1,stt)} //object{coxas{1,1,1}} //object{chassi(0,0,0)} //object{ eixos(100.00) } /*difference { union { object { bola } object { pino } } object { furo } rotate 360*tt*z translate -1.5*ctt*y }*/ #end // gera o quadro correspondente ao instante dado {clock}: quadro(clock)