// Exemplo de arquivo de descricao de cena para POV-ray // Last edited on 2020-09-30 19:57:13 by jstolfi // ====================================================================== // CORES E TEXTURAS //#include "textures.inc" background{ color rgb < 240/255, 243/255, 246/255 > } #declare tx_tanque3 = texture{ pigment{ color rgb < 1.00, 0.17, 0.10 > } finish{ diffuse 0.9 ambient 0.1 } scale 1.0 } #declare tx_tanque2 = texture{ pigment{ color rgb < 0.80, 0.17, 1.00 > } finish{ diffuse 0.9 ambient 0.1 } scale 1.0 } #declare tx_tanque1 = texture{ pigment{ color rgb < 0.10, 1.00, 0.17 > } finish{ diffuse 0.9 ambient 0.1 } scale 1.0 } #declare tx_tubo = texture{ pigment{ color rgb < 0.20, 0.07, 0.90 > } finish{ diffuse 0.9 ambient 0.1 } scale 1.0 } #declare tx_tubo2 = texture{ pigment{ color rgb < 0.70, 0.17, 0.60 > } finish{ diffuse 0.9 ambient 0.1 } scale 1.0 } // ====================================================================== // DESCRI��O DA CENA //------------------------------------------------------------------ #declare A = array[10000] #declare N = 0; #macro quadrado(i, j, cor) box{ < i, j, 0>, } pigment { rgb ( cor ) } #end #macro tanque3(i, j) #local tq = union{ sphere{ < i - 0.5, j - 0.5, 0.25 >, 0.25 texture{ tx_tanque3 } } sphere{ < i - 0.5, j - 0.5, 0.75 >, 0.25 texture{ tx_tanque3 } } sphere{ < i - 0.5, j - 0.5, 1.25 >, 0.25 texture{ tx_tanque3 } } cone{ < i - 0.5, j - 0.5, 1.75 >, 0, < i - 0.5, j - 0.5, 1.5 >, 0.3 texture{ tx_tanque3 } } cylinder{ < i - 0.5, j - 0.5, 0.25 >, < i - 0.5 + 0.35, j - 0.5, 0.25 >, 0.1 texture{ tx_tubo } } cylinder{ < i - 0.5, j - 0.5, 0.75 >, < i - 0.5, j - 0.5 + 0.35, 0.75 >, 0.1 texture{ tx_tubo } } cylinder{ < i - 0.5, j - 0.5, 1.25 >, < i - 0.5 - 0.35, j - 0.5, 1.25 >, 0.1 texture{ tx_tubo } } #declare A[N] = < i - 0.5 + 0.35, j - 0.5, 0.25 >; #declare N = N + 1; #declare A[N] = < i - 0.5, j - 0.5 + 0.35, 0.75 >; #declare N = N + 1; #declare A[N] = < i - 0.5 - 0.35, j - 0.5, 1.25 >; #declare N = N + 1; } tq #end #macro tanque2(i, j) #local tq = union{ cylinder{ < i - 0.5, j - 0.5, 0 >, < i - 0.5, j - 0.5, 0.25>, 0.35 texture{ tx_tanque2 } } box{ < i - 0.5, j - 0.5, 0.25>, < i - 0.5 + 0.25, j - 0.5 + 0.25, 1.5 > texture{ tx_tanque2 } } cylinder{ < i - 0.5, j - 0.5, 0.75 >, < i - 0.5 + 0.35, j - 0.5, 0.75 >, 0.1 texture{ tx_tubo } } cylinder{ < i - 0.5, j - 0.5, 0.75 >, < i - 0.5, j - 0.5 + 0.35, 0.75 >, 0.1 texture{ tx_tubo } } cylinder{ < i - 0.5, j - 0.5, 0.75 >, < i - 0.5 - 0.35, j - 0.5, 0.75 >, 0.1 texture{ tx_tubo } } } #declare A[N] = < i - 0.5 + 0.35, j - 0.5, 0.75 >; #declare N = N + 1; #declare A[N] = < i - 0.5, j - 0.5 + 0.35, 0.75 >; #declare N = N + 1; #declare A[N] = < i - 0.5 - 0.35, j - 0.5, 0.75 >; #declare N = N + 1; tq #end #macro tanque1(i, j) #local tq = union{ cylinder{ < i - 0.5, j - 0.5, 0 >, < i - 0.5, j - 0.5, 1>, 0.2 texture{ tx_tanque1 } } sphere{ < i - 0.5, j - 0.5, 1.25 >, 0.25 texture{ tx_tanque1 } } cylinder{ < i - 0.5, j - 0.5, 0.75 >, < i - 0.5 + 0.35, j - 0.5, 0.75 >, 0.1 texture{ tx_tubo } } cylinder{ < i - 0.5, j - 0.5, 0.75 >, < i - 0.5, j - 0.5 + 0.35, 0.75 >, 0.1 texture{ tx_tubo } } cylinder{ < i - 0.5, j - 0.5, 0.75 >, < i - 0.5 - 0.35, j - 0.5, 0.75 >, 0.1 texture{ tx_tubo } } cylinder{ < i - 0.5, j - 0.5, 0.75 >, < i - 0.5, j - 0.5 - 0.35, 0.75 >, 0.1 texture{ tx_tubo } } } #declare A[N] = < i - 0.5 + 0.35, j - 0.5, 0.75 >; #declare N = N + 1; #declare A[N] = < i - 0.5, j - 0.5 + 0.35, 0.75 >; #declare N = N + 1; #declare A[N] = < i - 0.5 - 0.35, j - 0.5, 0.75 >; #declare N = N + 1; #declare A[N] = < i - 0.5, j - 0.5 - 0.35, 0.75 >; #declare N = N + 1; tq #end #declare roleta1 = seed(92839); #macro gera_tanques(m, n) #declare casa = 1; #declare i = 0; #declare k = 0; #while(i < m) #declare j = 0; #while(j < n) #declare c = mod(k, 2); #declare k = k + 1; object{ quadrado(i, j, c) } // #debug concat("p = ", str(i, 5, 1), str(j, 5, 1), "\n") #local r = int(3*rand(roleta1)) + 1; #if(r = 1) tanque1(i + 1, j + 1) #end #if(r = 2) tanque2(i + 1, j + 1) #end #if(r = 3) tanque3(i + 1, j + 1) #end #debug concat("r = ", str(N, 5, 1), "\n") #declare j = j + 1; #end #declare i = i + 1; #end #end #macro tubulacao(p1, p2) union{ #local h = 5*rand(roleta1); #local p11 = p1 + <0, 0, h>; #local p22 = p2 + <0, 0, h>; union{ cylinder{ p1, p11, 0.1 texture{ tx_tubo2 } } cylinder{ p11, p22, 0.1 texture{ tx_tubo2 } } cylinder{ p22, p2, 0.1 texture{ tx_tubo2 } } } } #end #macro gera_tubulacoes() #while(N > 2) #local ii = int(N*rand(roleta1)); #local jj = int((N-1)*rand(roleta1)); #if(jj >= ii) #local jj = jj + 1; #end // Desenha #local p1 = A[ii]; #local p2 = A[jj]; object{ tubulacao(p1, p2) } #declare A[ii] = A[N-1]; #declare N = N - 1; #declare A[jj] = A[N-1]; #declare N = N - 1; #end #end union{ gera_tanques(5, 5) gera_tubulacoes() light_source { <0, 10, -3> color rgb < 200/255, 42/255, 222/255 > spotlight radius 100 falloff 30 tightness 10 point_at <0, 0, 0> } } #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, 0.00 >; #declare raio_cena = 10.0; #declare dir_camera = < 10.00, 8.00, 7.00 >; #declare dist_camera = 2*raio_cena; #declare intens_luz = 0.80; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)