// Last edited on 2019-07-17 12:48:22 by stolfilocal // Processed by remove-cam-lights background{ color rgb < 0.75, 0.80, 0.85 > } #declare tx_plastico_branco = texture{ pigment{ color rgb < 1.0, 1.0, 1.0 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_plastico_preto = texture{ pigment{ color rgb < 0.0, 0.0, 0.0 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_plastico_vermelho = texture{ pigment{ color rgb < 0.90, 0.20, 0.10 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_plastico_azul = texture{ pigment{ color rgb < 0.1, 0.2, 0.9 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare bola_unit = sphere{ <0, 0, 0>, 0.1 texture{ tx_plastico_vermelho } } #macro interplin (p0, p1, t0, t1, tt) #local r = (tt - t0) / (t1 - t0); #local s = 1 - r; #local vv = s * p0 + r * p1; vv #end // end interplin #macro interp_matriz (P, N, M, t0, t1, tt, R, k0, k1) #for (j, 0, N - 1) #for (i, 0, M - 1) #declare R[j][i] = interplin(P[k0][j][i], P[k1][j][i], t0, t1, tt); #end // for i #end // for j #end // end interp_matriz #macro bezier (A, B, C, D, t0, t1, tt) #local AB = interplin(A, B, t0, t1, tt); #local BC = interplin(B, C, t0, t1, tt); #local CD = interplin(C, D, t0, t1, tt); #local ABC = interplin(AB, BC, t0, t1, tt); #local BCD = interplin(BC, CD, t0, t1, tt); #local ABCD = interplin(ABC, BCD, t0, t1, tt); ABCD #end // end bezier #macro suaviza(P, N, k) #local i = 0; #for (i, 0, N - 1) #local j = mod(i + 1, N); #local vv = (P[k][j][1] - P[k][i][2]) / 2; #declare P[k][i][2] = P[k][i][3] - vv; #declare P[k][j][1] = P[k][j][0] + vv; #end // for i #end // end suaviza #macro noh(P, Na, Ne) union { #for (j, 0, Na - 1) #for (i, 0, 1, 1 / Ne) object{ bola_unit translate bezier(P[j][0], P[j][1], P[j][2], P[j][3], 0, 1, i) } #end #end } #end // end no #macro busca_frame(CK, NK, TK) #local i = 0; #for(i, 0, NK) #if (CK <= TK[i]) #break #end #end #if (i = NK + 1) #local i = NK; #end i #end #macro P5(TEX) union { sphere{ <0, 0, 0.23>, 0.03 texture{ TEX } } cylinder{ <0, 0, 0.2>, <0, 0, 0>, 0.03 texture{ TEX } } } #end #macro P4(B5, TEX) union { sphere{ <0, 0, 0.23>, 0.03 texture{ TEX } } cylinder{ <0, 0, 0.2>, <0, 0, 0>, 0.03 texture{ TEX } } object{ P5(TEX) rotate translate <0, 0, 0.26> } } #end #macro P3(B4, B5, TEX) union { sphere{ <0, 0, 0.23>, 0.03 texture{ TEX } } cylinder{ <0, 0, 0.2>, <0, 0, 0>, 0.03 texture{ TEX } } object{ P4(B5, TEX) rotate translate <0, 0, 0.26> } } #end #macro P2(B3, B4, B5, TEX) union { sphere{ <0, 0, 0.23>, 0.03 texture{ TEX } } cylinder{ <0, 0, 0.2>, <0, 0, 0>, 0.03 texture{ TEX } } object{ P3(B4, B5, TEX) rotate translate <0, 0, 0.26> } } #end #macro P1(B2, B3, B4, B5, TEX) union { sphere{ <0, 0, 0.23>, 0.03 texture{ TEX } } cylinder{ <0, 0, 0.2>, <0, 0, 0>, 0.03 texture{ TEX } } object{ P2(B3, B4, B5, TEX) rotate translate <0, 0, 0.26> } } #end #macro Perna(B0, B1, B2, B3, B4, B5, TEX) union{ object { P1(B2, B3, B4, B5, TEX) scale<1, -1, 1> rotate } } #end #macro Get_Dragao(DRG, F, NF, NP, NL, TEX) union{ object{ sphere{<1, -0.75, 1.2>, 0.4 texture{ TEX } } } object{ sphere{<1, -0.4, 1.2>, 0.4 texture{ TEX } } } object{ sphere{<1, -0.05, 1.2>, 0.4 texture{ TEX } } } object{ sphere{<1, 0.30, 1.2>, 0.4 texture{ TEX } } } object{ sphere{<1, 0.75, 1.2>, 0.4 texture{ TEX } } } object{ Perna(DRG[F][0][0], DRG[F][0][1], DRG[F][0][2], DRG[F][0][3], DRG[F][0][4], DRG[F][0][5], TEX) translate <0.85, -0.3, 0> } // posição da perna object{ Perna(DRG[F][1][0], DRG[F][1][1], DRG[F][1][2], DRG[F][1][3], DRG[F][1][4], DRG[F][1][5], TEX) translate <0.85, 0.4, 0> } // posição da perna object{ Perna(DRG[F][2][0], DRG[F][2][1], DRG[F][2][2], DRG[F][2][3], DRG[F][2][4], DRG[F][2][5], TEX) translate <0.85, 0.95, 0> } // posição da perna object{ Perna(DRG[F][3][0], DRG[F][3][1], DRG[F][3][2], DRG[F][3][3], DRG[F][3][4], DRG[F][3][5], TEX) translate <1.15, -0.3, 0> } // posição da perna object{ Perna(DRG[F][4][0], DRG[F][4][1], DRG[F][4][2], DRG[F][4][3], DRG[F][4][4], DRG[F][4][5], TEX) translate <1.15, 0.4, 0> } // posição da perna object{ Perna(DRG[F][5][0], DRG[F][5][1], DRG[F][5][2], DRG[F][5][3], DRG[F][5][4], DRG[F][5][5], TEX) translate <1.15, 0.95, 0> } // posição da perna } // end union dragao #end #include "eixos.inc" #include "eixos.inc" #declare NFrames = 1; // número de frames(intermediários + inicial + final) #declare NPernas = 6; // número de pernas do dragão #declare NLivres = 6; // número de graus de liberdade por perna #declare DRG = array[NFrames][NPernas][NLivres]; #declare DRG[0][0][0] = 0; // rotaciona a perna inteira #declare DRG[0][0][1] = 90; #declare DRG[0][0][2] = 45; #declare DRG[0][0][3] = 30; #declare DRG[0][0][4] = 15; #declare DRG[0][0][5] = 10; #declare DRG[0][1][0] = 0; // rotaciona a perna inteira #declare DRG[0][1][1] = 90; #declare DRG[0][1][2] = 45; #declare DRG[0][1][3] = 30; #declare DRG[0][1][4] = 15; #declare DRG[0][1][5] = 10; #declare DRG[0][2][0] = 0; // rotaciona a perna inteira #declare DRG[0][2][1] = 90; #declare DRG[0][2][2] = 45; #declare DRG[0][2][3] = 30; #declare DRG[0][2][4] = 15; #declare DRG[0][2][5] = 10; #declare DRG[0][3][0] = 0; // rotaciona a perna inteira #declare DRG[0][3][1] = 90; #declare DRG[0][3][2] = 45; #declare DRG[0][3][3] = 30; #declare DRG[0][3][4] = 15; #declare DRG[0][3][5] = 10; #declare DRG[0][4][0] = 0; // rotaciona a perna inteira #declare DRG[0][4][1] = 90; #declare DRG[0][4][2] = 45; #declare DRG[0][4][3] = 30; #declare DRG[0][4][4] = 15; #declare DRG[0][4][5] = 10; #declare DRG[0][5][0] = 0; // rotaciona a perna inteira #declare DRG[0][5][1] = 90; #declare DRG[0][5][2] = 45; #declare DRG[0][5][3] = 30; #declare DRG[0][5][4] = 15; #declare DRG[0][5][5] = 10; // object{ eixos(1.0) } object{ Get_Dragao(DRG, 0, NFrames, NPernas, NLivres, tx_plastico_vermelho) rotate <0, 0, -45> } #include "camlight.inc" #declare centro_cena = < +0.71, -0.71, 0.71 >; #declare raio_cena = 2.5; #declare dir_camera = < 45, 30, 15 >; #declare dist_camera = 5*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)