// CORES E TEXTURAS #declare tx_fosca = texture{ pigment{ color rgb < 1, 1, 1 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_fosca2 = texture{ pigment{ color rgb < 1, 0, 1 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_fosca3 = texture{ pigment{ color rgb < 1, 1, 0 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_fosca4 = texture{ pigment{ color rgb < 1, 0, 0 > } finish{ diffuse 0.9 ambient 0.1 } } // ====================================================================== // DESCRIÇÃO DA CENA #declare N = 4; #declare P = array[N][4]; #declare NK = 4; #declare NA = 4; #declare P = array[NK][NA][4] #declare tk = array[NK] //mat 1 #declare P[0][0][0] = <0, 0, 0>; #declare P[0][0][1] = <0, 1, 1.1>; #declare P[0][0][2] = <0, -2, 0.5>; #declare P[0][0][3] = <0, 0, 3>; #declare P[0][1][0] = <0, 0, 3>; #declare P[0][1][1] = <0, 1, -1>; #declare P[0][1][2] = <0,3, 0>; #declare P[0][1][3] = <0, 3.1, 2>; #declare P[0][2][0] = <0, 3.1, 2>; #declare P[0][2][1] = <0, 3, 1>; #declare P[0][2][2] = <0, 1, 0.5>; #declare P[0][2][3] = <0, 2, 0>; #declare P[0][3][0] = <0, 2, 0>; #declare P[0][3][1] = <0, -2, 0>; #declare P[0][3][2] = <0, -1,2>; #declare P[0][3][3] = <0, 0,0>; //mat 2 #declare P[1][0][0] = <0, 3,-1>; #declare P[1][0][1] = <0, 0,0>; #declare P[1][0][2] = <0, 1,0.5>; #declare P[1][0][3] = <0,-2,1>; #declare P[1][1][0] = <0,-2,1>; #declare P[1][1][1] = <0, 1,4>; #declare P[1][1][2] = <0,-1,0>; #declare P[1][1][3] = <0, 4,4>; #declare P[1][2][0] = <0, 4,4>; #declare P[1][2][1] = <0, 3, 1>; #declare P[1][2][2] = <0, 1, 0.5>; #declare P[1][2][3] = <0, 2,-1>; #declare P[1][3][0] = <0, 2, -1>; #declare P[1][3][1] = <0, -1, 0>; #declare P[1][3][2] = <0, 0, -1>; #declare P[1][3][3] = <0, 3,-1>; //mat 3 #declare P[2][2][0] = <0,-3,-3>; #declare P[2][2][1] = <0, 0,0>; #declare P[2][2][2] = <0, -1, 1>; #declare P[2][2][3] = <0, 1,1>; #declare P[2][3][0] = <0, 1,1>; #declare P[2][3][1] = <0, -1, 0>; #declare P[2][3][2] = <0, 0, 3>; #declare P[2][3][3] = <0, -2,4>; #declare P[2][0][0] = <0, -2,4>; #declare P[2][0][1] = <0, 0,-3>; #declare P[2][0][2] = <0, -1,1>; #declare P[2][0][3] = <0,5.5,-5.5>; #declare P[2][1][0] = <0,5.5,-5.5>; #declare P[2][1][1] = <0, 4.5,4>; #declare P[2][1][2] = <0,-1,0>; #declare P[2][1][3] = <0,-3,-3>; //mat 4 #declare P[3][1][0] = <0,3,3>; #declare P[3][1][1] = <0, 0,3>; #declare P[3][1][2] = <0,-2,3>; #declare P[3][0][0] = <0, -3,3>; #declare P[3][3][3] = <0, -3,3>; #declare P[3][3][1] = <0, 0, 0>; #declare P[3][3][2] = <0, -1, -1>; #declare P[3][3][0] = <0, 2, -1>; #declare P[3][2][3] = <0, 2,-1>; #declare P[3][2][1] = <0, 3, 1>; #declare P[3][2][2] = <0, 1, 0.5>; #declare P[3][2][0] = <0, 4,4>; #declare P[3][1][3] = <0, 4,4>; #declare P[3][0][1] = <0, 0,0>; #declare P[3][0][2] = <0, 1,0.5>; #declare P[3][0][3] = <0,3,3>; #macro interpol(t0, v0, t1, v1, tt) #local r = (tt - t0) / (t1 - t0); #local s = 1 - r; #local vv = s * v0 + r * v1; #local returnX = s * v0.x + r * v1.x; #local returnY = s * v0.y + r * v1.y; #local returnZ = s * v0.z + r * v1.z; #end #macro arcoBezier(t0, t1, A, B, C, D, tt) #local AB = interpol(t0, A, t1, B, tt); #local BC = interpol(t0, B, t1, C, tt); #local CD = interpol(t0, C, t1, D, tt); #local ABC = interpol(t0, AB, t1, BC, tt); #local BCD = interpol(t0, BC, t1, CD, tt); #local ABCD = interpol(t0, ABC, t1, BCD, tt); ABCD #end // Partes da cena: #include "eixos.inc" //t0 - tempo 0 //t1 - tempo 1 //v0 - vetor 0 //v1 - vetor 1 //tt - tempo t #macro matrizinterpola(P, k0,k1, N, c0, c1, cc, R) #for(i, 0, N - 1, 1) #for(j, 0, 4 - 1, 1) #local R[i][j] = interpol(c0, P[k0][i][j], c1, P[k1][i][j], cc); #end #end #end #macro noh(L,N,M, textura) union{ #local bolinha = sphere{ < 0.00, 0.00, 0.00 >,0.1 texture{ textura } } #for (j, 0, N-1, 1) #for(i, 0, 1, 0.001) #local A = L[j][0]; #local B = L[j][1]; #local C = L[j][2]; #local D = L[j][3]; object {bolinha translate arcoBezier(0,1,A,B,C,D,i) texture{textura}} #end #end } #end union{ #declare R = array[N][4]; #for(m,0,N-1,1) #for(n,0,3,1) #declare R[m][n] = <0,0,0>; #end #end //#for (cc,0,1,0.2) #if(clock < 0.2) matrizinterpola(P,0,1,N,0,0.2,clock,R) object{noh(R,N,100,tx_fosca)} #else #if(clock < 0.4) matrizinterpola(P,1,2,N,0.2,0.4,clock,R) object{noh(R,N,100,tx_fosca2)} #else #if(clock < 0.6) matrizinterpola(P,2,3,N,0.4,0.6,clock,R) object{noh(R,N,100,tx_fosca3)} #else matrizinterpola(P,3,0,N,0.6,1,clock,R) object{noh(R,N,100,tx_fosca4)} #end #end #end } #include "camlight.inc" #declare centro_cena = < 1,1,2>; #declare raio_cena = 3; #declare dir_camera = < 4,1,3 >; #declare dist_camera = 5*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)