// Last edited on DATE TIME by stolfi
// Exemplo de arquivo de descricao de cena para POV-ray
// Last edited on 2000-09-21 20:06:05 by ra002388

#include "dados.inc";
background{ color rgb < 0.00, 0.75, 0.85 > }

light_source {
  < 300.00, 800.00, 200.00 >
  color rgb < 1.00, 1.00, 1.00 >
}

light_source {
  < 0.00, 200.00, 800.00 >
  color rgb < 1.00, 1.00, 1.00 >
}

sky_sphere {
    pigment {
        color rgb <0.1,0.2,0.5>
    }
  }



#declare larg=10;
#declare ctr = < n*larg/1.33, 120, 0.00 >;
#declare camDir = (< n*larg*1.2, 100, n*larg/2 >) - (< n*larg/1.33, 120, 0.00 >);

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

#declare chao1 = <0,0.7,0.3>;
#declare chao2 = <0.4,0.8,0>;


#declare bluemetalreflection = <0.3,0.3,1.0>;
#declare bluemetal = texture {
  pigment { color bluemetalreflection }
  finish { diffuse 0.4 specular 0.2 roughness 0.005 ambient 0.01
    reflection bluemetalreflection
  }
}

#declare silvermetalreflection = <0.9,0.9,0.9>;
#declare silvermetal = texture {
  pigment { color silvermetalreflection }
  finish { diffuse 0.3 specular 0.1 roughness 0.005 ambient 0.01
    reflection silvermetalreflection
  }
}

#declare crystalcolor = <0.8,0.5,0.8>;
#declare crystal = texture {
  pigment { color crystalcolor filter 1.9}
  finish { diffuse 0.5 specular 0.2 roughness 0.005 ambient 0.1
    reflection 0.15*crystalcolor
  }
}

#declare tower = union {
  difference {
    cylinder {
      <13,0,0>,
      <13,36,0>,
      3
    }
    cylinder {
      <13,0,0>,
      <13,36,0>,
      2
    }
    texture { crystal }
    interior { ior 1.9 }
  }
  cone {
    <13,36,0>,4,
    <13,42,0>,0
    texture { bluemetal }
  }
  torus {
    4,1
    translate <13,32,0>
    texture { silvermetal }
  }
}


// Aqui está a cena, finalmente:

plane {y, 0
  pigment { checker color chao1, color chao2, scale 8 }
}

#declare i=0;
#while (i<n)
  object { tower scale <1,5*dados[i]/maximo,1> translate <i*larg,0,0>}
  object {text {
      ttf "arial.ttf"
      nomes[i]
      1,0
      pigment { color rgb <1,1,1> }
    } scale <larg,larg,1> rotate <0,0,90> translate <(i+1.6)*larg,210*dados[i]/maximo,0>}
  #declare i=i+1;
#end