// Last edited on DATE TIME by stolfi
#include "colors.inc"
#include "stones.inc" 
#include "golds.inc"
#include "textures.inc"
#include "skies.inc"
// #include "dados.inc"

#declare cor_metal_fosco= color rgb <1,1,1>;  
#declare metal_fosco= 
texture{
pigment {rgb cor_metal_fosco}
finish{
ambient 0.001 diffuse 0.5
reflection cor_metal_fosco
specular 0.050 roughness 0.1 
}
}
#declare tinta_D = 
  texture {
    pigment { color rgb < 1.00, 0.00, 0.00 > }
    finish { diffuse 0.5 specular 0.5 roughness 0.1 ambient 0.1 }
  }

/*camera{
location <3,29.5,0>
//right <-1.6, 0.00, 0.00>
//up <0.00,0.00,1.2>
sky <0.00,1.00,0.00>
look_at <-5,30,0>
}
*/
#declare ctr = <10,10,0>;
#declare camDir = (<-15,20,12>) - (<10,10,0>);

camera {
  location   ctr + 1.00*camDir
  right      -1.00*x
  up         0.75*y
  sky        y
  look_at    ctr
}



light_source { 
  1* < 0.0, 65.0, -30 >               // Posição da lâmpada.
  color rgb 1.2 * < 1.00, 1.00, 1.00 >   // Intensidade e corda luz.
  /*photons{  
     refraction on
     reflection on
     }*/
}

light_source { 
  1* < 20.0, 20.0, 10 >               // Posição da lâmpada.
  color rgb 0.8 * < 1.00, 1.00, 1.00 >   // Intensidade e corda luz.
  /*photons{  
     refraction on
     reflection on
     }*/
}


#declare tcoxa=
lathe{
quadratic_spline
8,
<0,0>,
<0.2,0.1>,
<0.4,0.2>,
<0.8,0.7>,
<0.7,1.1>,
<0.5,1.9>,
<0.4,2.3>,
<0.2,2.5>
texture {tinta_D}
}
#declare membro=
cylinder{
<0,0,0>,
<0,-2,0>,0.2
texture{tinta_D}
}

#declare art_grande=
sphere{ 
<0,0,0>,0.5
texture{tinta_D}
}

#declare art_pequena=
object{art_grande
scale<0.5,0.5,0.5>
}

#declare i=0;

#declare fonte=seed(14124);
#declare fonte2=seed(9823);
#declare fonte3=seed(98233);
#declare fonte4=seed(14823);
#declare fonte5=seed(1233432);

#while(i<20)

#if (rand(fonte5)<0.5) 
#declare sinal=1;
#else 
#declare sinal=-1;
#end

#declare peh=
box{
<-1,-1,-1>,
<1,1,1>
texture{tinta_D}
scale<0.3,0.3,0.3>
}

#declare canela2=
union{
object{membro}
object{art_pequena
translate<0,-2,0>}
object{peh
rotate sinal*90*x*rand(fonte)
translate<0,-2.5,0.3>}
}


#declare canela1=
union{
object{membro}
object{art_pequena
translate <0,-2,0>}
object{canela2
rotate 90*x*rand(fonte)
translate<0,-2,0>}
}


#declare coxa=
union{
object{tcoxa
rotate 180*z}
object{art_pequena
translate<0,-2.75,0>}
object{canela1
rotate 90*x*rand(fonte)
translate<0,-3,0>}
}

#declare pata=
union{
object{art_grande
translate<0,12,0>}
object{coxa
rotate 50*x*rand(fonte2)
rotate sinal*20*z*rand(fonte3)
rotate sinal*20*y*rand(fonte4)
translate<0,11.6,0>}
}
#if (i<10)
object{pata rotate 180*y translate<i*3,0,3>}
#else 
object{pata translate<(i-10)*3,0,-3>}
#end
#declare i=i+1;
#end

#declare corpo=
cylinder{
<-1,12,0>
<28,12,0>,3
texture{tinta_D}
}

object{corpo}

sky_sphere{S_Cloud1/*pigment{ color rgb <0.75,0.76,0.82>}*/}
plane{y,0
  texture{T_Stone1
    //pigment{ /*color rgb<0,1,0>*/checker color White, color Black scale 2 rotate y*30
   // }
  } 
}