// CORES E TEXTURAS #include "eixos.inc" background{ color rgb < 0.75, 0.80, 0.85 > } #declare random = seed (1153); #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 < 0, 0.80, 0> } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_verde = texture{ pigment{ color rgb < 0, 0.80, 0> } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_azul = texture{ pigment{ color rgb < 0, 0, 1> } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_laranja = texture{ pigment{ color rgb < 0.9, 0.5, 0.2> } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_marrom = texture{ pigment{ color rgb < 0.6, 0.3, 0> } 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_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 } #declare roleta = seed(1); #declare chao = box{ <-20,-20,-2>, <+20,+20,-3> texture{tx_xadrez}} #declare cilindro_corpo = cylinder{ < 0.00, 0.00, 0.00>, < 0.00, 0.00, 8.00>, 1.5 texture{ tx_azul } } #declare cilindro_braco = cylinder{ <0.00, 0.00, 0.00>, <3.5, 0.00, 0.00>, 0.5 texture {tx_laranja} } #declare articulacao = sphere{ <0,0,0> 0.5 texture {tx_azul} } #declare cilindro_ante_braco = cylinder{ <0.00, 0.00, 0.00>, <3, 0.00, 0.00>, 0.5 texture {tx_laranja} } #declare esfera_mao = sphere{ <0,0,0> 0.75 texture {tx_azul} } #declare cone_garra = cone{ <0,0,0>, 0.3 <1.5,0,0>, 0 texture {tx_laranja} } #declare cilindro_perna = cylinder{ <0,0,0>, <0,0,-3.5>, 0.5 texture {tx_laranja} } #declare cilindro_pe = cylinder{ <0,0,0>, <0,0,-2>, 0.3 texture {tx_azul} } #declare cilindro_pescoco = cylinder{ <0,0,0>, <0,0,1>, 0.3 texture {tx_laranja} } #declare esfera_cabeca = sphere{ <0,0,0>, 1 texture {tx_laranja} } #declare cone_nariz = cone{ <0,0,0>, 0.2, <0,0.5,0>, 0 texture {tx_azul} } #macro antebraco(rotMao, rotGarra) union{ object {articulacao} object {cilindro_ante_braco translate <0.5,0,0>} object {mao(rotGarra) rotate rotMao translate <4,0,0>} } #end #macro braco(rotAntebraco, rotMao, rotGarra) union { object {cilindro_braco} object {antebraco(rotMao, rotGarra) rotate rotAntebraco translate <4,0,0>} } #end #macro mao(rotGarra) union{ object {articulacao} object {esfera_mao translate <1,0,0>} object {cone_garra translate <1.5,0,0>} object {cone_garra rotate<0,-rotGarra,0> translate <1.5,0,0.25>} } #end #macro perna(rotPe) union{ object {articulacao} object {cilindro_perna translate <0,0,-0.5>} object {pe() rotate translate<0,0,-4.5>} } #end #macro pe() union{ object {articulacao} object {cilindro_pe translate <0,0,-0.5>} } #end #macro cabeca() union{ object{cilindro_pescoco} object{esfera_cabeca translate<0,0,2>} object{cone_nariz translate<0,1,2>} } #end #macro robo(rotAntebracoD, rotAntebracoE, rotMaoD, rotMaoE, rotGarraD, rotGarraE, rotPernaD, rotPernaE, rotPeD, rotPeE, rotCabeca) union{ object{cilindro_corpo} object{braco(rotAntebracoD, rotMaoD, rotGarraD) translate<1.5,0,5>} object{braco(rotAntebracoE, rotMaoE, rotGarraE) rotate <0,180,0> translate<-1.5,0,5>} object{perna(rotPeD) rotate rotPernaD translate<0.75,0, -0.25>} object{perna(rotPeE) rotate rotPernaE translate<-0.75,0, -0.25>} object{cabeca() rotate <0,0,rotCabeca> translate<0,0,8>} } #end #macro robo_mov(tt) #local PA = array[18]; #local PA[0] = 0; #local PA[1] = 90; #local PA[2] = 0; #local PA[3] = 0; #local PA[4] = 90; #local PA[5] = 0; #local PA[6] = 0; #local PA[7] = 0; #local PA[8] = 0; #local PA[9] = 0; #local PA[10] = 0; #local PA[11] = 0; #local PA[12] = 60; #local PA[13] = 0; #local PA[14] = 0; #local PA[15] = -60; #local PA[16] = 0; #local PA[17] = 0; #local PB = array[18]; #local PB[0] = 0; #local PB[1] = 0; #local PB[2] = 90; #local PB[3] = 0; #local PB[4] = 0; #local PB[5] = 90; #local PB[6] = 0; #local PB[7] = 0; #local PB[8] = 0; #local PB[9] = 0; #local PB[10] = 0; #local PB[11] = 0; #local PB[12] = 0; #local PB[13] = 0; #local PB[14] = 0; #local PB[15] = 0; #local PB[16] = 0; #local PB[17] = 0; #local PC = array[18]; #local PC[0] = 0; #local PC[1] = 270; #local PC[2] = 0; #local PC[3] = 0; #local PC[4] = 270; #local PC[5] = 0; #local PC[6] = 0; #local PC[7] = 0; #local PC[8] = 0; #local PC[9] = 0; #local PC[10] = 0; #local PC[11] = 0; #local PC[12] = -60; #local PC[13] = 0; #local PC[14] = 0; #local PC[15] = 60; #local PC[16] = 0; #local PC[17] = 0; #local PD = array[18]; #local PD[0] = 0; #local PD[1] = 0; #local PD[2] = -90; #local PD[3] = 0; #local PD[4] = 0; #local PD[5] = -90; #local PD[6] = 0; #local PD[7] = 0; #local PD[8] = 0; #local PD[9] = 0; #local PD[10] = 0; #local PD[11] = 0; #local PD[12] = 0; #local PD[13] = 0; #local PD[14] = 0; #local PD[15] = 0; #local PD[16] = 0; #local PD[17] = 0; #local PT = array[18]; #local N = 18; #local ii = 0; #while(ii < N) #if(tt >= 0 & tt < 0.33) #local PT[ii] = interpola1(tt, 0, 0.33, PA[ii], PB[ii]); #end #if(tt > 0.33 & tt < 0.66) #local PT[ii] = interpola1(tt, 0.33, 0.66, PB[ii], PC[ii]); #end #if(tt > 0.66 & tt <= 1) #local PT[ii] = interpola1(tt, 0.66, 1, PC[ii], PD[ii]); #end #local ii = ii + 1; #end union{ object {robo_vet(PT)} } #end #macro robo_vet(PA) union{ object{robo(, , , , 0, 0, , , 0, 0, 0)} } #end #macro interpola1(tt, tt0,tt1, vv0,vv1) #local rr = (tt - tt0)/(tt1 - tt0); #local vv = (1-rr)*vv0 + rr*vv1; vv #end #macro movimento(N) union{ #local ii = 0; #while(ii < N) object{robo_mov(0.05 * ii) translate } #local ii = ii + 1; #end } #end /*object{robo(<0,90,0>, <0,90,0>, <0,0,0>, <0,0,0>, 0, 0, <60,0,0>, <-60,0,0>, 0 , 0, 0) translate<0, 0, 0>} object{robo(<0,0,90>, <0,0,90>, <0,0,0>, <0,0,0>, 0, 0, <0,0,0>, <0,0,0>, 0 , 0, 0) translate<20, 0, 0>} object{robo(<0,270,0>, <0,270,0>, <0,0,0>, <0,0,0>, 0, 0, <-60,0,0>, <60,0,0>, 0 , 0, 0) translate<40, 0, 0>} object{robo(<0,0,-90>, <0,0,-90>, <0,0,0>, <0,0,0>, 0, 0, <0,0,0>, <0,0,0>, 0 , 0, 0) translate<60, 0, 0>} */ object{movimento(20)} #include "camlight.inc" #declare centro_cena = <40, 0, -10>; #declare raio_cena = 80.0; #declare dir_camera = <1, 4, 2>; #declare dist_camera = 5*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)