// Exemplo de arquivo de descricao de cena para POV-ray // Last edited on 2020-09-30 19:57:13 by jstolfi // ====================================================================== // CORES E TEXTURAS background{ color rgb < 0.75, 0.80, 0.85 > } #declare tx_verde = texture{ pigment{ color rgb < 0.15, 1.00, 0.15 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_vermelho = texture{ pigment{ color rgb < 1.00, 0.10, 0.10 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_azul = texture{ pigment{ color rgb < 0.10, 0.10, 1.00 > } finish{ diffuse 0.9 ambient 0.1 } } // ====================================================================== // DESCRIÇÃO DA CENA // MACROS QUE CONSTITUEM OS OBJETOS DA CENA #macro param_interpola1(tt, tt0, tt1, vv0, vv1) #local rr = (tt - tt0)/(tt1 - tt0); #local vv = (1 - rr)*vv0 + rr*vv1; vv #end #macro param_interpolaBezier(tt, tt0,tt3, vv0,vv1,vv2,vv3) #local vv01 = param_interpola1(tt, tt0,tt3, vv0,vv1); #local vv12 = param_interpola1(tt, tt0,tt3, vv1,vv2); #local vv23 = param_interpola1(tt, tt0,tt3, vv2,vv3); #local vv012 = param_interpola1(tt, tt0,tt3, vv01,vv12); #local vv123 = param_interpola1(tt, tt0,tt3, vv12,vv23); #local vv0123 = param_interpola1(tt, tt0,tt3, vv012,vv123); vv0123 #end #macro bola(posicao, raio) sphere{ posicao, raio texture {tx_verde} } #end #macro segtentaculo(M, P0, R0, P1, R1, P2, R2, P3, R3) #local i = 0; #local tt0 = 0; #local tt1 = M; union{ #while(i < M) #local posicao = param_interpolaBezier(i, tt0, tt1, P0, P1, P2, P3); #local raio = param_interpolaBezier(i, tt0, tt1, R0, R1, R2, R3); object { bola(posicao, raio) } #local i = i + 1; #end } #end #macro tentaculo(M, N, PP, RR) #local j = 0; union{ #while(j < N) object { segtentaculo(M, PP[j][0], RR[j][0], PP[j][1], RR[j][1], PP[j][2], RR[j][2], PP[j][3], RR[j][3]) } #local j = j + 1; #end } #end #macro tentaculo_teste(M) # local N = 5; # local PP = array[N][4]; # local RR = array[N][4]; #local PP[0][0] = <0, 0, 0>; #local PP[0][1] = <30, 10, 0>; #local PP[0][2] = <40, 70, 0>; #local PP[1][1] = <100, 70, 0>; #local PP[1][2] = <140, 10, 0>; #local PP[2][1] = <200, 100, 0>; #local PP[2][2] = <220, 120, 0>; #local PP[3][1] = <290, 120, 0>; #local PP[3][2] = <310, 210, 0>; #local PP[4][1] = <350, 290, 0>; #local PP[4][2] = <370, 310, 0>; #local PP[4][3] = <400, 290, 0>; #local PP[0][3] = (PP[0][2] + PP[1][1])/2; #local PP[1][0] = PP[0][3]; #local PP[1][3] = (PP[1][2] + PP[2][1])/2; #local PP[2][0] = PP[1][3]; #local PP[2][3] = (PP[2][2] + PP[3][1])/2; #local PP[3][0] = PP[2][3]; #local PP[3][3] = (PP[3][2] + PP[4][1])/2; #local PP[4][0] = PP[3][3]; #local RR[0][0] = 10; #local RR[0][1] = 20; #local RR[0][2] = 20; #local RR[1][1] = 20; #local RR[1][2] = 15; #local RR[2][1] = 20; #local RR[2][2] = 20; #local RR[3][1] = 20; #local RR[3][2] = 20; #local RR[4][1] = 14; #local RR[4][2] = 10; #local RR[4][3] = 5; #local RR[0][3] = (RR[0][2] + RR[1][1])/2; #local RR[1][0] = (RR[0][2] + RR[1][1])/2; #local RR[1][3] = (RR[1][2] + RR[2][1])/2; #local RR[2][0] = (RR[1][2] + RR[2][1])/2; #local RR[2][3] = (RR[2][2] + RR[3][1])/2; #local RR[3][0] = (RR[2][2] + RR[3][1])/2; #local RR[3][3] = (RR[3][2] + RR[4][1])/2; #local RR[4][0] = (RR[3][2] + RR[4][1])/2; object{ tentaculo(M, N, PP, RR) } #end #include "eixos.inc" union{ object{ tentaculo_teste(70) } } #include "camlight.inc" #declare centro_cena = < 150, 300, 0>; #declare raio_cena = 370; #declare dir_camera = < 20, -100, 10 >; #declare dist_camera = 5*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)