// ====================================================================== // CORES E TEXTURAS background{ color rgb < 0.75, 0.80, 0.85 > } #declare tx_plastico = texture{ pigment{ color rgb < 0.30, 0.70, 0.70 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_fosca = texture{ pigment{ color rgb < 0.30, 0.30, 0.60 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_pedra = texture{ pigment { color rgb <0.4, 0.2, 0> } finish { diffuse 0.9 ambient 0.1 } } #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 12.0 } // ====================================================================== // DESCRIÇÃO DA CENA #declare pe = union { sphere {<0,0,0>, 0.15} box {<0,-0.1,-0.1>, <0.5,0.1,0.1>} } #macro perna1(a0) union { sphere {<0,0,0>, 0.2} box {<0,-0.1, -0.1>, <1,0.1,0.1>} object {pe rotate <0, 90-a0> translate <1,0,0>} } #end #macro perna2(a1, b1, a0) union { sphere {<0,0,0>, 0.2} box {<0, -0.1, -0.1>, <2,0.1,0.1>} object { perna1(a0) rotate <0, a1, b1> translate <2,0,0>} } #end #macro perna3(a2, a1, b1, a0) union { sphere {<0,0,0>, 0.2} box {<0, -0.1, -0.1>, <2,0.1,0.1>} object { perna2(a1, b1, a0) rotate <0, a2, 0> translate <2,0,0>} } #end #macro perna4(a3, b3, a2, a1, b1, a0) union { sphere {<0,0,0>, 0.3} box {<-0.2,0,-0.2>, <0.2,1.5,0.2>} object { perna3(a2, a1, b1, a0) rotate <0, a3+90, b3> translate <0,1.5,0>} } #end #macro dragao(AP) union { cone {<0,0,0>, 1, <0,-6,0>, 0.2} box {<-1,0,-1>, <1,9,1>} sphere {<0,9,2>, 1.5} cone {<0,10.5,2>, 0.5, <0,14,2>, 0} #local i = 0; #while (i < 6) #local pos = <1.5, 1+3*div(i, 2), 0>; object { perna4(AP[i][3], AP[i][4], AP[i][5], AP[i][6], AP[i][7], AP[i][8]) rotate translate pos scale <1-2*mod(i, 2),1,1> } #local i = i + 1; #end } #end #macro busca_tempo(clk, NQ, tK) #local i = 0; #local tp = 0; #while (i < NQ-1) #if (clk < tK[i+1] & clk >= tK[i]) #local tp = i; #end #local i = i + 1; #end tp #end #macro interpolalin(t0, v0, t1, v1, tt) #local r = (tt-t0)/(t1-t0); (1-r)*v0+r*v1 #end #macro bezier(t0, t1, A, B, C, D, tt) #local AB = interpolalin(t0, A, t1, B, tt); #local BC = interpolalin(t0, B, t1, C, tt); #local CD = interpolalin(t0, C, t1, D, tt); #local ABC = interpolalin(t0, AB, t1, BC, tt); #local BCD = interpolalin(t0, BC, t1, CD, tt); #local ABCD = interpolalin(t0, ABC, t1, BCD, tt); ABCD #end #macro interpola_quadros(NP, NA, Q, k0, t0, k1, t1, tt, A) #local i = 0; #while (i < NP) #local j = 0; #while (j < NA) #declare A[i][j] = interpolalin( t0, Q[k0][i][j], t1, Q[k1][i][j], tt ); #local j = j+1; #end #local i = i+1; #end #end #macro quadro(clk) #local qd = busca_tempo(clk, NQ, tK); #local qd_n = qd+1; #local Aq = array[NP][NA]; interpola_quadros(NP, NA, Q, qd, tK[qd], qd_n, tK[qd_n], clk, Aq) object {dragao(Aq) texture {tx_fosca}} #end #declare NP = 6; #declare NA = 9; #declare NQ = 6; #declare tK = array[6] {0.0,0.2,0.4,0.6,0.8,1.0}; #declare Q = array[NQ][NP][NA]; #declare iq = 0; #while (iq < NP) #declare jq = 0; #while (jq < NA) #declare q = 0; #while (q < NQ) #declare Q[q][iq][jq] = 0; #declare q = q + 1; #end #declare jq = jq + 1; #end #declare iq = iq + 1; #end #declare Q[1][0][0] = -15; #declare Q[1][0][8] = -10; #declare Q[1][1][0] = -15; #declare Q[1][1][8] = -10; #declare Q[1][2][1] = +15; #declare Q[1][3][1] = +15; #declare Q[1][4][2] = +10; #declare Q[1][4][3] = -10; #declare Q[1][5][2] = +10; #declare Q[1][5][3] = -10; #declare Q[2][0][1] = +20; #declare Q[2][0][2] = -30; #declare Q[2][0][3] = -20; #declare Q[2][1][1] = +20; #declare Q[2][1][2] = -30; #declare Q[2][1][3] = -20; #declare Q[2][2][4] = -10; #declare Q[2][3][4] = -10; #declare Q[2][4][2] = -20; #declare Q[2][5][2] = -20; #declare p = 0; #while (p < NP) #declare Q[2][p][1] = -15*div(p, 2); #declare Q[2][p][8] = -110+20*div(p, 2); #declare Q[3][p][0] = -10; #declare Q[3][p][1] = -5; #declare Q[3][p][2] = -10; #declare Q[3][p][3] = -20+5*div(p, 2); #declare Q[3][p][5] = -5+5*div(p, 2); #declare Q[4][p][1] = -5; #declare Q[4][p][4] = +5; #declare Q[4][p][8] = 90-20*div(p, 2); #declare p = p+1; #end object { quadro(clock) } #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, 0.00 >; #declare raio_cena = 20; #declare dir_camera = < 14, 7.00, 6.00 >; #declare dist_camera = 5 * raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)