// Last edited on 2003-04-12 18:50:32 by stolfi
// MC930 - Trabalho prático 6 - 1s2003
// Artur Manoel Passos RA 001388

#include "colors.inc"

background{ SummerSky }

#declare tx1 =
  texture {
    pigment { Silver }
    finish { diffuse 0.5 specular 0.5 roughness 0.005 ambient 0.1 }
  }

#declare logotipo =
 text {
   ttf "arial.ttf"
   "O Senhor dos Aneis"
   0.15, 0
   texture{ pigment { Red } } // faltava pigment -- stolfi
 } 


light_source {
< -80.00, 30.00, 70.00 >
  color rgb 1.2*< 1,1,1 >
}

light_source {
<80.00, 30.00, 70.00 >
  color rgb 1.2*< 1,1,1 >
}


#if (clock <0.1)
   #declare centrobola1 = -6;
   #declare centrobola2 = 6;
#else 
   #declare centrobola1 = ((clock-0.1) * 20) - 6;
   #declare centrobola2 = ((clock-0.1) * -20) + 6;
#end

#if (clock <0.4)
   #declare rbola12 = 0.9;
#else
   #declare rbola12 = 0.0;
#end

#if ((clock>=0.4) & (clock<0.45))
   #declare rbola3 = 3;
#else 
   #declare rbola3 = 0.0;
#end

#if (clock<0.4)
   #declare rcilindro = 0;
#else
   #if (clock<0.45)
      #declare rcilindro = 0.9;
   #else 
      #if (clock <0.8)
        #declare rcilindro = 0.9 + (3.1/0.35)*(clock-0.45);
      #else
	#declare rcilindro = 4;
      #end
   #end
#end

#if (clock<=0.8)
   #declare anguloanel = 0;
#else
   #if (clock <=0.9)
      #declare anguloanel = (clock-0.8)*900;
   #else 
       #declare anguloanel = 90;
   #end
#end

#if (clock>0.95)
// alterada posição do logotipo para ficar legível
object { logotipo translate <-4.6, -3.0, 14> scale 1.1}
#end

sphere { <centrobola1,2, 0>, rbola12 pigment {White}}
sphere { <centrobola2,2, 0>, rbola12 pigment {White}}
sphere { <0,2,0> rbola3 pigment{Yellow}}
difference {
  cylinder{ <0,1,0>, <0, 3, 0> rcilindro rotate <anguloanel,0,  0> }
  cylinder{ <0,0.9,0>, <0, 3.1, 0> rcilindro*0.9 rotate <anguloanel,0 ,0>}
  pigment {Yellow} // estava fora de lugar -- stolfi
}

camera {
  location  <  0, -0.5, 30.00 >
  right     <  0.80, 0.00, 0.00 >
  up        <  0.00, 0.00, 0.60 >
  sky       <  0.00, 1.00, 0.00 >
  look_at   <  0.00, 0.00, -50.00 >
}