// Exemplo de arquivo de descricao de cena para POV-ray // Last edited on 2009-03-09 18:44:03 by stolfi // ====================================================================== // CÂMERA camera{ location < 130.00, 0.00, 0.0 > // 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, 20.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.0 * < 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.5 * < 1.00, 1.00, 1.00 > // Intensidade e corda luz. } light_source{ 10 * < 0.0, 0.0, -20.0 > // Posição da lâmpada. color rgb 0.5 * < 1.00, 1.00, 1.00 > // Intensidade e corda luz. } // ====================================================================== // EIXOS DE COORDENADAS #macro eixo(ponta,cor,nome) union{ sphere{ <0,0,0>, 0.02 } cylinder{ <0,0,0>, 0.91*ponta, 0.02 } cone{ 0.90*ponta, 0.06, ponta, 0.00 } texture{ pigment{ color rgb cor } finish{ ambient 0.5 diffuse 0.5 } } } #end #macro eixos(tamanho) union{ object{ eixo( , <1.0,0.2,0.2>, "X") } object{ eixo( <0,tamanho,0>, <0.0,0.8,0.0>, "Y") } object{ eixo( <0,0,tamanho>, <0.3,0.3,1.0>, "Z") } } #end // ====================================================================== // CORES E TEXTURAS background{ color rgb < 0.75, 0.80, 0.85 > } #declare tx_plastico = texture{ pigment{ color rgb < 0.10, 0.80, 1.00 > } 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_fosca_preta = texture{ pigment{ color rgb < 0.00, 0.00, 0.00 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_fosca_branca = texture{ pigment{ color rgb < 1.00, 1.00, 1.00 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_fosca2 = texture{ pigment{ color rgb < 1.00, 0.10, 0.10 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_espelho = texture{ pigment{ color rgb < 1.00, 0.90, 0.70 > } finish{ diffuse 0.1 reflection 0.8*< 1.00, 0.90, 0.70 > ambient 0.1 } } #declare tx_vidro = texture{ pigment{ color rgb < 0.97, 0.98, 1.00 > filter 0.70 } finish{ diffuse 0.03 reflection 0.25 ambient 0.02 specular 0.25 roughness 0.005 } } // ====================================================================== // DESCRIÇÃO DA CENA #macro pe() box { < -1.5, 0.00, -1.00 >, < 1.5, 1.00, 3.00 > texture{ tx_fosca } } #end #macro canela_com_pe(beta) union { cylinder{ <0,0,0>, <0,10,0>, 1 texture{ tx_fosca } } sphere{ < 0, 10, 0>, 1 texture{ tx_fosca } } object{ pe() rotate -beta*x translate 10*y } } #end #macro perna(alfa, beta) union { cylinder{ <0,0,0>, <0, 7, 0>, 1 texture{ tx_fosca } } sphere{ < 0, 7, 0>, 1 texture{ tx_fosca } } object{ canela_com_pe(beta) rotate alfa * x translate <0, 7, 0> } } #end #macro cabeca() union { // cabeca sphere{ < 0, 0, 0>, 4 texture{ tx_fosca2 } } // olhos sphere{ < 3.3, 0, 0>, 1 texture{ tx_fosca_preta } } sphere{ < -3.3, 0, 0>, 1 texture{ tx_fosca_preta } } // bico cone { <0,3,0>, 2.0, <0,8,0>, 0 texture{ tx_fosca } } } #end #macro pescoco_cabeca(g_cabeca) union { cylinder{ <0,0,0>, <0, 9, 0>, 1 texture{ tx_fosca } } sphere{ < 0, 9, 0>, 1 texture{ tx_fosca } } object{ cabeca() rotate 90*x rotate g_cabeca*x translate <0,9,0>} } #end #macro asinha() union { cone { <0,0,0>, 2.0, <0,5,0>, 1.5 texture{ tx_fosca } } } #end #macro asa(g_asinha) union { cylinder{ <0,0,0>, <0,6,0>, 2 texture{ tx_fosca } } sphere { <0.0, 6.0, 0.0 >, 2 texture{ tx_fosca } } object{ asinha() rotate g_asinha*x translate <0.0, 6.0, 0.0 > } } #end #macro galinha(p_esq1_bacia, p_esq1_joelho, p_esq1_torn, p_dir1_teta, p_dir1_alfa, p_dir1_beta, p_esq2_bacia, p_esq2_joelho, p_esq2_torn, p_dir2_teta, p_dir2_alfa, p_dir2_beta, p_esq3_bacia, p_esq3_joelho, p_esq3_torn, p_dir3_teta, p_dir3_alfa, p_dir3_beta, g_cabeca, g_pescoco, g_asinha, g_asa) union { // corpo sphere { <0.0, 0.0, 0.0 >, 1 scale <8, 15, 8> texture{ tx_fosca2 } } cone { <0,15,0>, 1.0, <0,17,0>, 3 texture{ tx_fosca } } // perna esquerda 1 sphere { <2.0, -6.0, -7.0 >, 1 texture{ tx_fosca } } object{ perna(p_esq1_joelho, p_esq1_torn) rotate 180*y rotate -p_esq1_bacia*x translate <2, -6, -7.0> } // perna direita 1 sphere { <-2.0, -6.0, -7.0 >, 1 texture{ tx_fosca } } object{ perna(p_dir1_alfa, p_dir1_beta) rotate 180*y rotate -p_dir1_teta*x translate <-2, -6, -7.0> } // perna esquerda 2 object{ perna(p_esq2_joelho, p_esq2_torn) rotate 180*y rotate -p_esq2_bacia*x translate <2, 0, -7.0> } sphere { <2.0, 0.0, -7.0 >, 1 texture{ tx_fosca } } //perna direita 2 object{ perna(p_dir2_alfa, p_dir2_beta) rotate 180*y rotate -p_dir2_teta*x translate <-2, 2, -7.0> } sphere { <-2.0, 2.0, -7.0 >, 1 texture{ tx_fosca } } // perna esquerda 3 object{ perna(p_esq3_joelho, p_esq3_torn) rotate 180*y rotate -p_esq3_bacia*x translate <2, 6, -7.0> } sphere { <2.0, 6.0, -7.0 >, 1 texture{ tx_fosca } } //perna direita 3 object{ perna(p_dir3_alfa, p_dir3_beta) rotate 180*y rotate -p_dir3_teta*x translate <-2, 6, -7.0> } sphere { <-2.0, 6.0, -7.0 >, 1 texture{ tx_fosca } } // cabeca object{ pescoco_cabeca(g_cabeca) rotate 90*x rotate g_pescoco*x translate <0, -10, 6> } sphere { <-0, -10, 6 >, 1 texture{ tx_fosca } } // asa direita object{ asa(g_asinha) rotate -90*x rotate -g_asa*y translate <8,0,0> } sphere { <8, 0, 0 >, 2 texture{ tx_fosca } } // asa direita object{ asa(g_asinha) rotate -90*x rotate g_asa*y translate <-8,0,0> } sphere { <-8, 0, 0 >, 2 texture{ tx_fosca } } } #end #macro interpola(x0, x1, rr) (1-rr) * x0 + rr * x1 #end #macro interpola_perna(a, b, c, a0, b0, c0, a1, b1, c1, tt, t0, t1) #local rr = (tt-t0) / (t1 - t0); #declare a = interpola(a0, a1, rr); #declare b = interpola(b0, b1, rr); #declare c = interpola(c0, c1, rr); #end #macro define_angulos_perna(bacia, joelho, torn, te) #local t0 = 0.0000; #local t1 = 0.2000; #local t2 = 0.4000; #local t3 = 0.6000; #local t4 = 0.8000; #local t5 = 1.0000; #local bacia0 = 90; #local bacia1 = 125; #local bacia2 = 145; #local bacia3 = 135; #local bacia4 = 125; #local bacia5 = 90; #local joelho0 = -45; #local joelho1 = -135; #local joelho2 = -135; #local joelho3 = -45; #local joelho4 = -45; #local joelho5 = -45; #local torn0 = -45; #local torn1 = -45; #local torn2 = -45; #local torn3 = -45; #local torn4 = -45; #local torn5 = -45; #if ((te >= t0) & (te < t1)) interpola_perna(bacia, joelho, torn, bacia0, joelho0, torn0, bacia1, joelho1, torn1, te, t0, t1) #end #if ((te >= t1) & (te < t2)) interpola_perna(bacia, joelho, torn, bacia1, joelho1, torn1, bacia2, joelho2, torn2, te, t0, t1) #end #if ((te >= t2) & (te < t3)) interpola_perna(bacia, joelho, torn, bacia2, joelho2, torn2, bacia3, joelho3, torn3, te, t0, t1) #end #if ((te >= t3) & (te < t4)) interpola_perna(bacia, joelho, torn, bacia3, joelho3, torn3, bacia4, joelho4, torn4, te, t0, t1) #end #if ((te >= t4) & (te <= t5)) interpola_perna(bacia, joelho, torn, bacia4, joelho4, torn4, bacia5, joelho5, torn5, te, t0, t1) #end #end #macro galinha_andando(tt) // tt = 0, início do passo // tt = 1, fim do passo #declare p_esq1_bacia = 90; #declare p_esq1_joelho = -45; #declare p_esq1_torn = -45; #declare p_dir1_teta = 90; #declare p_dir1_alfa = -45; #declare p_dir1_beta = -45; #declare p_esq2_bacia = 45; #declare p_esq2_joelho = 90; #declare p_esq2_torn = 45; #declare p_dir2_teta = 90; #declare p_dir2_alfa = -45; #declare p_dir2_beta = -45; #declare p_esq3_bacia = 45; #declare p_esq3_joelho = 90; #declare p_esq3_torn = 45; #declare p_dir3_teta = 90; #declare p_dir3_alfa = -45; #declare p_dir3_beta = -45; #declare g_cabeca = 0; #declare g_pescoco = 45; #declare g_asinha = 90; #declare g_asa = 45; #declare ta = tt; define_angulos_perna(p_esq1_bacia, p_esq1_joelho, p_esq1_torn, ta) define_angulos_perna(p_esq2_bacia, p_esq2_joelho, p_esq2_torn, ta) define_angulos_perna(p_esq3_bacia, p_esq3_joelho, p_esq3_torn, ta) object{ galinha(p_esq1_bacia, p_esq1_joelho, p_esq1_torn, p_dir1_teta, p_dir1_alfa, p_dir1_beta, p_esq2_bacia, p_esq2_joelho, p_esq2_torn, p_dir2_teta, p_dir2_alfa, p_dir2_beta, p_esq3_bacia, p_esq3_joelho, p_esq3_torn, p_dir3_teta, p_dir3_alfa, p_dir3_beta, g_cabeca, g_pescoco, g_asinha, g_asa) } #end object { galinha_andando(clock) }