// CORES E TEXTURAS
#include "eixos.inc"
background{ color rgb < 0.75, 0.80, 0.85 > }


#declare random = seed (1153);

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

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

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

#declare tx_azul = 
  texture{
    pigment{ color rgb < 0, 0, 1> }
    finish{ diffuse 0.9 ambient 0.1 }
  }

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


#declare tx_marrom = 
  texture{
    pigment{ color rgb < 0.6, 0.3, 0> }
    finish{ diffuse 0.9 ambient 0.1 }
  }

#declare tx_espelho = 
  texture{
    pigment{ color rgb < 1.00, 0.85, 0.30 > }
    finish{ diffuse 0.2 reflection 0.7*< 1.00, 0.85, 0.30 > ambient 0.1 }
  }

#declare tx_vidro = 
  texture{
    pigment{ color rgb < 0.85, 0.95, 1.00 > filter 0.70 }
    finish{ diffuse 0.03 reflection 0.25 ambient 0.02 specular 0.25 roughness 0.005 }
  }


#declare tx_xadrez =
  texture{
    pigment{ checker color rgb < 0.10, 0.32, 0.60 >, color rgb < 1.00, 0.97, 0.90 > }
    finish{ diffuse 0.9 ambient 0.1 }
    scale 2.0
  }


#declare roleta = seed(1);

#declare chao = 
  box{ <-20,-20,-2>, <+20,+20,-3> texture{tx_xadrez}}

#declare cilindro_corpo = 
  cylinder{
    < 0.00, 0.00, 0.00>,
    < 0.00, 0.00, 8.00>,
    1.5
    texture{ tx_azul }
  }

#declare cilindro_braco =
  cylinder{
    <0.00, 0.00, 0.00>,
    <3.5, 0.00, 0.00>,
    0.5
    texture {tx_laranja}
  }

#declare articulacao = 
  sphere{
    <0,0,0>
    0.5
    texture {tx_azul}
  }

#declare cilindro_ante_braco =
  cylinder{
    <0.00, 0.00, 0.00>,
    <3, 0.00, 0.00>,
    0.5
    texture {tx_laranja}
  }

#declare esfera_mao = 
  sphere{
    <0,0,0>
    0.75
    texture {tx_azul}
  }

#declare cone_garra = 
  cone{
    <0,0,0>, 0.3
    <1.5,0,0>, 0
    texture {tx_laranja}
  }

#declare cilindro_perna =
  cylinder{
    <0,0,0>,
    <0,0,-3.5>,
    0.5
    texture {tx_laranja}
  }

#declare cilindro_pe =
  cylinder{
    <0,0,0>,
    <0,0,-2>,
    0.3
    texture {tx_azul}
  }

#declare cilindro_pescoco =
  cylinder{
    <0,0,0>,
    <0,0,1>,
    0.3
    texture {tx_laranja}
  }

#declare esfera_cabeca =
  sphere{
    <0,0,0>,
    1
    texture {tx_laranja}
  }

#declare cone_nariz =
  cone{
    <0,0,0>, 0.2,
    <0,0.5,0>, 0
    texture {tx_azul}
  }


#macro antebraco(rotMao, rotGarra)
  union{
    object {articulacao}
    object {cilindro_ante_braco translate <0.5,0,0>}
    object {mao(rotGarra) rotate rotMao translate <4,0,0>}
  }
#end

#macro braco(rotAntebraco, rotMao, rotGarra)
  union {
    object {cilindro_braco}
    object {antebraco(rotMao, rotGarra) rotate rotAntebraco translate <4,0,0>}
  }
#end

#macro mao(rotGarra)
  union{
    object {articulacao}
    object {esfera_mao translate <1,0,0>}
    object {cone_garra translate <1.5,0,0>}
    object {cone_garra rotate<0,-rotGarra,0> translate <1.5,0,0.25>}
  }
#end

#macro perna(rotPe)
  union{
    object {articulacao}
    object {cilindro_perna translate <0,0,-0.5>}
    object {pe() rotate <rotPe, 0, 0> translate<0,0,-4.5>}
  }
#end

#macro pe()
  union{
    object {articulacao}
    object {cilindro_pe translate <0,0,-0.5>}
  }
#end

#macro cabeca()
  union{
    object{cilindro_pescoco}
    object{esfera_cabeca translate<0,0,2>}
    object{cone_nariz translate<0,1,2>}
  }
#end

#macro robo(rotAntebracoD, rotAntebracoE, rotMaoD, rotMaoE, rotGarraD, rotGarraE, rotPernaD, rotPernaE, rotPeD, rotPeE, rotCabeca)
  union{
    object{cilindro_corpo}
    object{braco(rotAntebracoD, rotMaoD, rotGarraD) translate<1.5,0,5>}
    object{braco(rotAntebracoE, rotMaoE, rotGarraE) rotate <0,180,0> translate<-1.5,0,5>}
    object{perna(rotPeD) rotate rotPernaD translate<0.75,0, -0.25>}
    object{perna(rotPeE) rotate rotPernaE translate<-0.75,0, -0.25>}
    object{cabeca() rotate <0,0,rotCabeca> translate<0,0,8>}
  }
#end

// object{ eixos(30) }

object{robo(<30,40,80>, <30,20,10>, <40,20,30>, <30,40,50>, 60, 70, <40,50,20>, <30,40,30>, 30,40, 55)  translate<0, -20, 0>}

object{robo(<0,0,0>, <0,0,0>, <0,0,0>, <0,0,0>, 0, 0, <0,0,0>, <0,0,0>, 0 , 0, 0) translate<30, 0, 0>}

object{robo(<-55, 30, -20>, <76,-14,46>, <-15,43,27>, <63,-14,7-4>, 34, 56, <-86,32,13>, <54,34,31>, 76 , -43, 61) translate<15, 15, 0>}

#include "camlight.inc"
#declare centro_cena = <20, 0, 5>;
#declare raio_cena = 32.0;
#declare dir_camera = <1.5, 4, 2>;
#declare dist_camera = 5*raio_cena;
#declare intens_luz = 1.20;
camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)