// Exemplo de arquivo de descricao de cena para POV-ray // Last edited on 2020-09-30 19:57:13 by jstolfi // ====================================================================== // Declarações essenciais background{ color rgb < 0.75, 0.75, 0.85 > } #declare M = 3; #declare N = 4; #declare arraysize = M*N*2; #declare tubos = array[arraysize] #declare theSeed = seed(42); // ====================================================================== // Texturas #declare tx_tubo = texture{ pigment{ color rgb < 0.50, 0.50, 0.50 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_fosca_vermelha = texture{ pigment{ color rgb < 0.70, 0.10, 0.10 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_fosca_verde = texture{ pigment{ color rgb < 0.10, 0.70, 0.10 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_fosca_azul = texture{ pigment{ color rgb < 0.10, 0.10, 0.70 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_fosca_amarela = texture{ pigment{ color rgb < 0.70, 0.70, 0.10 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_chao = texture{ pigment{ color rgb < 0.60, 0.40, 0.40 > } finish{ diffuse 0.9 ambient 0.1 } } // ====================================================================== // Formas #declare tanque1 = sphere{<0,0,1>, 1 texture{tx_fosca_amarela}} #declare tanque2 = union{ sphere{<0,0,0.9>, 0.4 texture{tx_fosca_verde}} sphere{<0,0,0.4>, 0.5 texture{tx_fosca_verde}} cylinder{<-0.7,0,0.4>, <0.7,0,0.4>, 0.1 texture{tx_tubo}} } #declare tanque3 = union{ cone{<0,0,0>, 0.8, <0,0,0.3>, 0.6 texture{tx_fosca_vermelha}} cylinder{<0,0,0.3>, <0,0,1.5>, 0.6 texture{tx_fosca_vermelha}} cylinder{<-0.7,0,0.4>, <0.7,0,0.4>, 0.1 texture{tx_tubo}} } #declare tanque4 = union{ cone{<0,0,0>,0.8 , <0,0,0.7>, 0.5 texture{tx_fosca_azul}} sphere{<0,0,0.7>, 0.5 texture{tx_fosca_azul}} cylinder{<-0.7,0,0.4>, <0.7,0,0.4>, 0.1 texture{tx_tubo}} } // ====================================================================== // Macros #macro interpola1(ta,t0,v0,t1,v1) #local fator = (ta-t0)/(t1-t0); #local valor = (fator * v1) + ((1-fator) * v0); valor #end #macro interpola2(p0,p1,num) union{ #local currentnum = num; #while(currentnum > 0) #local centro = interpola1(currentnum, 0, p0, num, p1); object{sphere{centro, 0.1} texture{tx_tubo}} #local currentnum = currentnum - 1; #end } #end #macro interpola3(ta,t0,t3,v0,v1,v2,v3) #local v01 = interpola1(ta,t0,v0,t3,v1); #local v12 = interpola1(ta,t0,v1,t3,v2); #local v23 = interpola1(ta,t0,v2,t3,v3); #local v012 = interpola1(ta,t0,v01,t3,v12); #local v123 = interpola1(ta,t0,v12,t3,v23); #local v0123 = interpola1(ta,t0,v012,t3,v123); v0123 #end #macro interpola4(p0,p1,p2,p3,num) union{ #local currentnum = num; #while(currentnum > 0) #local centro = interpola3(currentnum, 0, num, p0, p1, p2, p3); object{sphere{centro, 0.1} texture{tx_tubo}} #local currentnum = currentnum - 1; #end } #end #macro gera_tanques (m, n) union{ #declare currentM = m; #while(currentM > 0) #declare currentN = n; #while(currentN > 0) #declare escolha = rand(theSeed); #if(escolha < 0.33) object{tanque1 translate } #end #if(escolha > 0.66) object{tanque2 translate } #end #if(escolha > 0.33 & escolha < 0.66) object{tanque3 translate } #end #declare tubos[((currentM-1)*n + (currentN-1))*2] = <(currentM*2)-0.7,currentN*2,0.4>; #declare tubos[(((currentM-1)*n + (currentN-1))*2) +1] = <(currentM*2)+0.7,currentN*2,0.4>; #declare currentN = currentN - 1; #end #declare currentM = currentM - 1; #end } #end #macro tubulacao(p,q) #local altura = 1 + 2*rand(theSeed); #local palto = ; #local qalto = ; union{ object{sphere{p,0.1} texture{tx_tubo}} object{sphere{q,0.1} texture{tx_tubo}} object{sphere{qalto,0.1} texture{tx_tubo}} object{sphere{palto,0.1} texture{tx_tubo}} object{cylinder{p, palto, 0.1} texture{tx_tubo}} object{cylinder{q, qalto, 0.1} texture{tx_tubo}} object{cylinder{palto, qalto, 0.1} texture{tx_tubo}} } #end #macro gera_tubulacoes() union{ #while(arraysize > 0) #local i = int(arraysize*rand(theSeed)); #local j = int((arraysize-1)*rand(theSeed)); #if(j>=i) #local j = j+1; #end object{tubulacao(tubos[i],tubos[j])} #declare tubos[i] = tubos[arraysize-1]; #declare tubos[j] = tubos[arraysize-2]; #declare arraysize = arraysize-2; #end } #end // ====================================================================== //Render object{interpola4(<2,0,1.2>, <2,0,4>, <-5,0,5>, <-2,0,1> , 1000)} object{tanque3 rotate<0,0,-45> translate<2,0,0>} object{tanque1 translate<-2,0,0>} object{box{<-100,-100,-1>,<100,100,0>} texture{tx_chao}} #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, 1.00 >; #declare raio_cena = 7.0; #declare dir_camera = < 10.00, 10.00, 2.00 >; #declare dist_camera = 5*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)