//Pedro Feniman 083991

// ======================================================================
// CORES E TEXTURAS

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

#declare tx_plastico1 = 
  texture{
    pigment{ color rgb < 0.8, 0.6, 0.2 > }
    finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 }
  }

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

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

#declare raio = 2.000;

// Partes da cena:

#macro tree(n, raio, xini, xfim, yini,yfim,zini,zfim)
 #if ( n = 0 )
	union{
	box {
	    < xfim ,yfim, zfim> 
	    <xfim+0.15, yfim+0.25, zfim-0.5>  
		texture{ tx_plastico2 }
	}

box {
	    < xfim ,yfim-0.125, zfim-0.5> 
	    <xfim+0.15, yfim+0.125, zfim-1>  
		texture{ tx_plastico2 }
	}
   cylinder{
     < xini, yini, zini>,
     < xfim, yfim, zfim>,
	   raio
   texture{ tx_plastico1 }
 }

}
 #else
   union{

box {
	    < xfim ,yfim, zfim> 
	    <xfim+0.15, yfim+0.25, zfim-0.5>  
		texture{ tx_plastico2 }
	}
     cylinder{
           < xini, yini, zini>,
           < xfim, yfim, zfim>,
           raio
       texture{ tx_plastico1 }
     }
	   object{ tree(n-1,raio-0.07,xini, xfim,yfim,yfim+1,zfim,zfim+1.4) }
       object{ tree(n-1,raio-0.08,xini, xfim,yfim,yfim-1,zfim,zfim+1.4) }
	   object{ tree(n-1,raio-0.1,xfim, xfim+2,yfim,yfim+1,zfim,zfim+1.4) }
   }
 #end
#end

tree(3, 0.3, 0, 0, 0, 0,0,2)

#include "camlight.inc"
#declare centro_cena = < 0, 0, 3 >;
#declare raio_cena = 8.5;
#declare dir_camera = < 30.00, 18.00, 1.00 >;
#declare dist_camera = 18.0;
#declare intens_luz = 1.00;
camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)