// Fabio de Souza Azevedo - RA 952215 // 2021-09-29 // // TP06 // Exemplo de arquivo de descricao de cena para POV-ray // Last edited on 2020-09-30 19:57:13 by jstolfi // ====================================================================== // 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_espelho = texture{ pigment{ color rgb < 1.00, 0.85, 0.30 > } finish{ diffuse 0.2 reflection 0.7*< 1.00, 0.85, 0.30 > ambient 0.1 } } #declare tx_vidro = texture{ pigment{ color rgb < 0.85, 0.95, 1.00 > filter 0.70 } finish{ diffuse 0.03 reflection 0.25 ambient 0.02 specular 0.25 roughness 0.005 } } #declare tx_verde_escuro = texture{ pigment { color rgb <0, 0.5, 0> } //finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_verde_claro = texture{ pigment { color rgb <0, 1.0, 0> } //finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_azul_escuro = texture{ pigment { color rgb<0, 0, 0.5> } //finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_azul_escuro_espelhado = texture{ pigment { color rgb<0, 0, 0.5> } finish{ diffuse 0.2 reflection 0.7*<0, 0, 0.5> ambient 0.1 } } #declare tx_verm_escuro = texture{ pigment { color rgb<0.5, 0, 0> } //finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_verm_transp = texture{ pigment { color rgbt <1, 0, 0, 0.5> } //finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_xadrez = texture{ pigment{ checker color rgb < 0.10, 0.32, 0.60 >, color rgb < 1.00, 0.97, 0.90 > } finish{ diffuse 0.9 ambient 0.1 } scale 2.0 } // ====================================================================== // DESCRIÇÃO DA CENA // Partes da cena: // Pernas #declare w_pe = 0.25; // referência para a largura do pé #macro pe() box { <+0.0, -w_pe, 0.0>, <+4*w_pe, +w_pe, +w_pe> texture { tx_verde_claro } } #end #macro pe_tornozelo(ang_pe) union { sphere { 0, w_pe texture { tx_verde_escuro } } object { pe() translate <0, 0, -w_pe> rotate <0, +ang_pe, 0> } } #end #macro canela(ang_pe) union { sphere { 0, w_pe texture { tx_verde_escuro } } cylinder { 0, <8*w_pe, 0.0, 0.0>, 0.7*w_pe texture { tx_verde_claro } } object { pe_tornozelo(ang_pe) translate <8*w_pe, 0.0, 0.0> } } #end #macro perna(ang_joelho, ang_pe) union { sphere { 0, w_pe texture { tx_verde_escuro } } cylinder { 0, <10*w_pe, 0.0, 0.0>, 0.7*w_pe texture { tx_verde_claro } } object { canela(ang_pe) rotate <0, ang_joelho, 0> translate <10*w_pe, 0.0, 0.0> } } #end #macro quadril(ang_femur_dir, ang_joelho_dir, ang_pe_dir, ang_femur_esq, ang_joelho_esq, ang_pe_esq) #local alt = 1.5; #local r = 1.0; union { cylinder { 0, <0, 0, alt>, r texture { tx_verm_transp } } // perna direita object { perna(ang_joelho_dir, ang_pe_dir) rotate <0, +90, +90> // para acertar rotate translate } // perna esquerda object { perna(ang_joelho_esq, ang_pe_esq) rotate <0, +90, +90> // para acertar rotate scale <-1,1,1> translate <-r, 0, 0> } } #end // Braços #declare w_garra = 0.75*w_pe; #macro garra() box { <+0.0, -w_garra, 0.0>, <+4*w_garra, +w_garra, +w_garra> texture { tx_verde_claro } } #end #macro mao(ang_g1, ang_g2) // {ang_g1} = Ângulo da garra 1 (< 0) // {ang_g2} = Ângulo da garra 2 (> 0) union { sphere { 0, w_pe texture { tx_verde_escuro } } object { garra() translate <0,0,0> rotate <0, ang_g1, 0> texture { tx_verde_escuro } } object { garra() translate <0,0,-w_garra> rotate <0, ang_g2, 0> texture { tx_verde_escuro } } } #end #macro antebraco(ang_mao, ang_g1, ang_g2) // {ang_mao} = Giro da mao em relação ao eixo do antebraço // {ang_g1} = Ângulo da garra 1 (< 0) // {ang_g2} = Ângulo da garra 2 (> 0) union { sphere { 0, w_pe texture { tx_verde_escuro } } cylinder { 0, <6*w_pe, 0.0, 0.0>, 0.7*w_pe texture { tx_verde_claro } } object { mao(ang_g1, ang_g2) rotate translate <6*w_pe, 0.0, 0.0> } } #end #macro braco(ang_cotovelo, ang_mao, ang_g1, ang_g2) union { sphere { 0, w_pe texture { tx_verde_escuro } } cylinder { 0, <6*w_pe, 0.0, 0.0>, 0.7*w_pe texture { tx_verde_claro } } object { antebraco(ang_mao, ang_g1, ang_g2) rotate <0, ang_cotovelo, 0> translate <6*w_pe, 0.0, 0.0> } } #end #macro ombro(ang_ombro_dir, ang_cotovelo_dir, ang_mao_dir, ang_g1_dir, ang_g2_dir, ang_ombro_esq, ang_cotovelo_esq, ang_mao_esq, ang_g1_esq, ang_g2_esq) #local alt = 1.5; #local r = 1.0; union { cylinder { 0, <0, 0, alt>, r texture { tx_verm_transp } } // braço direito object { braco(ang_cotovelo_dir, ang_mao_dir, ang_g1_dir, ang_g2_dir) // braco(ang_cotovelo, ang_mao, ang_g1, ang_g2) rotate <0, +90, +90> // para acertar rotate translate } // braço esquerdo object { braco(ang_cotovelo_esq, ang_mao_esq, ang_g1_esq, ang_g2_esq) // braco(ang_cotovelo, ang_mao, ang_g1, ang_g2) rotate <0, +90, +90> // para acertar rotate scale <-1,1,1> translate <-r, 0, alt> } } #end #macro cabeca() #local alt = 1.5; #local r_base = 0.25; #local r_topo = 4*r_base; union { cylinder { 0, <0, 0, 0.5>, r_base texture { tx_verde_escuro } } cone { <0, 0, 0.5>, r_base, <0, 0, 0.5+alt>, r_topo texture { tx_verde_claro } } } #end #macro robo(ang_ombro_dir, ang_cotovelo_dir, ang_mao_dir, ang_g1_dir, ang_g2_dir, ang_ombro_esq, ang_cotovelo_esq, ang_mao_esq, ang_g1_esq, ang_g2_esq, ang_femur_dir, ang_joelho_dir, ang_pe_dir, ang_femur_esq, ang_joelho_esq, ang_pe_esq) #local alt = 1.5; #local r = 1.0; union { object { cabeca() translate <0,0,2*alt> } object { ombro(ang_ombro_dir, ang_cotovelo_dir, ang_mao_dir, ang_g1_dir, ang_g2_dir, ang_ombro_esq, ang_cotovelo_esq, ang_mao_esq, ang_g1_esq, ang_g2_esq) translate <0,0,+alt> } object { quadril(ang_femur_dir, ang_joelho_dir, ang_pe_dir, ang_femur_esq, ang_joelho_esq, ang_pe_esq) } } #end #include "eixos.inc" // Aqui está a cena, finalmente: object { eixos(8.0) } object { robo(30,0,0,+15,-15, -30,0,0,+45,-45, // ombro -30,0,-90, 30,0,-90) // quadril translate <+5,0,0> } object { robo(45,0,0,+15,-15, -45,0,0,+45,-45, // ombro -45,0,-90, 45,0,-90) // quadril translate <0,0,0> } object { robo(75,0,0,+15,-15, -75,0,0,+45,-45, // ombro -75,0,-90, 75,0,-90) // quadril translate <-5,0,0> } /* robo(ang_ombro_dir, ang_cotovelo_dir, ang_mao_dir, ang_g1_dir, ang_g2_dir, ang_ombro_esq, ang_cotovelo_esq, ang_mao_esq, ang_g1_esq, ang_g2_esq, ang_femur_dir, ang_joelho_dir, ang_pe_dir, ang_femur_esq, ang_joelho_esq, ang_pe_esq) */ #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, 0.00 >; #declare raio_cena = 13.0; #declare dir_camera = < 7.00, 14.00, 4.00 >; #declare dist_camera = 4*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)