// Last edited on 2009-07-23 14:05:32 by stolfilocal
// Processed by remove-cam-lights

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

#declare raio = 2.000;

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

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

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

#declare laranja = 
  texture {
    pigment { color rgb < 1.00, 0.50, 0.00 > }
    finish { diffuse 0.8 specular 0.1 roughness 0.005 ambient 0.1 }
  }

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

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

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

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

#declare marron = 
  texture {
    pigment { color rgb < 0.54, 0.27, 0.07 > }
    finish { diffuse 0.8 specular 0.1 roughness 0.005 ambient 0.1 }
  }

#declare torre = 
  object{
    box {
        < 0.00, 0.00, 0.00 >,
        < 1.00, 1.00, 3.00 >
        texture { azul }
    }
  }

#declare muro = 
  object{
    box{
        < 0.50, 0.40, 0.01 >,
        < 6.50, 0.60, 0.99 >
        texture { marron }
    }

  }

#declare tri_torre = 
  union{
    object{ torre } 
    object{ torre translate<6,0,0>}
    object{ torre translate<3,5.19,0>}
    object{ muro }
    object{ muro translate<-0.5,-0.5,0> rotate<0,0,60>}
    object{ muro translate<-0.5,-0.5,0> rotate<0,0,120> translate <6.5,0.5,0>}
    
   }

#declare tam = 1/3;
#declare n = 2;
#declare esq = 0;
#declare dir = 0;
#declare cima = 0;

#macro monta_castelo(n, esq, dir, cima)
  #if(n = 0)
    object{tri_torre}
  #else

    union{
      object{tri_torre}
      union{
       
        #if (dir = 1)
          object{monta_castelo(n-1, 0, 1, 1) translate<6/tam,0,0>}
        #end
        #if (esq = 1)
          object{monta_castelo(n-1, 1, 0, 1) translate<-6,0,0>}
        #end
 #if (cima = 1)
          object{monta_castelo(n-1, 1, 0, 1) translate<3/tam-6,5.19/tam,0>}
          object{monta_castelo(n-1, 0, 1, 1) translate<3/tam,5.19/tam,0>}
        #end
        
        scale<tam, tam, 1>
      }
    }
    
  #end
#end

object{monta_castelo(n, 1, 1, 1)}

// Original camera parameters:
// #local cam_ctr = <3.25,2.6,0.00>
// #local cam_vec = (<3.25,2.6,18.00>-<3.25,2.6,0.00>)
// #local cam_sky = z

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