 #include "colors.inc"
 #include "stones.inc"
 #include "woods.inc"

    #include "textures.inc"
 #if (clock<1)
   #declare horloge=clock;
   #else
   #declare horloge=1;
  #end
 global_settings {
   assumed_gamma 1.5
   noise_generator 2
    charset utf8
}
  camera {
     right x
    location <0, 3, -10>
    look_at 0
    angle 50
  }  
  light_source { <-50,50,-100> White }
  light_source { <-50,-50,-100> White }
  light_source { <50,-50,-100> White }
  light_source { <50,50,-100> White }
  light_source { <0,50,0> White }
  
  #declare truc=union
  {
 
  #for (i, 0, 8, 1)
   #for (j, 0, 8, 1)
   #for (k, 0, 8, 1)
   #declare test=1;
   #declare ii=div(i,3);
   #declare jj=div(j,3);
   #declare kk=div(k,3);
   #if (mod(i,3)*mod(j,3)=1)
      #declare test=0;
    #end
    #if (mod(ii,3)*mod(jj,3)=1)
      #declare test=0;
    #end
    #if (mod(k,3)*mod(j,3)=1)
      #declare test=0;
    #end
    
    #if (mod(kk,3)*mod(jj,3)=1)
      #declare test=0;
    #end
    
    #if (mod(i,3)*mod(k,3)=1)
      #declare test=0;
    #end
    #if (mod(ii,3)*mod(kk,3)=1)
      #declare test=0;
    #end
     
    
   #if (test=1) 
     object
     {
     box {<(i-4)/10*(2-horloge),(j-4)/10*(2-horloge),(k-4)/10*(2-horloge)> ,<(i-4)/10*(2-horloge)+1/10+1/1000,(j-4)/10*(2-horloge)+1/10+1/1000,(k-4)/10*(2-horloge)+1/10+1/1000> texture{T_Stone21}}
      rotate<i/8*180*(1-horloge),j/8*180*(1-horloge),k/8*90*(1-horloge)>
      no_shadow
     }
    #end
#end 
#end
 #end 
 
#declare Pyramid = 
   union { // This isn't true CSG, it's just used for convenience
      triangle { <-1, 0, -1>, <+1, 0, -1>, <0, 1, 0>  }
      triangle { <+1, 0, -1>, <+1, 0, +1>, <0, 1, 0>  }
      triangle { <-1, 0, +1>, <+1, 0, +1>, <0, 1, 0>  }
      triangle { <-1, 0, +1>, <-1, 0, -1>, <0, 1, 0>  }

      

   scale <1, 2, 1>
 
}
}// ----------- end of #for loop
#if (clock<1)
#if (clock>0)
object {Pyramid scale <1,clock,1> rotate 360*y*clock texture{ pigment{ color rgb<0,0,1>}}}
#end  
box{<-3,0,-3><3,-0.1,3> rotate 360*y*clock texture{ pigment{ color rgb<1,1,0>}}} 
#end

#if (clock>=1)
#for (i,-1,1)
#for (j,-1,1)
object {Pyramid scale <1,1,1> rotate 360*y*clock texture{ pigment{ color rgb<0,0,1>}}}
#if (clock>1)
object {Pyramid scale <1,clock-1,1>/3 translate <-2*i,0,-2*j> rotate 360*y*clock texture{ pigment{ color rgb<1,0,0>}}} 
#end
#end
#end
box{<-3,0,-3><3,-0.1,3> rotate 360*y*clock texture{ pigment{ color rgb<1,1,0>}}} 
#end

#if (clock>=2)
#for (i,-1,1)
#for (j,-1,1)
object {Pyramid scale <1,1,1> rotate 360*y*clock texture{ pigment{ color rgb<0,0,1>}}}
object {Pyramid scale <1,1,1>/3 translate <-2*i,0,-2*j> rotate 360*y*clock texture{ pigment{ color rgb<1,0,0>}}} 
#if (clock>2)
#for (i,-4,4)
#for (j,-4,4)
object {Pyramid scale <1,clock-2,1>/9 translate <-2*i,0,-2*j>/3 rotate 360*y*clock texture{ pigment{ color rgb<0,1,0>}}} 
#end
#end
#end
#end
#end
box{<-3,0,-3><3,-0.1,3> rotate 360*y*clock texture{ pigment{ color rgb<0.5,0.5,0>}}} 
#end

         


 
