// Last edited on 2004-01-22 21:11:10 by stolfi
//aleatorio:
//-cor dos nos
//-posicao dos pacotes
//-forma->cubo/esfera

#include "colors.inc"

background{ color rgb < 0.9, 1.0, 0.95 > }


light_source {
  < 0.00, 30.00, 30.00 >
  color rgb < 1.00, 1.00, 1.00 >
} 


#declare ctr = < 0.00, 0.00, 0.00 >;
#declare camDir = < 4.00, 12.00, 2.00 >;

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

//TEXTURAS E CORES

#declare fonte=seed  (338964);
#declare fonte2=seed (292536);
#declare fonte3=seed (493479);


//EIXOS

#declare eixoX =
cylinder{
   <3, 0, 0 >
   <-3, 0 ,0 >
  0.1
  texture {
  pigment { color Red filter 1}}
}

#declare eixoY =
cylinder{
   <0, 3, 0 >
   <0, -3 ,0 >
  0.1
  texture {
  pigment { color Blue filter 1}
  }
}


//OBJETOS


#declare noh =
   torus{ .3 .2
//  texture {tx_espelho}
   }


#declare grade=
union{
  #declare i=-2;

  #while (i<3)
     union{
    object{ cylinder{
      <-4,0,i*2>
      <4,0,i*2>
      0.05
      texture {
      pigment { color White }}
    }}

    object{ cylinder{
      <i*2,0,-4>
      <i*2,0,4>
      0.05
      texture {
      pigment { color White }}
    }}
     }
     #declare i=i+1;
  #end
}



#declare nohs =
union{
  #declare i=-2;

  #while (i<3)
     #declare j=-2;
     #while (j<3)
    object{ noh translate<i*2,0,j*2> 
      texture{pigment {color <(rand(fonte2))*2,rand(fonte)*1.5,rand(fonte)*1.9>}}
    }
    #declare j=j+1;
     #end
     #declare i=i+1;
  #end

}

#declare bola=
  sphere {
          <0, 0, 0>   
                0.40
                 texture {pigment{rgb <1,1,.5> }
                 }
              }


#declare cubo=
  box{
      <-.3, -.3,-.3 >
      < .3 ,.3 ,.3 >
            texture {pigment{rgb <0,0,1> }}
  }






#declare pacotes=

#declare j=0;
#while(j<3)
   #declare i=-2;
   #while (i<3)
  #if (rand(fonte)<.7)
       object{bola translate <i*2,0,(rand(fonte2)*8)-4>}
   #else
       object{cubo translate <(rand(fonte3)*8)-4,0,i*2>}
   #end
         #declare i=i+1;
   #end
   #declare j=j+1;
#end

//CENA

union{
  object{nohs}
  object{grade}
  object {pacotes}

}