// Exemplo de arquivo de descricao de ANIMAÇÃO para POV-ray // Last edited on 2009-09-24 15:40:22 by stolfi #declare FONT="arial.ttf" #declare tx_escada = texture { pigment { color rgb <0.0, 0.5, 0.5> } finish { diffuse 0.9 ambient 0.1 } } #declare tx_fosca = texture{ pigment{ color rgb < 1.00, 0.80, 0.80 > } finish{ diffuse 0.9 ambient 0.1 } } #declare times = 3; #macro Texto (txt, dx, sc) union { text{ ttf FONT txt, .1, 0 texture { pigment { color rgb <0.7, 0.2, 0.2> } finish { reflection 0.1 ambient 0.5 } } translate <0, 0.1, 0> scale 0.5 } box { <0, 0, -.05>, translate <0, 0, 0> texture {tx_escada}} cylinder { <0, 0, 0>, <3.6, 0, 0>, 0.1 texture { tx_fosca } translate <0, 0.5, 0> } union { cone { , 0.05, , 0.2 texture { pigment {color rgb<0.1, 0.1, 0.8>} } } cone { <2*dx/3, 0.5, 0>, 0.05, <2*dx/3, 0.5 + 0.6*sin(times*2*pi*clock), 0.4>, 0.2 texture { pigment {color rgb<0.1, 0.1, 0.8>} } } } union { cone { , 0.05, , 0.2 texture { pigment {color rgb<0.1, 0.1, 0.8>} } } cone { <2*dx/3, 0.5, 0>, 0.05, <2*dx/3, 0.5 + 0.6*sin(times*2*pi*clock), -0.4>, 0.2 texture { pigment {color rgb<0.1, 0.1, 0.8>} } } } scale sc } #end #macro TextAux (txt, dx, sc, sc2) union { object {Texto(txt, dx, sc)} rotate <90, 0, 90> translate <0.05, 0, 0> scale sc2 } #end #macro TextoAux2(txt, dx, sc, tx, ty, tz, sc2) union { object { TextAux(txt, dx, sc, sc2) translate } translate <0, -dx/2, 0> } #end #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 } } #declare bola = sphere { < 0.00, 0.00, 0.00 >, 2.00 texture { tinta_A } } #declare furo = cylinder { < -1.00, -2.00, -2.00 >, < +1.00, +2.00, +2.00 >, 1.50 texture { tinta_B } } #declare pino = cylinder { < -2.00, +2.00, -1.00 >, < +2.00, -2.00, +1.00 >, 0.5 + 0.3*stt texture { tinta_B } } // Aqui está a cena, finalmente: #include "eixos.inc" #declare tampe = 1.5; #declare tamap = 2; #declare tamcoxa = 3; #declare freqpe = 6; #macro pe() union { //object { box { <0, 0.25, 0>, <0.5, comp + 0.25, 0.5> } texture { tx_escada } } object { cylinder { <0.25, 0, 0.25>, <0.25, tampe, 0.25>, 0.5 } texture { tx_escada } } object { sphere { <0.25, 0, 0.25>, 0.5 } texture {tx_escada} } object { sphere { <0.25, tampe, 0.25>, 0.5 } texture {tx_escada} } } #end #macro anteperna(a) union { union { object { cylinder { <0.25, 0.25, 0.25>, <0.25, 0.25, tamap-0.25>, 0.5 } texture { tx_escada } } object { sphere { <0.25, 0.25, 0.25>, 0.5 } texture {tx_escada} } object { sphere { <0.25, 0.25, tamap-0.25>, 0.5 } texture {tx_escada} } rotate <30, 0, 0> } object { pe() rotate translate <0, 0.25, 0> } translate <0, -tamap*sin(60) + 0.25, -tamap + 0.25> } #end #macro coxa() union { union { union { object { cylinder { <0.25, 0.25, 0.25>, <0.25, 0.25, tamap-0.25>, 0.5 } texture { tx_escada } } object { sphere { <0.25, 0.25, 0.25>, 0.5 } texture {tx_escada} } object { sphere { <0.25, 0.25, tamap-0.25>, 0.5 } texture {tx_escada} } translate <0, 0, -0.25> } } object { anteperna(25*sin(freqpe * pi * clock)) rotate <-15*sin(freqpe * pi * clock), 0, 0> translate <0, 0.1, 0>} translate <0, 0, -tamap + 0.25> //rotate <0, 5*sin(freqpe * pi * clock), 0> } #end #macro corpo() union { union { object { coxa() translate <2, 0, 0> } object { coxa() translate <-2-0.25, 0, 0> } rotate <-18*sin(freqpe * pi * clock), 0, 0> } object { sphere { <0, 0, 0>, 2 } texture {tx_fosca} } translate <0, clock, 0> } #end union { object { eixos(3.0) scale 2 } //object { coxa() } object { corpo() } //union { // object { TextoAux2("Compre BATOM", 3.6, 1, 0, -0.5, 0.5, 2.5) } // translate <0, -16 + tt * 27, 4*sin(2*2*pi*tt)> //} //rotate 360*tt*z //translate -1.5*ctt*y } #end #include "camlight.inc" #declare centro_cena = < 0.0, 0.00, 0.00 >; #declare raio_cena = 10.0; #declare dir_camera = < 1, 1, 1 >; #declare dist_camera = 10.0; #declare intens_luz = 1.00; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz) // gera o quadro correspondente ao instante dado {clock}: quadro(clock)