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

#include "eixos.inc"
#include "camlight.inc"

#declare muro =
texture{
     pigment{ brick color rgb<1, 1, 1> color rgb<0.9,0.3,0.1>
              brick_size <0.25, 0.0525, 0.125 >
              mortar 0.01
     }
     normal { wrinkles 0.75 scale 0.01}
     finish { diffuse 0.9 phong 0.2}
}

#declare cristal =
texture{
    pigment{ color rgbf < 0, 0.9, 0.9, 0.9 > }
    finish{ diffuse 0.9 ambient 0.1 }
}

#declare torre =
union{

                cylinder {<0,0,0>, <0,0,30>, 5  texture {cristal}}

                difference{
                                cylinder {<0,0,30>, <0,0,38>, 8 texture {cristal}}
                                union{
                                                        cylinder        {<-8,0,38>,  <8,0,38>, 2 texture {cristal}}
                                                        cylinder        {<0,-8,38>,  <0,8,38>, 2 texture {cristal}}
                                                        sphere{ <0,0,36> , 3 texture {cristal}}
                                }
                }
}

#declare muralha =
                        box {<0,0,0>, <30,5,20> texture {muro} }

#macro ramo(s)

union{
                object {torre}
                object {muralha translate<5,-2.5,0>}
                object {muralha translate<5,-2.5,0> rotate <0,0,120>}
                object {muralha translate<5,-2.5,0> rotate <0,0,240>}
                scale s
}

#end

#macro castelo(p,c,s)

                #if (p>0)

                                union{

                                                object{ castelo(p-1,<35*s*0.86,-35*s*0.5,0>,s/2) rotate <0,0,30>}

                                }

                #else

                                union{
                                                object{ ramo(s) translate c }
                                }

                #end

#end

background{ color rgb < 0.75, 0.80, 0.85 > }
ramo(1)
castelo(1,<0,0,0>,1)

#declare centro_cena = < 0,0,0 >;
#declare raio_cena = 100.0;
#declare dir_camera = < -1, -1, 1 >;
#declare dist_camera = 100.0;
#declare intens_luz = 1.00;

camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)