// Exemplo de arquivo de descricao de cena para POV-ray // Last edited on 2020-09-30 19:57:13 by jstolfi // ====================================================================== // CORES E TEXTURAS 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_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 N = 0; #declare TUBOS = array[1000]; #macro tanque_1(pos_x, pos_y) #local p1 = <1.8, 0, 1>; #local p2 = <-1.8, 0, 1>; #local p3 = <0, 1.8, 2>; #local p4 = <0, -1.8, 2>; #local tanque = union { cylinder { <0, 0, 0>, // Center of one end <0, 0, 3>, // Center of other end 1 // Radius } cone { <0, 0, 3>, 1 // Center of other end <0,0,4>, 0.3 } cylinder { <0, 0, 1>, // Center of one end p1, // Center of other end 0.2 // Radius } cylinder { <0, 0, 1>, // Center of one end p2, // Center of other end 0.2 // Radius } cylinder { <0, 0, 2>, // Center of one end p3, // Center of other end 0.2 // Radius } cylinder { <0, 0, 2>, // Center of one end p4, // Center of other end 0.2 // Radius } texture { tx_plastico } } #declare TUBOS[N] = p1 + ; #declare N = N + 1; #declare TUBOS[N] = p2 + ; #declare N = N + 1; #declare TUBOS[N] = p3 + ; #declare N = N + 1; #declare TUBOS[N] = p4 + ; #declare N = N + 1; object { tanque translate } #end #macro tanque_2(pos_x, pos_y) #local p1 = <1.4, 0, 1.5>; #local p2 = <-1.4, 0, 1.5>; #local p3 = <0, 1.4, 1.5>; #local p4 = <0, -1.4, 1.5>; #local tanque = union { cone { <0, 0, 0>, 0.3 // Center of other end <0,0,1>, 1 } cylinder { <0, 0, 1>, // Center of one end <0, 0, 2>, // Center of other end 1 // Radius } sphere { < 0,0,2 >, 1 } cylinder { <0, 0, 1.5>, // Center of one end p1, // Center of other end 0.2 // Radius } cylinder { <0, 0, 1.5>, // Center of one end p2, // Center of other end 0.2 // Radius } cylinder { <0, 0, 1.5>, // Center of one end p3, // Center of other end 0.2 // Radius } cylinder { <0, 0, 1.5>, // Center of one end p4, // Center of other end 0.2 // Radius } texture { tx_plastico } } #declare TUBOS[N] = p1 + ; #declare N = N + 1; #declare TUBOS[N] = p2 + ; #declare N = N + 1; #declare TUBOS[N] = p3 + ; #declare N = N + 1; #declare TUBOS[N] = p4 + ; #declare N = N + 1; object { tanque translate } #end #macro tanque_3(pos_x, pos_y) #local p1 = <1.4, 0, 1.5>; #local p2 = <-1.4, 0, 1.5>; #local p3 = <0, 1.4, 1.5>; #local p4 = <0, -1.4, 1.5>; #local tanque = union { cone { <0, 0, 0>, 1.4 // Center of other end <0,0,1.2>, 0.6 } cylinder { <0, 0, 1.2>, // Center of one end <0, 0, 3>, // Center of other end 0.6 // Radius } cone { <0, 0, 3>, 0.6 // Center of other end <0,0,4>, 1.4 } cylinder { <0, 0, 1.5>, // Center of one end p1, // Center of other end 0.2 // Radius } cylinder { <0, 0, 1.5>, // Center of one end p2, // Center of other end 0.2 // Radius } cylinder { <0, 0, 1.5>, // Center of one end p3, // Center of other end 0.2 // Radius } cylinder { <0, 0, 1.5>, // Center of one end p4, // Center of other end 0.2 // Radius } texture { tx_plastico } } #declare TUBOS[N] = p1 + ; #declare N = N + 1; #declare TUBOS[N] = p2 + ; #declare N = N + 1; #declare TUBOS[N] = p3 + ; #declare N = N + 1; #declare TUBOS[N] = p4 + ; #declare N = N + 1; object { tanque translate } #end #declare roleta = seed(31415); #macro gera_tanques(m,n) union { #for (XCount,0,m-1) #for (YCount,0,n-1) #local k = int(3*rand(roleta)); #if (k = 0) tanque_1(5*XCount, 5*YCount) #end #if (k = 1) tanque_2(5*XCount, 5*YCount) #end #if (k = 2) tanque_3(5*XCount, 5*YCount) #end #end #end } #end #macro tubulacao(p, q) #local altura = 2 + int(8*rand(roleta)); union { cylinder { p, // Center of one end , // Center of other end 0.2 // Radius } cylinder { , // Center of other end , // Center of other end 0.2 // Radius } cylinder { , // Center of other end q, // Center of one end 0.2 // Radius } texture { tx_plastico } } #end #macro gera_tubulacoes() union { #while (N > 0) #local i = int(N*rand(roleta)); #local j = int((N-1)*rand(roleta)); #if (j >= i) #local j = j + 1; #end tubulacao(TUBOS[i], TUBOS[j]) #declare TUBOS[i] = TUBOS[N-1]; #declare N = N - 1; #declare TUBOS[j] = TUBOS[N-1]; #declare N = N - 1; #end } #end #declare chao = box{ <-20,-20,-1>, <+20,+20,0> } #include "eixos.inc" // Aqui est� a cena, finalmente: union{ object{ eixos(3.00) } object{ gera_tanques(2, 3) } object{ gera_tubulacoes() } object{ chao translate < 0,0,-5 > texture{ tx_xadrez } } } #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, 1.00 >; #declare raio_cena = 15.0; #declare dir_camera = < 14.00, 7.00, 4.00 >; #declare dist_camera = 5*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)