// ====================================================================== // 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_estranha = texture{ pigment{ color rgb < 1.00, 0.20, 0.20 > } 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 2*< 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,zz) union{ object{ sphere { + <0,0,0>, 5 } texture{ tx_estranha } } object{ cylinder{ + <0,0,5>, + <0,0,6>, 0.5 texture{ tx_cano } } } } #end #macro tanque2(xx,yy,zz) 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{ + <0,0,10>, + <0,0,11>, 0.5 texture{ tx_cano } } } } #end #macro tanque3(xx,yy,zz) 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 tanque4(xx,yy,zz) 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{ + <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 cano(posicaoInicial, posicaoFinal, altura) union{ object{ cylinder{ posicaoInicial, posicaoFinal, 0.5 texture{ tx_cano } } } } #end #macro interpola1(tt,tt0,v0,tt1,v1) #local ss = (tt - tt0) / (tt1 - tt0); #local vv = (1 - ss) * v0 + ss * v1; vv #end #macro interpola3(tt, tta, ttb, v0, v1, v2, v3) #local v01 = interpola1(tt,tta,v0,ttb,v1); #local v12 = interpola1(tt,tta,v1,ttb,v2); #local v23 = interpola1(tt,tta,v2,ttb,v3); #local v012 = interpola1(tt,tta,v01,ttb,v12); #local v123 = interpola1(tt,tta,v12,ttb,v23); #local v0123 = interpola1(tt,tta,v012,ttb,v123); v0123 #end #declare constAresta = 500; #macro executa_interpola(n, raio, p0, p1, p2, p3) union{ #local k = 0; #while (k < n) #local c = interpola3(k, 0, constAresta, p0, p1, p2, p3); object{ sphere { c, raio } texture{ tx_rosa } } #local k = k + 1; #end } #end #local rtubo = 0.20; #macro interpola3_multi(tt, n, pInit, P1, P2, pFim) union{ #local k = int(tt); #local Q0 = pInit; #local Q2 = pFim; #if (k > 0) #local Q0 = (P1[k] + P2[k - 1]) / 2; #end #if (k < n - 1) #local Q2 = (P1[k + 1] + P2[k]) / 2; #end #local c = interpola3(tt, k, k + 1, Q0, P1[k], P2[k], Q2); object{ sphere { c, rtubo } texture{ tx_rosa } } } #end #declare NMAX = 1000; #declare arrayDasPontas = array[NMAX]; #declare aleatorio = seed(45187); #declare CONSTANTE_POSICAO = 25; #declare CONSTANTE_ALTURA = 20; #declare numeroTotalPontas = 0; #macro geraTanques(m,n) union { #local indexM = 0; #while(indexM < m) #local xx = indexM * CONSTANTE_POSICAO; #local indexN = 0; #while(indexN < n) #local yy = indexN * CONSTANTE_POSICAO; #local zz = rand(aleatorio) * CONSTANTE_ALTURA; #if(rand(aleatorio) < 0.5) #local zz = zz * -1; #end #local tanqueEscolhido = rand(aleatorio) * 4; #if(tanqueEscolhido < 1) object { tanque1(xx,yy,zz) } #declare arrayDasPontas[numeroTotalPontas] = + <0,0,5.5>; #declare numeroTotalPontas = numeroTotalPontas + 1; #else #if(tanqueEscolhido < 2) object { tanque2(xx,yy,zz) } #declare arrayDasPontas[numeroTotalPontas] = + <0,5,3.5>; #declare arrayDasPontas[numeroTotalPontas + 1] = + <0,0,10.5>; #declare numeroTotalPontas = numeroTotalPontas + 2; #else #if(tanqueEscolhido < 3) object { tanque3(xx,yy,zz) } #declare arrayDasPontas[numeroTotalPontas] = + <0,5,3.5>; #declare arrayDasPontas[numeroTotalPontas + 1] = + <5,0,3.5>; #declare arrayDasPontas[numeroTotalPontas + 2] = + <-5,0,3.5>; #declare numeroTotalPontas = numeroTotalPontas + 3; #else object { tanque4(xx,yy,zz) } #declare arrayDasPontas[numeroTotalPontas] = + <0,9,3.5>; #declare arrayDasPontas[numeroTotalPontas + 1] = + <0,-9,3.5>; #declare arrayDasPontas[numeroTotalPontas + 2] = + <9,0,3.5>; #declare arrayDasPontas[numeroTotalPontas + 3] = + <1,2,12.5>; #declare numeroTotalPontas = numeroTotalPontas + 4; #end #end #end #local indexN = indexN + 1; #end #local indexM = indexM + 1; #end } #end #macro geraTubulacoes(m,n) union{ #while(numeroTotalPontas > 0) #local i = int(numeroTotalPontas * rand(aleatorio)); #local j = int((numeroTotalPontas - 1) * rand(aleatorio)); #if(j = i) #local j = j + 1; #end #declare posicaoToco1 = arrayDasPontas[i]; #declare posicaoToco2 = arrayDasPontas[j]; object { executa_interpola(constAresta, 0.5, posicaoToco1, posicaoToco1 + <-10,15,15>, posicaoToco2 + <10,-15,-15>, posicaoToco2) } #declare arrayDasPontas[i] = arrayDasPontas[numeroTotalPontas - 1]; #declare numeroTotalPontas = numeroTotalPontas - 1; #if(numeroTotalPontas > 0) #declare arrayDasPontas[j] = arrayDasPontas[numeroTotalPontas - 1]; #declare numeroTotalPontas = numeroTotalPontas - 1; #end #end } #end #include "eixos.inc" // Aqui este a cena, finalmente: #declare mm = 4; #declare nn = 4; #include "bezpoly.inc" union { #declare n = 3; #declare tt = 0; #declare P1 = array[n]; #declare P2 = array[n]; #declare P1[0] = <-3,0,0>; #declare P1[1] = <6,0,2>; #declare P1[2] = <-2,8,-5>; #declare P2[0] = <-5,0,-5>; #declare P2[1] = <6,-6,6>; #declare P2[2] = <10,-6,-6>; #local Pini = <-8,-9,+7>; #local Pfin = <5,5,5>; object{ bezpoly_multi(n, Pini, P1, P2, Pfin, 0.9*rtubo) } #while (tt < n) object { interpola3_multi(tt, n, Pini, P1, P2, Pfin) } #local tt = tt + 0.005; #end } #include "eixos.inc" // object{ eixos(15) } #declare cmin = < -12,-12,-11 >; #declare cmax = < +12,+10, +8 >; box{ cmin-0.1*z, 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.50*vlength(cmin - cmax); #declare dir_camera = < 15.00, -30.00, 10.00 >; #declare dist_camera = 5*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)