// Last edited on 2003-12-14 20:25:25 by stolfi
//**************************************************************************************
//*** Título: Logotipo para o laboratório de informação visual                       ***
//*** Data:   Campinas, 11 de novembro de 2003                                       ***
//*** Aluno:  Luciano Ludka Cordeiro - ra992077                                      ***
//**************************************************************************************

#include "colors.inc"
#include "textures.inc"
//**************************************************************************************
//*** Setagem dos parâmetros gerais da cena: *******************************************
//**************************************************************************************
#declare fonte = seed(75135982);
#declare probGota = 0.9;

//**************************************************************************************
//*** Câmera: **************************************************************************
//**************************************************************************************
#declare ctr = <0.00, 0.00, 1.50>;
#declare camDir = (<9.00, 1.00, 2.50>) - (<0.00, 0.00, 1.50>);

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

//**************************************************************************************
//*** Fontes de Luz: *******************************************************************
//**************************************************************************************
light_source {
   < 5.00, 5.00, 10.00>           // Posição da lâmpada.
   color rgb 1.9 * < 1.00, 1.00, 1.00 >       // Intensidade e corda luz.
}
light_source {
   < 4, 4.00, 0.50>           // Posição da lâmpada.
   color rgb 0.5 * < 1.00, 1.00, 1.00 >       // Intensidade e corda luz.
}

//**************************************************************************************
//*** Declaração das cores utilizadas: *************************************************
//**************************************************************************************
#declare azul = 
   texture {
      pigment { color rgb < 0.20, 0.25, 1.20 > }
      finish { diffuse 0.4 specular 0.5 roughness 0.005 ambient 0.1 }
   }

#declare cristal = texture{
    finish {
        ambient 0.1 specular 1 diffuse 0.1 reflection 0.25
        roughness 0.001
    }
    pigment { color <0.1, 1.0, 0.1> filter 1 }
}

#declare espelhado = texture {
    pigment { rgb <0.6, 0.6, 0.6> }
    finish {
        ambient 0.05 diffuse 0.05
        reflection <0.6, 0.6, 0.6>
        specular 0.2 roughness 0.05
    }
}

#declare espelhado_2 = texture {
    pigment { rgb <0.6, 0.6, 0.6> }
    finish {
        ambient 0.05 diffuse 0.05
        reflection <0.6, 0.6, 0.8>
        specular 0.2 roughness 0.05
    }
}        
  

//**************************************************************************************
//*** Declaração dos objetos utilizados: ***********************************************
//**************************************************************************************
#declare chao =
   plane { z, 0 pigment { checker color Grey color Tan scale 1 } }

#declare torus_aux = 
   torus { 0.3, 0.1 texture {espelhado} interior {ior 10} rotate 90*z}

#declare seq_torus =
union{
   #declare i = 0;
   #while(i<10)
      object { torus_aux rotate (i*18)*z translate <0.00, 0.8*(i-4.5), 0.06>}
      #declare i = i+1;
   #end
}

#declare oit_esfera =
intersection{
   box{<0,0,0> <-1,-1,1>}
   difference{
      sphere{<0,0,0>,1}
      sphere{<0,0,0>,0.9}  
   }
   texture{cristal}
}

#declare liv = 
   text {
      ttf "arial.ttf"
      "LIV", 
      0.30, 0
      rotate <90, 0, 90>
      scale <2,4,2>
      translate <0,-3,0.8>
      }

#declare gota =
   sphere{<0,0,0>, 0.07 texture {espelhado_2}} 

#declare gotas = 
union{
   #declare dy = 0;
   #while(dy<5)
      #declare dz = 0;
      #while(dz<7)
         #if(rand(fonte)<probGota)
             object{gota translate <5*(-0.5+rand(fonte)),dy,dz>}
         #end 
         #declare dz = dz+0.5;
      #end
      #declare dy = dy+0.5;
   #end    
}
//**************************************************************************************
//*** DECLARAÇÃO DA CENA - OBJETOS MONTADOS ********************************************
//**************************************************************************************
background { color rgb < 0.50, 0.50, 0.50 > }      
union{
   object { chao }
   object { gotas }
   object { seq_torus translate <0.5,0,0.2>}
   object {oit_esfera scale <3.8,3.8,3.8> translate <0.9, 0, 0.5>}
   object {liv texture {azul}}
}