// 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.75, 0.8, 0.85 > }

#declare tx_plastico = 
  texture{
    pigment{ color rgb < 0,1,1> }
    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_espelho = 
  texture{
    pigment{ color rgb < 0, 0, 1 > }
    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
  }

// ======================================================================
// DESCRI��O DA CENA 


#include "eixos.inc"

#macro tabuleiro(m, n)
  object{ eixos(3.00)}
  
  #declare peao=
  union{
    cone{
    <0,0,0>, 0.3
    <0, 0, 0.7> 0.1
    texture{tx_plastico}
    }

    sphere{
      <0, 0, 0.9>, 0.2
      texture{tx_plastico}
    }
  }

  #declare rainha=
    union{
      cone{
      <0,0,0>, 0.3
      <0, 0, 0.2> 0.2
      texture{tx_plastico}
      }

      cylinder{
        <0, 0, 0.2>, <0, 0, 1.1>, 0.15
        texture{tx_plastico}
      }
      cone{
      <0,0,1.1>, 0.2
      <0, 0, 1.2> 0.3
      texture{tx_plastico}
      }

      sphere{
        <0, 0, 1.4>, 0.2
        texture{tx_plastico}
      }
    }
  #declare casa=
    disc{
      <0, 0, 0>, <0, 0, 1> , 0.3
    }


  #declare Index = 1;
  #while(Index < m+1)

    union{
      disc{
       <0, 0, 0>, <0, 0, 1>, 8-(Index*1.25), 7.9-(Index*1.25)
    }
    }

    #if(mod(Index, 2) = 0)
        union{object{rainha translate<0, (8-(Index*1.25) + 7.9-(Index*1.25))/2, 0>}}
      #else
        union{object{peao translate<0, (8-(Index*1.25) + 7.9-(Index*1.25))/2, 0>}}
      #end

    #declare Count = 0;

    #while(Count < n)
      object{casa translate<0, (8-(Index*1.25) + 7.9-(Index*1.25))/2, 0>}

      #declare Count = Count + 1;
    #end



    #declare Index = Index + 1;
  #end

#end

tabuleiro(5, 4)

#include "camlight.inc"
#declare centro_cena = < 0.00, 0.00, 1.00 >;
#declare raio_cena = 8.0;
#declare dir_camera = < 18, 9.00, 7 >;
#declare dist_camera = 5*raio_cena;
#declare intens_luz = 1.20;
camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)