// ======================================================================
// 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_plastico2 = 
  texture{
    pigment{ color rgb < 0.10, 0.80, 1.50 > }
    finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 }
  }


#declare tx_plastico3 = 
  texture{
    pigment{ color rgb < 0.10, 0.80, 2.50 > }
    finish{ diffuse 0.8 ambient 0.1 specular 0.5 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
  }

// ======================================================================
// DESCRIÇÃO DA CENA 


#macro arvore (n, r1, r2, posicao)
    #if (n=0)
      object {dinheiro translate <0,0,posicao>  texture{tx_xadrez}}
    #else

      union{
	object{tronco  texture {tx_plastico}}
	  #if (n=1)
	    object{arvore(n-1, 0, 0, 0) translate <0,0,5>}
	  #else

	  object{arvore(n-1, r1+45, r2+45, 1.5) scale 0.7 rotate <r1,r2,0>  translate <0,0,posicao>}

	  object{arvore(n-1, r1+45, r2+45, 4) scale 0.7 rotate <r1,r2,120>  translate <0,0,posicao>}
	#end
      }

    #end
#end

#declare chao = 
  box{ <-20,-20,-1>, <+20,+20,0> }

#declare tronco =
   cone {
    <0,0,0>, 0.30,
    <0,0,5>, 0.00
    }

#declare dinheiro = 
   sphere {<0,0,0>, 0.7}

#include "eixos.inc"

// Aqui está a cena, finalmente:

union{
  object{ eixos(3.00) }

  object {arvore(5, 0, 0, 0)}
}



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