// TP03 - 04/09/03
// Last edited on 2003-10-21 22:35:08 by stolfi

global_settings { max_trace_level 10 }

// ======================================================================
// CÂMERA 

#declare ctr = <  0.00, 4.00, 0.00 >;
#declare camdir = <  15, 7.00, 30.00 >; 

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

#include "colors.inc"

// ======================================================================
// FONTES DE LUZ

// light_source {
//   10 * < +50.0, +30.0, +50.0 >              // Posição da lâmpada.
//   color rgb 1.2 * < 1.00, 1.00, 1.00 >   // Intensidade e corda luz.
// } 
// 
// light_source {
//   10 * < +50.0, -10.0, +10.0 >             // Posição da lâmpada.
//   color rgb 0.8 * < 1.00, 1.00, 1.00 >   // Intensidade e corda luz.
// } 

light_source {100*(ctr + vrotate(camdir,<0,45,0>) + 20*y) color 1.2*White}
light_source {100*(ctr + vrotate(camdir,<0,15,0>) + 10*y) color 0.6*White}
light_source {100*(ctr + vrotate(camdir,<0,105,0>) + 10*y) color 0.4*White}

// ======================================================================
// TRANSPARENCIA

#declare cor_cristal_vermelho = rgb < 1.00, 0.30, 0.30 >;
#declare tx_cristal_vermelho =
  texture {
    finish {
      ambient 0.1 diffuse 0.1
      reflection 0.25
      specular 1 roughness 0.001
    }
    pigment { color cor_cristal_vermelho filter 1}
  }
  


// ======================================================================
// METALICO

#declare cor_espelho_cinza = < 0.7, 0.7, 0.7 >;
#declare tx_espelho_cinza =
  texture {
    pigment { rgb cor_espelho_cinza }
    finish {
      ambient 0.05 diffuse 0.05
      reflection cor_espelho_cinza
      specular 0.20 roughness 0.05
    }
  }


// ======================================================================
// DESCRIÇÃO DA CENA 

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

//piso
plane { y, 0 pigment {checker color 0.7*White + 0.3*Green, color 0.4*White + 0.5*Green scale 2} }

plane { x, -30 pigment {checker color 0.7*White + 0.3*Green, color 0.4*White + 0.5*Green scale 2} }

#declare tinta_amarela = 
  texture {
    pigment { color Yellow }
    finish { diffuse 0.5 specular 0.5 roughness 0.005 ambient 0.1 }
  }  

#declare coluna =
  cylinder {
    < 0.00, 0.00, 0.00 >,
    < 0.00, 6.00, 0.00 >,
    0.4
    texture { tx_cristal_vermelho } 
    interior { ior 1.5 }
  }

#declare parede =
  box {
    < -3.00, 0.00, 0.0 >,
    < 3.00, 6.00, -6.00>
    texture { tx_espelho_cinza }
  }

#declare base =
  union{
    object {parede}
    object {coluna translate <-3,0,0>}
    object {coluna translate <3,0,0>}
    object {coluna translate <-3,0,-6>}
    object {coluna translate <3,0,-6>}
  }
  
#declare teto =
  difference {
    torus { 3.0, 2.0
      translate <0,5.5,-3>       
    }
    box {
      < -5.00, 0.00, 2.0 >,
      < 5.00, 6.00, -8.00>
    }
    texture { tx_espelho_cinza }
  }

#declare esfera =
  sphere {
    <0,6.5,-3>,2.0
    texture { tx_cristal_vermelho }
  }
  
#declare esferinha =
  sphere {
    <0,0,0>,1.0
    texture { tx_cristal_vermelho }
  }

#declare detalhe_porta =
  cylinder {
    < 0.00, 0.00, 0.00 >,
    < 0.00, 0.50, 0.00 >,
    0.5
    rotate -90*x
  }

#declare porta =
  union {
    object {detalhe_porta translate<0,3.8,0.2>}
    object {detalhe_porta translate<-0.7,3.5,0.2>}
    object {detalhe_porta translate<0.7,3.5,0.2>}
    box {
      < -1.20, 0.00, 0.20 >,
      < 1.20, 3.50, 0.00>
    }
    texture { tx_cristal_vermelho } 
    interior { ior 1.5 }
  }

// Aqui está a cena:
union {
  object{base} 
  object{teto}
  object{esfera}
  object{esferinha translate<-2.5,7,-0.5>}
  object{esferinha translate<2.5,7,-0.5>}
  object{esferinha translate<-2.5,7,-5.5>}
  object{esferinha translate<2.5,7,-5.5>}
  object{porta}
}