#include "colors.inc"

#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
}

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

#declare phi = (sqrt(5.0) - 1.0) / 2.0;

#macro Vector(X, Y)
  union {
    cylinder { X, Y, 0.01 pigment { color rgb <0, 0, 1> } }
    sphere { Y, 0.02 pigment { color rgb <1, 1, 0> } }
  }
#end

#macro dodecaedro()
  intersection {
    #local norms = array[12];
    #local norms[ 0] = <+1, 0, +phi>;
    #local norms[ 1] = <+1, 0, -phi>;
    #local norms[ 2] = <-1, 0, +phi>;
    #local norms[ 3] = <-1, 0, -phi>;
    #local norms[ 4] = <+phi, +1, 0>;
    #local norms[ 5] = <-phi, +1, 0>;
    #local norms[ 6] = <+phi, -1, 0>;
    #local norms[ 7] = <-phi, -1, 0>;
    #local norms[ 8] = <0, +phi, +1>;
    #local norms[ 9] = <0, -phi, +1>;
    #local norms[10] = <0, +phi, -1>;
    #local norms[11] = <0, -phi, -1>;

    #local i = 0;
    #while (i < 12)
      plane { norms[i], 1 }
      #local i = i+1;
    #end
  }
#end

#declare octaedro = intersection {
  #local norms = array[8];
  #local norms[0] = <+1, +1, +1>;
  #local norms[1] = <+1, +1, -1>;
  #local norms[2] = <+1, -1, +1>;
  #local norms[3] = <+1, -1, -1>;
  #local norms[4] = <-1, +1, +1>;
  #local norms[5] = <-1, +1, -1>;
  #local norms[6] = <-1, -1, +1>;
  #local norms[7] = <-1, -1, -1>;

  #local i = 0;
  #while (i < 8)
    plane { norms[i], 1 }
    #local i = i+1;
  #end
}

#declare icosaedro = intersection {
  object { dodecaedro() scale 1.06 }
  object { octaedro }
}

#declare cuboIoctaedro = intersection {
  box { <1, 1, 1>, <-1, -1, -1> scale 0.86 }
  object { octaedro }
}

#include "eixos.inc"

#declare chao = box { <-20,-20,-1>, <+20,+20,0> }

union {
  object { eixos(3.0) }
  object { chao translate -z*2 texture { tx_xadrez } }
  object {
    icosaedro
    texture { tx_vidro }
    interior { ior 1.2 }
    translate -x*2
  }
  object {
    cuboIoctaedro 
    texture { tx_vidro }
    interior { ior 1.2 }
    translate x*2
  }
}

#include "camlight.inc"
#declare centro_cena = < 0.00, 0.00, 0.00 >;
#declare raio_cena = 6.0;
#declare dir_camera = < 1.0, 1.0, 1.0 >;
#declare dist_camera = 16.0;
#declare intens_luz = 1.00;
camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)