// 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 "camlight.inc" #declare centro_cena = < 0.00, 0.00, 0.00 >; #declare raio_cena = 20.0; #declare dir_camera = <20,0,15>; #declare dist_camera = 20; #declare intens_luz = 1.00; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz) // ====================================================================== // 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. } // ====================================================================== // CORES E TEXTURAS background{ color rgb < 0.75, 0.80, 0.85 > } #declare tx_preto = texture{ pigment{ color rgb < 0.00, 0.00, 0.00 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_rosa = texture{ pigment{ color rgb < 1, 0.4, 0.8 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_vermelho = texture{ pigment{ color rgb < 1, 0, 0 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_pele = texture{ pigment{ color rgb < 1, 0.72, 0.51 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_verde = texture{ pigment{ color rgb < 0.49, 0.99 , 0 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_escada = texture{ pigment{ color rgb < .5,.6,.8 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_branco = texture{ pigment{ color rgb < 1, 1, 1 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_azul = texture{ pigment{ color rgb < 0, 0, 1 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_amarelo = texture{ pigment{ color rgb <1,1,0 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_xadrez = texture{ pigment{ checker color rgb < 0.10, 0.32, 0.60 >, color rgb < 0.20, 0.67, 0.20 > } finish{ diffuse 0.9 ambient 0.1 } scale 2.0 } #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.005 } } // ====================================================================== // MACROS #macro pe() union{ intersection{ cone { <0,0,0>,0.4,<0,1.5,0>,0.4 } texture {tx_pele} } } #end #macro canela(gama) union{ cone { <0,0,0>,0.4,<0,0,-3>,0.4 } sphere {<0,0,-3>,0.5 } object { pe() rotate gama*x translate <0,0,-3> } texture { tx_pele } } #end #macro coxa(beta,gama) union{ cone { <0,0,0>,0.4,<0,0,-3>,0.4 } sphere {<0,0,-3>,0.5 } object { canela(gama) rotate beta*x translate <0,0,-3> } texture { tx_pele } } #end #macro bicho(alfa,beta,gama) union{ union{ intersection{ sphere{<0,0,7.2>,3 } box{<-10,-10,7.2>,<10,10,15>} texture { tx_vidro} } box{<-4,-4,6.2>,<4,4,7.2>} texture {tx_azul} } object {coxa(beta,gama) rotate alfa*x translate <2,0,6.2>} object {coxa(beta,gama) rotate alfa*x translate <-2,0,6.2>} } #end #macro interpol(ta,va,tb,vb,tt) #local s = (tt-ta)/(tb-ta); ((1-s)*va+s*vb); #end // ====================================================================== // OBJETOS #declare chao = box{ <-10,-10,-1>,<10,10,0> texture {tx_xadrez} } // ====================================================================== // DESCRIÇÃO DA CENA background{ color rgb < 0.75, 0.80, 0.85 > } #include "eixos.inc" // Aqui está a cena, finalmente: union { object { chao } #declare t0 = 0; #declare t1 = 0.25; #declare t2 = 0.5; #declare t3 = 0.75; #declare t4 = 1; #if ((clock>=t0) & (clock<=t1)) #declare alfa = interpol(t0,15,t1,30,clock); #declare beta = interpol(t0,-30,t1,-60,clock); #declare gama = interpol(t0,15,t1,30,clock); #declare pos_carro = interpol(t0,0,t1,-1,clock); #end #if ((clock>t1) & (clock<=t2)) #declare alfa = interpol(t1,30,t2,0,clock); #declare beta = interpol(t1,-60,t2,0,clock); #declare gama = interpol(t1,30,t2,0,clock); #declare pos_carro = interpol(t1,-1,t2,1,clock); #end #if ((clock>t2) & (clock<=t3)) #declare alfa = interpol(t2,0,t3,7,clock); #declare beta = interpol(t2,0,t3,-14,clock); #declare gama = interpol(t2,0,t3,7,clock); #declare pos_carro = interpol(t2,1,t3,3,clock); #end #if ((clock>t3) & (clock } } #end // gera o quadro correspondente ao instante dado {clock}: quadro(clock)