// Exemplo de arquivo de descricao de cena para POV-ray
// Last edited on 2010-03-04 15:44:01 by stolfi

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

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

#declare tx_chao =
  texture{
    pigment{ color rgb < 0.00, 0.70, 0.00 > }
    scale 2.0
  }

// ======================================================================
// DESCRIÇÃO DA CENA 

#declare raio = 2.000;

// Partes da cena:

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

#macro cabeca()
  object{ sphere { < 0.00, 0.00, 0.00 >, 0.5 texture {
        pigment { color rgb <0.64, 0.16, 0.16> }
      } }  }
#end

#macro tronco()
  object{ box{ <-0.50, -0.70, -1>, <0.50, 0.70, 1> texture {
        pigment { color rgb <0.64, 0.16, 0.16> }
      }}  }
#end

#macro pescoco()
  object {
    cylinder {
      < 0, 0, 0 >,
      < 0, 0, 0.80 >,
      0.15
      texture{ pigment { color rgb <0.64, 0.16, 0.16> } }
    }
  }
#end

#macro orelha()
  object {
    cone {
      < 0, 0, 0>, 0.15,
      < 0, 0, 0.8>, 0
      texture{ pigment { color rgb <0.64, 0.16, 0.16> } }
    }
  }
#end

#macro pe()
  union {
    object{ 
      sphere { 
        < 0.00, 0.00, 0.00 >, 0.15 
        texture {
          pigment { color rgb <1, 1, 1> }
        } 
      }
    }
  
    object{
      box { 
        <-0.05, -0.10 ,-0.40>, <0.05, 0.10, 0> 
        texture {
          pigment { color rgb <1, 1, 1> }
        }
      }
    }
  }
#end

#macro canela(c)
  union {
    object{ 
      sphere { 
        < 0.00, 0.00, 0.00 >, 0.20 
        texture {
          pigment { color rgb <0.64, 0.16, 0.16> }
        } 
      }
    }
  
    object{
      box { 
        <-0.10, -0.10 ,-1>, <0.10, 0.10, 0> 
        texture {
          pigment { color rgb <0.64, 0.16, 0.16> }
        }
      }
    }

    object{pe() rotate <0,c,0> translate <0,0,-1>}
  }
#end

#macro coxa(b,c)
  union {
  object{ 
    box { 
      <-0.15, -0.15 ,-1>, <0.15, 0.15, 0> 
      texture {
        pigment { color rgb <0.64, 0.16, 0.16> }
      }
    }
  }
  object{canela(c) rotate <0,b,0> translate <0,0,-1>}
  }
#end

#macro perna(a,b,c)
  object{coxa(b,c) rotate <0,a,0>}
#end

#macro mao()
  object{ 
    sphere { 
      < 0.00, 0.00, 0.00 >, 0.15 
      texture {
        pigment { color rgb <1, 1, 1> }
      } 
    }
  }
#end

#macro parte_braco(b)
  union{
    object{ 
      box { 
        <-0.15, -0.15 ,-1>, <0.15, 0.15, 0> 
        texture {
          pigment { color rgb <0.64, 0.16, 0.16> }
        }
      }
    }
    object{antebraco() rotate <0,b,0> translate <0,0,-1>}
  }

#end

#macro antebraco()
  union {
    object{ sphere { < 0.00, 0.00, 0.00 >, 0.20 texture {
          pigment { color rgb <0.64, 0.16, 0.16> }
        } }  }
  
    object{
      box { 
        <-0.10, -0.10 ,-1>, <0.10, 0.10, 0> 
        texture {
          pigment { color rgb <0.64, 0.16, 0.16> }
        }
      }
    }
    object{mao() translate <0,0,-1>}
  }
#end

#macro braco(a,b)
  object{parte_braco(b) rotate <0,a,0>}
#end

#macro gatoDeRelogio(a1bd,a2bd,a1be,a2be,a1pd,a2pd,a3pd,a1pe,a2pe,a3pe)
union{
  object{cabeca() translate <0,0,3.7>}
  object{tronco() translate <0,0,2>}
  object{pescoco() translate <0,0,3>}
  object{orelha() rotate <10,0,0> translate <0,-0.15,3.8>}
  object{orelha() rotate <-10,0,0> translate <0,0.15,3.8>}
  object{braco(a1bd,a2bd) rotate <-10,0,0> translate <0,-0.8, 3>} // braco direito
  object{braco(a1be,a2be) rotate <10,0,0> translate <0, 0.8, 3>} // braco esquerdo
  object{perna(a1pd,a2pd,a3pd) translate <0, -0.60, 1>} // perna direita
  object{perna(a1pe,a2pe,a3pe) translate <0, 0.60, 1>} // perna esquerda
}

#end

#include "eixos.inc"

// Aqui está a cena, finalmente:

union{
  object{chao translate < 0,0,-1.2 > texture{ tx_chao } }
  object{gatoDeRelogio(-30,-60,20,-70,-60,90,-70,0,40,-90) rotate <0,0,90> translate <0,-3,0>}
  object{gatoDeRelogio(20,-70,-30,-60,0,40,-90,-60,90,-70) rotate <0,0,90>}
  object{gatoDeRelogio(180,-50,180,-50,-10,10,-90,-10,10,-90) rotate <0,0,90> translate <0,3,0>}
}

#include "camlight.inc"
#declare centro_cena = < 0.00, 0.00, 1.00 >;
#declare raio_cena = 8.0;
#declare dir_camera = < 50.00, 35.00, 20.00 >;
#declare dist_camera = 20.0;
#declare intens_luz = 1.00;
camlight(centro_cena, raio_cena, dir_camera, dist_camera , z, intens_luz)