// Exemplo de arquivo de descricao de cena para POV-ray // Last edited on 2010-03-04 15:44:01 by stolfi // ====================================================================== // CORES E TEXTURAS background{ color rgb < 0.75, 0.80, 0.85 > } #declare roleta = seed(500); #declare tx_plastico = texture{ pigment{ color rgb < 0.10, 0.80, 1.00 > } finish{ diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_fosca = texture{ pigment{ color rgb < 1.00, 0.80, 0.10 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_metal = texture{ pigment{color rgb < 1.00, 0.00, 0.00 > } finish{ reflection 0.30 } } #declare tx_espelho = texture{ pigment{ color rgb < 1.00, 0.85, 0.30 > } finish{ diffuse 0.2 reflection 0.7*< 1.00, 0.85, 0.30 > ambient 0.1 } } #declare tx_vidro = texture{ pigment{ color rgb < 0.85, 0.95, 1.00 > filter 0.70 } finish{ diffuse 0.03 reflection 0.25 ambient 0.02 specular 0.25 roughness 0.005 } } #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 } #declare tx_xadrez2 = texture{ pigment{ checker color rgb < 0.00, 0.00, 0.00 >, color rgb < 1.00, 1.00, 1.00 > } finish{ diffuse 1.0 ambient 1.0 } scale 5.0 } // ====================================================================== // DESCRIÇÃO DA CENA #declare raio = 2.000; // Partes da cena: #declare pino = cylinder{ < +2.00, +2.00, +0.00 >, < +2.00, +2.00, +2.00 >, 10.00 } #declare pino2 = cylinder{ < +2.00, +2.00, -1.00 >, < +2.00, +2.00, +7.00 >, 9.00 } #declare chao = box{ <+20.00,-20.00,-1.00>, <-20.00,+20.00,-0.00> } #macro abacus(m,n,valores,prob) union{ union{ difference{ object{cylinder{ < +0.50, +0.00, 0.00 >, < -0.50, +0.00, 0.00 > 1.5 } scale <1,1,m+1> } object{box{ < -1.00, -1.00, 1.00 >, < 1.00, +1.00, -1.00 > scale <1,1,m>} } } #local i = m; union{ #while(i > 0) object{box{ < -0.01, -1.00, 0.10 >, < +0.02, +1.00, -0.10 > translate <0,0,i*2-m> } } #local i = i - 1; #end } scale <1,n,1> } #local j = m; union{ #while(j > 0) object{ fileira(n,valores[j-1],prob) translate <0,-n-1,j*2-m-2> } #local j = j - 1; #end } } #end #macro bit(value,prob) #local def = (rand(roleta), <-0.5,-0.5,0.0> } translate <0,0,value> texture{tx_plastico} } object{ box{<0.1,0.1,2.0>, <-0.1,-0.1,0.0> } texture{tx_metal} } #else union{ object{ box{<0.5,0.5,1.0>, <-0.5,-0.5,0.0> } translate <0,0,value> texture{tx_xadrez2} } object{ box{<0.1,0.1,2.0>, <-0.1,-0.1,0.0> } texture{tx_metal} } #end } #end #macro fileira(n,value,prob) union{ #local r = int(value); #local f = value - r; #local i = n; #local valor = value; #local k = n; /*#while(i > 0) object{bit(mod(valor,2),prob) translate <0,2*i,0>} #local i = i - 1; #local valor = int(valor / 2); #end*/ #while (i > 0) #local vv = mod(r,2); #if (vv=0) object{bit(f,prob) translate <0,2*i,0>} #local f = 0; #else object{bit(1-f,prob) translate <0,2*i,0>} #end #local r = int(r/2); #local i = i-1; #end } #end #include "eixos.inc" // Aqui está a cena, finalmente: #declare n = 8; #declare valores = array[n]; #declare valores[0] = 0*(1-clock) + clock*2; #declare valores[1] = 1*(1-clock) + clock*9; #declare valores[2] = 2*(1-clock) + clock*15; #declare valores[3] = 3*(1-clock) + clock*8; #declare valores[4] = 4*(1-clock) + clock*20; #declare valores[5] = 11*(1-clock) + clock*3; #declare valores[6] = 6*(1-clock) + clock*7; #declare valores[7] = 20*(1-clock) + clock*0; union{ object{ abacus(8,8,valores,0.5) texture{tx_fosca}} } #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, 0.00 >; #declare raio_cena = 40.0; #declare dir_camera = <2, (-16)*(1-clock) + clock*16, 2.00 >; #declare dist_camera = 40.0; #declare intens_luz = 1.00; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)