// Exemplo de arquivo de descricao de cena para POV-ray
// Last edited on 2023-09-20 17:27:38 by stolfilocal

// ======================================================================
// CORES E TEXTURAS

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

#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_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 < 1.00, 0.85, 0.30 > }
    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 

#declare raio = 2.000;

// Partes da cena:
  
#declare hiperpeao = union {
  cylinder {
  <0, 0, 0>, <0, 0, 0.5>, 1 // center of one end, center of other end, radius  
  texture {tx_plastico}
}
cone {
  <0, 0, 0.5>, 0.5 // <x, y, z>, center & radius of one end
  <0, 0, 2>, 0 // <x, y, z>, center & radius of the other end
  texture {tx_plastico}
}

box {
  <-1, -1, 2>, <1, 1, 2.2> // <x, y, z> near lower left corner, <x, y, z> far upper right corner
  texture {tx_plastico}
  
}
}

#declare hiperdama = union {
 box {
  <-1, -1, 0>, <1, 1, 0.2> // <x, y, z> near lower left corner, <x, y, z> far upper right corner
  texture {tx_fosca}
}


}

#declare chao = 
  box{ <-20,-20,-1>, <+20,+20,0> }


#macro tabuleiro(fileiras, casas)
 #local i = 0;
 #local j = 0;

  union {

    #while(j < fileiras)

      #while(i < casas)
        #if (mod(casas, 2) = 0)
          #if (mod(fileiras, 2) = 0)
            object {hiperpeao translate <0, i, j> rotate 30*z}
          #else 
            object {hiperdama}
          #end
        #end
        // #else 
        //   object {}
        #local i = i + 1;
      #end
      #local j = j + 1;
    #end
  }
 
#end

#include "eixos.inc"

#local nfileiras = 5;
#local ncasas = 8;

union{
  object{ eixos(3.00) }

  object{ chao  translate < 0,0,-5 > texture{ tx_xadrez } }

  object { tabuleiro(nfileiras, ncasas) }
  
  union{ object{ eixos(3) } object{ hiperdama } translate 5*<1.0, +0.3, 0.0> }
  union{ object{ eixos(3) } object{ hiperpeao } translate 5*<1.0, -0.3, 0.0> }
  
}

#include "camlight.inc"
#declare centro_cena = < 0.00, 0.00, 1.00 >;
#declare raio_cena = 0.6*sqrt(nfileiras*nfileiras + ncasas*ncasas) + 2;
#declare dir_camera = < 14.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)