// Last edited on DATE TIME by USER
// Processed by remove-cam-lights

#declare FONT="arial.ttf"

#declare tx_escada = texture
{
  pigment { color rgb <0.0, 0.5, 0.5> }
  finish { diffuse 0.9 ambient 0.1 }
}

#declare tx_fosca =
  texture{
    pigment{ color rgb < 1.00, 0.80, 0.80 > }
    finish{ diffuse 0.9 ambient 0.1 }
  }

#declare times = 3;

#macro Texto (txt, dx, sc)
  union {
    text{
       ttf FONT txt, .1, 0
       texture { pigment { color rgb <0.7, 0.2, 0.2> } finish { reflection 0.1 ambient 0.5 }  }
       translate <0, 0.1, 0>
       scale 0.5
    }
    box { <0, 0, -.05>, <dx, 0.5, -0.05> translate <0, 0, 0> texture {tx_escada}}
    cylinder { <0, 0, 0>, <3.6, 0, 0>, 0.1 texture { tx_fosca } translate <0, 0.5, 0> }
    union {
      cone { <dx/3, 0.5, 0>, 0.05, <dx/3, 0.5 + 0.6*sin(times*2*pi*clock), 0.4>, 0.2 texture { pigment {color rgb<0.1, 0.1, 0.8>} } }
      cone { <2*dx/3, 0.5, 0>, 0.05, <2*dx/3, 0.5 + 0.6*sin(times*2*pi*clock), 0.4>, 0.2 texture { pigment {color rgb<0.1, 0.1, 0.8>} } }
    }
    union {
      cone { <dx/3, 0.5, 0>, 0.05, <dx/3, 0.5 + 0.6*sin(times*2*pi*clock), -0.4>, 0.2 texture { pigment {color rgb<0.1, 0.1, 0.8>} } }
      cone { <2*dx/3, 0.5, 0>, 0.05, <2*dx/3, 0.5 + 0.6*sin(times*2*pi*clock), -0.4>, 0.2 texture { pigment {color rgb<0.1, 0.1, 0.8>} } }
    }
    scale sc
  }
#end

#macro TextAux (txt, dx, sc, sc2)
  union {
    object {Texto(txt, dx, sc)}
    rotate <90, 0, 90>
    translate <0.05, 0, 0>
    scale sc2
  }
#end

#macro TextoAux2(txt, dx, sc, tx, ty, tz, sc2)
  union {
    object { TextAux(txt, dx, sc, sc2) translate <tx, ty, tz> }
    translate <0, -dx/2, 0>
  }
#end

#macro quadro(tt)

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

#declare raio = 2.000;

#declare ctt = cos(2*pi*tt);

#declare stt = sin(2*pi*tt);

#declare tinta_A =
  texture {
    pigment { color rgb < 0.55 + 0.45*ctt, 0.80, 0.55 - 0.5*ctt > }
    finish { diffuse 0.5 specular 0.5 roughness 0.005 ambient 0.1 }
  }

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

#declare bola =
  sphere {
    < 0.00, 0.00, 0.00 >, 2.00
    texture { tinta_A }
  }

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

#declare pino =
  cylinder {
    < -2.00, +2.00, -1.00 >,
    < +2.00, -2.00, +1.00 >,
    0.5 + 0.3*stt
    texture { tinta_B }
  }

#include "eixos.inc"

#declare tampe = 1.5;
#declare tamap = 2;
#declare tamcoxa = 3;
#declare freqpe = 6;

#macro pe()
  union {

    object { cylinder { <0.25, 0, 0.25>, <0.25, tampe, 0.25>, 0.5 } texture { tx_escada } }
    object { sphere { <0.25, 0, 0.25>, 0.5 } texture {tx_escada} }
    object { sphere { <0.25, tampe, 0.25>, 0.5 } texture {tx_escada} }
  }
#end

#macro anteperna(a)
  union {
    union {
      object { cylinder { <0.25, 0.25, 0.25>, <0.25, 0.25, tamap-0.25>, 0.5 } texture { tx_escada } }
      object { sphere { <0.25, 0.25, 0.25>, 0.5 } texture {tx_escada} }
      object { sphere { <0.25, 0.25, tamap-0.25>, 0.5 } texture {tx_escada} }
      rotate <30, 0, 0>
    }
    object { pe() rotate <a, 0, 0>  translate <0, 0.25, 0> }
    translate <0, -tamap*sin(60) + 0.25, -tamap + 0.25>
  }
#end

#macro coxa()
  union {
    union {
      union {
        object { cylinder { <0.25, 0.25, 0.25>, <0.25, 0.25, tamap-0.25>, 0.5 } texture { tx_escada } }
        object { sphere { <0.25, 0.25, 0.25>, 0.5 } texture {tx_escada} }
        object { sphere { <0.25, 0.25, tamap-0.25>, 0.5 } texture {tx_escada} }
        translate <0, 0, -0.25>
      }
    }
    object { anteperna(25*sin(freqpe * pi * clock)) rotate <-15*sin(freqpe * pi * clock), 0, 0> translate <0, 0.1, 0>}
    translate <0, 0, -tamap + 0.25>

  }
#end

#macro corpo()
  union {
    union {
      object { coxa() translate <2, 0, 0> }
      object { coxa() translate <-2-0.25, 0, 0> }
      rotate <-18*sin(freqpe * pi * clock), 0, 0>
    }
    object { sphere { <0, 0, 0>, 2 } texture {tx_fosca} }
    translate <0, clock, 0>
  }
#end

union {
object { eixos(3.0) scale 2 }

  object { corpo() }

}

#end

#include "camlight.inc"
#declare centro_cena = < 0.0, 0.00, 0.00 >;
#declare raio_cena = 10.0;
#declare dir_camera = < 1, 1, 1 >;
#declare dist_camera = 10.0;
#declare intens_luz = 1.00;
camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)

quadro(clock)