// MC930A Decima Atividade de Laboratório utilizando POV-ray
// Autor: Mário Riudoms Sangenis  -  RA: 992198
// Last edited on 2003-05-31 16:05:14 by stolfi

#include "colors.inc"
#include "textures.inc"

#declare ctr = <0,0,0>;
camera {
  location  ctr + 1.8 * < 0, 0, 6 >
  right -1.0*x  up 0.5*y  sky y
  look_at ctr
} 

light_source { 50*< -15.00, 10.00, 15.00 > color 1.2*White } 
light_source { 50*< +15.00,  7.00, 15.00 > color 0.8*White } 
light_source { 50*<  +3.00,  2.00, 15.00 > color 0.4*White } 

background{ Gray50 }

#declare olho =
  union {
    sphere { <.27,0,.95>, .5 pigment {White} }
    sphere { <.27,0,1.2>, .3 pigment {Sapphire_Agate} }
    sphere { <.27,0,1.45>, .1 pigment {Black} }
}

// #declare cara =
//   sphere { <0,0,0>, 1 
//     pigment {image_map {gif "cara.gif"} translate <-.5, -.5, 0> scale <2,2,2>}
//   }


#declare face =
blob {
    threshold .3
    
    // cabeca
    sphere { <0,0,0>, 1.5, 1 scale <1, 2, 1>}

    // orelha
    sphere { <1.2,0.1,0>, 0.3, 1 scale <1, 2, 1>}
    sphere { <-1,0.1,0>, 0.3, 1 scale <1, 2, 1>}
    
    // nariz
    sphere { <-.18,-.1,1.2>, 0.18, 1 scale <1, 2.5, 1>}      
    sphere { <-.1,-.4,1.2>, 0.2, 1 scale <1.5, 1, 1>}  

    // olhos
    sphere { <.27,0,1>, .2, 1}
    sphere { <-.57,0,.95>, .2, 1}

    // boca
    sphere { <0,-.85,1>, 0.12, 1 scale <3, .9, 1> translate <-.1,-.18,0>}
    sphere { <0,-.85,1>, 0.12, 1 scale <1.5, .9, 1> rotate <0,0,30> translate <-.22,-.2,0>}
    sphere { <0,-.85,1>, 0.12, 1 scale <1.5, .9, 1> rotate <0,0,-30> translate <0,-.2,-.05>}

    finish { phong 1 }
  }

// Aqui está a cena, finalmente:

#declare cena =
union { 
  object { face 
    pigment {image_map {gif "cara.gif"} translate <-.5, -.5, 0> scale <3,3,3>}
    // pigment { White }
  }
  //chapeu
  sphere { <0,1.5,0>, 1.25 
    scale <1, .9, 1> 
    pigment {image_map {gif "chapeu.gif"} translate <-.5, -1, 0> scale <3.5,2,2>} 
  }
}

object { cena }
object { cena rotate -53*y translate -2.9*x }
object { cena rotate +53*y translate +2.9*x }