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

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

#declare raio = 2.000;

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

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

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

#declare cor_cristal =
 pigment {color rgb <0.00, 0.00, 0.00>}

#declare cor_espelho =
 pigment {color rgb <0.01, 0.01, 0.01>}

#declare tx_cristal =
  texture{
    finish{
      ambient 0.1 diffuse 0.1 reflection 0.25
      specular 1 roughness 0.001
    }
    pigment{color rgb <1.00, 0.50, 0.50> filter 1}
  }

#declare tx_espelho =
  texture{
   pigment{rgb <0.00, 0.80, 0.80>}
   finish{
      ambient 0.05 diffuse 0.05
      reflection rgb <0.80, 0.80, 0.80>
      specular 0.20 roughness 0.05
    }
  }

#declare janelavagao =
union{
    #declare i = 1;
    #while (i < 40)
      #if (i > 1)
      #if (i < 40)
       #declare j = 0;
 #while (j < (i/6))
 #declare h = 1 + j;
         #declare janela3 =
             box {

      <6, (-15 -2*i)/2, h> , <-6, (-15 -2*i + 1)/2, h+0.5>
      texture {tinta_B}
      }
          object{janela3}
   #declare j = j + 1;
 #end
      #end
      #end
      #declare i = i + 7;
    #end
}

#declare janelas =
union{
    #declare i = 0;
    #while (i < 8)
      #declare a = i;
      #declare b = 2 + i;
      #declare h = 1 + i;
      #declare janela1 =
           box {<6, 0, h>, <-6, 1, h+0.5>
               texture {tinta_B}
           }
           object{janela1}
      #declare i = i + 1;
      #end
}

#declare roda =
union{
    #declare i = 0;
    #while (i < 10)
      #declare a = -4 + i;
      #declare b = 2 + i;
      #declare h = 1 + i;
      #declare roda1 =
           sphere {
    <5, a, -0.5> , 0.5
    }
      object{roda1}
      #declare roda2 =
           sphere {
    <-5, a, -0.5> , 0.5
    }
      object{roda2}
      #declare i = i + 2;
      #end
}

#declare vagao =
union{
    #declare i = 1;
    #while (i < 40)
      #declare a = 1 + i;
      #declare b = 2 + i;
      #declare h = 1 + i;
      #declare vagao1 =
           box {
               < 5.00, -10.00 - i, 0.00 >,
               <-5.00, -5.00 - i, h/2>
              texture {tinta_B}
           }
      object{vagao1}

      #if (i < 40)
       #declare j = 0;
       #while (j < 5)
         #declare roda3 =
             sphere {
      <5, -10 -i + j, -0.3> , 0.3
      }
          object{roda3}
   #declare roda4 =
             sphere {
      <-5, -10 -i + j, -0.3> , 0.3
      }
          object{roda4}
   #declare j = j + 1;
        #end
      #end
      #declare i = i + 7;
      #end
}

#declare locomotiva =
  box {
    < -5.00, -5.00, 0.00 >,
    < 5.00, 5.00, 10.00 >
    texture {tinta_B}
    }

#declare trilho =
  torus {
    2, 1
    texture { tinta_B }
    rotate 90*x
  }

union{
difference{
  object {locomotiva}
  object {janelas}
}
  object {roda}
difference{
  object {vagao}
  object {janelavagao}
}
}

#include "camlight.inc"
camlight(<0.00,-10.00,0.00>,<25.00,30.00,20.00>,1.00,z,1.0)