/* Feito por Andre Cesarino, RA 041939.*/ #include "eixos.inc" #include "camlight.inc" #declare centro_cena = < 10.00, 10.00, +3.00 >; #declare tempo = array[9] {0.0, 0.125, 0.250, 0.375, 0.500, 0.625, 0.750, 0.825, 1.000}; #local dist_camera = (1-clock)*15 + clock*10; #local raio_cena = (1-clock)*20 * clock*15; // #declare dir_camera = < -1.00, 10.00, 3.00 >; // #declare dist_camera = 30.0; // #declare raio_cena = 30.0; #declare intens_luz = 1.00; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz) /* CORES E TEXTURAS*/ background{ color rgb < 0.50, 0.50, 0.50 > } #declare cinza_brilhante = texture { pigment{ color rgb <0.50, 0.50, 0.50>} finish { diffuse 1 specular 0.5} } #declare vermelho_fosco = texture { pigment{ color rgb <1.00, 0.00, 0.00>} finish { diffuse 1 specular 0.2 } } #declare amarelo_fosco = texture { pigment{ color rgb <1.00, 1.00, 0.00>} finish { diffuse 1 specular 0.2 } } #declare tx_xadrez = texture { pigment{ checker color rgb < 0.10, 0.32, 0.60 >, color rgb < 1.00, 0.97, 0.90 > } finish{ diffuse 0.9 ambient 0.1 } scale 2.0 } /* DESCRICAO DA CENA */ #declare chao = box{ <-100,-100,-1>, <+100,+100,0>} //#declare tempo = array[num_quadros] {0.0, 0.125, 0.250, 0.375, 0.500, 0.625, 0.750, 0.825, 1.000}; // #macro interpola (f0,v0,f1,v1,f) // #local ss = (f-f0)/(f1-f0); // #local rr = 1 - ss; // (rr*v0 + ss*v1) // #end // // #macro quadro_anterior(fase) // #local i=0; // #while (i < (num_quadros-1)) // #if ((tempo[i] <= fase) & ((i = num_quadros-1) | (tempo[i+1] >= fase))) // #local resp = i; // #end // #local i=i+1; // #end // resp // // #end // #macro braco (tamanho,pos_braco,ang_y_braco,ang_x_braco,ang_antebraco) // union // { // sphere{<0,0,0>,tamanho/4 texture {branco_fosco}} // cone {<0,0,0>,tamanho/7,<0,0,-tamanho>,tamanho/10 texture {branco_fosco}} // // object{antebraco (tamanho,ang_antebraco) } // rotate ang_y_braco*y // rotate ang_x_braco*x // translate <0,tamanho/5,2*tamanho> // translate // } // #end #declare roleta = seed(313); #macro bit(pos_bit) #declare defeito = (rand(roleta) < prob); #if (defeito = 1) sphere{<0,0,0>,1 texture{vermelho_fosco}} #else sphere{<0,0,0>,1 texture{cinza_brilhante}} #end translate pos_bit #end #macro fileira_frac (valor,defeito,pos_fileira) #local vetor_bit = array[6]; #local valor_int = int(valor); #local frac = valor - valor_int; #local i = 0; #while (i < 6) #local valor_bit = mod(valor_int,2); #if (valor_bit = 0) #local vetor_bit[i] = frac; #local frac = 0; #else #local vetor_bit[i]= 1-frac; #end #local valor_int = int(valor_int/2); #local i = i+1; #end union { cylinder{<0,0,1>,<20,0,1>, 0.3 texture{cinza_brilhante}} object{ bit(<16+vetor_bit[5],0,1>)} object{ bit(<13+vetor_bit[4],0,1>)} object{ bit(<10+vetor_bit[3],0,1>)} object{ bit(<7+vetor_bit[2], 0,1>)} object{ bit(<4+vetor_bit[1], 0,1>)} object{ bit(<1+vetor_bit[0], 0,1>)} translate pos_fileira } #end #macro abaco (prob) union { //A estrutura do ábaco, de <0,0,0> a <22,2,20> box{< 0,0,0> , <22,2, 2> texture{cinza_brilhante}} box{<20,0,2> , <22,2,20> texture{cinza_brilhante}} box{<22,2,20>, <0,0,18> texture{cinza_brilhante}} box{<0,0,0> , <2,2,20> texture{cinza_brilhante}} object{fileira_frac(0,prob,<2,0,2>)} object{fileira_frac(1,prob,<2,0,4>)} object{fileira_frac(15, prob,<2,0,6>)} object{fileira_frac(15.5,prob,<2,0,8>)} object{fileira_frac(15.8,prob,<2,0,10>)} object{fileira_frac(16 ,prob,<2,0,12>)} object{fileira_frac(32,prob,<2,0,14>)} object{fileira_frac(63,prob,<2,0,16>)} } #end /*Aqui comeca a cena. */ union { object{ eixos(3.00) } object{ chao translate < 0,0,-5> texture {tx_xadrez}} object{ abaco(0.0)} }