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

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

plane{ z,1
  texture {
    pigment { rgb <0.75,0.8,0.85> }
    finish { ambient 0.1 diffuse 0.9 }
    scale 6
  }
}

#declare tinta_A =
  texture {
    pigment { color rgb < 1.00, 0.40, 1.00 > }
    finish { diffuse 0.8 specular 0.2 roughness 0.005 ambient 0.1 }
  }

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

#declare verde =
  texture {
    pigment { color rgb < 0, 1, 0 > }
    finish { diffuse 0.8 specular 0.2 roughness 0.005 ambient 0.1 }
  }

#declare azul =
 texture {
    pigment { color rgb < 0.30, 0.40, 1.00 > }
    finish { diffuse 0.8 specular 0.2 roughness 0.005 ambient 0.1 }
  }

#declare gerador = seed(1234);

#declare vagaof = box { <4,4,2>, <0,0,5.5> texture {tinta_A} }
#declare frente = cylinder { <2,4,2>, <2,7,2> 2 texture{tinta_A}}
#declare cham = cylinder { <2,6,3>, <2,6,5> 0.5 texture{tinta_A}}
#declare base = box { <4,4,2>, <0,7,2.2> texture {tinta_A} }
#declare base2 = box { <5,3,2>, <0,8,0> texture {tinta_A} }
#declare vagao = box { <4,-7,2>, <0,-1,5.5> texture {tinta_A} }
#declare roda = cylinder { <4,5,2>, <4.2,5,2> 0.8 texture{azul}}
#declare janela_quadf = box { < 4, 3.5, 3.5 >, < 4.1, 2.5, 5 > texture{azul} }
#declare janela_redondaf = cylinder { <4,3,4.3>, <4.2,3,4.3> 0.6 texture{azul} }

#declare janela_quad = box { < 4, -1.5, 3.5 >, < 4.1, -2.5, 5 > texture{azul} }
#declare janela_redonda = cylinder { <4,-2,4.3>, <4.2,-2,4.3> 0.6 texture{verde} }

#declare trilho = box { < 4, -100, 1 >, < 4.2 , 100, 1.2 > texture{preto} }
#declare liga = box { < 4.1, -100, 1 >, < 0, -99.6, 1.2 > texture{preto} }

#declare janela_frente = box { < 3.5, 4, 4.3 >, < 0.5, 4.1, 5.3 > texture{verde} }

#declare trem =
 union {
 #declare a = 1;
 object {vagaof}
 object {base}
 object {cham}
 object {roda}
 object {roda translate<0,-2.3,0>}
 object {roda translate<0,-4.3,0>}
 object {roda translate<-4.2,0,0>}
 object {roda translate<-4.2,-2.3,0>}
 object {roda translate<-4.2, -4.3,0>}
 object {janela_redondaf}
 object {janela_quadf translate<0,-1.5,0> }
 object {janela_redondaf translate<-4.2,0,0> }
 object {janela_quadf translate<-4.2,-1.5,0> }
 object {janela_frente}
 difference {
   object {frente}
   object {base2}
  }

 #while (a<7)
            object {vagao translate<0,(-7*(a-1)),0>}

     object {roda translate<0,-7*a,0>}
            object {roda translate<0,-2.2+(-7*a),0>}
     object {roda translate<0,-4.2+(-7*a),0>}
     object {roda translate<-4.2,-7*a,0>}
     object {roda translate<-4.2,-2.2+(-7*a),0>}
     object {roda translate<-4.2,-4.2+(-7*a),0>}

     #declare j = 0;
     #while (j<4)
         #if ((10*rand(gerador)) < 5)
           object {janela_redonda translate<0,(-7*(a-1))+(-1.5*j),0> }
    object {janela_redonda translate<-4.2,(-7*(a-1))+(-1.5*j),0> }
            #else
          object {janela_quad translate<0,(-7*(a-1))+(-1.5*j),0> }
    object {janela_quad translate<-4.2,(-7*(a-1))+(-1.5*j),0> }
        #end
               #declare j = j+1;
      #end

      #declare a = a+1;
 #end
}

union {
   object {trem}
   object {trilho}
   object {trilho translate<-4,0,0>}
   #declare l = 0;
   #while (l < 200)
     object {liga translate<0,l,0>}
   #declare l = l+1;
   #end
}

#include "camlight.inc"
camlight(<0.00,0.00,6.00>,<30.00,30.00,2.00>,1.00,z,1.0)