// Last edited on 2005-01-05 22:33:16 by stolfi
// Processed by remove-cam-lights

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

#declare raio = 2.000;

#declare tinta_Cinza =
  texture {
    pigment { color < 0.5, 0.5, 0.5 > }
    finish { diffuse 0.8 specular 0.2 roughness 0.005 ambient 0.1 }
  }

#declare tinta_Cinza_Claro =
  texture {
    pigment { color < 0.9, 0.9, 0.9 > }
    finish { diffuse 0.8 specular 0.2 roughness 0.005 ambient 0.1 }
  }

#declare tinta_Vermelha =
  texture {
    pigment { color < 0.9, 0.1, 0.1 > }
    finish { diffuse 0.8 specular 0.2 roughness 0.005 ambient 0.1 }
  }

#declare tinta_Marrom =
  texture {
    pigment { color < 0.5, 0.1, 0.1 > }
    finish { diffuse 0.8 specular 0.2 roughness 0.005 ambient 0.1 }
  }

#declare cor_cromo = < 0.7, 0.7, 0.73 >;

#declare tinta_cromada =
  texture {
    finish {
      ambient 0.05 diffuse 0.05 reflection cor_cromo
      specular 0.2 roughness 0.05
    }
    pigment { color cor_cromo }
  }

#declare chao =
  plane {z,0
    texture {
      pigment { checker <0,0.4,0>, <0,0.45,0>}
      finish  {ambient 0.1 diffuse 0.9}
      scale 3
    }
  }

#declare Locom_caldeira =
  cylinder {
  < 0, 0, 0 >,
  < 4, 0, 0 >,
  0.7
  texture {tinta_Cinza}
 }

#declare Locom_chamine =
  cylinder {
  < 0, 0, 0 >,
  < 0, 0, 0.5 >,
  0.3
  texture {tinta_Cinza}
 }

 #declare Locom_Box =
  box {
  < 0, 0, 0 >,
  < -2.5, 1.5, 2>
  texture {tinta_Cinza}
 }

#declare Roda =
cylinder {
  < 0, 0, 0 >,
  < 0, 0.1, 0 >,
  0.5
  texture {tinta_Cinza_Claro}
 }

 #declare Vagao_Box =
  box {
  < 0, 0, 0 >,
  < 4.5, 1.5, 1.9>

  translate <0,-0.75,-0.7>
 }

#declare Janela_Vagao =
  box {
  < 0, 0, 0>,
  < 0.5, 3, 0.5>
  texture {
    pigment { color < 1, 1, 1 > }
    finish { diffuse 0.8 specular 0.2 roughness 0.005 ambient 0.1 }
  }
}

#declare Vagao =
  union {
    difference {
      object {Vagao_Box}
      #declare i = 0;
      #while (i < 5)
        object{Janela_Vagao translate<+0.5+(0.8*i), 0, 0.5> }
        #declare i=i+1;
      #end
    }

    #declare j = 0;
    #while (j < 2)
      #declare i = 0;
      #while (i < 4)

        #if (j=0)
   #declare k=-1;
 #else
   #declare k=1;
 #end

        object{Roda translate<3.7-(1.1*i), 0.8*k, -0.4> }

        #declare i=i+1;
      #end
      #declare j = j+1;
    #end
  }

#declare Locomotiva =
  union {
    difference {
      object{Locom_Box translate <0,-0.75,-0.7>}
      object{Janela_Vagao scale<3,1,1.2> translate <-2,-0.75,0.3>}
      object{Janela_Vagao scale<5,0.37,0.8> translate <-1,-0.5,0.75>}
    }
    object{Locom_chamine translate<3.2,0,0.6>}
    object{Locom_caldeira}

    #declare j = 0;
    #while (j < 2)
      #declare i = 0;
      #while (i < 5)

        #if (j=0)
   #declare k=-1;
 #else
   #declare k=1;
 #end

 #if (i<3)
   #declare a=0;
 #else
   #declare a=0.8;
 #end

        object{Roda translate<3.5-(1.1*i)-a, 0.8*k, -0.4> }

        #declare i=i+1;
      #end
      #declare j = j+1;
    #end
  }

declare trilho_metal =
  box {
   <0,0,0>
   <-500,0.1,0.2>
   texture{tinta_Cinza_Claro}
  }

declare trilho_madeira =
  box {
   <0,0,0>
   <0.3,2,0.2>
   texture{tinta_Marrom}
  }

  #declare g = seed(1329756);
  object {Locomotiva}
  #declare i = 0;
  #while (i < 15)
     object {Vagao
             translate <-7.5-(5*i),0,0>
             texture {
               pigment { color < rand(g)*1.5, rand(g)*1.5, rand(g)*1.5 > }
               finish { diffuse 0.8 specular 0.2 roughness 0.005 ambient 0.1 }
             }
     }
     #declare i=i+1;
   #end
   object{trilho_metal translate <100,0.7,-1.1>}
   object{trilho_metal translate <100,-0.7,-1.1>}

   #declare i = 0;
   #while (i < 500)
     object {trilho_madeira
             translate <-400+(i*1),-1,-1.3>
     }
     #declare i=i+1;
   #end
   object {chao translate <0,0,-1.31>}

#include "camlight.inc"
camlight(<-5,0,0>,<17,9,4>,1.00,z,1.0)