// Last edited on 2007-04-01 19:50:54 by stolfi
// Processed by remove-cam-lights

background{ color rgb < 0.75, 0.80, 0.85 > }

#declare raio = 2.000;

#declare branco = 
  texture {
    pigment { color rgb < 1.00, 1.00, 1.00 > }
    finish { diffuse 0.8 specular 0.2 roughness 0.005 ambient 0.2 }
  }

#declare preto = 
  texture {
    pigment { color rgb < 0.00, 0.00, 0.00 > }
    finish { diffuse 0.8 specular 0.2 roughness 0.005 ambient 0.2 }
  }

#declare cinza = 
  texture {
    pigment { color rgb < 0.40, 0.40, 0.40 > }
    finish { diffuse 0.8 specular 0.2 roughness 0.005 ambient 0.2 }
  }

#declare caixa_branca = 
  box {
    < 0.00, 0.00, 0.00 >,
    < 1.00, 1.00, 1.00 >
    texture { branco }
}

#declare caixa_preta = 
  box {
    < 0.00, 0.00, 0.00 >,
    < 1.00, 1.00, 1.00 >
    texture { preto }
}

#declare torre_branca = 
  cylinder {
    < 0.00, 0.00, 0.00 >,
    < 0.00, 0.00, 1.50 >,
    0.40
    texture { branco }
  }

#declare torre_preta = 
  cylinder {
    < 0.00, 0.00, 0.00 >,
    < 0.00, 0.00, 1.50 >,
    0.40
    texture { cinza }
  }

#declare peao_branco =
  union {
    cylinder {
      < 0.00, 0.00, 0.00 >,
      < 0.00, 0.00, 0.30 >,
      0.40
      texture { branco }
    }
    cylinder {
      < 0.00, 0.00, 0.30 >,
      < 0.00, 0.00, 1.50 >,
      0.10
      texture { branco }
    }
  }

#declare peao_preto =
  union {
    cylinder {
      < 0.00, 0.00, 0.00 >,
      < 0.00, 0.00, 0.30 >,
      0.40
      texture { cinza }
    }
    cylinder {
      < 0.00, 0.00, 0.30 >,
      < 0.00, 0.00, 1.50 >,
      0.10
      texture { cinza }
    }
  }

#declare rei_branco =
  union {
    cylinder {
      < 0.00, 0.00, 0.00 >,
      < 0.00, 0.00, 1.50 >,
      0.40
      texture { branco }
    }
    cylinder {
      < 0.00, 0.00, 1.50 >,
      < 0.00, 0.00, 2.00 >,
      0.05
      texture { branco }
    }
    cylinder {
      < 0.00, 0.00, 2.00 >,
      < 0.00, 0.00, 2.50 >,
      0.15
      texture { branco }
    }
    texture { branco }
  }

#declare rei_preto =
  union {
    cylinder {
      < 0.00, 0.00, 0.00 >,
      < 0.00, 0.00, 1.50 >,
      0.40
      texture { cinza }
    }
    cylinder {
      < 0.00, 0.00, 1.50 >,
      < 0.00, 0.00, 2.00 >,
      0.05
      texture { cinza }
    }
    cylinder {
      < 0.00, 0.00, 2.00 >,
      < 0.00, 0.00, 2.50 >,
      0.15
      texture { cinza }
    }
    texture { cinza }
  }


#declare roleta = seed(1);
#declare i=0;
#while(i<100)
    #declare j=0;
    #while(j<100)
        #if(mod(i+j,2)=0)
            object { caixa_branca translate<i, j, 0>}
     #declare randomico = int(80*rand(roleta));
       #if(randomico=1)
         object { rei_preto translate<i+0.50, j+0.50, 1> } 
            #end
       #if(randomico=2)
         object { torre_preta translate<i+0.50, j+0.50, 1> } 
       #end
       #if(randomico=3)
         object { peao_preto translate<i+0.50, j+0.50, 1> } 
       #end
        #if(randomico=4)
         object { rei_branco translate<i+0.50, j+0.50, 1> } 
            #end
       #if(randomico=5)
         object { torre_branca translate<i+0.50, j+0.50, 1> } 
       #end
       #if(randomico=6)
         object { peao_branco translate<i+0.50, j+0.50, 1> } 
       #end
            #declare j = j + 1;
        #else
            object { caixa_preta translate<i, j, 0>}
     #declare randomico = int(80*rand(roleta));
       #if(randomico=1)
         object { rei_preto translate<i+0.50, j+0.50, 1> } 
            #end
       #if(randomico=2)
         object { torre_preta translate<i+0.50, j+0.50, 1> } 
       #end
       #if(randomico=3)
         object { peao_preto translate<i+0.50, j+0.50, 1> } 
       #end
        #if(randomico=4)
         object { rei_branco translate<i+0.50, j+0.50, 1> } 
            #end
       #if(randomico=5)
         object { torre_branca translate<i+0.50, j+0.50, 1> } 
       #end
       #if(randomico=6)
         object { peao_branco translate<i+0.50, j+0.50, 1> } 
       #end
            #declare j = j + 1;
        #end
    #end
    #declare i = i + 1;
#end

object { rei_preto translate<0,0,1> }

// Original camera parameters:
// #local cam_ctr = <50.00,50.00,0.00>
// #local cam_vec = (<80.00,80.00,8.00>-<50.00,50.00,0.00>)
// #local cam_sky = z

#include "camlight.inc"
camlight(<50.00,50.00,0.00>,<10,10,10>,50.0,z,1.0)