// ====================================================================== // CORES E TEXTURAS background{ color rgb < 0.75, 0.80, 0.85 > } #declare 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 } } #declare tx_branca = texture{ pigment{ color rgb < 1.0, 1.0, 1.0 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_verde = texture{ pigment{ color rgb < 0.0, 0.6, 0.6 > } finish{ diffuse 0.9 ambient 0.1 } } #declare 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 } } #declare 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 } } #declare tx_xadrez = texture{ pigment{ checker color rgb < 0.7, 0.7, 0.7 >, color rgb < 1.0, 1.0, 1.0 > } finish{ diffuse 0.9 ambient 0.1 } scale 2.0 } // ====================================================================== // DESCRICAO DA CENA #declare raio = 1.000; #declare PI = 3.14159; #declare space = 2.000; // Partes da cena: // tank 00 #declare tank_0 = sphere{ < 0, 0.00, 1.00 > raio * 1.5 texture{ tx_branca } } // tank 01 #declare column_01 = cylinder{ < 0, 0.00, 0.00 > < 0, 0.00, 1.50 >, raio * 0.8 texture{ tx_branca } } #declare roof_01 = sphere{ < 0, 0.00, 2.00 > raio texture{ tx_branca } } #declare tank_1 = union{ object{ column_01 } object{ roof_01 } } // tank 02 #declare column_02 = cylinder{ < 0, 0.00, 0.00 > < 0, 0.00, 1.50 >, raio texture{ tx_branca } } #declare roof_02 = sphere{ < 0, 0.00, 1.50 > raio * 0.5 texture{ tx_branca } } #declare tank_2 = union{ object{ column_02 } object{ roof_02 } } // tank 03 #declare column_03 = box{ < 1.00 , 1.00, 1.50 >, < -1.00 , -1.00, 0.00 > texture{ tx_branca } } #declare roof_03 = sphere{ < 0, 0.00, 1.50 > raio * 0.5 texture{ tx_branca } } #declare tank_3 = union{ object{ column_03 } object{ roof_03 } } // tocos #declare toco_1 = cylinder{ < 0, 0.0, 0.50 > < 0, 1.5, 0.50 >, raio * 0.2 texture{ tx_branca } } #declare toco_2 = cylinder{ < 0, 0.0, 0.50 > < 1.5, 0, 0.50 >, raio * 0.2 texture{ tx_branca } } #declare toco_3 = cylinder{ < 0, 0.0, 0.50 > < 0, -1.5, 0.50 >, raio * 0.2 texture{ tx_branca } } #declare toco_4 = cylinder{ < 0, 0.0, 0.50 > < -1.5, 0, 0.50 >, raio * 0.2 texture{ tx_branca } } #declare toco_5 = cylinder{ < 0, 0, 0.50 > < 0, 0, 4.00 >, raio * 0.2 texture{ tx_branca } } #declare cano_v = cylinder{ < 0, 0, 0.0 > < 0, 0, 5.00 >, raio * 0.2 texture{ tx_branca } } // teste #declare tanks = array[4] { tank_0, tank_1, tank_2, tank_3 } /////////////// #macro interpola(ti, t0, v0, t1, v1) #local ss = (ti - t0)/(t1 - v1); #local vv = ((1 - ss) * v0) + (ss * v1); vv #end #macro interpola3(ti, ta, tb, v0, v1, v2, v3) #local v01 = interpola(ti, ta, v0, tb, v1); #local v02 = interpola(ti, ta, v1, tb, v2); #local v03 = interpola(ti, ta, v2, tb, v3); #local v012 = interpola(ti, ta, v01, tb, v02); #local v123 = interpola(ti, ta, v02, tb, v03); #local v0123 = interpola(ti, ta, v012, tb, v123); v0123 #end #macro interpola3_multi(ti, ta, tb, pts, tmp, npts) #for (i, 0, npts - 2) #for (j, 0, (npts - 2) - i) #local tmp[j] = interpola(ti, ta, pts[j], tb, pts[j + 1]); #end #for (j, 0, (npts - 2) - i) #local pts[j] = tmp[j]; #end #end tmp[0] #end #macro interpola_multi(pts, tmp, npts, resolution, raio) union{ #local k = 0; #while (k < resolution) #local centro = interpola3_multi(k, 0, resolution, pts, tmp, npts); sphere{ centro, raio texture{ tx_branca } } #local k = k + 1; #end } #end #macro posiciona_vertices(verts, edges, orig, dest) #local spac = 2 * PI / verts; #local rad = 10 / spac; #local idx_pos_tocos = 0; #for (i,0,verts - 1) #local tx = sin(i * spac) * rad; #local ty = cos(i * spac) * rad; #local k = 0; #for (j,0,edges - 1) #if ((orig[j] = i) | (dest[j] = i)) #local k = k + 1; #end #end object { tanks[k - 1] translate < tx, ty > } #end #end #macro posiciona_arestas(verts, edges, orig, dest) #local arseed = seed(220792); #local spac = 2 * PI / verts; #local rad = 10 / spac; #local idx_pos_tocos = 0; #for (i,0,verts - 1) #for (j,0,edges - 1) #if (orig[j] = i) #local tx_o = sin(i * spac) * rad; #local ty_o = cos(i * spac) * rad; #local tx_d = sin(dest[j] * spac) * rad; #local ty_d = cos(dest[j] * spac) * rad; #local p0 = < tx_o, ty_o, 1.0 >; #local p1 = < tx_o, ty_o, 10.0 >; #local p2 = < tx_o * rand(arseed), ty_o * rand(arseed), 10 >; #local p3 = < tx_d * rand(arseed), ty_d * rand(arseed), -10 >; #local p4 = < tx_d, ty_d, -10.0 >; #local p5 = < tx_d, ty_d, 1.0 >; #local pts = array[6] { p0, p1, p2, p3, p4, p5 } #local tmp = array[6] { p0, p1, p2, p3, p4, p5 } interpola_multi(pts, tmp, 6, 50000, 0.1) #end #end #end #end #declare orig = array[9] { 0, 1, 1, 2, 2, 3, 4, 5, 6 } #declare dest = array[9] { 3, 6, 3, 4, 3, 5, 1, 6, 2 } posiciona_vertices(7, 9, orig, dest) posiciona_arestas(7, 9, orig, dest) #include "camlight.inc" #include "eixos.inc" // #declare chao = box{ <-50,-50,-1>, <+50,+50,0> } // object{ chao translate < -50,-50,-50 > texture{ tx_xadrez } } #declare centro_cena = < 0.00, 0.00, 0.00 >; #declare raio_cena = 20.0; #declare dir_camera = < -45.00, 45.00, 45.00 >; #declare dist_camera = 5*raio_cena; #declare intens_luz = 1.0; camlight(centro_cena, raio_cena, dir_camera, dist_camera, z, intens_luz)