//NOME: Plinio A. S. Freire  ra082505
// ============================================================================================
#include "eixos.inc"

//camera e luz 

#include "camlight.inc"
#declare centro_cena = < 0.00, 0.00, 1.00 >;
#declare raio_cena = 20.0;
#declare dir_camera = < 20,0, 4.50 >;
#declare dist_camera = 16.0;
#declare intens_luz = 1.00;
camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)


// cores e texturas

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

#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 < 1.00, 0.80, 0.10 > }
    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 tx_red =
  texture{
    pigment{ color rgb <1, 0, 0 >}
    finish{ diffuse 0.9 ambient 0.1 }
}

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

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

#declare tx_marrom =
  texture{
    pigment{ color rgb <0.8,0.6,0.3>}
}


//macro



#macro coelho(per1,antep1,pe1,per2,antep2,pe2,b1,anb1,b2,anb2)
  
  union{

    sphere{<0,0,7> 1.2 texture{tx_marrom}}
    cylinder{ <0,0,7>, <0,-1,9>, 0.2 texture{tx_marrom}}
    cylinder{ <0,0,7>, <0,1,9>, 0.2 texture{tx_marrom}}

    sphere{<0,0,6>, 1 texture{tx_marrom}}
    cylinder{ <0,0,3>, <0,0,6>, 1 texture{tx_marrom}}
    sphere{<0,0,4>, 1 texture{tx_marrom}}


   object{braco(anb1) rotate -b1*x translate <0,0,5>}

   object{braco(anb2) rotate -b2*x translate <0,0,5> scale <1,-1,1>}  

    object{perna(antep1,pe1) rotate -per1*x translate <0,0,3> 
      scale <1,-1,1>} 
    
    object{perna(antep2,pe2) rotate -per2*x translate <0,0,3>}
    
  
}
#end

#macro perna(a,b)

  union {
    cone{<0,0,-4>, 0.4  <0,0,0>, 1 texture{tx_marrom}}
    object{anteperna(b) rotate a*y translate <0,0,-4> } 
  }

#end

#macro anteperna(b)

  union {
   cone{<0,0,-2>, 0.4 <0,0,0>, 1.2 }
   object{pe() rotate b*y translate <0,0,-2>}
  }

#end


#macro pe()

  union {   
    cone{<2,0,0>, 0 <0,0,0>, 0.3 }
  }

#end

#macro braco(a)

  union{
    sphere{<0,0,0>, 0.5 texture{tx_marrom}}
    cylinder{<0,0,0>, <0,0,-1.6>, 0.3 texture{tx_marrom}}
    object{antebraco() rotate a*y translate <0,0,-1.6>} 
  }


#end

#macro antebraco()
 
  union{
    cone{ <0,0,0>, 0.3 <0,0,-2>, 0.1 texture{tx_marrom}}
    sphere{<0,0,-2>, 0.1 texture{tx_marrom}}
  }

#end

// ============================================================================================


union{

 // object{ eixos(3.00) }

  object{coelho(100,0,0,76,0,32,100,-35,100,-50) translate <0,5,0>}
  object{coelho(50,80,65,30,0,0,150,10,80,10) translate <0,-8,0>}

}