From Lecture 12: implementation of the path tracing algorithm.

Not polished right now, and needs lots of comments.