// ====================================================================== // CORES E TEXTURAS background{ color rgb < 0.75, 0.80, 0.85 > } #declare tx_cano = texture{ pigment{ color rgb < 0.70, 0.70, 0.70 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_azul = 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_rosa = texture{ pigment{ color rgb < 0.40, 0.10, 0.30 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_xadrez = texture { pigment { checker color rgb <1, 0, 0>, color rgb <0, 1, 0> scale 1 } finish { ambient 0.2 diffuse 0.8 } } // ====================================================================== // DESCRICAO DA CENA #macro tanque1(xx,yy) union{ object{ cylinder{ + <0,0,0>, + <0,0,10>, 4 texture{ tx_rosa } } } object{ sphere { + <0,0,10>, 4 } texture{ tx_rosa } } object{ cylinder{ + <0,4,4>, + <0,5,4>, 0.5 texture{ tx_cano } } } object{ cylinder{ + <4,0,4>, + <5,0,4>, 0.5 texture{ tx_cano } } } object{ cylinder{ + <-4,0,4>, + <-5,0,4>, 0.5 texture{ tx_cano } } } } #end #macro tanque2(xx,yy) union{ object{ cylinder{ + <0,0,0>, + <0,0,7>, 8 texture{ tx_azul } } } object{ cylinder{ + <0,0,7>, + <0,0,12>, 6 texture{ tx_azul } } } object{ cylinder{ + <0,8,4>, + <0,9,4>, 0.5 texture{ tx_cano } } } object{ cylinder{ + <8,0,4>, + <9,0,4>, 0.5 texture{ tx_cano } } } object{ cylinder{ + <1,2,12>, + <1,2,13>, 0.5 texture{ tx_cano } } } } #end #macro tanque3(xx,yy) union{ object{ cylinder{ + <0,0,0>, + <0,0,7>, 4 texture{ tx_xadrez } } } object{ cone{ + <0,0,7>, 4 + <0,0,10>, 2 texture{ tx_xadrez } } } object{ cylinder{ + <0,4,4>, + <0,5,4>, 0.5 texture{ tx_cano } } } object{ cylinder{ + <4,0,4>, + <5,0,4>, 0.5 texture{ tx_cano } } } object{ cylinder{ + <0,0,10>, + <0,0,11>, 0.5 texture{ tx_cano } } } } #end #macro cano(posicaoInicial, posicaoFinal, altura) union{ object{ cylinder{ posicaoInicial, posicaoInicial + <0,0,altura>, 0.5 texture{ tx_cano } } } object{ cylinder{ posicaoInicial + <0,0,altura>, posicaoFinal + <0,0,altura>, 0.5 texture{ tx_cano } } } object{ cylinder{ posicaoFinal, posicaoFinal + <0,0,altura>, 0.5 texture{ tx_cano } } } } #end #declare NMAX = 300; #declare arrayDasPontas = array[NMAX]; #declare roleta1 = seed(15647); #declare CONSTANTE_POSICAO = 15; #macro geraTanques(m,n) union { #local indexM = 0; #local posicaoArrayPontas = 0; #while(indexM < m) #local xx = indexM * CONSTANTE_POSICAO; #local indexN = 0; #while(indexN < n) #local yy = indexN * CONSTANTE_POSICAO; #local tanqueEscolhido = rand(roleta1) * 3; #if(tanqueEscolhido < 1) object { tanque1(xx,yy) } #declare arrayDasPontas[posicaoArrayPontas] = + <0,5,3.5>; #declare arrayDasPontas[posicaoArrayPontas + 1] = + <5,0,3.5>; #declare arrayDasPontas[posicaoArrayPontas + 2] = + <-5,0,3.5>; #else #if(tanqueEscolhido < 2) object { tanque2(xx,yy) } #declare arrayDasPontas[posicaoArrayPontas] = + <0,9,3.5>; #declare arrayDasPontas[posicaoArrayPontas + 1] = + <9,0,3.5>; #declare arrayDasPontas[posicaoArrayPontas + 2] = + <1,2,12.5>; #else object { tanque3(xx,yy) } #declare arrayDasPontas[posicaoArrayPontas] = + <0,5,3.5>; #declare arrayDasPontas[posicaoArrayPontas + 1] = + <5,0,3.5>; #declare arrayDasPontas[posicaoArrayPontas + 2] = + <0,0,10.5>; #end #end #local posicaoArrayPontas = posicaoArrayPontas + 3; #local indexN = indexN + 1; #end #local indexM = indexM + 1; #end } #end #macro geraTubulacoes(m,n) union{ #declare totalTanques = m * n * 3; #while(totalTanques > 0) #local i = int(totalTanques * rand(roleta1)); #local j = int((totalTanques - 1) * rand(roleta1)); #if(j = i) #local j = j + 1; #end #declare posicaoToco1 = arrayDasPontas[i]; #declare posicaoToco2 = arrayDasPontas[j]; #local altura = rand(roleta1) * 8 + 13; object{ cano(posicaoToco1, posicaoToco2, altura) } #declare arrayDasPontas[i] = arrayDasPontas[totalTanques - 1]; #declare totalTanques = totalTanques - 1; #declare arrayDasPontas[j] = arrayDasPontas[totalTanques - 1]; #declare totalTanques = totalTanques - 1; #end } #end #include "eixos.inc" // Aqui este a cena, finalmente: #declare mm = 4; #declare nn = 4; union { object { geraTanques(mm,nn) } object { geraTubulacoes(mm,nn) } } #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, 1.00 >; #declare raio_cena = 60.0; #declare dir_camera = < 2.00, 3.00, 1.00 >; #declare dist_camera = 5*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)