// ====================================================================== // CÂMERA camera{ location 0.45*< 14.00, 8.00, 4.50 > // 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, 1.00, 1.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. } // ====================================================================== // 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_galinha = texture{ pigment{ color rgb < 1.00, 0.9, 0.8 > } finish{ diffuse 0.6 ambient 0.2 } } // ====================================================================== // DESCRIÇÃO DA CENA // Partes da cena: #macro pe() box{ <0,0,0>, <1,0.5,0.2> texture{ tx_galinha } } #end #macro canela_com_pe( beta ) union{ cylinder{ <0,0,0>, <1.5,0,0>, 0.3 texture{ tx_galinha } } sphere{ <1.5,0,0> 0.3 texture{ tx_galinha } } object{ pe() rotate -beta*y translate <1.5,-0.2,0> } } #end #macro perna( alfa, beta ) union{ cylinder{ <0,0,0>, <2,0,0>, 0.3 texture{ tx_galinha } } sphere{ <2,0,0> 0.3 texture{ tx_galinha } } object{ canela_com_pe(beta) rotate -alfa*y translate <2,0,0> } } #end #macro bico() cone{ <0,0,0> 0.5 <1,0,0> 0 scale 0.8*z texture{ tx_galinha } } #end #macro cabeca() union{ sphere{ <0,0,0> 1 texture{ tx_galinha} } object{ bico() translate <0.9,0,0> } } #end #macro cabeca_pescoco( alfa, beta) union{ cylinder{ <0,0,0>, <1.5,0,0>, 0.2 texture{ tx_galinha } } object{ cabeca() scale 0.4 rotate alfa*z rotate beta*y translate <1.5,0,0> } } #end #macro ponta_asa() cone{ <0,0,0> 0.18 <1.5,0,0> 0 texture{ tx_galinha } } #end #macro asa( alfa, beta ) union{ cylinder{ <0,0,0>, <0.6,0,0>, 0.18 texture{ tx_galinha } } sphere{ <0,0,0> 0.18 translate <0.6,0,0> texture{ tx_galinha} } object{ ponta_asa() rotate alfa*y rotate beta*y translate <0.6,0,0> } } #end #macro corpo( alfa, alfa_cp, beta_cp, pa1, pb1, pc1, pa2, pb2, pc2, pa3, pb3, pc3, pa4, pb4, pc4, pa5, pb5, pc5, pa6, pb6, pc6, alfa_asa1, inc_asa1, alfa_asa2, inc_asa2 ) union{ sphere{ <0,0,0> 1 scale 1.4*x texture{ tx_galinha} } object{ cabeca_pescoco(alfa_cp,beta_cp) rotate -alfa*y translate <1,0,0.3> } // pernas sphere{ <0,0,0> 0.3 scale 0.6 translate <1,0.5,-0.35> texture{ tx_galinha} } object{ perna(pa1,pb1) scale 0.6 rotate pc1*y translate<1,0.5,-0.35> } sphere{ <0,0,0> 0.3 scale 0.6 translate <0,0.5,-0.35> texture{ tx_galinha} } object{ perna(pa2,pb2) scale 0.6 rotate pc2*y translate<0,0.5,-0.35> } sphere{ <0,0,0> 0.3 scale 0.6 translate <-1,0.5,-0.35> texture{ tx_galinha} } object{ perna(pa3,pb3) scale 0.6 rotate pc3*y translate<-1,0.5,-0.35> } sphere{ <0,0,0> 0.3 scale 0.6 translate <1,0.5,-0.35> texture{ tx_galinha} scale<1,-1,1> } object{ perna(pa4,pb4) scale 0.6 rotate pc4*y translate<1,0.5,-0.35> scale<1,-1,1> } sphere{ <0,0,0> 0.3 scale 0.6 translate <0,0.5,-0.35> texture{ tx_galinha} scale<1,-1,1> } object{ perna(pa5,pb5) scale 0.6 rotate pc5*y translate<0,0.5,-0.35> scale<1,-1,1> } sphere{ <0,0,0> 0.3 scale 0.6 translate <-1,0.5,-0.35> texture{ tx_galinha} scale<1,-1,1> } object{ perna(pa6,pb6) scale 0.6 rotate pc6*y translate<-1,0.5,-0.35> scale<1,-1,1> } // asas sphere{ <0,0,0> 0.18 translate <-0.3,1,0> texture{ tx_galinha} scale <-1,1,-1> } object{ asa(alfa_asa1, inc_asa1) translate <-0.3,1,0> scale <-1,1,-1> } sphere{ <0,0,0> 0.18 translate <-0.3,1,0> texture{ tx_galinha} scale <-1,1,-1> scale <1,-1,1> } object{ asa(alfa_asa2, inc_asa2) translate <-0.3,1,0> scale <-1,1,-1> scale <1,-1,1> } } #end #macro galinhas() object { corpo(20, 30, 50, 40, -80, 90, 60, -60, 90, 40, -60, 90, 40, -60, 100, 50, -60, 90, 40, -60, 90, 30, 10, 50, 20) rotate 13*z translate <0,0,0> } object { corpo(50, 20, 50, 40, -60, 80, 80, -60, 110, 40, -60, 90, 40, -60, 90, 40, -60, 90, 40, -60, 90, 70, 20, 40, 70) rotate -80*z translate <0,4,4> } object { corpo(30, 40, 50, 40, -50, 100, 40, -60, 90, 40, -60, 90, 40, -60, 80, 60, -60, 90, 40, -60, 90, 20, 30, 30, 10) rotate 0*z translate <-4,-5,3> } #end #macro define_angulos_perna(a,b,c,te) #local t0 = 0.0; #local t1 = 0.2; #local t2 = 0.4; #local t3 = 0.6; #local t4 = 0.8; #local t5 = 1.0; #local c0 = 110; #local a0 = -10; #local b0 = 120; #local c1 = 90; #local a1 = -40; #local b1 = 120; #local c2 = 60; #local a2 = -20; #local b2 = 90; #local c3 = 70; #local a3 = -10; #local b3 = 90; #local c4 = 80; #local a4 = -20; #local b4 = 100; #local c5 = 110; #local a5 = -10; #local b5 = 120; #if( te >= t0 & te < t1 ) interpola_perna(a,b,c,a0,b0,c0,a1,b1,c1,te,t0,t1); #end #if( te >= t1 & te < t2 ) interpola_perna(a,b,c,a1,b1,c1,a2,b2,c2,te,t1,t2); #end #if( te >= t2 & te < t3 ) interpola_perna(a,b,c,a2,b2,c2,a3,b3,c3,te,t2,t3); #end #if( te >= t3 & te < t4 ) interpola_perna(a,b,c,a3,b3,c3,a4,b4,c4,te,t3,t4); #end #if( te >= t4 & te <= t5 ) interpola_perna(a,b,c,a4,b4,c4,a5,b5,c5,te,t4,t5); #end #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 interpola(x0,x1,rr) (1-rr)*x0 + rr*x1 #end #macro galinha_andando(tt) // gera uma galinha durante um pulso // tt = 0 - inicio do pulso // tt = 1 - fim do pulso #local alfa=20; #local alfa_cp=30; #local beta_cp=50; #local pa1=0; #local pb1=0; #local pc1=0; #local pa2=0; #local pb2=0; #local pc2=0; #local alfa_asa1=30; #local inc_asa1=10; #local alfa_asa2=50; #local inc_asa2=20; #declare ta = tt; #declare td = mod(ta+0.5,1); define_angulos_perna(pa1,pb1,pc1,ta) define_angulos_perna(pa2,pb2,pc2,td) //define_angulos_perna(pa3,pb3,pc3,ta) //define_angulos_perna(pa4,pb4,pc4,ta) //define_angulos_perna(pa5,pb5,pc5,ta) //define_angulos_perna(pa6,pb6,pc6,ta) object{ corpo(alfa, alfa_cp, beta_cp, pa1, pb1, pc1, pa2, pb2, pc2, pa1, pb1, pc1, pa2, pb2, pc2, pa1, pb1, pc1, pa2, pb2, pc2, alfa_asa1, inc_asa1, alfa_asa2, inc_asa2) rotate -40*z translate <0,1.5,1.6> } #end // Cena: object{ eixos(3.00) } galinha_andando(clock)