// Last edited on 2003-11-27 02:13:59 by stolfi
// ======================================================================

#declare posCarro = <200*clock-100,0,0>;
#declare posCamera = <150*clock-20,40+30*clock,30+30*clock>;

camera {
  location   posCamera
  right      -1.00*x
  up         0.75*y
  sky        z
  look_at    posCarro
}
 

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

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

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

light_source {
  posCarro + <0,5,8>             // Posição da lâmpada.
  color rgb 0.6 * < 1.00, 1.00, 1.00 >   // Intensidade e corda luz.
} 
light_source {
  posCarro + <0,-5,8>             // Posição da lâmpada.
  color rgb 0.6 * < 1.00, 1.00, 1.00 >   // Intensidade e corda luz.
} 


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

background{ color rgb < 0.1, 0.1, 0.1 > }

#declare raio = 2.000;
//#declare clock

#declare corPrato = 
  texture {
    pigment { color rgb < 0.00, 0.70, 0.70 > }
    finish { diffuse 0.9 specular 0.5 roughness 0.005 ambient 0.1 }
  }

#declare cera = 
  texture {
    pigment { color rgb < 0.9, 0.9, 0.7 > }
    finish { diffuse 0.5 specular 1.0 roughness 0.5 ambient 0.5 }
  }
  
#declare cor_espelho = < 0.70, 0.40, 0.1 >;
#declare cor_prata = < 0.9, 0.9, 0.9 >;

#declare espelho = 
  texture {
    pigment { color rgb  cor_espelho}
    finish { diffuse 0.5 specular 0.20 roughness 0.05 ambient 0.05 reflection cor_espelho}
  }

#declare prata = 
  texture {
    pigment { color rgb  cor_prata}
    finish { diffuse 0.5 specular 0.20 roughness 0.05 ambient 0.05 reflection cor_espelho}
  }


#declare toalha = 
  texture {
    pigment {color <0.1,0.8,0.1>}//, color <1, 0, 0>}
//    finish { diffuse 0.5 specular 0.3 roughness 0.05 ambient 0.6}
  }


#declare faca = 
union{
  sphere {<0,0,0> 1 scale<0.4,8,2> translate<0,4,0>}
  difference {
    cylinder{<0.01,0,0> <-0.01,0,0> 1}
    box{<1,1,0> <-1,-1,1>}
    scale<1,10,4>
    translate<0,-4,2>
  }
  texture {prata}
}

#declare prato =
difference {
  sphere{<0,0,0> 1}
  sphere{<1.3,0,0> 1}
  scale<0.4,2,2>
  texture {corPrato}
}

#declare base = 
prism {
	0, 1, 6
#declare i=0;
#while(i<6)
<cos(i*pi/3),sin(i*pi/3)>
#declare i=i+1;
#end
texture{espelho}
scale <4,2,4>
rotate <90,0,0>
}

#declare haste =
lathe {
quadratic_spline
20
#declare i=0;
#while(i<20)
<2 + cos(i*pi/4),i>
#declare i=i+1;
#end
texture{espelho}
rotate <90,0,0>
}

#declare suporte = 
lathe {
quadratic_spline
10
#declare i=0;
#while(i<10)
<i*0.4,i*i*0.04>
#declare i=i+1;
#end
rotate<90,0,0>
texture{espelho}
}

#declare vela=
cylinder {
<0,0,0> <0,0,10> 1
texture{cera}
}

#declare candelabro =
union {
object {base}
object {haste translate<0,0,2>}
object {suporte translate <0,0,20>}
object {vela translate<0,0,21>}
}

#declare faixa =
union{
text{ttf "ariblk.ttf" "CHEGADA" 0.3 0 rotate<90,0,90> pigment{color <1,0,0>} scale<2,2,2> translate<0,-5,1>}
box{<0,-6,0> <0.1,6,4> pigment{color <1,1,1>}}
}


#declare carro = 
union {
object {faca}
object {prato translate<0.8,5,-3>}
object {prato translate<0.8,-5,-3>}
object {prato translate<0.8,5,-3> scale<-1,1,1>}
object {prato translate<0.8,-5,-3> scale<-1,1,1>}
translate<0,0,5>
//scale <,0.5,0.5>
rotate<0,0,90>
}

#declare portal = 
union {
object {candelabro translate<0,10,0>}
object {candelabro translate<0,-10,0>}
object {faixa translate<0,0,25>}
}

union {
	object{plane{<0,0,1> 0 texture{toalha}}}
	object{portal}
	object{carro translate posCarro}
}