#include "chars.inc"
#include "colors.inc"
#include "textures.inc"
#include "stones.inc"

#declare reg_cam =    // regular camera
camera {
  location <1.25, 1.5, -2.5>
  look_at <0, 0, 0>
}

#declare book_cam =   // focuses on book pile on top of column
camera {
  location <1.25, 1.5, -1.0>
  look_at <0, 0.725, 0>
}

#declare book2_cam =  // book pile, leaning on column
camera {
  location <1.25, 1.5, -2.0>
  look_at <1.2, 0.5, 0>
}

camera { reg_cam }

light_source {
  <0, 1.5, -3>
  color White
  spotlight
  point_at <0, -0.6, 0>
  radius 30
  falloff 60
  tightness 3
}

union {
  difference {
    cylinder { <0, 0.5, 0>, <0, -0.5, 0>, .5 }
    cylinder { <0, 0.6, -0.5>, <0, -0.6, -0.5>, 0.0654 }
    cylinder { <0.1294, 0.6, -0.4829>, <0.1294, -0.6, -0.4829>, 0.0654 }
    cylinder { <0.2499, 0.6, -0.4329>, <0.2499, -0.6, -0.4329>, 0.0654 }
    cylinder { <0.3534, 0.6, -0.3534>, <0.3534, -0.6, -0.3534>, 0.0654 }
    cylinder { <0.4329, 0.6, -0.2499>, <0.4329, -0.6, -0.2499>, 0.0654 }
    cylinder { <0.4829, 0.6, -0.1294>, <0.4829, -0.6, -0.1294>, 0.0654 }

    cylinder { <0.5, 0.6, 0>, <0.5, -0.6, 0>, 0.0654 }
    cylinder { <0.1294, 0.6, 0.4829>, <0.1294, -0.6, 0.4829>, 0.0654 }
    cylinder { <0.2499, 0.6, 0.4329>, <0.2499, -0.6, 0.4329>, 0.0654 }
    cylinder { <0.3534, 0.6, 0.3534>, <0.3534, -0.6, 0.3534>, 0.0654 }
    cylinder { <0.4329, 0.6, 0.2499>, <0.4329, -0.6, 0.2499>, 0.0654 }
    cylinder { <0.4829, 0.6, 0.1294>, <0.4829, -0.6, 0.1294>, 0.0654 }

    cylinder { <0, 0.6, 0.5>, <0, -0.6, 0.5>, 0.0654 }
    cylinder { <-0.1294, 0.6, 0.4829>, <-0.1294, -0.6, 0.4829>, 0.0654 }
    cylinder { <-0.2499, 0.6, 0.4329>, <-0.2499, -0.6, 0.4329>, 0.0654 }
    cylinder { <-0.3534, 0.6, 0.3534>, <-0.3534, -0.6, 0.3534>, 0.0654 }
    cylinder { <-0.4329, 0.6, 0.2499>, <-0.4329, -0.6, 0.2499>, 0.0654 }
    cylinder { <-0.4829, 0.6, 0.1294>, <-0.4829, -0.6, 0.1294>, 0.0654 }

    cylinder { <-0.5, 0.6, 0>, <-0.5, -0.6, 0>, 0.0654 }
    cylinder { <-0.1294, 0.6, -0.4829>, <-0.1294, -0.6, -0.4829>, 0.0654 }
    cylinder { <-0.2499, 0.6, -0.4329>, <-0.2499, -0.6, -0.4329>, 0.0654 }
    cylinder { <-0.3534, 0.6, -0.3534>, <-0.3534, -0.6, -0.3534>, 0.0654 }
    cylinder { <-0.4329, 0.6, -0.2499>, <-0.4329, -0.6, -0.2499>, 0.0654 }
    cylinder { <-0.4829, 0.6, -0.1294>, <-0.4829, -0.6, -0.1294>, 0.0654 }
  }
  box { <-0.6, 0.55, -0.6>, <0.6, 0.6, 0.6> }
  box { <-0.6, -0.6, -0.6>, <0.6, -0.55, 0.6> }
  torus { 0.55, 0.45 scale <0.55, 0.15, 0.55> translate <0, 0.5, 0> }
  torus { 0.55, 0.45 scale <0.55, 0.15, 0.55> translate <0,-0.5, 0> }
  texture { Stone17 }                       // Use in final render
  // pigment { color White }                // Use for QuickRender
}

difference {
  union {
    box { <-0.4, -0.5, -0.125>, <0.4, 0.5, -0.1> }      // Front Cover
    box { <-0.4, -0.5, 0.1>, <0.4, 0.5, 0.125> }        // Back Cover
    box {                                               // Pages
      <-0.4, -0.45, -0.1>, <0.35, 0.45, 0.1>
      pigment { color White }
      normal { bump_map { gif "fract001.gif" map_type 0 bump_size 3 }
        rotate y*90 }
    }
    box {
      <-0.5, -0.12, -0.05>, <0.5, 0.12, 0.05>
      texture { material_map {
        tga "homer.tga"
        once
        map_type 0
        texture { pigment { color LightSteelBlue } }
        texture { New_Brass }
      } scale <1, 0.24, 1> translate <-0.5, -0.12, 0> }
      rotate z*-90
      rotate y*90
      translate <-0.45, 0, 0>
    }
  }
  cylinder { <-0.4, -0.5, -0.12>, <-0.4, 0.5, -0.12>, 0.008 }
  cylinder { <-0.4, -0.5, 0.12>, <-0.4, 0.5, 0.12>, 0.008 }
  pigment { color LightSteelBlue }
  rotate <90, -90, 0>
  scale <1, 0.75, 1>
  translate <0, 0.725, 0>
}

