// Last edited on 2004-01-23 19:18:47 by stolfi // TP07 - 14/10/03 #include "colors.inc" // ====================================================================== #declare ctr = < 0, 0, 0 >; #declare camDir = < 7, 3, 30 >; camera { location ctr + 1.05*camDir right -1.00*x up 0.75*y sky y look_at ctr } light_source { 10 * < +30, +50, 50 > color rgb 1.2 * < 1, 1, 1 > } light_source { 10 * < +50, -10, 50 > color rgb 0.8 * < 1, 1, 1 > } light_source { 200 * < -10, 50, 50 > color rgb 0.6 * < 1, 1, 1 > } //---------------------------------------------- // Parâmetros da Animação #if (clock < 0.75) #declare tp = (clock-0.0)/(0.75-0.0); #declare pos_carro = (1-tp)*8 + tp*(-3); #declare pos_letreiro = (1-tp)*(-32) + tp*(-7.5); #declare pos_formula = 50; #declare pos_torus = 50; #declare raio_torus = 0.5; #else #declare tp = (clock-0.75)/(1.0-0.75); #declare pos_carro = -3; #declare pos_letreiro = 50; #declare pos_formula = -8; #declare pos_torus = 4; #declare raio_torus = (1-tp)*(0.01) + tp*(0.35); #end // ====================================================================== // 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.8 specular 0.3 roughness 0.005 ambient 0.1 } } #declare tinta_cinza = texture { pigment { LightGray } finish { diffuse 0.8 specular 0.3 roughness 0.005 ambient 0.1 } } #declare tinta_amarela = texture { pigment { Yellow } finish { diffuse 0.8 specular 0.3 roughness 0.005 ambient 0.1 } } #declare noh = sphere { <0,0,0>, 0.9 texture { tinta_cinza } } #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 } #declare dim_malha_x = 6; #declare dim_malha_y = 5; // Aqui está a cena: union { #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 fonte_pos_pacote_x = seed(5454); #declare fonte_pos_pacote_y = seed(5554); #declare fonte_multiplicador = seed(78643); #declare fonte_mais_um = seed(4362); #declare fonte_um = seed(2541); #declare i = 1; #declare x_noh = -12; #while (i <= dim_malha_x) #declare j = 1; #declare y_noh = -10; #while (j <= dim_malha_y) object { noh translate < x_noh, y_noh, 0.0 > } #declare tipo_pacote_x = rand(fonte_pacote_x); #declare tipo_pacote_y = rand(fonte_pacote_y); #declare multiplicador = rand(fonte_multiplicador) * 6; #declare pos_pacote_x = rand(fonte_pos_pacote_x) * multiplicador; #declare pos_pacote_y = rand(fonte_pos_pacote_y) * multiplicador; #declare cor_r = rand(fonte_r); #declare cor_g = rand(fonte_g); #declare cor_b = rand(fonte_b); #declare um = rand(fonte_um); #declare mais_um = rand(fonte_mais_um); #declare pos_x_animado = (1-clock) * (x_noh + pos_pacote_x) + clock * (x_noh + 5); #declare pos_y_animado = (1-clock) * (y_noh + pos_pacote_y) + clock * (y_noh + 4.5); #if (j != dim_malha_y ) object { conexao translate } #if (um <=0.5) #if (tipo_pacote_y < 0.33) object { pacote1 translate pigment { color rgb }} #else #if (tipo_pacote_y >= 0.33 & tipo_pacote_y < 0.66) object { pacote2 translate pigment { color rgb }} #else object { pacote3 translate pigment { color rgb }} #end #end #end #if (mais_um <=0.5) #declare tipo_pacote_y = rand(fonte_pacote_y); #declare multiplicador = rand(fonte_multiplicador) * 6; #declare pos_pacote_y = rand(fonte_pos_pacote_y) * multiplicador; #declare cor_r = rand(fonte_r); #declare cor_g = rand(fonte_g); #declare cor_b = rand(fonte_b); #declare pos_y_animado = (1-clock) * (y_noh + 4.5 - pos_pacote_y) + clock * (y_noh-0.7); #if (tipo_pacote_y < 0.33) object { pacote1 translate pigment { color rgb }} #else #if (tipo_pacote_y >= 0.33 & tipo_pacote_y < 0.66) object { pacote2 translate pigment { color rgb }} #else object { pacote3 translate pigment { color rgb }} #end #end #end #end #if (i != dim_malha_x ) #declare um = rand(fonte_um); #declare mais_um = rand(fonte_mais_um); object { conexao rotate -90*z translate } #if (um <=0.5) #declare cor_r = rand(fonte_r); #declare cor_g = rand(fonte_g); #declare cor_b = rand(fonte_b); #if (tipo_pacote_x < 0.33) object { pacote1 translate < pos_x_animado, y_noh-0.7, 0.0 > pigment { color rgb }} #else #if (tipo_pacote_x >= 0.33 & tipo_pacote_x < 0.66 ) object { pacote2 translate < pos_x_animado, y_noh-0.7, 0.0 > pigment { color rgb }} #else object { pacote3 translate < pos_x_animado, y_noh-0.7, 0.0 > pigment { color rgb }} #end #end #end #if (mais_um <=0.5) #declare tipo_pacote_x = rand(fonte_pacote_x); #declare multiplicador = rand(fonte_multiplicador) * 6; #declare pos_pacote_x = rand(fonte_pos_pacote_x) * multiplicador; #declare cor_r = rand(fonte_r); #declare cor_g = rand(fonte_g); #declare cor_b = rand(fonte_b); #declare pos_x_animado = (1-clock) * (x_noh + 5 - pos_pacote_x) + clock * x_noh; #if (tipo_pacote_x < 0.33) object { pacote1 translate < pos_x_animado, y_noh-0.7, 0.0 > pigment { color rgb }} #else #if (tipo_pacote_x >= 0.33 & tipo_pacote_x < 0.66 ) object { pacote2 translate < pos_x_animado, y_noh-0.7, 0.0 > pigment { color rgb }} #else object { pacote3 translate < pos_x_animado, y_noh-0.7, 0.0 > pigment { color rgb }} #end #end #end #end #declare y_noh = y_noh + 5; #declare j = j + 1; #end #declare x_noh = 5 + x_noh; #declare i = i + 1; #end }