// Last edited on 2003-04-12 20:24:41 by stolfi
// Exercicio 6 - MC930
// Nilton Volpato - RA 003243
// O Senhor dos Toróides

#include "colors.inc"
#include "golds.inc"
#include "stones.inc"
//#include "textures.inc"



//----------------------------------------------
// Parâmetros da Animação

#if ( clock <= 3/7 )
  #declare rotacao_x_camera = 90 - 90*(clock/(3/7));
  #declare raio_menor_1 = clock/(3/7);
  #declare raio_menor_2 = 1-clock/(3/7);
#else
  #declare rotacao_x_camera = 0;
  #declare raio_menor_1 = 1;
  #declare raio_menor_2 = 0;
#end

#if ( clock <= 4/7 )
  #declare posicao_z_texto = 0;
  #declare tamanho_texto = 0;
#else
  #declare posicao_z_texto = 0 - 10*( (clock - 4/7)/(1-4/7) );
  #declare tamanho_texto = (clock - 4/7)/(1-4/7);
#end

#declare cor_ceu = (clock)*<0.2, 0.3, 0.9> + (1-clock)*<0.89, 0.47,0.20>;



background { color cor_ceu }

//----------------------------------------------
// Luzes, Câmeras, ...

light_source {
  3*< 15.00, 20.00, -40.00 >
  color rgb 1.2 * < 1, 1, 1 >
}

camera {
  location  < 0, 0, -30 >
  right <4/3,0,0>
  up <0,1,0>
  look_at <0,0,0>
  
  rotate <rotacao_x_camera, 0, 0>
} 



//----------------------------------------------
// Cores e Texturas

#declare cor_toro = 
  texture {
    T_Gold_4A
  }



//----------------------------------------------
// Objetos

#declare toro_1 = 
  torus {
    8, 3*raio_menor_1
    texture { cor_toro }
  }

#declare toro_2 =
  torus {
    8, 3*raio_menor_2
    texture { cor_toro }
  }

#declare nome_filme =
  text {
    ttf "latinwd.ttf"
    "O Senhor dos Toroides"
    0.2, 0
  }


//----------------------------------------------
// Cena


object { 
  toro_1
  rotate <90,0,0>
}

object {
  toro_2
  rotate <90,90,0>
  translate <0,4,0>
}

#if ( tamanho_texto != 0 )
   object { 
     nome_filme
     scale <1,3,1>
     scale tamanho_texto
     translate <posicao_z_texto*9/10,0,posicao_z_texto>

     texture {
       pigment {
	 color rgb <0,1,1>
       }
       finish { ambient 0.3 diffuse 0.8 } // acrescentado -- stoli
     }
   }
#end


plane {
  y, -10
  texture { T_Grnt1 }
  //pigment { checker color Black color White scale 5 }
}