//Ejemplo de prueba para una escena vista 3D
//Por: Mario H Tiburcio Z

#include "colors.inc"
#include "librerias.inc"

camera {
  location <6,6,-6>
  look_at <0,0,0>
}

light_source {<4,5,-6> color White}


background {rgb <0.7, 0.7, 1>}

// Cuerpo del gato
#declare cuerpo_gato = sphere {
  <0, 0, 0>, 1
  pigment { color rgb <0.6, 0.5, 0.6> }
  scale <1.7, 0.8, 0.8>
}

// Cabeza del gato
#declare cabeza_gato = sphere {
  <-0.9, 1.3, -0.4>, 0.6
  pigment { color rgb <0.6, 0.5, 0.6> }
}


// Orejas (más grandes)
#declare oreja_derecha = cone {
  <-0.6, 1.9, -0.4>, 1
  <-0.9, 1.3, -0.4>, 0.5
  pigment { color rgb <0.4, 0.3, 0.5> }
}

#declare oreja_izquierda = cone {
  <-1.2, 1.9, -0.4>, 0.0
  <-0.9, 1.3, -0.4>, 0.5
  pigment { color rgb <0.4, 0.3, 0.5> }
}

// Ojos
#declare ojo_derecho = union {
  sphere {
    <-0.6, 1.4, -0.7>, 0.2
    pigment { color White }
  }
  sphere {
    <-0.55, 1.4, -0.75>, 0.08
    pigment { color Black }
  }
};

#declare ojo_izquierdo = union {
  sphere {
    <-1.2, 1.4, -0.7>, 0.2
    pigment { color White }
  }
  sphere {
    <-1.25, 1.4, -0.75>, 0.08
    pigment { color Black }
  }
};

// Nariz
#declare nariz = sphere {
  <-0.9, 1.2, -0.9>, 0.1
  pigment { color Pink }
}

// Sonrisa
#declare sonrisa = union {
  torus {
    0.3, 0.02
    rotate <90, 0, 0>
    translate <-0.9, 1.1, -0.8>
    pigment { color White }
  }
  sphere {
    <-0.8, 1.05, -0.75>, 0.02
    pigment { color Black }
  }
}

// Cola ajustada
#declare cola = sphere_sweep {
  cubic_spline
  6,
  <1.5, 0.0, -0.4>, 0.1
  <1.6, 0.2, -0.6>, 0.08
  <1.5, 0.4, -0.8>, 0.06
  <1.3, 0.6, -1.0>, 0.04
  <1.2, 0.8, -1.2>, 0.03
  <1.0, 1.0, -1.4>, 0.02
  pigment { color rgb <0.6, 0.5, 0.6> }
};

// Patas
#declare pata_frontal_derecha = cylinder {
  <-0.5, -0.4, 0.3>, <-0.5, 0.0, 0.3>, 0.1
  pigment { color rgb <0.6, 0.5, 0.6> }
};

#declare pata_frontal_izquierda = cylinder {
  <-1.3, -0.4, 0.3>, <-1.3, 0.0, 0.3>, 0.1
  pigment { color rgb <0.6, 0.5, 0.6> }
};

#declare pata_trasera_derecha = cylinder {
  <0.5, -0.4, -0.3>, <0.5, 0.0, -0.3>, 0.1
  pigment { color rgb <0.6, 0.5, 0.6> }
}

#declare pata_trasera_izquierda = cylinder {
  <-1.5, -0.4, -0.3>, <-1.5, 0.0, -0.3>, 0.1
  pigment { color rgb <0.6, 0.5, 0.6> }
}

// Gato completo
#declare gato = union {
  object { cuerpo_gato }
  object { cabeza_gato }
  object { oreja_derecha }
  object { oreja_izquierda }
  object { ojo_derecho }
  object { ojo_izquierdo }
  object { sonrisa }
  object { nariz }
  object { cola }
  object { pata_frontal_derecha }
  object { pata_frontal_izquierda }
  object { pata_trasera_derecha }
  object { pata_trasera_izquierda }
  translate <0, 0.5, 0> // Elevación del gato sobre el plano
  scale 0.5 // Tamaño reducido al 50%
}
// Posicionar el gato en la escena
object {
  gato
  rotate <0,360 *clock, 0>
}
plane  { y,0 pigment {checker Black White }}
ejes3D


