// CORES E TEXTURAS background{ color rgb < 0.75, 0.80, 0.85 > } #include "eixos.inc" #include "textures.inc" //texturas: #declare tx_fosca = texture{ pigment{ color rgb < 1.00, 0.80, 0.10 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_preto = texture{ pigment{ color rgb < 0, 0, 0 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_branco = texture{ pigment{ color rgb < 1.00, 1.00, 1.00 > } finish{ diffuse 0.9 ambient 0.1 } } //valores: #declare bits1 = 7; #declare linhas1 = 5; #declare valores1 = array[linhas1]; #declare valores1[0] = (1-clock)*11+clock*12; #declare valores1[1] = (1-clock)*12+clock*13; #declare valores1[2] = (1-clock)*16+clock*15; #declare valores1[3] = (1-clock)*4+clock*3; #declare valores1[4] = (1-clock)*126+clock*127; #declare SEED = seed(417); #declare esf_r=0.4; #declare cil_z=2; #declare cil_r=0.1; #declare bar_x=0.2; //partes da cena: #macro esfera(raio) sphere { <0, 0, 0>, raio } #end #macro cilindro(tamanho, raio) cylinder { <0, 0, 0>, <0, 0, tamanho>, raio } #end #macro bit(b, d) union { object { cilindro(cil_z, cil_r) texture { tx_fosca } } #if(d = 0) object { esfera(esf_r) texture { tx_branco } translate < 0, 0, esf_r + b*(cil_z-2*esf_r) > } #else object { esfera(esf_r) texture { tx_preto } translate < 0, 0, esf_r + b*(cil_z-2*esf_r) > } #end } #end #macro fileira(bits, numero, prob) union { object { box { <0, 0, 0> texture { tx_fosca } } } #local i = 0; #local r = int(numero); #local f = numero - r; #while (i < bits) #local s = rand(SEED); #if (s < prob) #local d = 1; #else #local d = 0; #end #local vv = mod(r,2); #if (vv = 0) #local b = f; #local f = 0; #else #local b = 1-f; #end object { bit(b, d) translate <0, (i+0.5) * 2*(5/4*esf_r), bar_x> } #local i = i + 1; #local r = int(r/2); #end } #end #macro abaco(linhas, bits, valores, prob) union { difference { object { box { <0, -bar_x, 0> } } object { box { <-0.1*bar_x, 0, bar_x> <1.1*bar_x, 2*(5/4*esf_r)*bits, linhas*(bar_x+cil_z)> } } texture { tx_fosca } } #local i = 0; #while (i < linhas) object { fileira(bits, valores[i], prob) translate <0, 0, i * (bar_x+cil_z)> } #local i = i + 1; #end } #end //cena: union{ object { eixos(10.0) } object { abaco(linhas1, bits1, valores1, 0.15) } } #include "camlight.inc" #declare centro_cena = < 0.00, 3.00, 5.00 >; #declare raio_cena = 11.0; #declare dir_camera = < 10.00, 2, 3 >; #declare dist_camera = 60.0; #declare intens_luz = 1.00; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)