// Persistence of Vision Ray Tracer Scene Description File
// File: ?.pov
// Vers: 3.5
// Desc: Basic Scene Example
// Date: mm/dd/yy
// Auth: ?
//

#version 3.5;

#include "colors.inc"

global_settings {
  assumed_gamma 1.0
}
background{color rgb .4}
// ----------------------------------------

camera {
  location  <3, 1, 3>*20
  direction 1.5*z
  right     x*image_width/image_height
  look_at   <0.0, 0.0,  0.0>
  angle 5
}

light_source {
  <0, 0, 0>            // light's position (translated below)
  color rgb <1, 1, 1>  // light's color
  translate <-30, 30, -30>
}

// ----------------------------------------


       // create a smooth blobby shape
#declare RadiusVal   = 1.0; // (0 < RadiusVal) outer sphere of influence on other components
#declare StrengthVal = 1.0; // (+ or -) strength of component's radiating density
#declare basebody=
     blob {
       // threshold (0.0 < threshold <= StrengthVal) surface falloff threshold #
       threshold 0.6
       cylinder { -1.3*x, +x, RadiusVal, StrengthVal*1  translate -.5*z}
       cylinder { -1.3*x, +x, RadiusVal, StrengthVal*1  translate +.5*z}
       cylinder { -.1*z, +.1*z, RadiusVal, StrengthVal*2  translate +.5*x+.35*y}
       // [sturm]
          sphere{1.1*x+.4*y,RadiusVal*.8, StrengthVal*.25}
       scale <1.2,.75,1>*1
       //translate .6*y
       rotate +180*y
};
#declare shellbody=difference{
     object{basebody}
     object{basebody scale .98}
}
box{-.15*(y+z)-3*x,3*x
            pigment {
      checker color Black, color Yellow scale <1,1,.5>
    } finish{ambient 1} 
}
box{-.15*(y+z)-3*x,3*x
            pigment {
      checker color Black, color Yellow scale <1,1,.5>
    } finish{ambient 1} rotate y*90
}
box{-.15*(y+z)-3*x,3*x
            pigment {
      checker color Black, color Yellow scale <1,1,.5>
    } finish{ambient 1} rotate z*90 translate -2*x
}
//
#declare trad=.3;
#declare twd=.3;
#declare tfront=1.4;
#declare tback=-1.1;
#declare tire= cylinder{-twd/2*z,twd/2*z,.3 pigment{color rgb .02}};
#declare wheelwell=union{
     object{tire  scale <1,1,1.2>}
     box{-twd*z-trad*x,twd/2*z+trad*x-y}
     scale 1.2
}
     
// sidewindowshaper
#declare sidewindowshape=prism {                                
  linear_sweep  // or conic_sweep for tapering to a point
  linear_spline // linear_spline | quadratic_spline | cubic_spline | bezier_spline 
  -1.5,         // height 1
   1.5,         // height 2
  5,           // number of points
  // (--- the <u,v> points ---)
  < 0.0, 0.0>, < -.25,  .23>, < -.7, .23>, < -.8,  0>, < 0,  0> 
rotate -x*90  translate y*.98+x*.00
}
//front window shaper
declare frontwindowshaper=prism {                                
  linear_sweep  // or conic_sweep for tapering to a point
  linear_spline // linear_spline | quadratic_spline | cubic_spline | bezier_spline 
  0,         // height 1
   .6,         // height 2
  5,           // number of points
  // (--- the <u,v> points ---)
  < -.70, 0.0>, < -.42,  .23>, < .42, .23>, < .70,  0>, < -.70,  0> 
     rotate -x*90  rotate y*90 translate x*.4+y*.98
}

declare rearwindowshaper=cylinder{-x,-2*x, .4 scale <1,.3,1> translate 1.05*y}

//declare headlighter=cylinder{-.2*x,.3*x, .13}
//object{headlighter translate 2*x+.78*y-.62*z}
#declare headlighters=union{
     cylinder{-.2*x,.3*x, .13 translate 2*x+.78*y-.62*z}
     cylinder{-.2*x,.3*x, .13 translate 2*x+.78*y+.62*z}
}
#declare headlights=union{
     cylinder{-.2*x,-.15*x, .13 translate 2*x+.78*y-.62*z}
     cylinder{-.2*x,-.15*x, .13 translate 2*x+.78*y+.62*z}
     pigment{color rgb 1} finish{ambient 1 diffuse 1 }
}
#declare fastcar=union{
     object{tire translate trad*y-.8*z+tfront*x}
     object{tire translate trad*y-.8*z+tback*x}
     object{tire translate trad*y+.8*z+tfront*x}
     object{tire translate trad*y+.8*z+tback*x}
     difference{
          object{basebody translate .6*y}
          object{wheelwell translate trad*y-.8*z+tfront*x}
          object{wheelwell translate trad*y-.8*z+tback*x}
          object{wheelwell translate trad*y+.8*z+tfront*x}
          object{wheelwell translate trad*y+.8*z+tback*x}
          object{sidewindowshape}
          object{frontwindowshaper}
          object{rearwindowshaper}
          object{headlighters}
            pigment{color rgb <0,0,.9>}
            finish{ambient .4 diffuse .4 phong .5}
     }     
      
     intersection{
          object{shellbody translate .6*y}
          union{
               object{sidewindowshape}
               object{frontwindowshaper}
               object{rearwindowshaper}
          }
          pigment{color rgbt .3*<1,1,1>+<0,0,0,.6>} finish{ambient .6 diffuse .5 phong 10}
     } 
     
     intersection{
          object{shellbody translate .6*y}
          object{headlighters}
          pigment{color rgbt 1*<1,1,1>+<0,0,0,.6>} finish{ambient 1.2 diffuse .5 phong 10}
     }
}

object{fastcar}
plane { y, -0.0 pigment {color rgb .2}}     