// Last edited on 2003-11-27 01:43:59 by stolfi
// Exemplo de arquivo de descricao de cena para POV-ray

// ======================================================================
#declare zoom = 0.9;

#declare ctr = < 0, 0, 0 >;
#declare camDir = < 0,0, 30 >;

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

// ======================================================================
// FONTES DE LUZ

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

light_source {
  10 * < 0.0, -10.0, 10.0 >             // Posição da lâmpada.
  color rgb 0.9 * < 1.00, 1.00, 1.00 >   // Intensidade e corda luz.
} 

// ======================================================================
// DESCRIÇÃO DA CENA 
#declare C = 1/255;
background{ color rgb < 0.95, 0.90, 0.68 > }


#declare cor_cristal = <0.9,0.9,1>;
#declare tx_cristal = 
  texture {
    finish{
      ambient 0.1 diffuse 0.1
      reflection 0.15
      specular 1 roughness 0.001
    }
    pigment { color cor_cristal filter 1 }
  }

#declare cor_espelho = <0.1,0.1,0.2>;
#declare tx_espelho =
  texture {
    pigment { rgb cor_espelho }
    finish { ambient 0.05 
	     diffuse 0.05 
	     reflection 0.95
	     specular 0.20 roughness 0.05 
	   }
  }

#declare azul = 
  texture {
    pigment { color rgb < 0.10, 0.80, 1.00 > }
    finish { diffuse 0.9 specular 0.5 roughness 0.005 ambient 0.1 }
  }

#declare amarelo = 
  texture {
    pigment { color rgb < 1.00, 0.80, 0.10 > }
    finish { diffuse 0.9 specular 0.5 roughness 0.005 ambient 0.1 }
  }

#declare vermelho = 
  texture {
    pigment { color rgb < 1.0, 0.0, 0.0 > }
    finish { diffuse 0.9 specular 0.5 roughness 0.005 ambient 0.1 }
  }
#declare verde = 
  texture {
    pigment { color rgb < 0.0, 1.0, 0.0 > }
    finish { diffuse 0.9 specular 0.5 roughness 0.005 ambient 0.1 }
  }
#declare laranja = 
  texture {
    pigment { color rgb < 252*C, 200*C, 81*C > }
    finish { diffuse 0.9 specular 0.5 roughness 0.005 ambient 0.1 }
  }

#declare preto = 
  texture {
    pigment { color rgb < 0*C, 0*C, 0*C > }
    finish { diffuse 0.9 specular 0.5 roughness 0.005 ambient 0.1 }
  }
#declare xadrez =
texture {
pigment {checker color rgb <1,1,0.9>
	color rgb <0,0,0.9>
}
}

// Objetos
// Os eixos para auxilio
#declare  eixo_x = 
   cylinder {
    < -50, 0, 0 >,
    < 50, 0, 0 >,
    0.1
    texture { vermelho }
  }
#declare  eixo_y = 
   cylinder {
    < -50, 0, 0 >,
    < 50, 0, 0 >,
    0.1
    texture { verde }
    rotate <0,0,90>
  }
#declare  eixo_z = 
   cylinder {
    < -50, 0, 0 >,
    < 50, 0, 0 >,
    0.1
    texture { azul }
    rotate <90,90,0>
  }

#declare eixos = 
union{
  object{eixo_x}
  object{eixo_y}
  object{eixo_z}
}

//O Chao
#declare chao =
box{
  <-50,-50,0>,
  <50,50,-1>
  texture { xadrez }
}
//--------------------------------------------------------//
// 1-clock
#declare clock_inv = 1 - clock;

// Angulo do toro em y
#if (clock < 0.25)
 #declare ang_toro_y1 = 16*clock*360;
#else
 #declare ang_toro_y1 = 0;
#end

#if (clock > 0.75)
 #declare ang_toro_y2 = 16*clock_inv*360;
#else
 #declare ang_toro_y2 = 0;
#end

// Angulo do toro em x
#if (clock < 0.25)
  #if (clock > 0.125)
    #declare ang_toro_x1 = 16*clock*360;
  #else
    #declare ang_toro_x1 = 0;
  #end
#else
  #declare ang_toro_x1 = 0;
#end

#if (clock_inv < 0.25)
  #if (clock_inv > 0.125)
    #declare ang_toro_x2 = 16*clock*360;
  #else
    #declare ang_toro_x2 = 0;
  #end
#else
  #declare ang_toro_x2 = 0;
#end



//--------------------------------------------------------//
//--------------------------------------------------------//
// Logotipo
//
#declare texto_logotipo =
text{
  ttf "impact.ttf"
    "Formula Zero"
    0.2, 0
    pigment {color rgb <0,0,255>}
  translate <-2.5, 3*sin(3.14*clock),3*sin(3.14*clock)>
    //rotate <360*(1-clock),0,360*clock>
}

#declare pneu_logo = 
torus{
  4, 1
    rotate <-90+ang_toro_x1-ang_toro_x2,ang_toro_y1-ang_toro_y2,20*360*clock>  
    translate <0, 3*sin(3.14*clock),3*sin(3.14*clock)>
   texture {xadrez}
//pigment { color rgb < 0*C, 0*C, 0*C > }
}



#declare logotipo = 
union {
  object {texto_logotipo}
  object {pneu_logo}
}

//------------------------
//Portao

#declare my_lathe_1 = 
lathe {
    quadratic_spline
    6,
    <0,0>,<0,0.05>, <0,2>, <9,2>, <6,3>, <0,3.5>
      texture {tx_cristal}
    rotate 90*x
finish {
      ambient .3
      phong .75
    }
  }
#declare fact = 0.3;
#declare coluna_1 =
prism {
    linear_sweep
    linear_spline
    0, // sweep the following shape from here ...
    10, // ... up through here
    13, // the number of points making up the shape ...
    0.3*<3,5>, <0,0>, 0.3*<-3,5>, <0,0>, 0.3*<-5,0>, <0,0>, 0.3*<-3,-5>, <0,0>, 0.3*<3, -5>, <0,0>, 0.3*<5,0>, <0,0>, 0.3*<3,5>
    pigment {color rgb <0,1,0.5>  }
  }


  
// Aqui está a cena, finalmente:

union{
  //object{eixos}
  object{chao 
	   translate <0,0,-10>
	   rotate -90*x}
  object{my_lathe_1
	   rotate 90*x
	   translate <0,8,0>}
  object {coluna_1
	    translate <7,-4,0>}
  object {coluna_1
	    translate <-7,-4,0>}
  object{logotipo}
}