// Exemplo de arquivo de descricao de cena para POV-ray // Last edited on 2020-09-30 19:57:13 by jstolfi // ====================================================================== // CORES E TEXTURAS background{ color rgb < 0.90, 0.80, 0.85 > } #declare corPreta = rgb<0.2,0.2,0.2>; #declare corBranca = rgb<0.8,0.8,0.8>; #declare tx_fosca_preta = texture{ pigment{ color rgb < 0.1, 0.1, 0.1 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_fosca_cinza = texture{ pigment{ color rgb < 0.3, 0.3, 0.3 > } finish{ diffuse 0.9 ambient 0.1 } } #declare tx_xadrez = texture{ pigment{ checker color rgb < 0.1, 0.1, 0.1 >, color rgb < 1.00, 0.97, 0.90 > } finish{ diffuse 0.9 ambient 0.1 } scale 2.0 } #declare tx_fosca = texture{ pigment{ color rgb < 0.80, 0.80, 0.10 > } finish{ diffuse 0.9 ambient 0.1 } } #declare peao = union { cylinder { <0, 0, 0>, <0, 0, 0.3>, 0.75// center of one end, center of other end, radius texture{tx_fosca_preta} } cone { <0, 0, 0.3>, 0.5 // , center & radius of one end <0, 0, 1.5>, 0 // , center & radius of the other end texture{tx_fosca_cinza} } } #declare rainha = union { cylinder { <0, 0, 0>, <0, 0, 0.3>, 0.75// center of one end, center of other end, radius texture{tx_fosca_preta} } cone { <0, 0, 0.3>, 0.5 // , center & radius of one end <0, 0, 1.5>, 0 // , center & radius of the other end texture{tx_xadrez} } sphere{ < 0,0,1.5 >, 0.35 texture{tx_fosca}} } #declare casa = cylinder { <0, 0, 0>, <0, 0, 0.1>, 1// center of one end, center of other end, radius } // Funão que deveria criar o tabuleiro #macro create_board(n, m) union { #for (i, 0, n-1) #local casaColor = corBranca; #local angles = i*360/n; #local X = m*acos(angles); #local Y = m*acos(angles); #if(mod(i,2)=0) casaColor = corBranca #else casaColor = corPreta #end object{casa translate pigment{casaColor}} #end #for (j, 0, n-1) #local angle2 = j*360/n; #local X2 = m*acos(angle2); #local Y2 = m*acos(angle2); #local element = peao; object{element translate} #if(mod(j,3)=1) element = peao #else #end #if(mod(j,2)=2) element = rainha #else #end #end } #end #include "eixos.inc" union{ object{eixos(3.00) } // object{casas} // object{create_board(3,3)} object{peao} } #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, 2.00 >; #declare raio_cena = 6.0; #declare dir_camera = < 14.00, 7.00, 4.00 >; // #declare dir_camera = < -2.00, 7.00, 4.00 >; #declare dist_camera = 5*raio_cena; #declare intens_luz = 1.20; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)