// Last edited on 2007-07-23 22:36:41 by stolfi
// Processed by remove-cam-lights

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

#declare verde =
  texture {
    pigment { color rgb < 0.05 1 0.1 > }
    finish { diffuse 0.3 specular 0.3 roughness 0.005 ambient 0.1 }
  }

#declare preto =
  texture {
    pigment { color rgb < 0 0 0 > }
    finish { diffuse 0.4 specular 0.3 roughness 0.005 ambient 0.1 }
  }

#declare branco =
  texture {
    pigment { color rgb < 1 1 1 > }
  finish { diffuse 0.5 specular 0.5 roughness 0.005 ambient 0.1 }
  }

#declare marrom =
  texture {
    pigment { color rgb < 0.3 0.3 0.1 > }
    finish { diffuse 0.4 specular 0.3 roughness 0.005 ambient 0.1 }
  }

#declare olho =
union {
 sphere { <0,0,0> 1 texture { verde }}
 sphere { <0.2,0.2,0> 0.8 texture { branco }}
 sphere { <0.42,0.42,0> 0.55 texture { preto }}
}

#declare tronco = sphere { <0,0,0> 5 scale 0.65*z texture { verde }}

#declare cabeca =
 difference {
  union {
   sphere { <4,4,1> 3 texture { verde }}
   object { olho rotate -40*z translate <5,3.5,4> }
   object { olho rotate 40*z translate <3.5,5,4> }
  }
  cylinder { <0, 0, 0>, < 3, 3, 0 >, 0.2 texture {preto} translate <6,5,1.5>  }
  cylinder { <0, 0, 0>, < 3, 3, 0 >, 0.2 texture {preto} translate <5,6,1.5>  }
  cylinder { <-4, -4, 0>, < 4, 4, 0 >, 0.15 texture {preto} rotate 90*z translate <6.05,6.05,0.5>  }
 }

#declare corpo =
union {
 object { tronco rotate 30*z }
 object { cabeca translate -0.5*z }
}

#declare lanca =
union {
 cylinder { < -1.5, 0, 0 >, < 8.00, 0, 0 >, 0.35 }
 cone { <8,0,0>, 0.8 <9,0,0>,0 }
}

#macro mao(arma)
union {
 sphere { <0,0,0> 0.8 }
 #if (arma) object { lanca texture {marrom} rotate <0,-25+50*clock,90-30*clock> } #end
}
#end

#macro antebraco(ang, tamBraco, arma)
union{
 cone { <0, 0, 0>,0.6 <tamBraco, 0, 0 >, 0.5 }
 sphere { <tamBraco,0,0> 0.5 }
 object { mao(arma) rotate ang*y translate (tamBraco+0.5)*x }
}
#end

#macro braco(angAnte, angMao, tamBraco, arma)
union{
 cone { <0, 0, 0>, 0.8 < 3, 0, 0 >, 0.6 }
 sphere { <3,0,0> 0.6 }
 object { antebraco(angMao, tamBraco,arma) rotate angAnte*y translate 3*x }
}
#end

#macro pata(angOmbroY,angOmbroZ angAnte, angMao, tamBraco, arma)
union{
 sphere { <0,0,0> 0.8 }
 object { braco(angAnte,angMao,tamBraco,arma) rotate <0,angOmbroY,angOmbroZ> }
 texture {verde}
}
#end

#macro sapo(dirOmbroY, dirOmbroZ, dirAnte, dirMao, esqOmbroY, esqOmbroZ, esqAnte, esqMao,
       dirPernaY, dirPernaZ, dirCoxa, dirPe, esqPernaY, esqPernaZ, esqCoxa, esqPe)
union {
 object { corpo texture {verde} rotate 45*z}

 object { pata(dirOmbroY,dirOmbroZ,dirAnte,dirMao,1.5,1) scale 1.1 translate <3.7,3,-1.5> }
 object { pata(esqOmbroY,esqOmbroZ,esqAnte,esqMao,1.5,0) scale 1.1 scale <-1,0,0> translate <-3.7,3,-1.5> }

 object { pata(dirPernaY,dirPernaZ,dirCoxa,dirPe,3.3,0) scale 1.8 translate <3.7,-3,0.5> }
 object { pata(esqPernaY,esqPernaZ,esqCoxa,esqPe,3.3,0) scale 1.8 scale <-1,0,0> translate <-3.7,-3,0.5> }
}
#end

#declare dOmbroY = -20 -10*clock;
#declare dOmbroZ = -40 +100*clock;
#declare dAnte   = -90 +90*clock;
#declare eOmbroY =  20 -30*clock;
#declare eOmbroZ =  90 -60*clock;
#declare eAnte   =   0 +80*clock;

object { sapo(dOmbroY,dOmbroZ,dAnte,0,  eOmbroY,eOmbroZ,eAnte,0, -20,0,90,0,  -20,0,90,0) }

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

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