background{ color rgb 1.5*< 0, 0.3, 0.6 > } // ====================================================================== // CORES E TEXTURAS #declare tx_tabuleiro = texture { pigment { color rgb 1.5*< 0.05, 0.40, 0.50 > } finish { diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_casa = texture { pigment { color rgb 3*< 0.1, 0.1, 0.1 > } finish { diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_peao = texture { pigment { color rgb 1.6*< 0, 0.5, 0 > } finish { diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } #declare tx_dama = texture { pigment { color rgb 1.8*< 0.5, 0, 0 > } finish { diffuse 0.8 ambient 0.1 specular 0.5 roughness 0.005 } } // ====================================================================== // PECAS #declare peao = union { cylinder { <0, 0, 0>, <0, 0, 0.1>, 0.5 texture { tx_peao } } cone { <0, 0, 0.1>, 0.4 <0, 0, 0.9>, 0.1 texture { tx_peao } } sphere { <0, 0, 1>, 0.25 texture { tx_peao } } } #declare dama = union { cylinder { <0, 0, 0>, <0, 0, 0.1>, 0.5 texture { tx_dama } } cone { <0, 0, 0.1>, 0.4 <0, 0, 1.15>, 0.1 texture { tx_dama } } sphere { <0, 0, 1.25>, 0.25 texture { tx_dama } } cone { <0, 0, 1.35>, 0.1 <0, 0, 1.75>, 0.35 texture { tx_dama } } } // ====================================================================== // TABULEIRO #macro tabuleiro(m, n) #local RI = 3; #local RA = 2; #local DEGRAU = 1; #local CASA_R = 0.75; #local CASA_I = 2; #local i = 0; union{ #while (i < m) // BASE DO ANDAR cylinder { <0, 0, -(i * DEGRAU)>, <0, 0, -(i + 1) * DEGRAU>, (RI + i * RA) texture { tx_tabuleiro } } #local j = 0; #while (j < n) // CASA cylinder { <(CASA_I + (i * RA)), 0, -(i * DEGRAU) + 0.001>, <(CASA_I + (i * RA)), 0, -(i + 1) * DEGRAU>, CASA_R texture { tx_casa } rotate <0, 0, j * (360 / n)> } // PECA #if (mod(i, 2) = 0 & mod(j, 2) = 1) object{ peao translate <(CASA_I + (i * RA)), 0, -(i * DEGRAU)> rotate <0, 0, j * (360 / n)> } #end #if (mod(i, 2) = 1 & mod(j, 2) = 0) object{ dama translate <(CASA_I + (i * RA)), 0, -(i * DEGRAU)> rotate <0, 0, j * (360 / n)> } #end #local j = j + 1; #end #local i = i + 1; #end } #end // ====================================================================== // MONTANDO #declare nfileiras = 6; #declare ncasas = 8; object{ tabuleiro(nfileiras, ncasas) } #include "camlight.inc" #declare centro_cena = < 0.00, 0.00, -0.5*(nfileiras+1) >; #declare raio_cena = 1.15*(3 + 2*nfileiras); #declare dir_camera = < 1.00, 1.00, 1.00 >; #declare dist_camera = 7*raio_cena; #declare intens_luz = 1.2; camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)