// Last edited on 2023-12-25 12:00:44 by stolfi background{ color rgb < 0.8, 0.8, 0.9 > } #declare tx_plastico_marrom_claro = texture { pigment { color rgb < 0.5, 0.4, 0.3 > } finish { diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_plastico_marrom_escuro = texture { pigment { color rgb < 0.4, 0.3, 0.2 > } finish { diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #macro mao(b5) union { sphere { <0, 0, 0>, 1 texture { tx_plastico_marrom_escuro } } cylinder { <0, 0, 0>, <3, 0, 0>, 1 rotate <0, b5, 0> texture { tx_plastico_marrom_claro } } cylinder { <0, 0, 0>, <3, 0, 0>, 1 rotate <0, b5, 60> texture { tx_plastico_marrom_claro } } cylinder { <0, 0, 0>, <3, 0, 0>, 1 rotate <0, b5, -60> texture { tx_plastico_marrom_claro } } } #end #macro cotovelo(b4, b5) union { object{ mao(b5) translate <5, 0, 0> rotate <0, b4, 0> } cylinder { <0, 0, 0>, <5, 0, 0>, 1 rotate <0, b4, 0> texture { tx_plastico_marrom_claro } } sphere { <0, 0, 0>, 1 texture { tx_plastico_marrom_escuro } } } #end #macro membro(b1, b2, b3, b4, b5) union { object{ cotovelo(b4, b5) translate<5, 0, 0> rotate } cylinder { <0, 0, 0>, <5, 0, 0>, 1 rotate texture { tx_plastico_marrom_claro } } sphere { <0, 0, 0>, 1 texture { tx_plastico_marrom_escuro } } } #end #macro cabeca(a5, a6) union { difference { box { <-0.75, -0.75, 0.5>, <0.75, 0.75, 2> texture { tx_plastico_marrom_claro } } cylinder { <0, 0.76, 1.25>, <0, 0.5, 1.25>, 0.5 texture { tx_plastico_marrom_claro } } } cylinder { <0, 0, 0.5>, <0, 0, 0>, 3 texture { tx_plastico_marrom_claro } } sphere { <0, 0, 0>, 1 texture { tx_plastico_marrom_escuro } } rotate } #end #macro vertebra(a4, a5, a6) union { object{ cabeca(a5, a6) translate<0, 0, 5> rotate } cylinder { <0, 0, 0>, <0, 0, 5>, 1 rotate texture { tx_plastico_marrom_claro } } sphere { <0, 0, 0>, 1 texture { tx_plastico_marrom_escuro } } } #end #macro pescoco(a1, a2, a3, a4, a5, a6) union { object{ vertebra(a4, a5, a6) translate<0, 0, 5> rotate } cylinder { <0, 0, 0>, <0, 0, 5>, 1 rotate texture { tx_plastico_marrom_claro } } sphere { <0, 0, 0>, 1 texture { tx_plastico_marrom_escuro } } } #end #macro robo(a1, a2, a3, a4, a5, a6, b11, b12, b13, b14, b15, b21, b22, b23, b24, b25, b31, b32, b33, b34, b35, b41, b42, b43, b44, b45) union { box { <-2.5, -2.5, -5>, <2.5, 2.5, 5> texture {tx_plastico_marrom_claro} } object { pescoco(a1, a2, a3, a4, a5, a6) translate<0, 0, 5> } object { membro(b11, b12, b13, b14, b15) translate<2.5, 0, 4> } object { membro(b21, b22, b23, b24, b25) translate<2.5, 0, 4> scale <-1, 1, 1> } object { membro(b31, b32, b33, b34, b35) translate<2.5, 0, -4> } object { membro(b41, b42, b43, b44, b45) translate<2.5, 0, -4> scale <-1, 1, 1>} } #end #macro cena(tt) object { robo( 0, 30 - (sin(pi * tt) * 30), 0, -60 + (sin(pi * tt) * 60), 30 - (sin(pi * tt) * 30), 0, // PESCOÇO 180 - (tt * 360), - (cos(2 * pi * tt) * 30), (sin(2*pi*tt) * 30), 60 - (sin(pi * tt) * 60), 0, // BRAÇO DIREITO 0 - (tt * 360), (cos(2 * pi * tt) * 30), - (sin(2*pi*tt) * 30), 60, 0, // BRAÇO ESQUERDO 0 - (tt * 360), (cos(2 * pi * tt) * 30), - (sin(2*pi*tt) * 30), 60, 0, // PERNA DIREITA // PERNA DIREITA 180 - (tt * 360), - (cos(2 * pi * tt) * 30), (sin(2*pi*tt) * 30), 60 - (sin(pi * tt) * 30), 0, // PERNA ESQUERDA ) } #end // COMENTARIO // Tentei fazer esticar o braço para evitar o contato com a perna mas não funcionou muito bem object { cena(clock) } #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, 0.00 >; #declare raio_cena = 25.0 + (sin(pi * clock) * 3); #declare dir_camera = < 1, 1, 1 >; #declare dist_camera = 5 * raio_cena; #declare intens_luz = 1.2; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)