// ====================================================================== // 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_fosca = texture{ pigment{ color rgb < 1.0, 1.0, 1.0 > } 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.10, 0.32, 0.60 >, color rgb < 1.00, 0.97, 0.90 > } 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_fosca } } // tank 01 #declare column_01 = cylinder{ < 0, 0.00, 0.00 > < 0, 0.00, 1.50 >, raio * 0.8 texture{ tx_fosca } } #declare roof_01 = sphere{ < 0, 0.00, 2.00 > raio texture{ tx_fosca } } #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_fosca } } #declare roof_02 = sphere{ < 0, 0.00, 1.50 > raio * 0.5 texture{ tx_fosca } } #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_fosca } } #declare roof_03 = sphere{ < 0, 0.00, 1.50 > raio * 0.5 texture{ tx_fosca } } #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_fosca } } #declare toco_2 = cylinder{ < 0, 0.0, 0.50 > < 1.5, 0, 0.50 >, raio * 0.2 texture{ tx_fosca } } #declare toco_3 = cylinder{ < 0, 0.0, 0.50 > < 0, -1.5, 0.50 >, raio * 0.2 texture{ tx_fosca } } #declare toco_4 = cylinder{ < 0, 0.0, 0.50 > < -1.5, 0, 0.50 >, raio * 0.2 texture{ tx_fosca } } #declare toco_5 = cylinder{ < 0, 0, 0.50 > < 0, 0, 4.00 >, raio * 0.2 texture{ tx_fosca } } #declare cano_v = cylinder{ < 0, 0, 0.0 > < 0, 0, 5.00 >, raio * 0.2 texture{ tx_fosca } } // teste #declare tanks = array[4] { tank_0, tank_1, tank_2, tank_3 } /////////////// #macro interpolate_base(ti, t0, v0, t1, v1) #local ss = (ti - t0)/(t1 - v1); #local vv = ((1 - ss) * v0) + (ss * v1); vv #end #macro interpolate_super(ti, ta, tb, v0, v1, v2, v3) #local v01 = interpolate_base(ti, ta, v0, tb, v1); #local v02 = interpolate_base(ti, ta, v1, tb, v2); #local v03 = interpolate_base(ti, ta, v2, tb, v3); #local v012 = interpolate_base(ti, ta, v01, tb, v02); #local v123 = interpolate_base(ti, ta, v02, tb, v03); #local v0123 = interpolate_base(ti, ta, v012, tb, v123); v0123 #end #macro test_interpola(p0, p1, p2, p3, n, raio) union{ #local k = 0; #while (k < n) #local centro = interpolate_super(k, 0, n, p0, p1, p2, p3); sphere{ centro, raio texture{ tx_fosca } } #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 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_d, ty_d, -10.0 >; #local p3 = < tx_d, ty_d, 1.0 >; test_interpola(p0, p1, p2, p3, 500, 0.1) #end #end #end #end // #declare chao = // box{ <-20,-20,-1>, <+20,+20,0> } #include "eixos.inc" #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" #declare centro_cena = < 5.00, 5.00, 5.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.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)