// 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; #declare tamap = 1.5; #declare tamcoxa = 2.0; #declare espessura = 0.4; #macro parte(tam) union { object { cylinder { <0, 0, 0>, <0, tam, 0>, espessura } texture { tx_escada } } object { sphere { <0, 0, 0>, espessura } texture {tx_escada} } object { sphere { <0, tam, 0>, espessura } texture {tx_escada} } } #end #macro pe() union { object { parte(tampe) texture {tx_escada} } } #end #macro anteperna(alfa) union { union { object { parte(tamap) rotate <90, 0, 0> } } object { pe() rotate } translate <0, 0, -tamap> } #end #macro coxa(alfa, betha) union { object { parte(tamcoxa) rotate <90, 0, 0> } object { anteperna(alfa) rotate } translate <0, 0, -tamcoxa> } #end #macro corpo(alfa, betha, ghama) union { union { object { coxa(alfa, betha) rotate translate <2.2, 0, 0>} object { coxa(alfa, betha) rotate translate <-2.2, 0, 0>} translate <0, 0, -0.5> } object { sphere { <0, 0, 0>, 2 } texture {tx_fosca} } //object { coxa() translate <-2-0.25, 0, 0> } //rotate <-18*sin(freqpe * pi * clock), 0, 0> //translate <0, clock, 0> } #end #macro aux(fase) #declare f = fase; #while (f >= 1) #declare f = f - 1; #end #declare gh = 75; #declare al = 0; #declare altura = 2; #if (f < 0.250) #declare gh = gh - 60 * f * 4; #declare be = -gh; #declare al = al - 30 * f * 8; #end #if (f >= 0.250) #declare gh = gh - 60 * 0.250 * 4; #declare be = -gh; #declare al = al - 30 * 0.250 * 8; #end #if (f > 0.750) #declare gh = gh + 60 * (f - 0.750) * 4; #declare be = -gh; #declare al = al + 30 * (f - 0.750) * 8; #end #declare altura = altura + sin(75)*tamcoxa + tamap + sin(al)*tampe + sin(gh) * tamcoxa + 0.5 + 0.5; union { object { corpo(al, be, gh) } translate <0, 0, altura> } #end #macro armacao (fase) union { #declare hab = 6*2.5; #declare hab2 = hab - 2*2.5; #declare h = 0; object {aux(fase) translate <0, 10*fase, 0>} #if (fase < 0.4) #declare h = h + hab * fase; #end #if (fase >= 0.4 & fase <= 0.6) #declare h = h + hab * 0.4; #end #if (fase >= 0.6) #declare h = h - (hab - hab2) * (fase - 0.6) + hab*0.4; #end translate <0, 0, h> } #end #macro voo (h, fase) union { #declare hab = 10*2.5; #declare hab2 = hab - 2*2.5; #declare h = 0; object {aux(fase) translate <0, 10*fase, 0>} #if (fase < 0.4) #declare h = h + hab * fase; #end #if (fase >= 0.4 & fase <= 0.6) #declare h = h + hab * 0.4; #end #if (fase >= 0.6) #declare h = h - (hab - hab2) * (fase - 0.6) + hab*0.4; #end translate <0, 10, h> } #end #macro armacao_geral(p, fase) object { armacao(fase) translate p } #end union { //object { eixos(3.0) scale 2 } object { cylinder { <0, 0, -5>, <0, 0, 0>, 4 } texture {tinta_A} translate <0, 1, 0> } object { cylinder { <0, 0, -5 - 4>, <0, 0, 0>, 4 } texture {tinta_A} translate <0, 1 + 10, 4> } object { cylinder { <0, 0, -5 - 8>, <0, 0, 0>, 4 } texture {tinta_A} translate <0, 1 + 20, 8> } object { cylinder { <0, 0, -5 - 12>, <0, 0, 0>, 4 } texture {tinta_A} translate <0, 1 + 30, 12> } object { cylinder { <0, 0, -5 - 16>, <0, 0, 0>, 4 } texture {tinta_A} translate <0, 1 + 40, 16> } #if (clock < 0.5) object { armacao(2*clock) } #end #if (clock >= 0.5) object { voo(0, 2*(clock-0.5)) } #end } #end #include "camlight.inc" #declare centro_cena = < 0.0, 7.00 + 14*clock, 4.00 + 9*clock >; #declare raio_cena = 12.0; #declare dir_camera = < 1, 0, 0.0 >; #declare dist_camera = 12.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)