// Last edited on 2007-07-23 20:28:00 by stolfi
// Processed by remove-cam-lights

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

#declare raio = 2.000;

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

#declare tinta_B =
  texture {
    pigment { color rgb < .50, 0.50, 0.50 > }
    finish { diffuse 0.5 specular 0.5 roughness 0.005 ambient 0.1 }
  }

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

#declare tinta_D =
  texture {
    pigment { color rgb < 0.10, 0.20, 0.50 > }
    finish { diffuse 0.5 specular 0.5 roughness 0.005 ambient 0.1 }
  }

#declare bola =
  sphere {
    < 0.00, 0.00, 0.00 >, 2.0
    texture { tinta_B }
  }

#declare furo =
  cylinder {
    < -1.00, -2.00, -2.00 >,
    < +1.00, +2.00, +2.00 >,
    2.00
    texture { tinta_B }
  }

#declare pino =
  cylinder {
    < -2.00, +2.00, -1.00 >,
    < +2.00, -2.00, +1.00 >,
    0.75
    texture { tinta_B }
  }

#declare caixa =
  box {
    < -2.00, 1.00, 2.00 >,
    < +2.00, -1.00, -2.00 >
    texture { tinta_B }
  }

#declare cabeca =
 cone {
    < 0, 0, 1.5 >, 0.2
    < 0, 0, 3.0 >, 1.0
    texture { tinta_B }
}

#declare cabeca1 =
 sphere {
   <0, 0, 2.25 >, 1
   texture { tinta_B }
}

#declare orelha =
 sphere {
   < 0.3, -.5, 3.2 >, 0.4
   texture { tinta_B }
}

#declare lanca =
  cylinder {
    < -2.00, +2.00, -1.00 >,
    < +2.00, -2.00, +1.00 >,
    0.05
    texture { tinta_B }
  }

#macro mao()
union{
   box{ < 0, 0, 0 >,
        < 0.5, 0.5, 0.2 >
      texture { tinta_B }}
   lanca
}
#end

#macro antebraco(a4)
   union{
     cylinder{ <0,0,0>, <2,0,0>, .2
               texture { tinta_B }
             }
     object{ mao()
             rotate a4*x
             translate 2*x
     }
  }
#end

#macro braco(a3,a4,a5)
   union{
     cylinder{ <0,0,0>, <1.5,0,0>, 0.3
               texture { tinta_B }
             }
     object{antebraco(a4)
         rotate a3*y
         translate 1.5*x
 }
rotate a5*y
}
#end

#macro pe()
   box{ < 0, 0, 0 >,
        < 0.5, 0.5, 0.2 >
      texture { tinta_B }}
#end

#macro canela(a2)
   union{
     cylinder{ <0,0,0>, <2,0,0>, .4
               texture { tinta_B }
             }
     object{ pe()
             rotate a2*x
             translate 2*x
     }
  }
#end

#macro perna(a1,a0,a6)
   union{
     cylinder{ <0,0,0>, <0,0,-1.5>, 0.6
               texture { tinta_B }
             }
     object{canela(a0)
         rotate a1*y
         translate -1.5*z
     }
rotate a6*y
}
#end

union{
  intersection{
    object { bola }
    object { caixa }
  }
  intersection{
    object { cabeca }
    object { cabeca1 }
  }
}

object {orelha
        scale <.5, 1., 1.>
}
object {orelha
        scale <.5, 1., 1.>
        translate <0, 1, 0>
}

#declare bd1 = -50 - 20*clock;
#declare bd2 = 0;
#declare bd3 = 10 - 30*clock;

#declare be1 = 45 - 90*clock;
#declare be2 = 10;
#declare be3 = -30*clock;

#declare pd1 = 45+90*clock;
#declare pd2 = 0;
#declare pd3 = 0;

#declare pe1 = 45+110*clock;
#declare pe2 = 0;
#declare pe3 = 0;

object {braco(bd1, bd2, bd3)
        translate <0, 1.2, 1.3>}

object {braco(be1, be2, be3)
        translate <0, -1.2, 1.3>}

object {perna(pe1, pe2, pe3)
        translate <0, -1, -2>}

object {perna(pd1, pd2, pd3)
        translate <0, 1, -2>}

// Original camera parameters:
// #local cam_ctr = <0,0,0>
// #local cam_vec = <8.00,3.00,5.00>
// #local cam_sky = z

#include "camlight.inc"
camlight(<0,0,0>,<10,7,5>,18.0,z,1.0)