// Exercicio 3
// Last edited on 2001-06-02 20:47:27 by stolfi

#include "colors.inc"

background{ color rgb < 0.00, 0.53, 0.75 > }

light_source {
  < 30.00, 20.00, 80.00 >
  color rgb < 1.00, 1.00, 1.00 >
} 

camera {
  location  <  9.00, -4.00, 2.50 >
  right     < -0.60, 0.00, 0.00 >
  up        <  0.00, 0.00, 0.80 >
  sky       <  0.00, 0.00, 1.00 >
  look_at   <  2.00, 0.90, 0.00 >
} 

#declare tinta_A = 
  texture {
    pigment { color rgb < 0.10, 0.80, 1.00 > }
    finish { diffuse 0.5 specular 0.5 roughness 0.005 ambient 0.1 }
  }

#declare tinta_B = 
  texture {
    pigment { color rgb < 1.00, 0.80, 0.10 > }
    finish { diffuse 0.5 specular 0.5 roughness 0.005 ambient 0.1 }
  }

#declare cor_cristal = <0.10,0.80,1.00>;
#declare tx_cristal =
texture{
  finish {
     ambient 0.1 diffuse 0.1
     reflection 0.25
     specular 1 roughness 0.001
}
pigment {color cor_cristal filter 1 }
}

#declare cor_espelho = <0.00,0.1,0.40>;
#declare tx_espelho =
  texture{
  pigment {rgb cor_espelho }
  finish{
  ambient 0.05 diffuse 0.05
  reflection cor_espelho
  specular 0.20 roughness 0.05
  }
}  


#declare plano =
    plane { <0, 0, -2>,10
    pigment { checker color Black, color White scale 10 }
  }


# declare base =
    torus { 1.5, 0.3        // major and minor radius
    rotate 90*x      // so we can see it from the top
    texture { tx_espelho }
    translate <0,0,-2>    
}

#declare corpo =
    cylinder {
    <2, 0.9, 0.1>,     // Center of one end
    <2, 0.9, -2>,    // Center of other end
    0.73           // Radius
    open           // Remove end caps
    texture { tx_cristal } hollow interior {ior 1.5}
  }

#declare borda =
    torus { 1.3, 0.2        // major and minor radius
    rotate 90*x      // so we can see it from the top
    texture {tx_espelho}
    rotate <0,0,-10>
  }

#declare detalhe =
    torus { 1, 0.1        // major and minor radius
    rotate 90*x      // so we can see it from the top
    pigment { color rgb < 0.10, 0.80, 1.00 > }
}

object {plano}
union { 
object {base translate <0,0,0>}
object {corpo translate <0,0,1>} 
object {borda translate <0.9,0.4,0>}
object {detalhe translate <0,0,2>}
object {detalhe rotate 90*x translate <2,1,2>}
object {detalhe rotate 150*x translate <2,1,2>}
object {detalhe rotate -150*x translate <2,1,2>}
}