//
// ======================================================================
// CÂMERA 

camera {
  location  < 50.00, 40.00, 18 >  // Posição do observador.
  right     -1.00*x                // Largura RELATIVA da imagem.
  up        0.50*y                 // Altura RELATIVA da imagem.      
  sky       z                      // Qual direção é "para cima"?
  look_at   <  0, 20, 5 >  // Para onde a câmera está apontando.
} 
// Nota: os parâmetros "right" e "up" devem ter a mesma proporção
// que os parâmetros ${WIDTH} e ${HEIGHT} no Makefile.

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

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

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

background{ color rgb < 0.75, 0.80, 0.85 > }

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

#declare tinta_B = 
  texture {
    pigment { color rgb < 0.50, 0.60, 0.70 > }
    finish { diffuse 0.5 specular 0.5 roughness 0.001 ambient 0.1  }
  }

#declare tinta_C =  
  texture {
    pigment { color rgb < 0.90, 0.40, 0.00 > }
    finish { diffuse 0.5 specular 0.5 roughness 0.005 ambient 0.1 }
  }

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

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

#declare tinta_F = 
  texture {
    pigment { color rgb < 0.80, 0.90, 0.80 > }
    finish { diffuse 0.5 specular 0.5 roughness 0.005 ambient 0.1 }
  }


#declare fi    = 10;
#declare omegha = 15;
#declare teta  = 20;
#declare beta  = 30;
#declare alfa  = 60;

#declare CLK = clock;

#declare dedo1 =
  cylinder {
    <0,0,0> 
    <0,0,-3> 0.5
    texture {tinta_A}	
}

#declare dedo2 =
  cylinder {
    <0,0,0> 
    <0,3,0> 0.5
    texture {tinta_A}	
}

#declare dedo3 =
  cylinder {
    <0,0,0> 
    <0,3,0> 0.5
    texture {tinta_A}	
}

#declare mao = 
  union {
    box {
      <-1.5,0,-2.5>
      < 1.5,5, 2.5>
      texture {tinta_B}
    }
    object {dedo1 rotate -fi*x*CLK    translate <0.75,3.0,-2.0>}
    object {dedo2 rotate -omegha*x*CLK translate <0.75,4.9,-0.5>}
    object {dedo3 rotate  teta*x*CLK  translate <0.75,4.9,1.5>}
}

#declare antebraco = 
  union {
   cylinder { 
     <0,0,0>
     <0,13,0> 1.5
     texture {tinta_C}
   }
   object {mao rotate beta*x*CLK rotate 70*y*CLK translate <0,12.8,0>}
}  

#declare braco = 
  union {
    cylinder {
      <0,0,0>
      <0,18,0> 2.5
      texture {tinta_D}
    }
    object {antebraco rotate alfa*x*CLK translate <0,17.8,0>}
  }

plane {z,-6.0
  texture {
    pigment {color rgb < 1.00, 0.80, 0.25 > }
    finish {ambient 0.1 diffuse 0.9 }
    scale 2
    rotate 45*y
  }
}

union{
  object {braco}
}