// CORES E TEXTURAS // background{ color rgb < 0.75, 0.80, 0.85 > } background{ color rgb < 0.90, 0.80, 0.85 > } #declare tx_tanque = texture{ pigment{ color rgb < 0.9, 0.70, 0.60 > } //finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_pecas = texture{ pigment{ color rgb < 1.00, 0.80, 0.10 > } 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 } finish{ diffuse 0.2 reflection 1.0*< 1.00, 1.00, 1.00 > 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 } #declare vertice2 = union{ cylinder{ < +1.00, +1.00, +0.00 >, < +1.00, +1.00, +2.00 >, 1.0 texture{ tx_tanque } } cone{ < +1.00, +1.00, +2.00 >, 1.0, < +1.00, +1.00, +4.00 >, 0.5 texture{ tx_tanque } } cylinder{ < +1.00, +1.90, +1.00 >, < +1.00, +2.25, +1.00 >, 0.1 texture{ tx_tanque } } cylinder{ < +1.00, +0.10, +1.00 >, < +1.00, -0.25, +1.00 >, 0.1 texture{ tx_tanque } } } #declare vertice3 = union{ cylinder{ < +1.00, +1.00, +0.00 >, < +1.00, +1.00, +2.00 >, 1.0 texture{ tx_tanque } } cone{ < +1.00, +1.00, +2.00 >, 1.0, < +1.00, +1.00, +4.00 >, 0.5 texture{ tx_tanque } } cylinder{ < +1.00, +1.90, +1.00 >, < +1.00, +2.25, +1.00 >, 0.1 texture{ tx_tanque } } cylinder{ < +1.00, +0.10, +1.00 >, < +1.00, -0.25, +1.00 >, 0.1 texture{ tx_tanque } } cylinder{ < +1.90, +1.00, +1.00 >, < +2.25, +1.00, +1.00 >, 0.1 texture{ tx_tanque } } } #declare vertice4 = union{ cylinder{ < +1.00, +1.00, +0.00 >, < +1.00, +1.00, +2.00 >, 1.0 texture{ tx_tanque } } cone{ < +1.00, +1.00, +2.00 >, 1.0, < +1.00, +1.00, +4.00 >, 0.5 texture{ tx_tanque } } cylinder{ < +1.00, +1.90, +1.00 >, < +1.00, +2.25, +1.00 >, 0.1 texture{ tx_tanque } } cylinder{ < +1.00, +0.10, +1.00 >, < +1.00, -0.25, +1.00 >, 0.1 texture{ tx_tanque } } cylinder{ < +1.90, +1.00, +1.00 >, < +2.25, +1.00, +1.00 >, 0.1 texture{ tx_tanque } } cylinder{ < +0.10, +1.00, +1.00 >, < -0.25, +1.00, +1.00 >, 0.1 texture{ tx_tanque } } } #macro interpola1(tt, t0, t1, p0, p1) #local ss = (tt - t0) / (t1 - t0); #local xx = (1 - ss) * p0.x + (ss * p1.x); #local yy = (1 - ss) * p0.y + (ss * p1.y); #local zz = (1 - ss) * p0.z + (ss * p1.z); #local ponto = < xx, yy, zz >; ponto #end #macro testa_interpola1(p0, p1, n, raio) #local delta_x = (p1.x - p0.x) / (n - 1); #local delta_y = (p1.y - p0.y) / (n - 1); #local xx = p0.x; #local yy = p0.y; #local i = 0; union{ #while (i < n) sphere{ < xx, yy, +0.00 >, raio texture{ tx_tanque } } #local xx = xx + delta_x; #local yy = yy + delta_y; #local i = i + 1; #end } #end #macro interpola3(tt, t0, t1, v0, v1, v2, v3) #local v01 = interpola1(tt, t0, t1, v0, v1); #local v12 = interpola1(tt, t0, t1, v1, v2); #local v23 = interpola1(tt, t0, t1, v2, v3); #local v012 = interpola1(tt, t0, t1, v01, v12); #local v123 = interpola1(tt, t0, t1, v12, v23); #local v0123 = interpola1(tt, t0, t1, v012, v123); v0123 #end #declare roleta = seed( 31159 ); #declare ponta_cano = array[3000] #declare N = 0; #macro gera_tanques(m, n) #local i = 0; #local j = 0; #local n_tanque = 1; #while (i < m) #local j = 0; #while (j < n) #local n_tanque = 1 + int(3.0*rand(roleta)); #if (n_tanque = 1) object{ tanque1 translate < 5.0*i, 5.0*j, 0.0 > } #declare ponta_cano[N] = < (5.0*i + 1.00), (5.0*j + 1.75), +3.00 >; #declare ponta_cano[N+1] = < (5.0*i + 1.00), (5.0*j + 0.25), +3.00 >; #declare ponta_cano[N+2] = < (5.0*i + 1.00), (5.0*j + 1.00), +4.25 >; #declare N = N + 3; #end #if (n_tanque = 2) object{ tanque2 translate < 5.0*i, 5.0*j, 0.0 > } #declare ponta_cano[N] = < (5.0*i + 1.00), (5.0*j + 2.00), +3.00 >; #declare ponta_cano[N+1] = < (5.0*i + 1.00), (5.0*j + 1.50), +4.25 >; #declare ponta_cano[N+2] = < (5.0*i + 1.00), (5.0*j + 0.50), +4.25 >; #declare N = N + 3; #end #if (n_tanque = 3) object{ tanque3 translate < 5.0*i, 5.0*j, 0.0 > } #declare ponta_cano[N] = < (5.0*i + 1.00), (5.0*j + 2.25), +1.50 >; #declare ponta_cano[N+1] = < (5.0*i + 1.00), (5.0*j - 0.25), +1.50 >; #declare ponta_cano[N+2] = < (5.0*i + 1.00), (5.0*j + 1.00), +4.25 >; #declare N = N + 3; #end #local j = j + 1; #end #local i = i + 1; #end #end #local m = 6; #local n = 6; // gera_tanques(m, n) #include "eixos.inc" // object{ eixos(15) } object{ vertice2 translate < 0, -5, 0 > } object{ vertice3 translate < 5, -5, 0 > } object{ vertice4 translate < 10, -5, 0 > } testa_interpola1(<0, 0, 0>, <30, 0, 0>, 5, 1) #declare cmin = < -2,-8,-2 >; #declare cmax = < +32,+2,+2 >; box{ cmin, texture{ pigment{ color rgb <0.80,0.70,0.60> } finish {diffuse 0.7 ambient 0.3 } } } #include "camlight.inc" #declare centro_cena = (cmin + cmax)/2; #declare raio_cena = 0.45*vlength(cmin - cmax); #declare dir_camera = < 14.00, 7.00, 4.00 >; #declare dist_camera = 5*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)