// Last edited on DATE TIME by stolfi
// MC930 - Computação Gráfica - 2003-S2 - Jorge Stolfi
// Trabalho de Laboratório 07 - Rede de Computadores Animada
// Marilda Pereira Yamashiro 981756   14/10/2003
// ======================================================================

#declare ctr = < 0.00, -40.00, 0.00 >;
#declare camDir = (30*< 5.0, 20, 5 >) - (< 0.00, -40.00, 0.00 >);

camera {
  location   ctr + 1.00*camDir
  right      -1.00*x
  up         0.75*y
  sky        z
  look_at    ctr
}
 

// ======================================================================
// 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, 80.0, +10.0 >             // Posição da lâmpada.
  color rgb 0.8 * < 1.00, 1.00, 1.00 >   // Intensidade e corda luz.
} 

// ======================================================================
// DESCRIÇÃO DA CENA 

#include "colors.inc"
background{ color rgb < 0.85, 0.9, 1.0 > }

  
#declare pack =
  sphere {
    < 0.00, 0.00, 0.00 >, 5.00 
    pigment { Blue }
    } 
#declare rede = 
  cylinder {
    < 0, 0, 0 >,
    < 1, 1, 1 >,
    1.50
    pigment { Yellow }
  }   

union{

 #declare source  = seed(10);
 #declare source2 = seed(345);
 #declare i = 1;
 #declare j = 1;
 #declare pos_i = 0; 
 #declare pos_f1 = 0;
 #declare pos_f2 = 0;
 #declare pos_f3 = 0;
 #declare pos_f4 = 0;
 
 #while (j <=5 )
   #while (i <= 5)
      #if (rand(source) < 0.50)
          sphere { <i*30,rand(source)*30,0>,5 
                   pigment { color rgb < rand(source), rand(source2), rand(source) > }
                   translate <1,100*clock,1>
    }
      #else 
          sphere { <i*50,rand(source2)*50,0>,5 
                   pigment { color rgb < rand(source2), rand(source), rand(source2) > }
                   translate <1,100*clock,1>
      }    
    
      #end      
      #declare i=i+1;
   #end
   #if (rand(source) < 0.50)
          sphere { <rand(source)*60,j*50,0>,5 
                   pigment { color rgb < rand(source), rand(source2), rand(source) > }
                   translate <1,100*clock,1>
    }
       
      #else 
          sphere { <rand(source2)*80,j*30,0>,5 
                   pigment { color rgb < rand(source2), rand(source), rand(source2) > }
                   translate <1,100*clock,1>
    }       
       
      #end      
   #declare j=j+1;
 #end
}