// Last edited on DATE TIME by USER // 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.20, 0.20, 0.20 > } 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_white = texture{ pigment{ color rgb < 1, 1, 1 > } 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" #include "retalho-simples.inc" #macro carroceria(PP, NH, NV) union { #for (iV, 0, NV - 1, 1) #for (iH, 0, NH - 1, 1) #local P = array[4][4]; #for(i, 0, 4 - 1, 1) #for (j, 0, 4 - 1, 1) #local P[i][j] = PP[iV][iH][i][j]; #end #end object { retalho(P, 0.04, tx_fosca, tx_coke_2) } #end #end } #end #macro criaMatrizDaCarroceria(NH, NV) #local retalhoEspacoJunto = 3; #local retalhoEspacoSeparado = 4.5; #local retalhoEspaco = retalhoEspacoSeparado; #local PP = array[NV][NH][4][4]; #for (iV, 0, NV - 1, 1) #for (iH, 0, NH - 1, 1) #for (i, 0, 4 - 1, 1) #for (j, 0, 4 - 1, 1) #local PP[iV][iH][i][j] = ; #end #end #end #end PP #end #macro fazFrenteDoCarro(PP, NH, NV) #local ponto = PP[1][0][3][0]; #local PP[1][0][3][0] = ; #local ponto = PP[0][0][0][0]; #local PP[0][0][0][0] = ; PP #end #macro fazTetoDoCarro(PP, NH, NV) #for (tetoIndex, 0, 1, 1) #for (i, 0, 4 - 1, 1) #for (j, 0, 4 - 1, 1) #local ponto = PP[tetoIndex][1][i][j]; #local PP[tetoIndex][1][i][j] = ; #end #end #end #local ponto = PP[0][1][0][1]; #local PP[0][1][0][1] = ; #local ponto = PP[0][1][0][2]; #local PP[0][1][0][2] = ; #local ponto = PP[1][1][3][1]; #local PP[1][1][3][1] = ; #local ponto = PP[1][1][3][2]; #local PP[1][1][3][2] = ; PP #end #macro fazTraseiraDoCarro(PP, NH, NV) #local ponto = PP[1][2][0][3]; #local PP[1][2][0][3] = ; #local ponto = PP[1][2][1][3]; #local PP[1][2][1][3] = ; #local ponto = PP[1][2][2][3]; #local PP[1][2][2][3] = ; #local ponto = PP[1][2][3][3]; #local PP[1][2][3][3] = ; #local ponto = PP[1][2][1][1]; #local PP[1][2][1][1] = ; #local ponto = PP[1][2][2][1]; #local PP[1][2][1][1] = ; #local ponto = PP[1][2][3][1]; #local PP[1][2][3][1] = ; #local ponto = PP[0][2][0][3]; #local PP[0][2][0][3] = ; #local ponto = PP[0][2][1][3]; #local PP[0][2][1][3] = ; #local ponto = PP[0][2][2][3]; #local PP[0][2][2][3] = ; #local ponto = PP[0][2][3][3]; #local PP[0][2][3][3] = ; #local ponto = PP[0][2][0][1]; #local PP[0][2][1][1] = ; #local ponto = PP[0][2][1][1]; #local PP[0][2][1][1] = ; #local ponto = PP[0][2][2][1]; #local PP[0][2][1][1] = ; PP #end #macro calcula_media(p1, p2) <(p1.x + p2.x) / 2, (p1.y + p2.y) / 2, (p1.z + p2.z) / 2> #end #macro emenda_retalho_horizontal(PP, r0, s0, r1, s1) #for (i, 0, 4 - 1, 1) #local ponto_medio = calcula_media(PP[r0][s0][i][2], PP[r1][s1][i][1]); #local PP[r0][s0][i][3] = ponto_medio; #local PP[r1][s1][i][0] = ponto_medio; #end PP #end #macro emenda_retalho_vertical(PP, r0, s0, r1, s1) #for (j, 0, 4 - 1, 1) #local ponto_medio = calcula_media(PP[r0][s0][2][j], PP[r1][s1][1][j]); #local PP[r0][s0][3][j] = ponto_medio; #local PP[r1][s1][0][j] = ponto_medio; #end PP #end #macro emenda_retalho(PP, r0, s0, r1, s1) #if (r0 = 0 & s0 = 0 & r1 = 0 & s1 = 1) #local PP = emenda_retalho_horizontal(PP, r0, s0, r1, s1); #end #if (r0 = 0 & s0 = 1 & r1 = 0 & s1 = 2) #local PP = emenda_retalho_horizontal(PP, r0, s0, r1, s1); #end #if (r0 = 1 & s0 = 0 & r1 = 1 & s1 = 1) #local PP = emenda_retalho_horizontal(PP, r0, s0, r1, s1); #end #if (r0 = 1 & s0 = 1 & r1 = 1 & s1 = 2) #local PP = emenda_retalho_horizontal(PP, r0, s0, r1, s1); #end #if (r0 = 0 & s0 = 0 & r1 = 1 & s1 = 0) #local PP = emenda_retalho_vertical(PP, r0, s0, r1, s1); #end #if (r0 = 0 & s0 = 1 & r1 = 1 & s1 = 1) #local PP = emenda_retalho_vertical(PP, r0, s0, r1, s1); #end #if (r0 = 0 & s0 = 2 & r1 = 1 & s1 = 2) #local PP = emenda_retalho_vertical(PP, r0, s0, r1, s1); #end PP #end #macro cria_carroceria_emendada(PP) #local PP = emenda_retalho(PP, 0, 0, 0, 1); #local PP = emenda_retalho(PP, 0, 1, 0, 2); #local PP = emenda_retalho(PP, 1, 0, 1, 1); #local PP = emenda_retalho(PP, 1, 1, 1, 2); #local PP = emenda_retalho(PP, 0, 0, 1, 0); #local PP = emenda_retalho(PP, 0, 1, 1, 1); #local PP = emenda_retalho(PP, 0, 2, 1, 2); PP #end union { object{ eixos(3.00) } #local NH = 3; #local NV = 2; #local PP = criaMatrizDaCarroceria(NH, NV); #local PP = fazFrenteDoCarro(PP, NH, NV); #local PP = fazTetoDoCarro(PP, NH, NV); #local PP = fazTraseiraDoCarro(PP, NH, NV); #local PP = cria_carroceria_emendada(PP); object { carroceria(PP, NH, NV) } } #include "camlight.inc" #local centro_cena = < 0.00, 3.00, 1.00 >; #local raio_cena = 10.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)