Move some code to separate files.
Dramatically improve light sampling.

Previously a random position on the light's surface was sampled, causing
about half of the samples to hit the back side. Now only the visible
side of the sphere is sampled, ensuring much lower variance.