// ====================================================================== // CORES E TEXTURAS background{ color rgb < 0.5, 0.5, 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,0,0 >, color rgb < 1,1,1 > } finish{ diffuse 0.9 ambient 0.1 } scale 2.0 } // ====================================================================== // DESCRICAO DA CENA #declare plength = array[5]; #declare plength[0] = 1; #declare plength[1] = 3; #declare plength[2] = 3; #declare plength[3] = 3; #declare plength[4] = 3; #declare corpo = cylinder { <0, -4, 0>, <0, 4, 0>, 2 } #declare cabeca = union { sphere { <0, 0, 0>, 1 } cone { <0, 0, 0>, 0.2, <0, 6, 0>, 0 } } #macro perna1seg(a1) cylinder { <0, 0, 0>, , 0.1 rotate <0, a1, 0> } #end #macro perna2seg(a1, a2) union { object {perna1seg(a1) translate } cylinder{ <0, 0, 0>, , 0.1 } rotate <0, a2, 0> } #end #macro perna3seg(a1, a2, a3) union { object {perna2seg(a1, a2) translate } cylinder{ <0, 0, 0>, , 0.1 } rotate <0, a3, 0> } #end #macro perna4seg(a1, a2, a3, a4) union { object {perna3seg(a1, a2, a3) translate } cylinder{ <0, 0, 0>, 0.1 } rotate <0, a4, 0> } #end #macro perna5seg(a1, a2, a3, a4, a5) union { object {perna4seg(a1, a2, a3, a4) translate } cylinder{ <0, 0, 0>, 0.1 } rotate <0, a5, 0> } #end #macro perna(a1, a2, a3, a4, a5) object { perna5seg(a5, a4, a3, a2, a1) translate <2, 0, 0> } #end #macro dragao(A) union { object {corpo} object {cabeca translate <0, 5, 1>} object {perna(A[0][0], A[0][1], A[0][2], A[0][3], A[0][4]) translate <0, 0, 0>} object {perna(A[1][0], A[1][1], A[1][2], A[1][3], A[1][4]) translate <0, 2, 0>} object {perna(A[2][0], A[2][1], A[2][2], A[2][3], A[2][4]) translate <0, -2, 0>} object {perna(A[3][0], A[3][1], A[3][2], A[3][3], A[3][4]) translate <0, 0, 0> scale <-1, 1, 1>} object {perna(A[4][0], A[4][1], A[4][2], A[4][3], A[4][4]) translate <0, 2, 0> scale <-1, 1, 1>} object {perna(A[0][0], A[0][1], A[0][2], A[0][3], A[0][4]) translate <0, -2, 0> scale <-1, 1, 1>} texture { tx_fosca } rotate <30, 0, -50> } #end #macro interpolin(t0, v0, t1, v1, tt) #local r = (tt-t0)/(t1-t0); #local s = 1-r; #local vv = s*v0 + r*v1; vv #end #declare Q = array[6]; #declare i = 0; #while (i < 6) #declare Q[i] = array[6]; #declare j = 0; #while (j < 6) #declare Q[i][j] = array[5]; #declare j = j + 1; #end #declare i = i + 1; #end #declare i = 0; #while (i < 6) #declare Q[0][i][0] = -60; #declare Q[0][i][1] = 90; #declare Q[0][i][2] = 90; #declare Q[0][i][3] = -90; #declare Q[0][i][4] = -45; #declare i = i + 1; #end #declare i = 0; #while (i < 6) #declare Q[1][i][0] = -20; #declare Q[1][i][1] = 67; #declare Q[1][i][2] = 67; #declare Q[1][i][3] = -73; #declare Q[1][i][4] = -35; #declare i = i + 1; #end #declare i = 0; #while (i < 6) #declare Q[2][i][0] = 20; #declare Q[2][i][1] = 44; #declare Q[2][i][2] = 44; #declare Q[2][i][3] = -58; #declare Q[2][i][4] = -25; #declare i = i + 1; #end #declare i = 0; #while (i < 6) #declare Q[3][i][0] = 60; #declare Q[3][i][1] = 21; #declare Q[3][i][2] = 21; #declare Q[3][i][3] = -41; #declare Q[3][i][4] = -15; #declare i = i + 1; #end #declare i = 0; #while (i < 6) #declare Q[4][i][0] = 20; #declare Q[4][i][1] = 44; #declare Q[4][i][2] = 44; #declare Q[4][i][3] = -58; #declare Q[4][i][4] = -25; #declare i = i + 1; #end #declare i = 0; #while (i < 6) #declare Q[5][i][0] = -20; #declare Q[5][i][1] = 67; #declare Q[5][i][2] = 67; #declare Q[5][i][3] = -73; #declare Q[5][i][4] = -35; #declare i = i + 1; #end #declare tk = array[6]; #declare tk[0] = (1/6) * 0; #declare tk[1] = (1/6) * 1; #declare tk[2] = (1/6) * 2; #declare tk[3] = (1/6) * 3; #declare tk[4] = (1/6) * 4; #declare tk[5] = (1/6) * 5; #declare A = array[6]; #declare A[0] = array[5]; #declare A[1] = array[5]; #declare A[2] = array[5]; #declare A[3] = array[5]; #declare A[4] = array[5]; #declare A[5] = array[5]; #macro interpola_quadros(NP, NA, Qu, k0, t0, k1, t1, tt, Au) #declare quadro_inicial = Qu[k0]; #declare quadro_final = Qu[k1]; #declare i = 0; #while (i < NP) #declare j = 0; #while (j < NA) #declare a0 = quadro_inicial[i][j]; #declare a1 = quadro_final[i][j]; #declare Au[i][j] = interpolin(t0, a0, t1, a1, tt); #declare j = j + 1; #end #declare i = i + 1; #end #end #macro busca_clock(clk, NQ, tk) #declare i = 0; #declare ret = NQ-1; #while (i < NQ) #if (clk < tk[i]) #declare ret = i-1; #declare i = NQ; #end #declare i = i + 1; #end ret #end #macro quadro(clk) #declare qu = busca_clock(clk, 6, tk); #declare qa = qu+1; #if(qa >= 6) interpola_quadros(6, 5, Q, qu, tk[qu], 0, 1, clk, A) #else interpola_quadros(6, 5, Q, qu, tk[qu], qa, tk[qa], clk, A) #end object{ dragao(A) scale <0.5, 0.5, 0.5> } #end quadro(clock) #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, 0.00 >; #declare raio_cena = 15.0; #declare dir_camera = < 7.00, 7.00, 7.00 >; #declare dist_camera = 5*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)