// Exemplo de arquivo de descricao de cena para POV-ray // Last edited on 2017-05-07 20:10:09 by stolfilocal #include "eixos.inc" #include "retalho-simples.inc" // Cores e Texturas ===================================================== background{ color rgb < 0.75, 0.80, 0.85 > } #declare tx_laranja = texture{ pigment{ color rgb < 1.0, 0.55, 0.0 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_preto = texture{ pigment{ color rgb < 0, 0, 0 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_vermelho = texture{ pigment{ color rgb < 1, 0, 0 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_green = texture{ pigment{ color rgb < 0.55, 1, 0 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_blue = texture{ pigment{ color rgb < 0, 0.55, 1 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_yellow = texture{ pigment{ color rgb < 1, 1, 0 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_pink = texture{ pigment{ color rgb < 1, 0.75, 0.79 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } // Declaração de Macros ================================================== // Interpolação Linear #macro interp1 (A, B, tA, tB, tt) #local pB = (tt - tA) / (tB - tA); #local pA = 1 - pB; #local AB = pA * A + pB * B; AB #end // end interplin // Interpolação de Bezier #macro interp3 (A, B, C, D, t0, t1, tt) #local AB = interp1(A, B, t0, t1, tt); #local BC = interp1(B, C, t0, t1, tt); #local CD = interp1(C, D, t0, t1, tt); #local ABC = interp1(AB, BC, t0, t1, tt); #local BCD = interp1(BC, CD, t0, t1, tt); #local ABCD = interp1(ABC, BCD, t0, t1, tt); ABCD #end // end interp3 // define pontos fornecidos na matriz #macro Ponto(P, i, P0, P1, P2, P3) #declare P[i][0] = P0; #declare P[i][1] = P1; #declare P[i][2] = P2; #declare P[i][3] = P3; #end #macro Emenda_Matriz_Hor(P, Q) // apenas horizontalmente #for(i, 0, 3) #declare P[i][3] = (P[i][2] + Q[i][1])/2; #declare Q[i][0] = P[i][3]; #end #end #macro Emenda_Matriz_Ver(P, Q) // apenas verticalmente #for(i, 0, 3) #declare P[3][i] = (P[2][i] + Q[1][i])/2; #declare Q[0][i] = P[3][i]; #end #end #macro Translate_Modify(P, V) #for(i, 0, 3) #declare P[i][0] = P[i][0] + V; #declare P[i][1] = P[i][1] + V; #declare P[i][2] = P[i][2] + V; #declare P[i][3] = P[i][3] + V; #end #end // Descrição de Cena ==================================================== object { union{ //object{ eixos(1.0) } #declare Rad = 0; // thickness // capô ================================================================================ #declare P0 = array[4][4]; Ponto(P0, 0, <0,0,0.75>, <0,1,1.50>, <0,2,1.75>, <0,3,1.75>) Ponto(P0, 1, <1,0,0.50>, <1,1,1.00>, <1,2,1.25>, <1,3,1.25>) Ponto(P0, 2, <2,0,0.25>, <2,1,0.75>, <2,2,1.00>, <2,3,1.00>) Ponto(P0, 3, <3,0,0.00>, <3,1,0.00>, <3,2,0.00>, <3,3,0.00>) // Lateral do Capô #declare Q0 = array[4][4]; Ponto(Q0, 0, <0,-1.00,0.00>, <0,-0.66,+0.35>, <0,-0.33,+0.55>, <0,0,+0.75>) Ponto(Q0, 1, <1,-0.66,0.00>, <1,-0.44,+0.20>, <1,-0.22,+0.37>, <1,0,+0.50>) Ponto(Q0, 2, <2,-0.33,0.00>, <2,-0.22,+0.10>, <2,-0.11,+0.20>, <2,0,+0.25>) Ponto(Q0, 3, <3, 0.00,0.00>, <3, 0.00, 0.00>, <3, 0.00, 0.00>, <3,0, 0.00>) Emenda_Matriz_Hor(Q0, P0) // ====================================================================================== // metade da frente do meio ============================================================= #declare P1 = array[4][4]; Ponto(P1, 0, <0,0,1.75>, <0,1,2.125>, <0,2,2.50>, <0,3,2.50>) Ponto(P1, 1, <1,0,1.50>, <1,1,2.00>, <1,2,2.125>, <1,3,2.25>) Ponto(P1, 2, <2,0,1.25>, <2,1,1.75>, <2,2,2.00>, <2,3,2.00>) Ponto(P1, 3, <3,0,0.75>, <3,1,1.50>, <3,2,1.75>, <3,3,1.75>) Translate_Modify(P1, <-3, 0, 0>) // Lateral da metade da frente do meio #declare Q1 = array[4][4]; Ponto(Q1, 0, <0,-2.00,0.00>, <0,-1.66,+0.70>, <0,-1.33,+1.40>, <0,0,+1.75>) Ponto(Q1, 1, <1,-1.66,0.00>, <1,-1.22,+0.50>, <1,-1.00,+1.00>, <1,0,+1.50>) Ponto(Q1, 2, <2,-1.33,0.00>, <2,-1.00,+0.42>, <2,-0.66,+0.84>, <2,0,+1.25>) Ponto(Q1, 3, <3,-1.00,0.00>, <3,-0.66,+0.35>, <3,-0.33,+0.55>, <3,0,+0.75>) Translate_Modify(Q1, <-3, 0, 0>) Emenda_Matriz_Hor(Q1, P1) // ====================================================================================== // metade de trás do meio =============================================================== #declare P2 = array[4][4]; Ponto(P2, 0, <0,0,0.75>, <0,1,1.50>, <0,2,1.75>, <0,3,1.75>) Ponto(P2, 1, <1,0,1.25>, <1,1,1.75>, <1,2,2.00>, <1,3,2.00>) Ponto(P2, 2, <2,0,1.50>, <2,1,2.00>, <2,2,2.125>, <2,3,2.25>) Ponto(P2, 3, <3,0,1.75>, <3,1,2.125>, <3,2,2.50>, <3,3,2.50>) Translate_Modify(P2, <-6, 0, 0>) // Lateral da metade de trás do meio #declare Q2 = array[4][4]; Ponto(Q2, 0, <0,-1.00,0.00>, <0,-0.66,+0.35>, <0,-0.33,+0.55>, <0,0,+0.75>) Ponto(Q2, 1, <1,-1.33,0.00>, <1,-1.00,+0.42>, <1,-0.66,+0.84>, <1,0,+1.25>) Ponto(Q2, 2, <2,-1.66,0.00>, <2,-1.22,+0.50>, <2,-1.00,+1.00>, <2,0,+1.50>) Ponto(Q2, 3, <3,-2.00,0.00>, <3,-1.66,+0.70>, <3,-1.33,+1.40>, <3,0,+1.75>) Translate_Modify(Q2, <-6, 0, 0>) Emenda_Matriz_Hor(Q2, P2) // ====================================================================================== // porta malas ========================================================================== #declare P3 = array[4][4]; Ponto(P3, 3, <3,0,0.75>, <3,1,1.50>, <3,2,1.75>, <3,3,1.75>) Ponto(P3, 2, <2,0,0.50>, <2,1,1.00>, <2,2,1.25>, <2,3,1.25>) Ponto(P3, 1, <1,0,0.25>, <1,1,0.75>, <1,2,1.00>, <1,3,1.00>) Ponto(P3, 0, <0,0,0.00>, <0,1,0.00>, <0,2,0.00>, <0,3,0.00>) Translate_Modify(P3, <-9, 0, 0>) // lateral porta malas #declare Q3 = array[4][4]; Ponto(Q3, 3, <3,-1.00,0.00>, <3,-0.66,+0.35>, <3,-0.33,+0.55>, <3,0,+0.75>) Ponto(Q3, 2, <2,-0.66,0.00>, <2,-0.44,+0.20>, <2,-0.22,+0.37>, <2,0,+0.50>) Ponto(Q3, 1, <1,-0.33,0.00>, <1,-0.22,+0.10>, <1,-0.11,+0.20>, <1,0,+0.25>) Ponto(Q3, 0, <0, 0.00,0.00>, <0, 0.00, 0.00>, <0, 0.00, 0.00>, <0,0, 0.00>) Translate_Modify(Q3, <-9, 0, 0>) Emenda_Matriz_Hor(Q3, P3) // ====================================================================================== Emenda_Matriz_Ver(P3, P2) Emenda_Matriz_Ver(P2, P1) Emenda_Matriz_Ver(P1, P0) Emenda_Matriz_Ver(Q3, Q2) Emenda_Matriz_Ver(Q2, Q1) Emenda_Matriz_Ver(Q1, Q0) // Plota: object{ retalho (P0,Rad,tx_preto,tx_green) scale <0.5, 0.5, 0.5> } object{ retalho (P0,Rad,tx_preto,tx_laranja) scale <0.5, -0.5, 0.5> translate <0, 3, 0> } object{ retalho (Q0,Rad,tx_preto,tx_green) scale <0.5, 0.5, 0.5> } object{ retalho (Q0,Rad,tx_preto,tx_laranja) scale <0.5, -0.5, 0.5> translate <0, 3, 0> } object{ retalho (P1,Rad,tx_preto,tx_vermelho) scale <0.5, 0.5, 0.5> } object{ retalho (P1,Rad,tx_preto,tx_blue) scale <0.5, -0.5, 0.5> translate <0, 3, 0> } object{ retalho (Q1,Rad,tx_preto,tx_vermelho) scale <0.5, 0.5, 0.5> } object{ retalho (Q1,Rad,tx_preto,tx_blue) scale <0.5, -0.5, 0.5> translate <0, 3, 0> } object{ retalho (P2,Rad,tx_preto,tx_vermelho) scale <0.5, 0.5, 0.5> } object{ retalho (P2,Rad,tx_preto,tx_blue) scale <0.5, -0.5, 0.5> translate <0, 3, 0> } object{ retalho (Q2,Rad,tx_preto,tx_vermelho) scale <0.5, 0.5, 0.5> } object{ retalho (Q2,Rad,tx_preto,tx_blue) scale <0.5, -0.5, 0.5> translate <0, 3, 0> } object{ retalho (P3,Rad,tx_preto,tx_yellow) scale <0.5, 0.5, 0.5> } object{ retalho (P3,Rad,tx_preto,tx_pink) scale <0.5, -0.5, 0.5> translate <0, 3, 0> } object{ retalho (Q3,Rad,tx_preto,tx_yellow) scale <0.5, 0.5, 0.5> } object{ retalho (Q3,Rad,tx_preto,tx_pink) scale <0.5, -0.5, 0.5> translate <0, 3, 0> } // ====================================================================================== } rotate<45, 0, 45> // rotaciona cena inteira } // Declaração de Câmera ================================================= #include "camlight.inc" #declare centro_cena = < 0.5, 0.5, 0.5>; #declare raio_cena = 10.0; #declare dir_camera = < 45, 0, 0 >; #declare dist_camera = 5*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)