// CORES E TEXTURAS // background{ color rgb < 0.75, 0.80, 0.85 > } background{ color rgb < 0.90, 0.20, 0.85 > } #declare tx_tanque = texture{ pigment{ color rgb < 0.7, 0.50, 0.40 > } //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 } ///////////////////////////////////////////////////////////////////////////////////////////// // DESCRICAO DA CENA #include "eixos.inc" #declare tanque1 = union{ box{ < +0.00, +0.00, +0.00 >, < +2.00, +2.00, +2.00 > texture{ tx_tanque } } cylinder{ < +1.00, +1.00, +2.00 >, < +1.00, +1.00, +4.00 >, 0.5 texture{ tx_tanque } } cylinder{ < +1.00, +1.40, +3.00 >, < +1.00, +1.75, +3.00 >, 0.1 texture{ tx_tanque } } cylinder{ < +1.00, +0.60, +3.00 >, < +1.00, +0.25, +3.00 >, 0.1 texture{ tx_tanque } } cylinder{ < +1.00, +1.00, +4.00 >, < +1.00, +1.00, +4.25 >, 0.1 texture{ tx_tanque } } } #declare tanque2 = 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.60, +3.00 >, < +1.00, +2.00, +3.00 >, 0.1 texture{ tx_tanque } } cylinder{ < +1.00, +1.1, +3.85 >, < +1.00, +1.5, +4.25 >, 0.1 texture{ tx_tanque } } cylinder{ < +1.00, +0.9, +3.85 >, < +1.00, +0.5, +4.25 >, 0.1 texture{ tx_tanque } } } #declare tanque3 = union{ cylinder{ < +1.00, +1.00, +0.00 >, < +1.00, +1.00, +3.00 >, 1.0 texture{ tx_tanque } } sphere{ < +1.00, +1.00, +3.00 >, 1.0 texture{ tx_tanque } } cylinder{ < +1.00, +1.9, +1.50 >, < +1.00, +2.25, +1.50 >, 0.1 texture{ tx_tanque } } cylinder{ < +1.00, +0.10, +1.50 >, < +1.00, -0.25, +1.50 >, 0.1 texture{ tx_tanque } } cylinder{ < +1.00, +1.00, +3.90 >, < +1.00, +1.00, +4.25 >, 0.1 texture{ tx_tanque } } } ////////////////////////////////////////////////////////////////////////////////////////////////// // Aqui esta a cena, finalmente: // exemplo //#declare object3 = // difference{ // object{ object1} // object{ object2 } // } //object{ tanque1 // translate < 0.0, -5.0, 0.0 > // } //object{ tanque2 // translate < 0.0, +5.0, 0.0 > // } //object{ tanque3 // translate < 5.0, 0.0, 0.0 > // } #local m = 6; #local n = 6; #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 gera_tanques(m, n) //#local pos_x = 0.0; //#local pos_y = 0.0; //#macro desenhar_circulo(raio) // #local i = 0; // #while (i < n) // #local pos_x = raio * cos(i * theta); // #local pos_y = raio * sin(i * theta); // #if (mod(i, 4) = 0) // object { rainha // translate < pos_x, pos_y, 0 > // } // #else // object { peao // translate < pos_x, pos_y, 0 > // } // #end // #local i = i + 1; // #end //#end //#macro desenhar_tudo(m, n) // desenhar_circulo(raio_tabuleiro - 5.0) // desenhar_circulo((raio_tabuleiro - 5.0) * (m - 1) / m) //#end //desenhar_tudo(m, n) object{ eixos(20.0) } #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, 0.00 >; #declare raio_cena = 50.0; #declare dir_camera = < 14.00, 7.00, 4.00 >; #declare dist_camera = 2*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)