// Last edited on 2019-07-17 13:09:10 by stolfilocal // Processed by remove-cam-lights background{ color rgb < 0.75, 0.80, 0.85 > } #local 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 } } #local tx_fosca = texture{ pigment{ color rgb < 1.00, 0.80, 0.10 > } finish{ diffuse 0.9 ambient 0.1 } } #local tx_fosca_2 = texture{ pigment{ color rgb < 0.40, 0.40, 0.40 > } finish{ diffuse 0.9 ambient 0.1 } } #local tx_fosca_3 = texture{ pigment{ color rgb < 1.00, 1.00, 0.00 > } finish{ diffuse 0.9 ambient 0.1 } } #local tx_fosca_black = texture{ pigment{ color rgb < 0.30, 0.35, 0.30 > } finish{ diffuse 0.9 ambient 0.1 } } #local tx_coke = texture{ pigment{ color rgb < 1, 0, 0 > } finish{ diffuse 0.2 reflection 0.7*< 1.00, 0.85, 0.30 > ambient 0.1 } } #local tx_coke_2 = texture{ pigment{ color rgb < 0.9, 0.00, 0.00 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #local tx_fosca_4 = texture{ pigment{ color rgb < 0.5, 0.9, 0.5 > } finish{ diffuse 0.9 ambient 0.1 } } #local 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 } } #local 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 } } #local 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 } #local tx_xadrez_2 = texture{ pigment{ checker color rgb < 0.00, 0.02, 0.00 >, color rgb < 1.00, 0.97, 0.90 > } finish{ diffuse 0.9 ambient 0.1 } scale 1 } #include "eixos.inc" #macro interpolNumber(t0, v0, t1, v1, tt) #local r = (tt - t0) / (t1 - t0); #local s = 1 - r; #local vv = s * v0 + r * v1; vv #end #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 bezierArc(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 #macro suavizar(P, N, i) #local j = mod(i+1, N); #local vv = (P[j][1] - P[i][2])/2; #local P[i][2] = P[i][3] - vv; #local P[j][1] = P[j][0] + vv; #end #macro createStrangeFigure(sphereRadius) #local cursor = sphere{ < 0.00, 0.00, 0.00 >, sphereRadius texture{ tx_coke_2 } } union { #for(i, 0, 1, 0.01) #local A = <0, 0, 0>; #local B = <0, 1, 2>; #local C = <0, 2, -2>; #local D = <0, 3, 1>; object { cursor translate bezierArc(0, 1, A, B, C, D, i) } #end } #end #macro interpol1Matrix(P, Q, N, c0, c1, cc, R) #for(i, 0, N - 1, 1) #for(j, 0, 4 - 1, 1) #local R[i][j] = interpol(c0, P[i][j], c1, Q[i][j], cc); #end #end #end #macro noh(P, N, M) #local sphereRadius = 0.1; #local cursor = sphere{ < 0.00, 0.00, 0.00 >, sphereRadius texture{ tx_coke_2 } } union { #for(matrixLine, 0, N - 1, 1) #for(i, 0, 1, 1/M) object { cursor translate bezierArc(0, 1, P[matrixLine][0], P[matrixLine][1], P[matrixLine][2], P[matrixLine][3], i) } #end #end } #end #macro interpolMatrix(P, f0, f1, N, c0, c1, cc, R) #for(i, 0, N - 1, 1) #for(j, 0, 4 - 1, 1) #local R[i][j] = interpol(c0, P[f0][i][j], c1, P[f1][i][j], cc); #end #end #end #macro busca_tempo(clk, framesCount, frameTimeArray) #local valueToBeReturned = 0; #if (clk = 0) #local valueToBeReturned = 0; #elseif (clk = 1) #local valueToBeReturned = NK - 2; #else #for(i, 0, framesCount - 1, 1) #if (clk >= frameTimeArray[i]) #local valueToBeReturned = i; #end #end #end valueToBeReturned #end #declare cursor = sphere { < 0.00, 0.00, 0.00 >, 0.1 texture{ tx_coke_2 } } #declare rectangleCursor = box { <-0.1, 0.1, -0.1>, <0.1, 1.1, 0.1> texture { tx_fosca_4 } } #macro p1() union { object { cursor } object { rectangleCursor } } #end #macro p2p1(aAngle) union { object { cursor } object { rectangleCursor } object { p1() rotate translate <0, 1, 0> } } #end #macro p3p2p1(bAngle, aAngle) union { object { cursor } object { rectangleCursor } object { p2p1(aAngle) rotate translate <0, 1, 0> } } #end #macro p4p3p2p1(cAngle, bAngle, aAngle) union { object { cursor } object { rectangleCursor } object { p3p2p1(bAngle, aAngle) rotate translate <0, 1, 0> } } #end #macro p5p4p3p2p1(dAngle, cAngle, bAngle, aAngle) union { object { cursor } object { rectangleCursor } object { p4p3p2p1(cAngle, bAngle, aAngle) rotate translate <0, 1, 0> } } #end #macro perna(dAngle, cAngle, bAngle, aAngle) object { p5p4p3p2p1(dAngle, cAngle, bAngle, aAngle) } #end #macro inseto(anglesMatrix) union { #local aAngle = 300; #local bAngle = 80; #local cAngle = 90; #local dAngle = 270; object { box { <0, 0, 0>, <1.0, 1.0, 1.0> texture { tx_fosca_black } } } object { perna(anglesMatrix[0][0], anglesMatrix[0][1], anglesMatrix[0][2], anglesMatrix[0][3]) rotate <315, 0, 0> translate <1, 1, 0>} object { perna(anglesMatrix[1][0], anglesMatrix[1][1], anglesMatrix[1][2], anglesMatrix[1][3]) rotate <315, 0, 0> scale <1, -1, 1> translate <1, 0, 0>} object { perna(anglesMatrix[2][0], anglesMatrix[2][1], anglesMatrix[2][2], anglesMatrix[2][3]) rotate <315, 0, 270> translate <1, 0.5, 0>} object { perna(anglesMatrix[3][0], anglesMatrix[3][1], anglesMatrix[3][2], anglesMatrix[3][3]) rotate <315, 0, 270> scale <-1, 1, 1> translate <0, 0.5, 0>} object { perna(anglesMatrix[4][0], anglesMatrix[4][1], anglesMatrix[4][2], anglesMatrix[4][3]) rotate <345, 0, 0> translate <0.5, 1, 0.5>} object { perna(anglesMatrix[5][0], anglesMatrix[5][1], anglesMatrix[5][2], anglesMatrix[5][3]) rotate <345, 0, 0> scale <1, -1, 1> translate <0.5, 0, 0.5>} } #end #macro interpola_quadros(NP, NA, Q, k0, t0, k1, t1, tt, A) #for(i, 0, NP - 1, 1) #for(j, 0, NA - 1, 1) #local A[i][j] = interpolNumber(t0, Q[k0][i][j], t1, Q[k1][i][j], tt); #end #end #end #macro busca_tempo(clk, NQ, tk) #local valueToBeReturned = 0; #for (i, 0, NQ - 1, 1) #local valorDoQuadroChave = tk[i]; #if (clk > valorDoQuadroChave) #local valueToBeReturned = i; #end #end valueToBeReturned #end #include "frames_matrix.inc" #macro quadro(clk) #local frameIndex = busca_tempo(clock, NK, tk); interpola_quadros(NP, NA, Q, frameIndex, tk[frameIndex], frameIndex + 1, tk[frameIndex + 1], clock, A) object { inseto(A) } #end union { object { quadro(clock) } } #include "camlight.inc" #local centro_cena = < 0.00, 0.00, -0.00 >; #local raio_cena = 6.0; #local dir_camera = < 14.00, 7.00, 4.00 >; #local dist_camera = 5*raio_cena; #local intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)