#declare R1 = seed(061485); #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 } background { color rgb < 0.75, 0.80, 0.85 > } #declare chao = box { <-20, -20, 0>, <20, 20, 0> } #macro bit(set, defeito) union { #if (set) #local tz = 0.8; #else #local tz = 0.2; #end sphere { <0, 0, 0> 0.2 translate z*tz } cylinder { <0, 0, 0>, <0, 0, 1>, 0.05 pigment { color rgb <0.7, 0.7, 0.7> } } #if (defeito = 1) rotate <80, 0, int(rand(R1)*360)> #end } #end #declare S = 1; // Espacamento entre bits #macro numero(n, N, prob) union { #local i = 0; #local nn = int(n); #while (i < N) #local r = nn - int(nn / 2)*2; #local nn = int(nn / 2); #if (rand(R1) < prob) #local defeito = 1; #else #local defeito = 0; #end #if (r = 1) object { bit(true, defeito) translate } #else object { bit(false, defeito) translate } #end #local i = i+1; #end } #end #macro moldura(N) difference { #local p = 0.5; // tamanho da borda #local m = 2.0; // tamanho da margem #local l = (N-1)*S + m; // tamanho da moldura box { <0, 0, 0>, } box { , } pigment { color rgb <0.8, 0.8, 0.8> } translate <-m/2, -m/2, 0> } #end #macro abaco(m, n, valores, prob) union { object { moldura(n) } #local i = 0; #while (i < m) object { numero(valores[i], n, prob) translate <0, i*S, 0> #if (i - int(i/2)*2 = 0) pigment { color rgb <1, 0, 0> } #else pigment { color rgb <0, 0, 1> } #end } #local i = i+1; #end #local tt = (n-1)*S/2; translate <-tt, -tt, 0> } #end #declare valores = array[10]; #declare valores[0] = 0; #declare valores[1] = 6; #declare valores[2] = 14; #declare valores[3] = 8; #declare valores[4] = 5; #declare valores[5] = 314; #declare valores[6] = 159; #declare valores[7] = 42; #declare valores[8] = 23; #declare valores[9] = 1023; union { object { chao texture { tx_xadrez } } object { abaco(10, 10, valores, 0.3) rotate z*40.37 } scale 0.8 } #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, 1.00 >; #declare raio_cena = 6.0; #declare dir_camera = < 0, 1, 0.5 >; #declare dist_camera = 140.0; #declare intens_luz = 1.00; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)