// 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 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_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_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 } } // ====================================================================== // DESCRIÇÃO DA CENA #declare raio = 2.000; #declare moldura = box{ <2,-22,7>, <-2,10,-8> texture { tx_plastico } } #declare suporte = cylinder{ <0,0,-0.5>, <0,0,2.5>, 0.2 texture { tx_vidro } } #declare botao = sphere{ <0,0,0>, 0.5 texture { tx_espelho } } #declare roleta = seed(417); // ====================================================================== // MACROS #macro bit(valor, prob) union{ object{ suporte } #local def = (rand(roleta) < prob); #if(def = 0) object{ botao translate < 0,0,valor*2 > } #else object{ botao translate < 0,0,1 > } // a peca fica presa no centro do suporte #end } #end #macro fileira(n, valor, prob) #local r = int(valor); #local f = valor - r; #local i = n; union{ #while (i > 0) #local vb = mod(r,2); #if (vb = 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 i = i-1; #local r = int(r / 2); #end } #end #macro abaco(m,n,valores,prob) union{ #local i = 0; #while(i < m) object{ fileira(n, valores[i], prob) translate <0,0,-5*i> } #local i = i+1; #end } #end #declare valores = array[2]; #declare valores[0] = (1-clock)*3 + clock*4; #declare valores[1] = (1-clock)*2 + clock*10; #declare maiores = array[2]; #declare maiores[0] = (1-clock)*30 + clock*35; #declare maiores[1] = (1-clock)*100 + clock*127; #declare bit_isolado = array[1]; #declare bit_isolado[0] = (1-clock)*0 + clock*1; // ====================================================================== #include "eixos.inc" // Aqui está a cena, finalmente: union{ object{ abaco(2,4,valores,0.1) } object{ abaco(2,8,maiores,0.05) translate <0,-18,0>} object{ abaco(1,1,bit_isolado,0.1) rotate <90,0,0> translate <0,-10,3> } // object{ bit(0.6, 0.1) rotate <90,0,0> translate <0,-10,5> } } #include "camlight.inc" #declare centro_cena = < (1-clock)*0.00, 0.00, 0.00 > + < clock*4, 0, 0 >; #declare raio_cena = (1-clock)*12.0 + clock*15.0; #declare dir_camera = < 14.00, 7.00, 8.00 >; #declare dist_camera = 20.0; #declare intens_luz = 1.00; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)