Removed -noboundscheck, -inline switches. That actually made the program faster.
Re-enabled the GC collector, and it doesn't crash now. Maybe it was because of some bugs getting fixed in the newer version of dmd.
In shade(), if dot(n, l) is <= 0, the for-loop that sends many shadow rays doesn't even execute. Also, some variables are now cached - they don't need to be recalculated every time in the loop.

Before these changes the program used to run in ~60 seconds. Now it takes ~42!
Todo: Triangle.hit() IS THE BOTTLENECK! If I return true or false at its beginning the program runs in 7 seconds!