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

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 Red = texture{
        pigment{ color rgb < 0.8, 0.1, 0.1 > }
}

#declare Blue = texture{
        pigment{ color rgb < 0.1, 0.1, 0.8 > }
}

#declare Green = texture{
        pigment{ color rgb < 0.1, 0.8, 0.1 > }
}

#declare Yellow = texture{
        pigment{ color rgb < 0.1, 0.6, 0.6 > }
}

#declare tx_fosca =
  texture{
    pigment{ color rgb < 1.00, 0.80, 0.10 > }
    finish{ diffuse 0.9 ambient 0.1 }
  }

#declare tx_espelho =
  texture{
    pigment{ color rgb < 1.00, 0.85, 0.30 > }
    finish{ diffuse 0.2 reflection 0.7*< 1.00, 0.85, 0.30 > ambient 0.1 }
  }

#declare tx_vidro =
  texture{
    pigment{ color rgb < 0.85, 0.95, 1.00 > filter 0.70 }
    finish{ diffuse 0.03 reflection 0.25 ambient 0.02 specular 0.25 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
  }

#declare roleta = seed(4);

#macro muralha(nmuralhas, raio, height, espessura)
        union{
                #local parameter = rand(roleta);
                #if(parameter<0.3)
                        #local parameter=parameter*2;
                #end
                #if(parameter>0.7)
                        #local parameter=parameter*2;
                #end
                difference{
                        cylinder{<0, 0, 0>, <0, 0, height>, raio }
                        cylinder{<0, 0, -1>, <0, 0, height+1>, raio-espessura }
                }
                #if(nmuralhas>0)
                        object{muralha (nmuralhas-1, raio*parameter, height*parameter, espessura*parameter)}
                #end
        }
#end

#macro castelo(ntowers, height, raio)
        union{
                #local p1 = 0.25 + rand(roleta)/2;
                #local p2 = 0.25 + rand(roleta)/2;
                cylinder{<0, 0, 0>, <0, 0, height>, raio texture{ Red}}
                #if(ntowers>0)
                        object{ castelo(ntowers-1, height*p1, raio*p1) translate<raio, 0, height> }
                        object{ castelo(ntowers-1, height*p2, raio*p2) translate<-raio, 0, height> }
                #else
                        cone{<0, 0, 0>, raio, <0, 0, height>, 0 texture{Blue} translate<0, 0, height>}
                #end
        }
#end

#declare muro=object{muralha(3, 30, 5, 4)}
#declare castle=object{castelo(3, 10, 5)}
#declare plano = union{
        plane{<0, 0, 1>, 0 texture{ Green } }
}

union{
        object{ muro texture{ Yellow}}
        object{ castle   texture{ tx_fosca }}
        object{ plano texture{ Green}}
}

#include "camlight.inc"
#declare centro_cena = < 0, 0, 10 >;
#declare raio_cena = 30.0;
#declare dir_camera = < 1.00, 5.00, 3.00 >;
#declare dist_camera = 100.0;
#declare intens_luz = 1.00;
camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)