#include "stars.inc"
camera {
 location < 0,5,10 >  // Posição do observador.

  //right     1.0*x                 // Largura RELATIVA da imagem.
  //up        0.75*y                 // Altura RELATIVA da imagem.      
  sky       y                      // Qual direção é "para cima"?
  look_at   <0, 1, 0 >  // Para ond e a câmera está apontando.
} 
// Nota: os parâmetros "right" e "up" devem ter a mesma proporção
// que os parâmetros ${WIDTH} e ${HEIGHT} no Makefile.

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

/*light_source {
  10 * < 0.0, +20.0, +20.0 >              // Posição da lâmpada.
   color rgb 1.2 * < 1.00, 1.00, 1.00 >   // Intensidade e corda luz. 
  //area_light <5, 0, 0>, <0, 0, 5>, 10, 10
  //adaptive 1
 
} 
  */
light_source {
  10 * <20.0, +10.0, 20.0 >              // Posição da lâmpada.
   color rgb 4 * < 1.00, 1.00, 1.00 >   // Intensidade e corda luz. 
  //area_light <5, 0, 0>, <0, 0, 5>, 10, 10
  //adaptive 1
 
} 


/*light_source {
  20 * <0, +10.0, 20.0 >              // Posição da lâmpada.
   color rgb 2 * < 1.00, 1.00, 1.00 >   // Intensidade e corda luz. 
  //area_light <5, 0, 0>, <0, 0, 5>, 10, 10
  //adaptive 1
 
}  */

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


/*------------------------CONFIGURACOES GERAIS DO AMBIENETE-------------------------------*/

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

//rgbf (filter)  rgbt (transmit)   
 //*--TEXTURA SKY <--tutorial 
   #declare Clouds0 = pigment{ 
     gradient y
     color_map {
        [0 color <0,0,1>]
        [1 color <0.4,0.5,0.7>]
      }
      scale 2
      translate -1
    
   }
 
 
   #declare Clouds1 = pigment {
      bozo
      turbulence 0.2
      color_map {
        [0.0 color rgb <0,0,1> filter 1]
        [0.5 color rgb <1,1,1>]
        [1.0 color rgb <0,0,1> filter 1]
      }
    }
 
  #declare Clouds4 = pigment {
    granite
    turbulence 1
    color_map {
      [0.0 color rgb <1,1,1> filter 1]
      [0.5 color rgb <1,1,1>]
      [1.0 color rgb <1,1,1> filter 1]
    }
  }

#declare Starfield1 =
//texture {
    pigment {
        granite
        color_map {
            [ 0.000  0.270 color rgb < 0, 0, 0> color rgb < 0, 0, 0> ]
            [ 0.270  0.280 color rgb <.5,.5,.4> color rgb <.8,.8,.4> ]
            [ 0.280  0.470 color rgb < 0, 0, 0> color rgb < 0, 0, 0> ]
            [ 0.470  0.480 color rgb <.4,.4,.5> color rgb <.4,.4,.8> ]
            [ 0.480  0.680 color rgb < 0, 0, 0> color rgb < 0, 0, 0> ]
            [ 0.680  0.690 color rgb <.5,.4,.4> color rgb <.8,.4,.4> ]
            [ 0.690  0.880 color rgb < 0, 0, 0> color rgb < 0, 0, 0> ]
            [ 0.880  0.890 color rgb <.5,.5,.5> color rgb < 1, 1, 1> ]
            [ 0.890  1.000 color rgb < 0, 0, 0> color rgb < 0, 0, 0> ]
        }
    turbulence 1
    sine_wave
    scale .5
    }
    //finish { diffuse 0 ambient 1 }
//}
  
  
 sky_sphere{
   pigment {Starfield1}
  } 

 /*fog {
  fog_type   2
  distance   100
  color      rgb 0.6 // gray
  fog_offset 0.1
  fog_alt    0.6
  turbulence 0.8
}
*/

#declare ceu = 
  texture{
    pigment { Clouds0} 
    pigment {Clouds1 scale 0.5}
  }

/*------------------------------FIM DESCRICAO MEI AMBIENTE--------------------------*/





  
 
/*-----------------------------------TEXTURAS------------------------------*/ 
#declare cor_inseto=
    texture{ 
      pigment{
        gradient x
        color_map {
          [0 color <0.2,0.8,0.0>]
          [1 color <1,0.9,0.1>]
      }
     } 
     
    }  
    
#declare cor_juntas=
      texture{
         pigment {color rgb <0.9,0.1,0.1>}
      
      }    
 
 
#declare sup_mato =
     texture{
        pigment {
         gradient x
         turbulence 1
         color_map{
           [0.00 color rgb <0.9,0.1,0.0>]
           [0.25 color rgb <0.9,0.1,0>]
           [0.50 color rgb <0.9,0.0,0.1>]
           [0.75 color rgb <0.4,0.4,0.4>]
           [1.00 color rgb <0.1,0.1,0>]
         
         } 
         scale 0.5
         
       }  
       normal { bumps 0.5 scale 0.3}
         
     } 
         

    
 #declare sup_transp=
  texture{
     finish {
       ambient 0.1
       diffuse 0.1
       roughness 0.001
       reflection 0.25
       specular 1
     
     }
      
      pigment {color rgb <0.1,0.1,0.3> filter 1  } 
  }  
  //interior {ior 1.5}
  
