// TP06 - 07/10/03 #include "colors.inc" // ====================================================================== // CÂMERA camera { location < 0, 0.00, 30.00 > // Posição do observador. right -1.0*x // Largura RELATIVA da imagem. up 0.75*y // Altura RELATIVA da imagem. sky y // Qual direção é "para cima"? look_at < 0.00, 10.00, 0.00 > // Para onde a câmera está apontando. } // Nota: os parâmetros "right" e "up" devem ter a mesma proporção // que os parâmetros ${WIDTH} e ${HEIGHT} no Makefile. // ====================================================================== // FONTES DE LUZ light_source { 10 * < +50.0, +30.0, +50.0 > // Posição da lâmpada. color rgb 1.2 * < 1.00, 1.00, 1.00 > // Intensidade e corda luz. } light_source { 10 * < +50.0, -10.0, +10.0 > // Posição da lâmpada. color rgb 0.8 * < 1.00, 1.00, 1.00 > // Intensidade e corda luz. } light_source { 200*<30, 1, 2> color 0.8*White } light_source { 200*<30, 20, 20> color 0.8*White } light_source { 200*<-5, 20, 20> color 0.9*White } // ====================================================================== // DESCRIÇÃO DA CENA background{ color rgb < 0.75, 0.80, 0.85 > } #declare fonte_r = seed(4); #declare fonte_g = seed(7); #declare fonte_b = seed(3); #declare cor_r = rand(fonte_r); #declare cor_g = rand(fonte_g); #declare cor_b = rand(fonte_b); #declare tinta_aleatoria = texture { pigment { rgb < cor_r, cor_g, cor_b > } finish { diffuse 0.5 specular 0.5 roughness 0.005 ambient 0.1 } } #declare tinta_azul = texture { pigment { LightGray } finish { diffuse 0.5 specular 0.5 roughness 0.005 ambient 0.1 } } #declare tinta_amarela = texture { pigment { Yellow } finish { diffuse 0.5 specular 0.5 roughness 0.005 ambient 0.1 } } #declare noh = sphere { <0,0,0>, 0.7 texture { tinta_azul } } #declare conexao = cylinder { < 0.00, 0.00, 0.00>, < 0.00, 5.00, 0.00>, 0.1 texture { tinta_amarela } } #declare pacote1 = box { < -0.50, 0.00, 0.50 >, < 0.50, 1.00, -0.50> } #declare pacote2 = cone { < 0.00 ,0.00 ,0.00 >, 0.5 < 0.00, 1.50, 0.00 >, 0.0 } #declare pacote3 = cylinder { < 0.00, 0.00, 0.00>, < 0.00, 1.00, 0.00>, 0.5 } // Aqui está a cena: union { #declare dim_malha_x = 2; #declare dim_malha_y = 2; #declare fonte_r = seed(476); #declare fonte_g = seed(756); #declare fonte_b = seed(653); #declare fonte_pacote_x = seed(3432); #declare fonte_pacote_y = seed(332); #declare i = 1; #declare x_noh = -5; #while (i <= dim_malha_x) #declare j = 1; #declare y_noh = 10; #while (j <= dim_malha_y) #declare tipo_pacote_x = rand(fonte_pacote_x); #declare tipo_pacote_y = rand(fonte_pacote_y); #declare cor_r = rand(fonte_r); #declare cor_g = rand(fonte_g); #declare cor_b = rand(fonte_b); object { noh translate < x_noh, y_noh, 0.0 > } object { conexao translate } #if (tipo_pacote_y < 0.33) object { pacote1 translate pigment { color rgb } } #else #if (0.33 <= tipo_pacote_y < 0.66) object { pacote2 translate pigment { color rgb }} #else object { pacote3 translate pigment { color rgb }} #end #end #declare cor_r = rand(fonte_r); #declare cor_g = rand(fonte_g); #declare cor_b = rand(fonte_b); object { conexao rotate -90*z translate } #if (tipo_pacote_x < 0.33) object { pacote1 translate pigment { color rgb } } #else #if (0.33 <= tipo_pacote_x < 0.66) object { pacote3 translate pigment { color rgb }} #else object { pacote2 translate pigment { color rgb }} #end #end #declare y_noh = y_noh + 5; #declare j = j + 1; #end object { noh translate < x_noh, y_noh, 0.0 > } object { conexao rotate -90*z translate } #declare tipo_pacote_x = rand(fonte_pacote_x); #declare tipo_pacote_y = rand(fonte_pacote_y); #if (tipo_pacote_x < 0.33) object { pacote1 translate pigment { color rgb } } #else #if (0.33 <= tipo_pacote_x < 0.66) object { pacote2 translate pigment { color rgb }} #else object { pacote3 translate pigment { color rgb }} #end #end #declare x_noh = 5 + x_noh; #declare i = i + 1; #end #declare j = 1; #declare y_noh = 10; #while (j <= dim_malha_y) #declare cor_r = rand(fonte_r); #declare cor_g = rand(fonte_g); #declare cor_b = rand(fonte_b); #declare tipo_pacote_x = rand(fonte_pacote_x); #declare tipo_pacote_y = rand(fonte_pacote_y); object { noh translate < x_noh, y_noh, 0.0 > } object { conexao translate } #if (tipo_pacote_y < 0.33) object { pacote1 translate pigment { color rgb } } #else #if (0.33 <= tipo_pacote_y < 0.66) object { pacote2 translate pigment { color rgb }} #else object { pacote3 translate pigment { color rgb }} #end #end #declare y_noh = y_noh + 5; #declare j = j + 1; #end object { noh translate < x_noh, y_noh, 0.0 > } }