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

#declare vv = < 5.00, -25.00, 25.00 >;
#declare uu = vaxis_rotate ( vv, z, 360*clock );

 

 

 

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

#declare tinta_cinza =
  texture {
    pigment { color rgb < 0.67, 0.67, 0.67 > }
    finish { diffuse 0.8 specular 0.1 roughness 0.005 ambient 0.1 }
  }

#declare tinta_rosa =
  texture {
    pigment { color rgb < 1.00, 0.07, 0.53 > }
    finish { diffuse 0.8 specular 0.1 roughness 0.005 ambient 0.1 }
  }

#macro folha()
  union {

    
    difference {
      sphere { < 0, 0, 0.1 >, 1 scale < 1, 1, 0.75 > }
      sphere { < 0, 0, 0.1 >, 1 scale < 1, 1, 0.75 > translate < 0, 0, 0.25 > }
      box { < -2, -2, 0.1 >, < 2, 2, 2 > }
      translate < 2.9, 0, 0 >
    }

    
    cylinder { < -3, 0, 0.1 >, < -1, 0, 0.1 >, 0.5 scale < 1, 1, 0.2 > translate < 3, 0, 0 > }

    
    sphere { < 0, 0, 0 >, 0.6 }

    texture { tinta_cinza }
  }
#end

#macro galho_1(folha_y)
  union {
    cylinder {
      < +0.0, +0.0, +0.0 >, < +3.0, +0.0, +0.0 >, 0.3 texture { tinta_rosa }
    }
    sphere { < 0, 0, 0 >, 0.6 texture { tinta_rosa } }
    object {
      folha()
      rotate < 0, folha_y, 0 >
      translate < 3, 0, 0 >
    }
  }
#end

#macro galho_2(folha_y, galho_1_y)
  union {
    cylinder {
      < +0.0, +0.0, +0.0 >, < +3.0, +0.0, +0.0 >, 0.3 texture { tinta_cinza }
    }
    sphere { < 0, 0, 0 >, 0.6 texture { tinta_cinza } }
    object {
      galho_1(folha_y)
      rotate < 0, galho_1_y, 0 >
      translate < 3, 0, 0 >
    }
  }
#end

#macro galho_3(folha_y, galho_1_y, galho_2_y)
  union {
    cylinder {
      < +0.0, +0.0, +0.0 >, < +3.0, +0.0, +0.0 >, 0.3 texture { tinta_rosa }
    }
    sphere { < 0, 0, 0 >, 0.6 texture { tinta_rosa } }
    object {
      galho_2(folha_y, galho_1_y)
      rotate < 0, galho_2_y + 90, 0 >
      translate < 3, 0, 0 >
    }
  }
#end

#macro base(folha_y, galho_1_y, galho_2_y, galho_3_y)
  union {
    box {
      < -2.0, -2.0, -0.5 >,
      < +2.0, +2.0, +0.5 >
      texture { tinta_cinza }
    }
    object {
      galho_3(folha_y, galho_1_y, galho_2_y)
      rotate < 0, galho_3_y - 90, 0 >
    }
  }
#end

#declare nh = 5.0;
#declare nv = 4.0;
#declare nquadros = nh * nv;
#declare cini = 0.0;
#declare cfin = 1.0;

#declare cpasso = ( cfin - cini ) / ( nquadros - 0.9999);

#declare ck = cini;

#declare c0 = 0.0;
#declare c1 = 1.0/5;
#declare c2 = 2.0/5;
#declare c3 = 3.0/5;
#declare c4 = 4.0/5;
#declare c5 = 1.0;

#macro quadro(ck)

    #if ( (ck >= c0) & (ck < c1) )

      #declare rr = (ck - c0) / (c1 - c0);
      #declare ss = (c1 - ck) / (c1 - c0);

      #declare folha_y = ss*0 + rr*30;
      #declare galho_1_y = ss*0 + rr*0;
      #declare galho_2_y = ss*0 + rr*0;
      #declare galho_3_y = ss*0 + rr*0;
    #end
    #if ( (ck >= c1) & (ck < c2) )

      #declare rr = (ck - c1) / (c2 - c1);
      #declare ss = (c2 - ck) / (c2 - c1);

      #declare folha_y = ss*30 + rr*30;
      #declare galho_1_y = ss*0 + rr*30;
      #declare galho_2_y = ss*0 + rr*0;
      #declare galho_3_y = ss*0 + rr*0;
    #end
    #if ( (ck >= c2) & (ck < c3) )

      #declare rr = (ck - c2) / (c3 - c2);
      #declare ss = (c3 - ck) / (c3 - c2);

      #declare folha_y = ss*30 + rr*(-30);
      #declare galho_1_y = ss*30 + rr*30;
      #declare galho_2_y = ss*0 + rr*30;
      #declare galho_3_y = ss*0 + rr*30;
    #end
    #if ( (ck >= c3) & (ck < c4) )

      #declare rr = (ck - c3) / (c4 - c3);
      #declare ss = (c4 - ck) / (c4 - c3);

      #declare folha_y = ss*(-30) + rr*(-30);
      #declare galho_1_y = ss*30 + rr*30;
      #declare galho_2_y = ss*30 + rr*0;
      #declare galho_3_y = ss*30 + rr*0;
    #end
    #if ( (ck >= c4) & (ck < c5) )

      #declare rr = (ck - c4) / (c5 - c4);
      #declare ss = (c5 - ck) / (c5 - c4);

      #declare folha_y = ss*(-30) + rr*0;
      #declare galho_1_y = ss*30 + rr*0;
      #declare galho_2_y = ss*0 + rr*0;
      #declare galho_3_y = ss*0 + rr*0;
    #end

    object {
      base (folha_y, galho_1_y, galho_2_y, galho_3_y)
    }

#end

#declare chao =
  plane {
    z, 0
    texture { pigment { checker rgb < 1, 1, 1 >, rgb < 0.5, 0.5, 0.5 > }
      finish { diffuse 0.5 ambient 0.5 }
    }
    scale 10
    translate -10*z
  }

object { chao }

object { quadro(clock) }

object { quadro(mod(clock+0.3, 1.0)) translate < 0, 10, 0 > }

// Original camera parameters:
// #local cam_ctr = <5.00,0.00,0.00>
// #local cam_vec = ((uu)-<5.00,0.00,0.00>)
// #local cam_sky = z

#include "camlight.inc"
camlight(<5.00,0.00,0.00>,<10,10,10>,20.0,z,1.0)