difference {
  union {
    box { <-0.4, -0.5, -0.125>, <0.4, 0.5, -0.1>        // Front Cover
      // pigment { image_map {
        // tga "caesar.tga"
        // once
        // map_type 0
        // texture { pigment { color Silver } finish { SilverFinish } }
        // texture { pigment { color Green } }
      // } scale <0.8, 1, 1> translate <-0.4, -0.5, 0> }
    }
    box { <-0.4, -0.5, 0.1>, <0.4, 0.5, 0.125> }        // Back Cover
    box {                                               // Pages
      <-0.4, -0.45, -0.1>, <0.35, 0.45, 0.1>
      pigment { color White }
      normal { bump_map { gif "fract001.gif" map_type 0 bump_size 3 }
        rotate y*90 }
    }
    box {
      <-0.5, -0.12, -0.05>, <0.5, 0.12, 0.05>
      texture { material_map {
        tga "vergil.tga"
        once
        map_type 0
        texture { pigment { color NavyBlue } }
        texture { New_Brass }
      } scale <1, 0.24, 1> translate <-0.5, -0.12, 0> }
      rotate z*-90
      rotate y*90
      translate <-0.45, 0, 0>
    }
  }
  cylinder { <-0.4, -0.5, -0.12>, <-0.4, 0.5, -0.12>, 0.008 }
  cylinder { <-0.4, -0.5, 0.12>, <-0.4, 0.5, 0.12>, 0.008 }
  pigment { color NavyBlue }
  rotate <90, -150, 0>
  scale <1, 0.75, 1>
  translate <0, 0.95, 0>
}

difference {
  union {
    box { <-0.4, -0.5, -0.125>, <0.4, 0.5, -0.1> }      // Front Cover
    box { <-0.4, -0.5, 0.1>, <0.4, 0.5, 0.125> }        // Back Cover
    box {                                               // Pages
      <-0.4, -0.45, -0.1>, <0.35, 0.45, 0.1>
      pigment { color White }
      normal { bump_map { gif "fract001.gif" map_type 0 bump_size 3 }
        rotate y*90 }
    }
    box {
      <-0.5, -0.12, -0.05>, <0.5, 0.12, 0.05>
      texture { material_map {
        tga "sophocle.tga"
        once
        map_type 0
        texture { pigment { color SkyBlue } }
        texture { New_Brass }
      } scale <1, 0.24, 1> translate <-0.5, -0.12, 0> }
      rotate z*-90
      rotate y*90
      translate <-0.45, 0, 0>
    }
  }
  cylinder { <-0.4, -0.5, -0.12>, <-0.4, 0.5, -0.12>, 0.008 }
  cylinder { <-0.4, -0.5, 0.12>, <-0.4, 0.5, 0.12>, 0.008 }
  pigment { color SkyBlue }
  rotate <0, -90, 40.541>
  scale <1, 0.75, 1>
  translate <0.87995, 0, 0>
}

difference {
  union {
    box { <-0.4, -0.5, -0.125>, <0.4, 0.5, -0.1>         // Front Cover
      // pigment { image_map {
        // tga "caesar.tga"
        // once
        // map_type 0
        // texture { pigment { color Silver } finish { SilverFinish } }
        // texture { pigment { color Green } }
      // } scale <0.8, 1, 1> translate <-0.4, -0.5, 0> }
    }
    box { <-0.4, -0.5, 0.1>, <0.4, 0.5, 0.125> }         // Back Cover
    box {                                                // Pages
      <-0.4, -0.45, -0.1>, <0.35, 0.45, 0.1>
      pigment { color White }
      normal { bump_map { gif "fract001.gif" map_type 0 bump_size 3 }
        rotate y*90 }
    }
    box {
      <-0.5, -0.12, -0.05>, <0.5, 0.12, 0.05>
      texture { material_map {
        tga "cicero.tga"
        once
        map_type 0
        texture { pigment { color SlateBlue } }
        texture { New_Brass }
      } scale <1, 0.24, 1> translate <-0.5, -0.12, 0> }
      rotate z*-90
      rotate y*90
      translate <-0.45, 0, 0>
    }
  }
  cylinder { <-0.4, -0.5, -0.12>, <-0.4, 0.5, -0.12>, 0.008 }
  cylinder { <-0.4, -0.5, 0.12>, <-0.4, 0.5, 0.12>, 0.008 }
  pigment { color SlateBlue }
  rotate <0, -90, 40.541>
  scale <1, 0.75, 1>
  // translate <1.056145, 0, 0>
  translate <1.18, 0, 0>
}

plane {
  y, -0.6
  texture {
    pigment { color Gray75 }
    normal {
      bump_map { gif "fract001.gif" map_type 0 bump_size 5 }
      rotate x*90
      scale 5
    }
    finish { crand 0.05 roughness 0.5 }
  }
}
