// Exemplo de arquivo de descricao de cena para POV-ray // Last edited on 2010-03-04 15:44:01 by stolfi // ====================================================================== // CORES E TEXTURAS #include "textures.inc" 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_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 tx_marrom = texture{ pigment{ color rgb < 0.92, 0.51, 0.23 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_marrom_claro = texture{ pigment{ color rgb < 1.02, 0.71, 0.23 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_verde = //35,142,35 texture{ pigment{ color rgb < 0.35, 1.42, 0.35 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_verde_escuro = //47,79,47 texture{ pigment{ color rgb < 0.47,0.79, 0.47 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } // ====================================================================== // DESCRIÇÃO DA CENA #declare raio = 2.000; #declare raioPequeno = 1.000; // Partes da cena: #declare orelha = cone{ <0, 0, 0>, 0.15 <0, 0, 0.5>, 0 } #declare cabeca = sphere{ <0, 0, 0>, 1 } #declare tronco = cone{ <0, 0, 0>, 1.7 <0, 0, 5>, 0.3 } #declare articulacao = sphere{ <0, 0, 0>, 0.25 } #declare membro = cylinder{ <0, 0, 0>, <0, 0, 1>, 0.20 } #declare rabo = cone{ <0, 0, 0>, 0.3 <0, 0, 2.5>, 0.1 } #declare chao = box{ <-20,-20,-1>, <+20,+20,0> } #include "eixos.inc" // Aqui está a cena, finalmente: //90,0,90,0,-70,-45,110,-70,-45,110 #macro corpo(A,B,C,D,E,F,G,H,I,J) union { object{ orelha translate < -0.5,0,5.8 > texture{ tx_marrom } } object{ orelha translate < 0.5,0,5.8 > texture{ tx_marrom } } object{ cabeca translate < 0,0,5 > texture{ tx_marrom } } object{ tronco texture{ tx_marrom } } object{ braco(A) rotate B *z translate < 0.80,0,3.5 > texture{ tx_marrom } } object{ braco(C) rotate D *z rotate 180 *y translate < -0.80,0,3.5 > texture{ tx_marrom } } object{ rabo rotate 45 *x translate < 0,-1,1.5 > texture{ tx_marrom } } object{ perna(F-(E+90),G) scale <2,2,2> rotate E *x translate <-1,0,0> texture{ tx_marrom } } object{ perna(I-(H+90),J) scale <2,2,2> rotate H *x translate <1,0,0> texture{ tx_marrom } } } scale <0.5,0.5,0.5> translate < 0,0,3 > #end #macro mao() union { object{ articulacao texture{ tx_marrom_claro } } object{ membro scale <1,1,0.5> rotate 90 *y translate < 0.25,0,0 > texture{ tx_marrom } } } #end #macro antebraco() union { object{ articulacao texture{ tx_marrom_claro } } object{ membro scale <1,1,1> rotate 90 *y translate < 0.25,0,0 > texture{ tx_marrom } } } #end #macro coxa() union { object{ articulacao texture{ tx_marrom_claro } } object{ membro scale <1,1,1.5> rotate -90 *x translate < 0,0.25,0> texture{ tx_marrom } } } #end #macro canela() union { object{ articulacao texture{ tx_marrom_claro } } object{ membro scale <1,1,1> rotate -90 *x translate < 0,0.25,0 > texture{ tx_marrom } } } #end #macro pe() union { object{ articulacao texture{ tx_marrom_claro } } object{ membro scale <0.8,0.8,0.8> rotate -90 *x translate < 0,0.25,0 > texture{ tx_marrom } } } #end #macro braco(A) union { object{ antebraco() translate < -(0.25+1),0,0 > } object{ mao() rotate A *y } } translate < (0.25+1),0,0 > #end #macro perna(A,B) union { object{ coxa() translate < 0,-(0.25+1.5),0 > } object{ subperna(B) rotate A *x } } translate < 0,(0.25+1.5),0 > #end #macro subperna(B) union { object{ canela() translate < 0,-(1.25),0 > } object{ pe() rotate B *x translate < 0,0,0 > } } translate < 0,1.25,0 > #end #declare NQ = 7; //num quadros //A,C #declare argA = array[NQ]; #declare argA[0] = -90; #declare argA[1] = -30; #declare argA[2] = +30; #declare argA[3] = +90; #declare argA[4] = +30; #declare argA[5] = -30; #declare argA[6] = -90; //E,H #declare argE = array[NQ]; #declare argE[0] = -90; #declare argE[1] = -60; #declare argE[2] = -30; #declare argE[3] = +00; #declare argE[4] = -30; #declare argE[5] = -60; #declare argE[6] = -90; //B, D, F, I #declare argB = array[NQ]; #declare argB[0] = 0; #declare argB[1] = 0; #declare argB[2] = 0; #declare argB[3] = 0; #declare argB[4] = 0; #declare argB[5] = 0; #declare argB[6] = 0; //G, J #declare argG = array[NQ]; #declare argG[0] = 90; #declare argG[1] = 90; #declare argG[2] = 90; #declare argG[3] = 90; #declare argG[4] = 90; #declare argG[5] = 90; #declare argG[6] = 90; #declare tempo = array[NQ]; #declare tempo[0] = 0.0; #declare tempo[1] = 0.16; //16 #declare tempo[2] = 0.33; //17 #declare tempo[3] = 0.49; //16 #declare tempo[4] = 0.66; //17 #declare tempo[4] = 0.83; //17 #declare tempo[6] = 1.0; //17 #macro interpola(f0,v0,f1,v1,f) #local ss = (f-f0)/(f1-f0); #local rr = 1 - ss; (rr * v0 + ss * v1) #end #macro danca(clk) union { #local fase = 1; #while (clk <= tempo[fase]) #local fase = fase + 1; #end #local valorA = interpola(tempo[fase-1],argA[fase-1],tempo[fase],argA[fase],clk); #local valorB = interpola(tempo[fase-1],argB[fase-1],tempo[fase],argB[fase],clk); #local valorE = interpola(tempo[fase-1],argE[fase-1],tempo[fase],argE[fase],clk); #local valorG = interpola(tempo[fase-1],argG[fase-1],tempo[fase],argG[fase],clk); object{ corpo(valorA,valorB,valorA,valorB,valorE,valorB,valorG,valorE,valorB,valorG) translate < 0,0,0 > } } #end //object{ danca(1) translate < 0,0,0 > } //1 //object{ corpo(-90,0,-90,0,-90,0,90,-90,0,90) translate < 0,0,0 > } //2 //object{ corpo(-30,0,-30,0,-30,0,90,-30,0,90) translate < 0,0,0 > } //3 //object{ corpo(30,0,30,0,30,0,90,30,0,90) translate < 0,0,0 > } //object{ corpo(-45,30,45,30,-70,-45,110,-70,-45,110) translate < 0,0,0 > } //7 //object{ corpo(90,0,90,0,-90,0,0,-90,0,0) translate < 0,0,0 > } //object{ subperna(90) } object{ eixos(3.00) } object{ chao translate < 0,0,-5 > texture{ tx_verde_escuro } } #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, 2.00 >; #declare raio_cena = 15.0; #declare dir_camera = < -2.00, 4.00, 3.00 >; #declare dist_camera = 7.0; #declare intens_luz = 1.00; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)