// ====================================================================== // CORES E TEXTURAS background{ color rgb < 0.75, 0.2, 0.85 > } #declare tx_plastico = texture{ pigment{ color rgb < 0.90, 0.20, 0.20 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_transparente = texture{ pigment{ color rgb < 0.10, 0.80, 1.00 > transmit 0.8} finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } // ====================================================================== // DESCRI��O DA CENA #declare raio_nivel = 3; #declare tomate_base = sphere{ < 0.00, 0.00, 0.00 >, 0.5 texture{ tx_plastico } } #declare tomate_folha = box { <-0.5, -0.5, 0.5>, <0.5, 0.5, 0.65> // near lower left corner, far upper right corner texture{ tx_plastico } } #declare garrafa_agua_base = cylinder{ < +0.00, -0.00, -0.00 >, < +0.00, +0.00, +0.5 >, 0.2 texture{ tx_plastico } } #declare garrafa_agua_tampa = cone{ < 0, 0, 0.5 >, 0.2 < 0, 0, 0.8 >, 0.01 texture{ tx_plastico } } #declare garrafa_ketchup_base = box { <-0.5, -0.5, 0>, <0.5, 0.5, 1.2> texture{ tx_plastico } } #declare garrafa_ketchup_tampa = cylinder{ < +0.00, -0.00, 1.2 >, < +0.00, +0.00, 1.4 >, 0.4 texture{ tx_plastico } } #macro gerar_garrafa_agua(pos_x,pos_y) union{ object{garrafa_agua_base} object{garrafa_agua_tampa} translate } #end #macro gerar_tomate(pos_x,pos_y) union{ object{tomate_base} object{tomate_folha} translate } #end #macro gerar_garrafa_ketchup(pos_x,pos_y) union{ object{garrafa_ketchup_base} object{garrafa_ketchup_tampa} translate } #end // offsets dos tocos de canos (posicao tocos = posicao dos tanques + offset) #declare offsets_tocos_tomate = array[2]; #declare offsets_tocos_tomate[0] = <0,0.5,0.25>; #declare offsets_tocos_tomate[1] = <0.5,0,0.25>; #declare offsets_tocos_garrafa_agua = array[2]; #declare offsets_tocos_garrafa_agua[0] = <0,0.5,0.15>; #declare offsets_tocos_garrafa_agua[1] = <0,0.5,0.35>; #declare offsets_tocos_garrafa_ketchup = array[2]; #declare offsets_tocos_garrafa_ketchup[0] = <0,0.5,0.15>; #declare offsets_tocos_garrafa_ketchup[1] = <0,0.5,0.35>; #declare contador_m = 0; #declare contador_n = 0; #declare Nmax = 1000; #declare posicoes_tocos = array[Nmax]; #declare roleta = seed(99); #declare N = 0; #declare aresta_grade = 2; #macro gera_tanques(m,n) #while (contador_m < m) #while (contador_n < n) #local pos_x = int(aresta_grade*contador_m); #local pos_y = int(aresta_grade*contador_n); #local tipo_tanque = int(2*rand(roleta)); #local tipo_toco = int(rand(roleta)); #if(tipo_tanque=0) #declare posicoes_tocos[N] = + offsets_tocos_tomate[tipo_toco]; #declare posicoes_tocos[N+1] = + offsets_tocos_tomate[tipo_toco]; gerar_tomate(pos_x, pos_y) #end #if(tipo_tanque=1) #declare posicoes_tocos[N] = + offsets_tocos_garrafa_agua[tipo_toco]; #declare posicoes_tocos[N+1] = + offsets_tocos_garrafa_agua[tipo_toco]; gerar_garrafa_agua(pos_x, pos_y) #end #if(tipo_tanque=2) #declare posicoes_tocos[N] = + offsets_tocos_garrafa_ketchup[tipo_toco]; #declare posicoes_tocos[N+1] = + offsets_tocos_garrafa_ketchup[tipo_toco]; gerar_garrafa_ketchup(pos_x, pos_y) #end #declare contador_n = contador_n + 1; #declare N = N + 2; #end #declare contador_n = 0; #declare contador_m = contador_m + 1; #end #end #declare contador_N = 0; #macro gera_tubulacoes() #while (contador_N < N) // #local i = int(N*rand(roleta)); // #debug concat("i ", str(i)) // #local j = int(N*rand(roleta)); // #debug concat("j ", str(j)) #local i = 0; #local j = 4; #if(j>=i) #local j = j+1; #if (j = N) #local j = 0; #end #end cylinder{ posicoes_tocos[i], posicoes_tocos[j], 0.2 texture{ tx_plastico } } #declare contador_N = contador_N + 1; #end #end // Aqui est� a cena, finalmente: gera_tanques(2,2) gera_tubulacoes() #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, 0.00 >; #declare raio_cena = 6.0; #declare dir_camera = < 14.00, 7.00, 5.00 >; #declare dist_camera = 4*raio_cena; #declare intens_luz = 2.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)