#declare sup_metalica =
   texture {
      finish{
        ambient 0.05
	diffuse 0.05
	reflection color rgb <0,0.4,0.8>
	specular 0.1
	roughness 0.05
    }   
    
   }  
 
#declare sup_metalica2 =
   texture {
      finish{
        ambient 0.05
	diffuse 0.05
	reflection color rgb <0.9,0.1,0.1>
	specular 0.20
	roughness 0.05
    }   
    
   }              
/*---------------------------FIM--TEXTURAS-------------------------------------*/


/*------------------------------------PISO---------------------------*/
/*#declare piso = 
   plane{
     <0,1,0>,-3
     //texture {sup_mato}         
     pigment {color rgb <0.4,0.4,0.4>}
     normal { bumps 0.5 scale 0.3}
    // normal { wrinkles 0.3}
          
         
        
   }*/
/*------------------------------------------------------------------*/

 
  


/*---------------CRESCIMENTO--------------------*/
#declare clck1 = clock/0.5;
#declare clck2 = (clock-0.3)/(1-0.3); 
#declare clck3 = clock/0.8;
#declare clck4 = (clock-0.8)/(1-0.8);
#declare expl=0;

#if (clock>0.8)
  #declare expl = (1-clck4)*0+clck4*2;
#end



#declare posxcil = -1.2;
#declare posycil = 1; 
#declare eco2=0;

#declare eco1 = (1-clck3)*0+clck3*1; 




#if(clock>0.3)
  #declare eco2 = (1-clck2)*1+clck2*1.5;
  
#end


  
/*#declare desycil = (1-clock)*posycil+clock*2;
#declare desxcil  = (1-clock)*posxcil+clock*-2;
 */
 
#declare terra = 
  sphere {
    <0,0,0>
    2
    texture {Clouds1}
  }


#declare death = 
  blob{
  threshold 0.5
   sphere {
     <0,0,0>
     0.6
     1
      texture {
        pigment {color rgb <0.9, 0.1, 0.1> transmit 0.5}
        finish {specular 0.1 ambient 0.9}//ambient 1 diffuse .6}
      }   
   }
   sphere { <0.3,0,0>,0.4,1 pigment {color rgb <0.25,0.25,0>} }  
   sphere { <0.3,0.3,0>,0.5,1 pigment {color rgb <0.25,0.25,0>} }  
   sphere { <0,0,0.2>,0.6,1 pigment {color rgb <0.25,0.25,0>} }  
   sphere { <0.5,0,0>,0.2,-1 pigment {color rgb <0.25,0.25,0>} }  
   sphere { <0.5,0.6,0>,0.1,-1 pigment {color rgb <0.25,0.25,0>} }  
   sphere { <0,0,0.6>,0.2,-1 pigment {color rgb <0.25,0.25,0>} }      
  }

#declare cometa =
 light_source {
    <0, 0, 0>
    color rgb 5*<1,0.1,0,1>
    looks_like { death}
    //projetced_throught { explosion}
    media_attenuation on
    
}       
     
#declare economia=
   blob{
      threshold 0.5
      sphere {<0,0,0>,expl,-5 texture {Clouds1}}
      sphere {<0,0,0>, 2,1 texture{ceu}  }
      sphere {<1.5,0,0> ,eco1*2, -1.5 texture{ceu}}
      sphere {<-1.2,0,0>, -eco1, 1  texture{ceu}}
      sphere {<-eco2,eco2,0>,1, 1  texture{ceu}}
      sphere {<-eco2,-eco2,0>,1, 1  texture{ceu}}
      sphere {<-eco2,0,0>,1, 1  texture{ceu}}
      
      
   }

#declare explosion = 
  sphere {
    <-1,0,0>
    (1-clck4)*1.5+clck4*0.3 
   texture {
        pigment {color rgb <0.9, 0.9, 0.4> transmit 0.5}
        finish {specular 0.1 ambient 0.9}//ambient 1 diffuse .6}
      }   
}     
 
#declare fonte=
 light_source {
    <0, 0, 0>
    color rgb 5*<1,0.1,0,1>
    looks_like { explosion }
    //projetced_throught { explosion}
    media_attenuation on
    
}     
   
// (1-clck1)*0+clck1*12; 
   

/*-------------------CENA----------------------*/
//object{piso}
object {economia}
object {death scale 1 translate <(1-clck3)*-8+clck3*-1,(1-clck3)*8+0*clck3,(1-clck3)*-18+clck3*0>}

#if (clock>0.8)
  object {fonte}

#end
/*#if (clock>0.8)
 object {death translate <fimx,fimy,fimz>}
#end
*/