// Exemplo de arquivo de descricao de cena para POV-ray // Last edited on 2020-09-30 19:57:13 by jstolfi // ====================================================================== // CORES E TEXTURAS #declare semente = seed(42); #declare M = 500; #declare N = 500; #declare A = array[M*N]; #declare num_ponta_tanque = 0; background{ color rgb < 0.75, 0.80, 0.85 > } #declare tx_plastico = 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_fosca = 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 } } #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 } // ====================================================================== // DESCRI��O DA CENA #declare raio = 2.000; // Partes da cena: #declare tanqueA = union { union { box { <-1, -1, 0>, <1, 1, 0.2> // near lower left corner, far upper right corner texture {tx_plastico} } cone { <0, 0, 0.2>, 0.25 // , center & radius of one end <0, 0, 1.3>, 1 // , center & radius of the other end texture {tx_plastico} } } } #declare tanqueB = union { union { cylinder { <0, 0, 0>, <0, 0, 1>, 1 // center of one end, center of other end, radius texture {tx_plastico} } box { <-0.6, -0.6, 1>, <0.6, 0.6, 1.6> // near lower left corner, far upper right corner texture {tx_plastico} } } } #declare tanqueC = union { union { box { <-1, -1, 0>, <1, 1, 2> // near lower left corner, far upper right corner texture {tx_plastico} } sphere { <0, 0, 2>, 1 // , radius texture {tx_plastico} } } } #declare chao = box{ <-200,-200,-1>, <+200,+200,0> } #include "eixos.inc" #macro gera_tanquesA(xx, yy) union { #local p1 = ; #local q1 = ; #local q2 = <2+xx, yy, 0.7>; #local q3 = ; #declare A[num_ponta_tanque] = q1; #declare num_ponta_tanque = num_ponta_tanque + 1; box { , // near lower left corner, far upper right corner texture {tx_plastico} } cone { , 0.25 // , center & radius of one end , 1 // , center & radius of the other end texture {tx_plastico} } cylinder { , q1, 0.1 // center of one end, center of other end, radius open // remove end caps texture {tx_fosca} } cylinder { , q2, 0.1 // center of one end, center of other end, radius open // remove end caps texture {tx_fosca} } cylinder { , q3, 0.1 // center of one end, center of other end, radius open // remove end caps texture {tx_fosca} } } #end #macro gera_tanquesB(xx, yy) union { #local p1 = ; #local q1 = ; #local q2 = <2+xx, yy, 0.7>; #local q3 = ; #declare A[num_ponta_tanque] = q1; #declare num_ponta_tanque = num_ponta_tanque + 1; cylinder { , , 1 // center of one end, center of other end, radius texture {tx_plastico} } box { , // near lower left corner, far upper right corner texture {tx_plastico} } cylinder { , , 0.1 // center of one end, center of other end, radius open // remove end caps texture {tx_fosca} } cylinder { , <2+xx, yy, 0.7>, 0.1 // center of one end, center of other end, radius open // remove end caps texture {tx_fosca} } cylinder { , , 0.1 // center of one end, center of other end, radius open // remove end caps texture {tx_fosca} } } #end #macro gera_tanquesC(xx, yy) union { #local p1 = ; #local q1 = ; #local q2 = <2+xx, yy, 0.7>; #local q3 = ; #declare A[num_ponta_tanque] = q1; #declare num_ponta_tanque = num_ponta_tanque + 1; box { , // near lower left corner, far upper right corner texture {tx_plastico} } sphere { , 1 // , radius texture {tx_plastico} } cylinder { , , 0.1 // center of one end, center of other end, radius open // remove end caps texture {tx_fosca} } cylinder { , <2+xx, yy, 0.7>, 0.1 // center of one end, center of other end, radius open // remove end caps texture {tx_fosca} } cylinder { , , 0.1 // center of one end, center of other end, radius open // remove end caps texture {tx_fosca} } } #end #macro gera_tanques_grade(m, n) #local tipo_tanque = int(3*rand(semente)); #if(tipo_tanque = 0) object {gera_tanquesA(m, n)} #end #if(tipo_tanque = 1) object {gera_tanquesB(m, n)} #end #if(tipo_tanque = 2) object {gera_tanquesC(m, n)} #end #end // #macro gera_tubulacoes(p, q) // union { // cylinder { // p, , 0.1 // center of one end, center of other end, radius // } // } // #end // Aqui est� a cena, finalmente: #declare m_atual = 0; #while(m_atual < M) #declare n_atual = 0; #while(n_atual < N) object {gera_tanques_grade(m_atual, n_atual)} #declare n_atual = n_atual + 10; #end #declare m_atual = m_atual + 10; #end // #declare ponta_tanque_atual = 0; // #while(ponta_tanque_atual < M*N) // object{gera_tubulacoes(ponta_tanque_atual, ponta_tanque_atual)} // #declare ponta_tanque_atual = ponta_tanque_atual + 1; // #end union{ object{ eixos(3.00) } object{ chao translate < 0,0,-5 > texture{ tx_xadrez } } // object {gera_tanques_grade(2, 2)} } #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, 1.00 >; #declare raio_cena = 30.0; #declare dir_camera = < 200.00, 200.00, 50.00 >; #declare dist_camera = 5*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)