// Last edited on 2003-12-09 04:46:55 by stolfi //************************************************************************************** //*** Título: A visão de Samsa - andando por aí! *** //*** Data: Campinas, 31 de outubro de 2003 *** //*** Aluno: Luciano Ludka Cordeiro - ra992077 *** //************************************************************************************** #include "colors.inc" #include "textures.inc" //************************************************************************************** //*** Setagem dos parâmetros gerais da cena: ******************************************* //************************************************************************************** #declare fonte = seed(75135982); //************************************************************************************** //*** Câmera: ************************************************************************** //************************************************************************************** #declare vel = 1.00; #declare ctr = <-0.40, 0.00, 1.20 > - clock*vel*x; #declare camDir = < -8.00, 10.00, 5.00>; // sphere{ ctr, 0.8 texture{ pigment{ color rgb <1,0,1> } finish { ambient 0.6 diffuse 0.4 } } } camera { location ctr + 0.45*camDir right -1.00*x up 0.75*y sky z look_at ctr } //************************************************************************************** //*** Fontes de Luz: ******************************************************************* //************************************************************************************** light_source { 20*< 5.00, 10.00, 30.00> // Posição da lâmpada. color rgb 0.8 * < 1.00, 1.00, 1.00 > // Intensidade e corda luz. } light_source { 20*< -10, 3.00, 30.0> // Posição da lâmpada. color rgb 0.4 * < 1.00, 1.00, 1.00 > // Intensidade e corda luz. } light_source { 20*< -10, 10.00, 5.0> // Posição da lâmpada. color rgb 1.2 * < 1.00, 1.00, 1.00 > // Intensidade e corda luz. } //************************************************************************************** //*** Declaração das cores utilizadas: ************************************************* //************************************************************************************** #declare vermelho = texture { pigment { color rgb < 0.80, 0.16, 0.20 > } //finish { diffuse 0.5 specular 0.2 roughness 0.005 ambient 0.3 } } #declare marrom = texture { pigment { color rgb < 0.60, 0.16, 0.20 > } //finish { diffuse 0.5 specular 0.2 roughness 0.005 ambient 0.3 } } #declare cor_barata = < 0.8, 0.2, 0.2 >; #declare cor_barata_aux = < 0.2, 0.1, 0.1 >; #declare tx_barata = texture { pigment { rgb cor_barata } //finish { ambient 0.15 diffuse 0.20 reflection cor_barata_aux specular 0.05 roughness 0.20 } } #declare marrom_2 = texture { pigment { color rgb < 0.60, 0.28, 0.25 > } //finish { diffuse 0.3 specular 0.7 roughness 0.005 ambient 0.0 } } #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 azul_2 = texture { pigment { color rgb < 0.40, 0.45, 0.80 > } //finish { diffuse 0.1 specular 0.8 roughness 0.005 ambient 0.1 } } #declare verde_claro = texture { pigment { color rgb < 0.60, 1.25, 0.60 > } //finish { diffuse 0.1 specular 0.8 roughness 0.005 ambient 0.1 } } #declare tx_olho = texture { pigment { color rgb < 0.10, 0.05, 0.10 > } } //************************************************************************************** //*** Declaração dos objetos utilizados: *********************************************** //************************************************************************************** #declare chao = plane{ z,0 texture{ pigment{ checker color Grey, color Tan } finish{ diffuse 0.7 ambient 0.3 } scale 0.5*vel } } #declare antena2 = union{ cylinder {<0.00, 0.00, 0.00>,<0.00, 0.00, 1.00>, 0.02 texture {tx_olho} } sphere {<0.00 0.00 0.00>, 0.02 texture {tx_olho} } } #declare antena = union{ cylinder {<0,0,0>,<0,0,1>, 0.02} object {antena2 rotate <0,60,0> translate <0,0,1>} } #declare head = union{ sphere { <0.00, 0.00, 0.00>, 0.40 texture {vermelho} } /*cabeça principal*/ sphere { <0.10, +0.15, 0.35>, 0.07 texture {tx_olho} } /*olho*/ sphere { <0.10, -0.15, 0.35>, 0.07 texture { tx_olho }} /*olho*/ sphere { <0.32, 0.00, 0.17>, 0.07 texture {tx_olho} scale <1,2,1>} /* boca */ object {antena translate <0.00, +0.15, 0.35>} /*antena*/ object {antena translate <0.00, -0.15, 0.35>} /*antena*/ } #declare origem = < 0.00, 0.00, 0.00 >; //origem ligeiramente afastada para trás, para remover falha #declare ponto4 = < 0.00, 0.00, 0.08 >; #declare ponto3 = < 0.00, 0.00, 0.13 >; #declare ponto2 = < 0.00, 0.00, 0.21 >; #declare ponto1 = < 0.00, 0.00, 0.34 >; #declare pata4 = union{ cylinder{ origem, ponto4, 0.01 texture {marrom_2} } sphere {origem, 0.01 texture {marrom_2} } } // clock1 vai de 1 a zero e depois retorna a 1 #declare clock1 = 2*abs(0.50-clock); #declare clock2 = 1 - clock1; #declare contador = 0; #declare patas = union{ #declare numParPatas = 0; #while (numParPatas < 4) #declare par = -1; #while (par < 2) #if ( mod(numParPatas+contador,2) = 0) #declare detPos = clock1; #else #declare detPos = clock2; #end #declare contador = contador+1; #declare alfa_x = detPos; // deve variar entre 0 e 1 #declare alfa_y = 0; // não interessa ao movimento #declare alfa_z = 1; // também não interessa ao movimento #declare beta = abs(sin(45+asin(detPos))); #declare gama = mod(detPos,0.5); #declare teta = mod(detPos,0.5); #declare pata3 = union{ cylinder{ origem, ponto3, 0.02 texture {marrom_2} } sphere {origem, 0.02 texture {marrom_2} } object { pata4 rotate translate ponto3 } } #declare pata2 = union{ cylinder{ origem, ponto2, 0.03 texture {marrom_2} } sphere {origem, 0.03 texture {marrom_2} } object { pata3 rotate translate ponto2 } } #declare pata1 = union{ cylinder{ origem, ponto1, 0.05 texture {marrom_2} } sphere {origem, 0.05 texture {marrom_2} } object { pata2 rotate translate ponto1} } object{ pata1 rotate <(-45)*alfa_x, 45*alfa_y, 90*alfa_z> scale <2, 2*par, 2> /* para dar um par de patas por fila */ translate } #declare par = par+2; #end #declare numParPatas = numParPatas+1; #end } #declare body = union{ object{ difference{ sphere { < 0.00, 0.00, 0.00 >, 1.00 texture {marrom} } box { < -2.00, -2.00, 0.00 >, < 2.00, 2.00, 2.00 > texture {tx_barata} } } scale <3,1,1> } object { head rotate <0, -120, -90>translate <-3.20, 0.00, 0.00> } } #declare barata = union{ object { patas } object { body } } //************************************************************************************** //*** DECLARAÇÃO DA CENA - OBJETOS MONTADOS ******************************************** //************************************************************************************** background { color rgb < 0.50, 0.50, 0.50 > } union{ object { chao } object { barata scale <1,1,-1> translate <1-clock, 0, 1.4>} }