Refactored PathTraceIntegrator so that each path maintains its own state.

This make the code a lot easier to work with, and separates the specific
path tracing algorithm from the rendering loop.