// MC930 - POV-Ray, Exercicio 3
// Fabio de Souza Azevedo - RA 952215
// Aula de 18/03/2003
// (Terminado em casa em 25/03/2003)

background { color rgb < 0.15, 0.30, 0.07 > }


// Para ver meio em perspectiva
camera {
  location  < -1.5, 0.8, -3.3 >
  look_at   < 0.0,-0.35, 0.00 >
}  


light_source {
  < 0.00, 5.00, -15.00 >
  color rgb < 1.00, 1.00, 1.00 >
} 


// Exemplo do POV:
#include "colors.inc"


#declare blob_corpo_cabeca =
  blob {
    threshold .35
    sphere { <0.0,-0.5, 0.0>, 1.2, 1.5 pigment {Brown} }
    sphere { <0.0, 0.7, 0.0>, 0.7, 1.3 pigment {Brown} }
    finish { phong 1 }
  }


#declare barriga =
  sphere { <0.0, -0.55,-0.2>, 0.7 pigment {Red} }


#declare boca =
    torus {
       0.25, 0.15
       pigment {Red}
    }


#declare olhos =
  union {
    sphere {<-0.12, 0.65, -0.3>, 0.2 pigment {White} }
    sphere {< 0.12, 0.65, -0.3>, 0.2 pigment {White} }
    
    sphere {<-0.12, 0.60, -0.5>, 0.07 pigment {Black} }
    sphere {< 0.12, 0.60, -0.5>, 0.07 pigment {Black} }
  }
   

// Orelha definida na "origem", para ser transladada depois
#declare orelha =
    difference {
      sphere {<0.0, 0.0, 0.0>, 0.20 pigment {Brown} }
      sphere {<0.0, 0.0,-0.1>, 0.17 pigment {Brown} }
    }
    

#declare blob_braco =
  blob {
    threshold .35
    sphere {<-0.8, 0, 0>, 0.3, 1 pigment {Brown} }
    cylinder { <-0.8, 0, 0>, <-1.3, -1.4, 0>, 0.3, 1 }
    pigment {Brown}    
    finish { phong 1 }
  }


#declare roda =
  torus {
     0.2, 0.08
     pigment {Red}
  }


#declare eixo =
  union {
    cylinder { <0.0, -1.3, 0.0>, <0.0, -1.75, 0.0>, 0.1 }
    cylinder { <-0.4, -1.7, 0.0>, <0.4, -1.7, 0.0>, 0.1 }
  }
  
#declare garra =
  difference {
    intersection {
      sphere { <0.0, 0.15, 0.0>, 0.35 pigment {Red} } // x= -1.45
      sphere { <0.0, -0.15, 0.0>, 0.35 pigment {Red} }
    }
    sphere { <0.0, -0.2, 0.0>, 0.35 pigment {Red} }
  }


// Aqui está a cena, finalmente:

object { blob_corpo_cabeca }
object { barriga }
object { olhos }

object { orelha translate <-0.45, 0.8, 0.0> }
object { orelha translate < 0.45, 0.8, 0.0> }

object { boca translate <0.0, 0.35, -0.2> }
object { boca translate <0.0, 0.25, -0.2> }

object { blob_braco }
object { blob_braco rotate <0, 180, 0> }

// Garras de fora
object { garra translate <-2.15, -0.6, 0> rotate <0,0,30>}
object { garra translate < 2.15, -0.6, 0> rotate <0,0,-30>}

// Garras de dentro
object { garra translate <-0.1, -1.9, 0> rotate <0,180,30>}
object { garra translate < 0.1, -1.9, 0> rotate <0,180,-30>}

object { eixo }

object { roda rotate <90, 90, 0> translate <-0.2, -1.7, 0.0>}
object { roda rotate <90, 90, 0> translate < 0.2, -1.7, 0.0>}